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

@formspree/core

Package Overview
Dependencies
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formspree/core - npm Package Compare versions

Comparing version 2.7.2-beta.0 to 2.7.2

2

dist/index.js

@@ -1,1 +0,1 @@

"use strict";var b=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var r in t)b(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A(t))!D.call(e,s)&&s!==r&&b(e,s,{get:()=>t[s],enumerable:!(i=F(t,s))||i.enumerable});return e};var N=e=>M(b({},"__esModule",{value:!0}),e);var k={};j(k,{Client:()=>u,createClient:()=>E,getDefaultClient:()=>C,isFieldError:()=>P});module.exports=N(k);var p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",L=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;function g(e){e=String(e);for(var t,r,i,s,o="",a=0,d=e.length%3;a<e.length;){if((r=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|i<<8|s,o+=p.charAt(t>>18&63)+p.charAt(t>>12&63)+p.charAt(t>>6&63)+p.charAt(t&63)}return d?o.slice(0,d-3)+"===".substring(d):o}function R(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!L.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));for(var t,r="",i,s,o=0;o<e.length;)t=p.indexOf(e.charAt(o++))<<18|p.indexOf(e.charAt(o++))<<12|(i=p.indexOf(e.charAt(o++)))<<6|(s=p.indexOf(e.charAt(o++))),r+=i===64?String.fromCharCode(t>>16&255):s===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,t&255);return r}var I="2.7.2-beta.0";var T=e=>g(JSON.stringify(e));var _=e=>{let t=`@formspree/core@${I}`;return e?`${e} ${t}`:t},x=()=>1*new Date,y=(e,t,r)=>{e instanceof FormData?e.append(t,r):e=Object.assign(e,{[t]:r})},O=async({stripePromise:e,response:t,responseData:r,payload:i,data:s,fetchImpl:o,request:a,url:d})=>{let c=await e.handleCardAction(r.stripe.paymentIntentClientSecret);if(c.error)return{response:t,body:{errors:[{code:"STRIPE_CLIENT_ERROR",message:"Stripe SCA error",field:"paymentMethod"}]}};{i.paymentMethod.id||y(s,"paymentMethod",i.paymentMethod.id),y(s,"paymentIntent",c.paymentIntent.id),y(s,"resubmitKey",r.resubmitKey);let m=await o(d,{...a,body:JSON.stringify({paymentIntent:c.paymentIntent.id,resubmitKey:r.resubmitKey})}),n=await m.json();return{response:m,body:n}}};var B=()=>navigator.webdriver||!!document.documentElement.getAttribute(R("d2ViZHJpdmVy"))||!!window.callPhantom||!!window._phantom,h=class{constructor(){this.loadedAt=x(),this.webdriver=B()}teardown(){}data(){return{loadedAt:this.loadedAt,webdriver:this.webdriver}}};var u=class{constructor(t={}){this.project=t.project,this.stripePromise=t.stripePromise,typeof window<"u"&&this.startBrowserSession()}startBrowserSession(){this.session||(this.session=new h)}teardown(){this.session&&this.session.teardown()}async submitForm(t,r,i={}){let s=i.endpoint||"https://formspree.io",o=i.fetchImpl||fetch,a=this.project?`${s}/p/${this.project}/f/${t}`:`${s}/f/${t}`,d=n=>n instanceof FormData?n:JSON.stringify(n),c={Accept:"application/json","Formspree-Client":_(i.clientName)};this.session&&(c["Formspree-Session-Data"]=T(this.session.data())),r instanceof FormData||(c["Content-Type"]="application/json");let m={method:"POST",mode:"cors",body:d(r),headers:c};if(this.stripePromise&&i.createPaymentMethod){let n=await i.createPaymentMethod();if(n.error)return{response:null,body:{errors:[{code:"STRIPE_CLIENT_ERROR",message:"Error creating payment method",field:"paymentMethod"}]}};y(r,"paymentMethod",n.paymentMethod.id);let f=await o(a,{...m,body:r}),l=await f.json();return l&&l.stripe&&l.stripe.requiresAction&&l.resubmitKey?await O({stripePromise:this.stripePromise,responseData:l,response:f,payload:n,data:r,fetchImpl:o,request:m,url:a}):{response:f,body:l}}else return o(a,m).then(n=>n.json().then(f=>({body:f,response:n})))}},E=e=>new u(e),C=()=>(S||(S=E()),S),S;var w=(o=>(o.REQUIRED_FIELD_MISSING="REQUIRED_FIELD_MISSING",o.REQUIRED_FIELD_EMPTY="REQUIRED_FIELD_EMPTY",o.TYPE_EMAIL="TYPE_EMAIL",o.TYPE_NUMERIC="TYPE_NUMERIC",o.TYPE_TEXT="TYPE_TEXT",o))(w||{});function P(e){return e.code in w&&e.field!==void 0}0&&(module.exports={Client,createClient,getDefaultClient,isFieldError});
"use strict";var b=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var r in t)b(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A(t))!D.call(e,s)&&s!==r&&b(e,s,{get:()=>t[s],enumerable:!(i=F(t,s))||i.enumerable});return e};var N=e=>M(b({},"__esModule",{value:!0}),e);var k={};j(k,{Client:()=>y,createClient:()=>E,getDefaultClient:()=>C,isFieldError:()=>P});module.exports=N(k);var p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",L=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;function g(e){e=String(e);for(var t,r,i,s,o="",a=0,d=e.length%3;a<e.length;){if((r=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|i<<8|s,o+=p.charAt(t>>18&63)+p.charAt(t>>12&63)+p.charAt(t>>6&63)+p.charAt(t&63)}return d?o.slice(0,d-3)+"===".substring(d):o}function R(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!L.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));for(var t,r="",i,s,o=0;o<e.length;)t=p.indexOf(e.charAt(o++))<<18|p.indexOf(e.charAt(o++))<<12|(i=p.indexOf(e.charAt(o++)))<<6|(s=p.indexOf(e.charAt(o++))),r+=i===64?String.fromCharCode(t>>16&255):s===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,t&255);return r}var I="2.7.2";var T=e=>g(JSON.stringify(e));var _=e=>{let t=`@formspree/core@${I}`;return e?`${e} ${t}`:t},x=()=>1*new Date,u=(e,t,r)=>{e instanceof FormData?e.append(t,r):e=Object.assign(e,{[t]:r})},O=async({stripePromise:e,response:t,responseData:r,payload:i,data:s,fetchImpl:o,request:a,url:d})=>{let c=await e.handleCardAction(r.stripe.paymentIntentClientSecret);if(c.error)return{response:t,body:{errors:[{code:"STRIPE_CLIENT_ERROR",message:"Stripe SCA error",field:"paymentMethod"}]}};{i.paymentMethod.id||u(s,"paymentMethod",i.paymentMethod.id),u(s,"paymentIntent",c.paymentIntent.id),u(s,"resubmitKey",r.resubmitKey);let m=await o(d,{...a,body:JSON.stringify({paymentIntent:c.paymentIntent.id,resubmitKey:r.resubmitKey})}),n=await m.json();return{response:m,body:n}}};var B=()=>navigator.webdriver||!!document.documentElement.getAttribute(R("d2ViZHJpdmVy"))||!!window.callPhantom||!!window._phantom,h=class{constructor(){this.loadedAt=x(),this.webdriver=B()}teardown(){}data(){return{loadedAt:this.loadedAt,webdriver:this.webdriver}}};var y=class{constructor(t={}){this.project=t.project,this.stripePromise=t.stripePromise,typeof window<"u"&&this.startBrowserSession()}startBrowserSession(){this.session||(this.session=new h)}teardown(){this.session&&this.session.teardown()}async submitForm(t,r,i={}){let s=i.endpoint||"https://formspree.io",o=i.fetchImpl||fetch,a=this.project?`${s}/p/${this.project}/f/${t}`:`${s}/f/${t}`,d=n=>n instanceof FormData?n:JSON.stringify(n),c={Accept:"application/json","Formspree-Client":_(i.clientName)};this.session&&(c["Formspree-Session-Data"]=T(this.session.data())),r instanceof FormData||(c["Content-Type"]="application/json");let m={method:"POST",mode:"cors",body:d(r),headers:c};if(this.stripePromise&&i.createPaymentMethod){let n=await i.createPaymentMethod();if(n.error)return{response:null,body:{errors:[{code:"STRIPE_CLIENT_ERROR",message:"Error creating payment method",field:"paymentMethod"}]}};u(r,"paymentMethod",n.paymentMethod.id);let f=await o(a,{...m,body:r}),l=await f.json();return l&&l.stripe&&l.stripe.requiresAction&&l.resubmitKey?await O({stripePromise:this.stripePromise,responseData:l,response:f,payload:n,data:r,fetchImpl:o,request:m,url:a}):{response:f,body:l}}else return o(a,m).then(n=>n.json().then(f=>({body:f,response:n})))}},E=e=>new y(e),C=()=>(S||(S=E()),S),S;var w=(o=>(o.REQUIRED_FIELD_MISSING="REQUIRED_FIELD_MISSING",o.REQUIRED_FIELD_EMPTY="REQUIRED_FIELD_EMPTY",o.TYPE_EMAIL="TYPE_EMAIL",o.TYPE_NUMERIC="TYPE_NUMERIC",o.TYPE_TEXT="TYPE_TEXT",o))(w||{});function P(e){return e.code in w&&e.field!==void 0}0&&(module.exports={Client,createClient,getDefaultClient,isFieldError});
{
"name": "@formspree/core",
"version": "2.7.2-beta.0",
"version": "2.7.2",
"description": "The core library for Formspree",

@@ -50,3 +50,3 @@ "private": false,

"dependencies": {
"@stripe/stripe-js": "^1.29.0"
"@stripe/stripe-js": "^1.35.0"
},

@@ -53,0 +53,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

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