3 lines
8.3 KiB
JavaScript
3 lines
8.3 KiB
JavaScript
|
|
import{R as u}from"../vendor-8efd6c0a.js";import{P as i}from"../@fortawesome/react-fontawesome-08267a95.js";function M(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),t.push.apply(t,n)}return t}function _(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?M(Object(t),!0).forEach(function(n){K(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):M(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function w(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(e){return typeof e}:w=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(r)}function K(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Y(r,e){return oe(r)||ae(r,e)||ue(r,e)||ie()}function oe(r){if(Array.isArray(r))return r}function ae(r,e){var t=r&&(typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"]);if(t!=null){var n=[],s=!0,a=!1,f,m;try{for(t=t.call(r);!(s=(f=t.next()).done)&&(n.push(f.value),!(e&&n.length===e));s=!0);}catch(o){a=!0,m=o}finally{try{!s&&t.return!=null&&t.return()}finally{if(a)throw m}}return n}}function ue(r,e){if(r){if(typeof r=="string")return W(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return W(r,e)}}function W(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function ie(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var v=function(e,t,n){var s=!!n,a=u.useRef(n);u.useEffect(function(){a.current=n},[n]),u.useEffect(function(){if(!s||!e)return function(){};var f=function(){a.current&&a.current.apply(a,arguments)};return e.on(t,f),function(){e.off(t,f)}},[s,t,e,a])},I=function(e){var t=u.useRef(e);return u.useEffect(function(){t.current=e},[e]),t.current},O=function(e){return e!==null&&w(e)==="object"},se=function(e){return O(e)&&typeof e.then=="function"},ce=function(e){return O(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},q="[object Object]",le=function r(e,t){if(!O(e)||!O(t))return e===t;var n=Array.isArray(e),s=Array.isArray(t);if(n!==s)return!1;var a=Object.prototype.toString.call(e)===q,f=Object.prototype.toString.call(t)===q;if(a!==f)return!1;if(!a&&!n)return e===t;var m=Object.keys(e),o=Object.keys(t);if(m.length!==o.length)return!1;for(var C={},y=0;y<m.length;y+=1)C[m[y]]=!0;for(var g=0;g<o.length;g+=1)C[o[g]]=!0;var p=Object.keys(C);if(p.length!==m.length)return!1;var k=e,E=t,b=function(P){return r(k[P],E[P])};return p.every(b)},F=function(e,t,n){return O(e)?Object.keys(e).reduce(function(s,a){var f=!O(t)||!le(e[a],t[a]);return n.includes(a)?(f&&console.warn("Unsupported prop change: options.".concat(a," is not a mutable property.")),s):f?_(_({},s||{}),{},K({},a,e[a])):s},null):null},J="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",$=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J;if(e===null||ce(e))return e;throw new Error(t)},fe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J;if(se(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(s){return $(s,t)})};var n=$(e,t);return n===null?{tag:"empty"}:{tag:"sync",stripe:n}},pe=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"2.8.1"}),e.registerAppInfo({name:"react-stripe-js",version:"2.8.1",url:"https://stripe.com/docs/stripe-js/react"}))},L=u.createContext(null);L.displayName="ElementsContext";var de=function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e},me=function(e){var t=e.stripe,n=e.options,s=e.children,a=u.useMemo(function(){return fe(t)},[t]),f=u.useState(function(){return{stripe:a.tag==="sync"?a.stripe:null,elements:a.tag==="sync"?a.stripe.elements(n):null}}),m=Y(f,2),o=m[0],C=m[1];u.useEffect(function(){var p=!0,k=function(b){C(function(x){return x.stripe?x:{stripe:b,elements:b.elements(n)}})};return a.tag==="async"&&!o.stripe?a.stripePromise.then(function(E){E&&p&&k(E)}):a.tag==="sync"&&!o.stripe&&k(a.stripe),function(){p=!1}},[a,o,n]);var y=I(t);u.useEffect(function(){y!==null&&y!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[y,t]);var g=I(n);return u.useEffect(function(){if(o.elements){var p=F(n,g,["clientSecret","fonts"]);p&&o.elements.update(p)}},[n,g,o.elements]),u.useEffect(function(){pe(o.stripe)},[o.stripe]),u.createElement(L.Provider,{value:o},s)};me.propTypes={stripe:i.any,options:i.object};i.func.isRequired;var z=u.createContext(null);z.displayName="CustomCheckoutSdkContext";var ve=function(e,t){if(!e)throw new Error("Could not find CustomCheckoutProvider context; You need to wrap the part of your app that ".concat(t," in an <CustomCheckoutProvider> provider."));return e},ye=u.createContext(null);ye.displayName="CustomCheckoutContext";i.any,i.shape({clientSecret:i.string.isRequired,elementsOptions:i.object}).isRequired;var D=function(e){var t=u.useContext(z),n=u.useContext(L);if(t&&n)throw new Error("You cannot wrap the part of your app that ".concat(e," in both <CustomCheckoutProvider> and <Elements> providers."));retu
|