Socket
Socket
Sign inDemoInstall

@beekai/react

Package Overview
Dependencies
4
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.4.0

103

index.js

@@ -9,24 +9,29 @@ import * as React from 'react';

function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (!_n && _i["return"] != null) _i["return"]();
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
;
}
} catch (err) {
_d = !0, _e = err;
} finally {
if (_d) throw _e;
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return _arr;
}

@@ -213,10 +218,5 @@

function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (undefined === method) {
if (context.delegate = null, "throw" === context.method) {
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var methodName = context.method,
method = delegate.iterator[methodName];
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);

@@ -468,7 +468,11 @@ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;

if (props.formId) {
_context.next = 2;
_context.next = 3;
break;
}
methods.setError('root.error', {
type: 'credential',
message: 'Missing form id'
});
return _context.abrupt("return");
case 2:
case 3:
formData = new FormData();

@@ -487,4 +491,4 @@ Object.entries(data).forEach(function (_ref) {

formData.append('__form_id', formId);
_context.prev = 5;
_context.next = 8;
_context.prev = 6;
_context.next = 9;
return fetch('https://www.beekai.com/api/v1/submit', {

@@ -494,28 +498,28 @@ method: 'POST',

});
case 8:
case 9:
response = _context.sent;
if (!(response.status === 200)) {
_context.next = 16;
_context.next = 17;
break;
}
_context.next = 12;
_context.next = 13;
return response.json();
case 12:
case 13:
_data = _context.sent;
setSubmissionId(_data.id);
_context.next = 17;
_context.next = 18;
break;
case 16:
methods.setError('serverError', {
type: 'server',
message: "Request has failed with status code ".concat(response.status)
case 17:
methods.setError('root.serverError', {
type: response.status.toString(),
message: "Request failed with status code ".concat(response.status)
});
case 17:
_context.next = 22;
case 18:
_context.next = 23;
break;
case 19:
_context.prev = 19;
_context.t0 = _context["catch"](5);
case 20:
_context.prev = 20;
_context.t0 = _context["catch"](6);
if (_context.t0 instanceof Error) {
methods.setError('serverError', {
methods.setError('root.serverError', {
type: 'server',

@@ -525,3 +529,3 @@ message: _context.t0.message

}
case 22:
case 23:
case "end":

@@ -531,3 +535,3 @@ return _context.stop();

}
}, _callee, null, [[5, 19]]);
}, _callee, null, [[6, 20]]);
}));

@@ -539,6 +543,3 @@ };

submissionId: submissionId,
onSubmit: function onSubmit(e) {
methods.clearErrors();
methods.handleSubmit(submit)(e);
}
onSubmit: methods.handleSubmit(submit)
});

@@ -545,0 +546,0 @@ }

{
"name": "@beekai/react",
"version": "0.3.1",
"version": "0.4.0",
"license": "MIT",

@@ -16,4 +16,4 @@ "publishConfig": {

"react": "18.2.0",
"react-hook-form": "7.40.0"
"react-hook-form": "7.43.0-next.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc