Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formspree/react

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formspree/react - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

52

dist/formspree-react.cjs.js

@@ -25,2 +25,17 @@ 'use strict';

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -136,4 +151,8 @@ if (source == null) return {};

var version = "2.2.2";
var version = "2.2.3";
function isEvent(data) {
return data.preventDefault !== undefined;
}
function useForm(formKey) {

@@ -171,18 +190,31 @@ var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var handleSubmit = function handleSubmit(event) {
event.preventDefault();
var form = event.target;
var handleSubmit = function handleSubmit(submissionData) {
var getFormData = function getFormData(event) {
event.preventDefault();
var form = event.target;
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
var formData = new FormData(form); // Append extra data from config
return new FormData(form);
};
var formData = isEvent(submissionData) ? getFormData(submissionData) : submissionData;
var appendExtraData = function appendExtraData(prop, value) {
if (formData instanceof FormData) {
formData.append(prop, value);
} else {
formData = Object.assign(formData, _defineProperty({}, prop, value));
}
}; // Append extra data from config
if (_typeof(extraData) === 'object') {
for (var prop in extraData) {
if (typeof extraData[prop] === 'function') {
formData.append(prop, extraData[prop].call(null));
appendExtraData(prop, extraData[prop].call(null));
} else {
formData.append(prop, extraData[prop]);
appendExtraData(prop, extraData[prop]);
}

@@ -189,0 +221,0 @@ }

@@ -18,2 +18,17 @@ import React, { useState, useEffect, useContext } from 'react';

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -129,4 +144,8 @@ if (source == null) return {};

var version = "2.2.2";
var version = "2.2.3";
function isEvent(data) {
return data.preventDefault !== undefined;
}
function useForm(formKey) {

@@ -164,18 +183,31 @@ var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var handleSubmit = function handleSubmit(event) {
event.preventDefault();
var form = event.target;
var handleSubmit = function handleSubmit(submissionData) {
var getFormData = function getFormData(event) {
event.preventDefault();
var form = event.target;
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
var formData = new FormData(form); // Append extra data from config
return new FormData(form);
};
var formData = isEvent(submissionData) ? getFormData(submissionData) : submissionData;
var appendExtraData = function appendExtraData(prop, value) {
if (formData instanceof FormData) {
formData.append(prop, value);
} else {
formData = Object.assign(formData, _defineProperty({}, prop, value));
}
}; // Append extra data from config
if (_typeof(extraData) === 'object') {
for (var prop in extraData) {
if (typeof extraData[prop] === 'function') {
formData.append(prop, extraData[prop].call(null));
appendExtraData(prop, extraData[prop].call(null));
} else {
formData.append(prop, extraData[prop]);
appendExtraData(prop, extraData[prop]);
}

@@ -182,0 +214,0 @@ }

@@ -20,2 +20,17 @@ var FormspreeReact = (function (exports, React) {

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -1144,4 +1159,8 @@ if (source == null) return {};

var version$1 = "2.2.2";
var version$1 = "2.2.3";
function isEvent(data) {
return data.preventDefault !== undefined;
}
function useForm(formKey) {

@@ -1179,18 +1198,31 @@ var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var handleSubmit = function handleSubmit(event) {
event.preventDefault();
var form = event.target;
var handleSubmit = function handleSubmit(submissionData) {
var getFormData = function getFormData(event) {
event.preventDefault();
var form = event.target;
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
if (form.tagName != 'FORM') {
throw new Error('submit was triggered for a non-form element');
}
var formData = new FormData(form); // Append extra data from config
return new FormData(form);
};
var formData = isEvent(submissionData) ? getFormData(submissionData) : submissionData;
var appendExtraData = function appendExtraData(prop, value) {
if (formData instanceof FormData) {
formData.append(prop, value);
} else {
formData = Object.assign(formData, _defineProperty({}, prop, value));
}
}; // Append extra data from config
if (_typeof(extraData) === 'object') {
for (var prop in extraData) {
if (typeof extraData[prop] === 'function') {
formData.append(prop, extraData[prop].call(null));
appendExtraData(prop, extraData[prop].call(null));
} else {
formData.append(prop, extraData[prop]);
appendExtraData(prop, extraData[prop]);
}

@@ -1197,0 +1229,0 @@ }

12

dist/types/src/useForm.d.ts
import React from 'react';
import { Client } from '@formspree/core';
import { SubmissionResponse } from '@formspree/core/forms';
import { SubmissionResponse, SubmissionData } from '@formspree/core/forms';
interface ErrorPayload {

@@ -9,8 +9,10 @@ field?: string;

}
declare type SubmitHandler = (event: React.FormEvent<HTMLFormElement>) => Promise<SubmissionResponse>;
declare type FormEvent = React.FormEvent<HTMLFormElement>;
declare type ExtraData = {
[key: string]: string | (() => string);
};
declare type SubmitHandler = (submissionData: FormEvent | SubmissionData) => Promise<SubmissionResponse>;
export declare function useForm(formKey: string, args?: {
client?: Client;
data?: {
[key: string]: string | (() => string);
};
data?: ExtraData;
endpoint?: string;

@@ -17,0 +19,0 @@ debug?: boolean;

{
"name": "@formspree/react",
"version": "2.2.2",
"version": "2.2.3",
"description": "The React component library for Formspree",

@@ -5,0 +5,0 @@ "bugs": {

@@ -5,8 +5,4 @@ # Formspree React

## Releasing
## Help and Support
Run the following to publish a new version:
```
npm run release
```
For help and support please see [the Formspree React docs](https://help.formspree.io/hc/en-us/articles/360055613373).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc