@getopenpay/openpay-js 0.2.4-alpha.4cdb512 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -22,4 +22,4 @@ Error: ${he(e)}`),new Error(t)}},ba=r=>(r==null?void 0:r["op-pockyt-3ds-url"])!=
|
|
|
22
22
|
Error: ${he(e)}`),new Error(t)}},Aa=async(r,e)=>{const t=Ca(e),n=await vn({url:t["op-airwallex-3ds-url"],baseUrl:r}),s=Pa(n.href??""),o=t["op-airwallex-initial-intent-id"];if(o!==s){const c="Unable to process your credit card. Please contact support for assistance.",u=`Intent ID from callback (${s}) does not match the initial intent ID (${o}).`;throw fr(u),new Error(c)}return{existing_cc:{initial_intent_id:s,consent_id:t["op-airwallex-consent-id"]}}},{log__:j,err__:kn}=$("common-cc"),{log__:En}=$("stripe-cc");i.array(i.object({our_existing_pm_id:i.string()})).length(1);const Ta=Ge(async({context:r,checkoutPaymentMethod:e,nonCdeFormInputs:t,formCallbacks:n,customParams:s})=>{var l;j("├ Running common CC flow...",{checkoutPaymentMethod:e});const o=r.anyCdeConnection,a=await Se(o);j(`├ Validating non-CDE form fields [Mode: ${a.mode}]`);const c=We(t,n.get.onValidationError),u={session_id:r.elementsSessionId,checkout_payment_method:e,non_cde_form_fields:c,extra_metadata:{}};try{j(`├ Tokenizing card info in CDE [Session: ${r.elementsSessionId}]`);const d=await Vi(s.currentCdeConnections,{session_id:r.elementsSessionId});if(sa(d,n.get.onValidationError),a.mode==="setup"){j(`├ Setting up payment method in CDE [Token: ${a.token}]`);const m=await zi(o,u);return j(`╰ Setup completed successfully [PM ID: ${m.payment_method_id}]`),{mode:"setup",result:m}}else{j(`├ Initial checkout flow. Checking out card info in CDE [Session: ${r.elementsSessionId}]`);const m=await an(o,u);return j("╰ Checkout completed successfully."),{mode:"checkout",result:m}}}catch(d){if(d instanceof on&&d.originalErrorMessage.includes("3DS_REQUIRED")){j("├ Card requires 3DS, starting non-legacy payment flow"),j("Received 3DS error response headers:",d.response.headers);const m=ba(d.response.headers);if(m){j("├ Pockyt 3DS case detected. Going through Pockyt 3DS flow.");const T=await ka(r.baseUrl,d.response.headers);u.extra_metadata.pockyt=T}const w=xa(d.response.headers);if(w){j("├ Airwallex 3DS case detected. Going through Airwallex 3DS flow.");const T=await Aa(r.baseUrl,d.response.headers);u.extra_metadata.airwallex=T}const h=await Fi(o,u);j("├ Payment flow result:",h);const g=m||w,E=((l=d.response.headers)==null?void 0:l["op-should-use-new-flow"])!=="true";g?j("├ Pre-start 3DS is successful, other 3DS flows will be skipped."):E?(j("├ Using stripe 3DS flow"),await Na(h)):(j("├ Using common 3DS flow"),await Ra(h,r.baseUrl));const P=h.cc_pm_id;if(a.mode==="setup"){j(`├ Confirming payment flow [cc_pm_id: ${P}]`);const T=await Ce(o,{secure_token:a.token,existing_cc_pm_id:P});j("├ Confirm payment flow result received Result:",T);const A=pr(T);return j(`╰ Setup completed successfully [PM ID: ${A.payment_method_id}]`),{mode:"setup",result:A}}else{j(`├ Checking out after 3DS flow [Flow: ${E?"legacy":"new"}]`);const T=await an(o,{...u,existing_cc_pm_id:P,do_not_use_legacy_cc_flow:E});return j("╰ Checkout completed successfully."),{mode:"checkout",result:T}}}throw kn("╰ Error checking out card info in CDE"),kn(d),d}}),Ia=r=>{const e=r.required_user_actions.find(t=>t.type==="stripe_3ds");if(!e)throw new Error("No stripe 3DS action found");return Ao.parse(e)},Oa=r=>{const e=r.required_user_actions.find(t=>t.type==="airwallex_payment_consent");if(!e)throw new Error("No common 3DS action found");return So.parse(e)},Ra=async(r,e)=>{const t=Oa(r);j(`├ Using common 3DS flow [URL: ${t.redirect_url}]`);const{status:n}=await Ut({url:t.redirect_url,baseUrl:e});if(j(`╰ 3DS verification completed [Status: ${n}]`),n===re.CANCELLED)throw new Error("3DS verification cancelled");if(n===re.FAILURE)throw new Error("3DS verification failed")},Na=async r=>{const e=Ia(r);En(`├ Using stripe 3DS flow [Client Secret: ${e.client_secret.substring(0,8)}...]`),await Do(e),En("╰ Stripe 3DS flow completed successfully")},{log__:G,err__:Ma}=$("stripe-pr"),ja=i.object({provider:i.union([i.literal("apple_pay"),i.literal("google_pay")]),processor_name:i.literal("stripe"),metadata:i.object({stripe_pk:i.string()})}),Da=$t(async({context:r})=>{G("Checking if there are any CPMs for Stripe PR...");const e=Ye(r.checkoutPaymentMethods,ja);G("Initializing Stripe PR flow...");const t=r.anyCdeConnection,n=await Se(t),s=n.mode==="setup";G("Getting initial preview amount");const o=await Mt(t,n.token,s,void 0),a=await Ro(e.metadata.stripe_pk,o.amountAtom,o.currency,s);G("Checking if can make payment");const c=await a.canMakePayment();return c===null?(Ma("canMakePayment returned null"),{isAvailable:!1,reason:"canMakePayment returned null"}):(G("Stripe PR flow initialized successfully. Can make payment",c),{isAvailable:!0,pr:a,availableProviders:{applePay:c.applePay,googlePay:c.googlePay}})}),La=Ge(async({context:r,checkoutPaymentMethod:e,nonCdeFormInputs:t,formCallbacks:n,customParams:s,initResult:o})=>{if(G("Running Stripe PR flow..."),s.provider!==e.provider)throw new Error(`Provider mismatch. Expected ${s.provider}, got ${e.provider}`);const a=r.anyCdeConnection,c=o.pr;if(s!=null&&s.overridePaymentRequest){const g=s.overridePaymentRequest;G("Overriding PR amount with",g),$a(c,g.amount,g.pending,g.stripeApplePay)}G("Showing PR dialog..."),c.show();const u=await Mo(c);G("Stripe PM added event:",u),G("Merging PM fields with form fields...");const l=Fa(t,u),d=We(l,n.get.onValidationError);G("PR dialog finished. Starting payment flow...",d);const m=await $i(a,{fields:d,checkoutPaymentMethod:e}),w=Ua(m);G("Confirming PR with Stripe..."),await jo(w,u);const h=await Se(a);if(h.mode==="setup"){G("Confirming payment flow for setup...");const g=await Ce(a,{secure_token:h.token});return{mode:"setup",result:pr(g)}}else{G("Performing checkout...");const g={secure_token:h.token,payment_input:{provider_type:e.provider},customer_first_name:d[f.FIRST_NAME],customer_last_name:d[f.LAST_NAME],customer_email:d[f.EMAIL],customer_zip_code:d[f.ZIP_CODE],customer_country:d[f.COUNTRY],promotion_code:d[f.PROMOTION_CODE],line_items:h.line_items,total_amount_atom:h.amount_total_atom,cancel_at_end:!1,checkout_payment_method:e};return{mode:"checkout",result:await jt(a,g)}}}),Fa=(r,e)=>{var u,l,d,m;const t={...r},[n,...s]=((l=(u=e.payerName)==null?void 0:u.trim())==null?void 0:l.split(/\s+/))??[],o=s.join(" ")||void 0,a=(m=(d=e.paymentMethod)==null?void 0:d.billing_details)==null?void 0:m.address,c=e.shippingAddress;return t[f.FIRST_NAME]=t[f.FIRST_NAME]||n||"_OP_UNKNOWN",t[f.LAST_NAME]=t[f.LAST_NAME]||o||"_OP_UNKNOWN",t[f.EMAIL]=t[f.EMAIL]||e.payerEmail||"op_unfilled@getopenpay.com",t[f.ZIP_CODE]=t[f.ZIP_CODE]||(a==null?void 0:a.postal_code)||(c==null?void 0:c.postalCode)||"00000",t[f.COUNTRY]=t[f.COUNTRY]||(a==null?void 0:a.country)||(c==null?void 0:c.country)||"US",G("Final form inputs:",t),t},$a=(r,e,t,n)=>{r.update({total:{amount:e.amountAtom,label:"Total",pending:t},currency:e.currency,applePay:n})},Ua=r=>{if(r.required_user_actions.length!==1)throw new Error(`Error occurred.
|
|
23
23
|
Details: got ${r.required_user_actions.length} required user actions`);return To.parse(r.required_user_actions[0])},{log__:me,err__:Sn}=$("pockyt-paypal"),Za=i.object({processor_name:i.literal("pockyt"),provider:i.literal("paypal")}),Va=i.array(i.object({paypal_iframe_url:i.string(),verify_token:i.string()})).length(1),za=Ge(async({context:r,checkoutPaymentMethod:e,nonCdeFormInputs:t,formCallbacks:n,customParams:s})=>{me("Running Pockyt Paypal flow...");const o=r.anyCdeConnection,a=await Se(o);me("Verifying CPM...");const c=Za.parse(e);me("├ Validating non-CDE form fields");const u=s==null?void 0:s.settings,l=We(t,n.get.onValidationError,u==null?void 0:u.defaultFieldValues),d=na(l);me(`Starting payment flow... Mode: ${a.mode}`);const m=a.mode!=="setup",w=await Nt(o,{payment_provider:c.provider,checkout_payment_method:c,use_pay_first_flow:m,pay_first_flow_cart_info:m?{line_items:a.line_items,displayed_total_amount_atom:a.amount_total_atom}:void 0,...d});if(me("Start payment flow response",w),!w.checkout_attempt_id)throw Sn("Checkout attempt ID not found in response:",w),new Error("An error occurred during checkout, please try again with another payment method.");const h=Va.parse(w.required_user_actions)[0];me("Opening paypal iframe...");const g=await _a("PayPal",o,h.verify_token,h.paypal_iframe_url);me("Paypal flow result",g);const E=bn(g.href);me(`Confirming payment flow using vault ID ${E}`);const P=await Ce(o,{secure_token:a.token,their_pm_id:E,checkout_attempt_id:m?w.checkout_attempt_id:void 0});if(me("Confirm payment flow result",P),a.mode==="setup")return{mode:"setup",result:{payment_method_id:P.payment_methods[0].id}};if(!P.pay_first_success_response)throw Sn("Checkout failed, no pay-first success response:",P),new Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:P.pay_first_success_response}}),hr=({gateway:r,gatewayMerchantId:e,merchantName:t,merchantId:n,initialPreview:s,overridePaymentRequest:o})=>{var l;const a=o!=null&&o.amount?Math.max(o.amount.amountAtom/100,0):Math.max((s==null?void 0:s.amountAtom)??0,0),c=(((l=o==null?void 0:o.amount)==null?void 0:l.currency)??(s==null?void 0:s.currency)??"USD").toUpperCase(),u={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL"},allowCreditCards:!0,allowPrepaidCards:!0},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:r,gatewayMerchantId:e}}}],emailRequired:!0,merchantInfo:{merchantId:n??"",merchantName:t},transactionInfo:{countryCode:"US",currencyCode:c,totalPriceStatus:o!=null&&o.pending?"ESTIMATED":"FINAL",totalPrice:a.toFixed(2)}};return o!=null&&o.googlePayPaymentRequest?{...u,...o.googlePayPaymentRequest}:u},Ba=()=>new Promise((r,e)=>{const t=document.createElement("script");t.src="https://pay.google.com/gp/p/js/pay.js",t.async=!0,t.onload=()=>r(),t.onerror=()=>e(new Error("Failed to load Google Pay SDK")),document.body.appendChild(t)}),qa=r=>{const e=r.required_user_actions.find(t=>t.type==="airwallex_payment_consent");return e?zr.parse(e):null},Ga=(r,e)=>{var s,o,a,c;const t={...r},n=(o=(s=e.paymentMethodData)==null?void 0:s.info)==null?void 0:o.billingAddress;if(n){const[u,...l]=((c=(a=n.name)==null?void 0:a.trim())==null?void 0:c.split(/\s+/))??[],d=l.join(" ")||void 0;t[f.EMAIL]=t[f.EMAIL]||e.email||"op_unfilled@getopenpay.com",t[f.COUNTRY]=t[f.COUNTRY]||n.countryCode||"US",t[f.ADDRESS]=t[f.ADDRESS]||n.address1||"",t[f.CITY]=t[f.CITY]||n.locality||"",t[f.ZIP_CODE]=t[f.ZIP_CODE]||n.postalCode||"00000",t[f.STATE]=t[f.STATE]||n.administrativeArea||"",t[f.FIRST_NAME]=t[f.FIRST_NAME]||u||"_OP_UNKNOWN",t[f.LAST_NAME]=t[f.LAST_NAME]||d||"_OP_UNKNOWN"}return t},{log__:J,err__:vt}=$("gpay");let mr=null;const Cn=r=>{const e=r===je?"PRODUCTION":"TEST";return mr===null&&(mr=new window.google.payments.api.PaymentsClient({environment:e,merchantInfo:hr({gateway:"airwallex",gatewayMerchantId:"",merchantName:""}).merchantInfo})),mr},xn=i.object({provider:i.literal("google_pay"),processor_name:i.literal("airwallex"),metadata:i.object({processor_account_id:i.string(),processor_account_name:i.string(),google_pay_merchant_id:i.string().nullish()})}),Ya=$t(async({context:r,formCallbacks:e})=>{var o,a;const t=Ye(r.checkoutPaymentMethods,xn);if(!t)return{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};J("Google Pay CPM",t);const n=t.metadata;if(!n.processor_account_id)return vt("No gateway merchant ID found in processor account"),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};if(J("Loading Google Pay SDK..."),await Ba(),!((a=(o=window.google)==null?void 0:o.payments)!=null&&a.api))return vt("Google Pay SDK not loaded properly"),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};J("Google Pay SDK loaded",window.google.payments);try{const{result:c}=await Cn(r.baseUrl).isReadyToPay(hr({gateway:"airwallex",gatewayMerchantId:n.processor_account_id,merchantName:n.processor_account_name,merchantId:n.google_pay_merchant_id??"",initialPreview:void 0}));if(!c)return J("Google Pay is not available for this user"),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}}}catch(c){return vt("Error checking Google Pay availability",c),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}}}return{isAvailable:!0,isLoading:!1,startFlow:async c=>{try{ne.airwallexGooglePay.run({context:r,checkoutPaymentMethod:t,nonCdeFormInputs:ze(r.formDiv),formCallbacks:e,initResult:void 0,customParams:c??{}})}catch(u){vt("Google Pay payment error",u),e.get.onCheckoutError((u==null?void 0:u.message)??"Unknown error")}}}}),Wa=Ge(async({context:r,checkoutPaymentMethod:e,nonCdeFormInputs:t,formCallbacks:n,customParams:s})=>{var m,w,h,g,E,P,T;J("Starting Google Pay flow...");const o=Ye(r.checkoutPaymentMethods,xn),a=Cn(r.baseUrl),c=r.anyCdeConnection,u=await Se(c),l=o.metadata;if(!l.processor_account_id)throw new Error("No gateway merchant ID found in processor account");const d=hr({gateway:"airwallex",gatewayMerchantId:l.processor_account_id,merchantName:l.processor_account_name,merchantId:"",initialPreview:await Mt(c,u.token,u.mode==="setup",void 0),overridePaymentRequest:s==null?void 0:s.overridePaymentRequest});try{const A=await a.loadPaymentData(d);J("Google Pay Payment data",A);const I=Ga(t,A),D=We(I,n.get.onValidationError),L=(w=(m=A.paymentMethodData)==null?void 0:m.tokenizationData)==null?void 0:w.token;if(!L)throw new Error("No payment token received from Google Pay");const V=await Nt(c,{payment_provider:e.provider,checkout_payment_method:e,new_customer_email:D[f.EMAIL],new_customer_first_name:D[f.FIRST_NAME],new_customer_last_name:D[f.LAST_NAME],new_customer_address:{postal_code:D[f.ZIP_CODE],country_code:D[f.COUNTRY]}}),Ae=qa(V);J("Start flow next actions",Ae);const xr=await Ce(c,{secure_token:u.token,processor_specific_metadata:{payment_provider:e.provider,airwallex_consent_id:Ae==null?void 0:Ae.consent_id,airwallex_payment_method_data:{type:"googlepay",googlepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:L}}}});J("[1st] Confirm payment flow response",xr);let bt=(g=(h=xr.payment_methods)==null?void 0:h[0])==null?void 0:g.id;const Me=(E=xr.required_user_actions)==null?void 0:E.find(de=>de.type==="airwallex_payment_consent");if(Me&&Me.redirect_url){J("3DS Required, starting verification...",Me);const{status:de}=await Ut({url:Me.redirect_url,baseUrl:r.baseUrl});if(J(`╰ 3DS verification completed [Status: ${de}]`),de===re.CANCELLED)throw new Error("3DS verification cancelled");if(de===re.FAILURE)throw new Error("3DS verification failed")}if(Me&&!bt){const de=await Ce(c,{secure_token:u.token,their_pm_id:Me.their_pm_id,processor_specific_metadata:{payment_provider:e.provider,airwallex_consent_id:Me.consent_id}});J("[2nd] Confirm payment flow response",de),bt=(T=(P=de.payment_methods)==null?void 0:P[0])==null?void 0:T.id}if(!bt)throw new Error("No PM ID found");if(u.mode==="setup")return{mode:"setup",result:{payment_method_id:bt}};{J("Starting one-time payment flow...");const de={secure_token:u.token,payment_input:{provider_type:e.provider},do_not_use_legacy_cc_flow:!0,use_confirmed_pm_id:bt,line_items:u.line_items,total_amount_atom:u.amount_total_atom,cancel_at_end:!1,checkout_payment_method:e,customer_email:D[f.EMAIL],customer_zip_code:D[f.ZIP_CODE],customer_country:D[f.COUNTRY],promotion_code:D[f.PROMOTION_CODE],customer_first_name:D[f.FIRST_NAME],customer_last_name:D[f.LAST_NAME]};return{mode:"checkout",result:await jt(c,de)}}}catch(A){throw vt("Google Pay payment error",A),new Error((A==null?void 0:A.message)??"Unknown error")}}),Ha=()=>new Promise((r,e)=>{const t=document.createElement("script");t.src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",t.crossOrigin="anonymous",t.async=!0,t.onload=()=>r(),t.onerror=()=>e(new Error("Failed to load Apple Pay SDK")),document.body.appendChild(t)}),Ka=(r,e)=>{var n;const t={...r};return e&&(t[f.EMAIL]=t[f.EMAIL]||e.emailAddress||"op_unfilled@getopenpay.com",t[f.COUNTRY]=t[f.COUNTRY]||e.countryCode||"US",t[f.ADDRESS]=t[f.ADDRESS]||((n=e.addressLines)==null?void 0:n[0])||"",t[f.CITY]=t[f.CITY]||e.locality||"",t[f.ZIP_CODE]=t[f.ZIP_CODE]||e.postalCode||"00000",t[f.STATE]=t[f.STATE]||e.administrativeArea||"",t[f.FIRST_NAME]=t[f.FIRST_NAME]||e.givenName||"_OP_UNKNOWN",t[f.LAST_NAME]=t[f.LAST_NAME]||e.familyName||"_OP_UNKNOWN"),t},{log__:Zt}=$("applepay-session");async function Ja(r,e){try{const n=(await Nt(e.connection,{payment_provider:e.checkoutPaymentMethod.provider,checkout_payment_method:e.checkoutPaymentMethod,new_customer_email:e.nonCdeFormInputs[f.EMAIL],new_customer_first_name:e.nonCdeFormInputs[f.FIRST_NAME],new_customer_last_name:e.nonCdeFormInputs[f.LAST_NAME],processor_specific_metadata:{airwallex_payment_session:{validation_url:r.validationURL,initiative_context:window.location.hostname,their_account_id:e.processorAccount.processor_account_id}}})).required_user_actions[0],s=n.payment_session,o=n.consent_id;if(!s)throw new Error("No session data received from payment flow");if(!o)throw new Error("No consent ID received from payment flow");return e.session.completeMerchantValidation(s),o}catch(t){throw e.session.abort(),t}}async function Xa(r,e){var s,o;if(!r.redirect_url)throw new Error("No redirect URL found");Zt("3DS Required, starting verification...",r);const{status:t}=await Ut({url:r.redirect_url,baseUrl:e.baseUrl});if(Zt(`╰ 3DS verification completed [Status: ${t}]`),t===re.CANCELLED)throw new Error("3DS verification cancelled");if(t===re.FAILURE)throw new Error("3DS verification failed");const n=await Ce(e.connection,{secure_token:e.prefill.token,processor_specific_metadata:{their_pm_id:r.their_pm_id,airwallex_consent_id:r.consent_id,payment_provider:e.checkoutPaymentMethod.provider}});return Zt("[2nd] Confirm payment flow response",n),(o=(s=n.payment_methods)==null?void 0:s[0])==null?void 0:o.id}async function Qa(r,e,t){return{mode:"checkout",result:await jt(t.connection,{secure_token:t.prefill.token,payment_input:{provider_type:t.checkoutPaymentMethod.provider},do_not_use_legacy_cc_flow:!0,use_confirmed_pm_id:r,line_items:t.prefill.line_items,total_amount_atom:t.prefill.amount_total_atom,cancel_at_end:!1,checkout_payment_method:t.checkoutPaymentMethod,customer_email:e[f.EMAIL],customer_zip_code:e[f.ZIP_CODE],customer_country:e[f.COUNTRY],promotion_code:e[f.PROMOTION_CODE]})}}async function ec(r,e,t){var n,s,o;try{const a=r.payment,c=Ka(e.nonCdeFormInputs,a.billingContact),u=We(c,e.formCallbacks.get.onValidationError),l=await Ce(e.connection,{secure_token:e.prefill.token,processor_specific_metadata:{payment_provider:e.checkoutPaymentMethod.provider,airwallex_consent_id:t,airwallex_payment_method_data:{type:"applepay",applepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:JSON.stringify(a.token)}}}});Zt("[1st] Confirm payment flow response",l);let d=(s=(n=l.payment_methods)==null?void 0:n[0])==null?void 0:s.id;const m=(o=l.required_user_actions)==null?void 0:o.find(h=>h.type==="airwallex_payment_consent");if(m!=null&&m.redirect_url&&m.consent_id&&m.their_pm_id&&(d=await Xa(m,e)),!d)throw new Error("No PM ID found");const w={status:ApplePaySession.STATUS_SUCCESS};return e.session.completePayment(w),e.isSetupMode?{mode:"setup",result:{payment_method_id:d}}:await Qa(d,u,e)}catch(a){const c={status:ApplePaySession.STATUS_FAILURE};throw e.session.completePayment(c),a}}const{log__:H,err__:yr}=$("applepay"),Pn=i.object({provider:i.literal("apple_pay"),processor_name:i.literal("airwallex"),metadata:i.object({processor_account_id:i.string(),processor_account_name:i.string()})}),tc=$t(async({context:r,formCallbacks:e})=>{const t=Ye(r.checkoutPaymentMethods,Pn);if(!t)return{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};H("Loading Apple Pay SDK...");try{await Ha(),H("Apple Pay SDK loaded successfully")}catch(d){return yr("Failed to load Apple Pay SDK",d),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}}}if(!window.ApplePaySession||!ApplePaySession.canMakePayments())return H("Apple Pay is not available on this device/browser"),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};if(H("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return H("No active cards available for Apple Pay"),{isAvailable:!1,isLoading:!1,startFlow:async()=>{}};const s=r.anyCdeConnection,o=await Se(s),a=o.mode==="setup",c=await Mt(s,o.token,a,void 0),u=t.metadata;if(H("processorAccount",u),!u.processor_account_id)throw new Error("No gateway merchant ID found in processor account");return{isAvailable:!0,isLoading:!1,startFlow:async d=>{var m;try{await ne.airwallexApplePay.run({context:r,checkoutPaymentMethod:t,nonCdeFormInputs:ze(r.formDiv),formCallbacks:e,customParams:{isSetupMode:a,prefill:o,initialPreview:((m=d==null?void 0:d.overridePaymentRequest)==null?void 0:m.amount)??c,overridePaymentRequest:d==null?void 0:d.overridePaymentRequest},initResult:void 0})}catch(w){yr("Apple Pay payment error",w),e.get.onCheckoutError((w==null?void 0:w.message)??"Unknown error")}}}}),rc=Ge(async({context:r,checkoutPaymentMethod:e,nonCdeFormInputs:t,customParams:n,formCallbacks:s})=>{var T,A;const o=Ye(r.checkoutPaymentMethods,Pn),{initialPreview:a,isSetupMode:c,prefill:u,overridePaymentRequest:l}=n,d=(((T=l==null?void 0:l.amount)==null?void 0:T.currency)??a.currency??"USD").toUpperCase(),m=(A=l==null?void 0:l.amount)!=null&&A.amountAtom?(l.amount.amountAtom/100).toFixed(2):Math.max(a.amountAtom/100,0).toFixed(2),w={label:(l==null?void 0:l.label)??(c?"Setup Payment":"Payment Total"),type:l!=null&&l.pending?"pending":"final",amount:m},h={countryCode:"US",currencyCode:d,supportedNetworks:["visa","masterCard","amex","discover"],merchantCapabilities:["supports3DS","supportsCredit","supportsDebit","supportsEMV"],total:w,...(l==null?void 0:l.applePayPaymentRequest)??{}};H("Payment Request",h);const g=new ApplePaySession(3,h);H("ApplePaySession",g);const E={session:g,connection:r.anyCdeConnection,checkoutPaymentMethod:e,nonCdeFormInputs:t,processorAccount:o.metadata,prefill:u,isSetupMode:c,baseUrl:r.baseUrl,formCallbacks:s};let P;return new Promise((I,D)=>{g.oncancel=()=>{H("Payment cancelled by user"),D(new Error("Payment cancelled by user"))},g.onvalidatemerchant=async L=>{try{P=await Ja(L,E)}catch(V){D(V)}},g.onshippingmethodselected=L=>{H("Shipping method selected",L.shippingMethod)},g.onshippingmethodselected=L=>{H("Shipping method selected",L.shippingMethod);const V={};g.completeShippingMethodSelection(V)},g.onshippingcontactselected=L=>{H("Shipping contact selected",L.shippingContact);const V={};g.completeShippingContactSelection(V)},g.onpaymentmethodselected=L=>{H("Payment method selected",L.paymentMethod);const V={newTotal:{...w}};g.completePaymentMethodSelection(V)},g.onpaymentauthorized=async L=>{try{const V=await ec(L,E,P);I(V)}catch(V){D(V)}},g.begin()}).catch(I=>{throw yr("Apple Pay payment error",I),I})}),_r=(r,e,t)=>{const n=r.filter(s=>{const o=t===void 0?!0:s.processor_name===t,a=s.provider===e;return o&&a});if(n.length===0)throw console.error("CPMs list",r),new Error(`No CPMs found with provider '${e}' and processor '${t}'`);if(n.length!==1)throw console.error("CPMs list",r),new Error(`More than one CPM found with provider '${e}' and processor '${t}'`);return n[0]},ne={commonCC:{init:async()=>{},run:Ta},stripePR:{init:Da,run:La},stripeLink:{init:ca,run:la},pockytPaypal:{run:za},airwallexGooglePay:{init:Ya,run:Wa},airwallexApplePay:{init:tc,run:rc}};var gr=function(r,e){return gr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])},gr(r,e)};function xe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");gr(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function nc(r,e,t,n){function s(o){return o instanceof t?o:new t(function(a){a(o)})}return new(t||(t=Promise))(function(o,a){function c(d){try{l(n.next(d))}catch(m){a(m)}}function u(d){try{l(n.throw(d))}catch(m){a(m)}}function l(d){d.done?o(d.value):s(d.value).then(c,u)}l((n=n.apply(r,e||[])).next())})}function An(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(l){return function(d){return u([l,d])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(t=0)),t;)try{if(n=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,s=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(d){l=[6,d],s=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function He(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vt(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,o=[],a;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(c){a={error:c}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return o}function zt(r,e,t){if(t||arguments.length===2)for(var n=0,s=e.length,o;n<s;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))}function Ke(r){return this instanceof Ke?(this.v=r,this):new Ke(r)}function sc(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),s[Symbol.asyncIterator]=function(){return this},s;function a(h){return function(g){return Promise.resolve(g).then(h,m)}}function c(h,g){n[h]&&(s[h]=function(E){return new Promise(function(P,T){o.push([h,E,P,T])>1||u(h,E)})},g&&(s[h]=g(s[h])))}function u(h,g){try{l(n[h](g))}catch(E){w(o[0][3],E)}}function l(h){h.value instanceof Ke?Promise.resolve(h.value.v).then(d,m):w(o[0][2],h)}function d(h){u("next",h)}function m(h){u("throw",h)}function w(h,g){h(g),o.shift(),o.length&&u(o[0][0],o[0][1])}}function oc(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof He=="function"?He(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(o){t[o]=r[o]&&function(a){return new Promise(function(c,u){a=r[o](a),s(c,u,a.done,a.value)})}}function s(o,a,c,u){Promise.resolve(u).then(function(l){o({value:l,done:c})},a)}}typeof SuppressedError=="function"&&SuppressedError;function Z(r){return typeof r=="function"}function Bt(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var vr=Bt(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
24
24
|
`+t.map(function(n,s){return s+1+") "+n.toString()}).join(`
|
|
25
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function qt(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var wt=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,s,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=He(a),u=c.next();!u.done;u=c.next()){var l=u.value;l.remove(this)}}catch(E){e={error:E}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var d=this.initialTeardown;if(Z(d))try{d()}catch(E){o=E instanceof vr?E.errors:[E]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var w=He(m),h=w.next();!h.done;h=w.next()){var g=h.value;try{On(g)}catch(E){o=o??[],E instanceof vr?o=zt(zt([],Vt(o)),Vt(E.errors)):o.push(E)}}}catch(E){n={error:E}}finally{try{h&&!h.done&&(s=w.return)&&s.call(w)}finally{if(n)throw n.error}}}if(o)throw new vr(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)On(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&qt(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&qt(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),Tn=wt.EMPTY;function In(r){return r instanceof wt||r&&"closed"in r&&Z(r.remove)&&Z(r.add)&&Z(r.unsubscribe)}function On(r){Z(r)?r():r.unsubscribe()}var Rn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Nn={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setTimeout.apply(void 0,zt([r,e],Vt(t)))},clearTimeout:function(r){var e=Nn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function Mn(r){Nn.setTimeout(function(){throw r})}function jn(){}function Gt(r){r()}var wr=function(r){xe(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,In(t)&&t.add(n)):n.destination=lc,n}return e.create=function(t,n,s){return new kr(t,n,s)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(wt),ic=Function.prototype.bind;function br(r,e){return ic.call(r,e)}var ac=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Yt(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Yt(n)}else Yt(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Yt(t)}},r}(),kr=function(r){xe(e,r);function e(t,n,s){var o=r.call(this)||this,a;if(Z(t)||!t)a={next:t??void 0,error:n??void 0,complete:s??void 0};else{var c;o&&Rn.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&br(t.next,c),error:t.error&&br(t.error,c),complete:t.complete&&br(t.complete,c)}):a=t}return o.destination=new ac(a),o}return e}(wr);function Yt(r){Mn(r)}function cc(r){throw r}var lc={closed:!0,next:jn,error:cc,complete:jn},Er=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function uc(r){return r}function dc(r){return r.length===0?uc:r.length===1?r[0]:function(t){return r.reduce(function(n,s){return s(n)},t)}}var ye=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var s=this,o=fc(e)?e:new kr(e,t,n);return Gt(function(){var a=s,c=a.operator,u=a.source;o.add(c?c.call(o,u):u?s._subscribe(o):s._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Dn(t),new t(function(s,o){var a=new kr({next:function(c){try{e(c)}catch(u){o(u),a.unsubscribe()}},error:o,complete:s});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[Er]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dc(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Dn(e),new e(function(n,s){var o;t.subscribe(function(a){return o=a},function(a){return s(a)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function Dn(r){var e;return(e=r??Rn.Promise)!==null&&e!==void 0?e:Promise}function pc(r){return r&&Z(r.next)&&Z(r.error)&&Z(r.complete)}function fc(r){return r&&r instanceof wr||pc(r)&&In(r)}function hc(r){return Z(r==null?void 0:r.lift)}function mc(r){return function(e){if(hc(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function yc(r,e,t,n,s){return new _c(r,e,t,n,s)}var _c=function(r){xe(e,r);function e(t,n,s,o,a,c){var u=r.call(this,t)||this;return u.onFinalize=a,u.shouldUnsubscribe=c,u._next=n?function(l){try{n(l)}catch(d){t.error(d)}}:r.prototype._next,u._error=o?function(l){try{o(l)}catch(d){t.error(d)}finally{this.unsubscribe()}}:r.prototype._error,u._complete=s?function(){try{s()}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._complete,u}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(wr),gc=Bt(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ln=function(r){xe(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Fn(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new gc},e.prototype.next=function(t){var n=this;Gt(function(){var s,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=He(n.currentObservers),c=a.next();!c.done;c=a.next()){var u=c.value;u.next(t)}}catch(l){s={error:l}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(s)throw s.error}}}})},e.prototype.error=function(t){var n=this;Gt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var s=n.observers;s.length;)s.shift().error(t)}})},e.prototype.complete=function(){var t=this;Gt(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,s=this,o=s.hasError,a=s.isStopped,c=s.observers;return o||a?Tn:(this.currentObservers=null,c.push(t),new wt(function(){n.currentObservers=null,qt(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,s=n.hasError,o=n.thrownError,a=n.isStopped;s?t.error(o):a&&t.complete()},e.prototype.asObservable=function(){var t=new ye;return t.source=this,t},e.create=function(t,n){return new Fn(t,n)},e}(ye),Fn=function(r){xe(e,r);function e(t,n){var s=r.call(this)||this;return s.destination=t,s.source=n,s}return e.prototype.next=function(t){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,t)},e.prototype.error=function(t){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&s!==void 0?s:Tn},e}(Ln),vc={now:function(){return Date.now()},delegate:void 0},wc=function(r){xe(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return this},e}(wt),$n={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setInterval.apply(void 0,zt([r,e],Vt(t)))},clearInterval:function(r){return clearInterval(r)},delegate:void 0},bc=function(r){xe(e,r);function e(t,n){var s=r.call(this,t,n)||this;return s.scheduler=t,s.work=n,s.pending=!1,s}return e.prototype.schedule=function(t,n){var s;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var o=this.id,a=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(a,o,n)),this.pending=!0,this.delay=n,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(a,this.id,n),this},e.prototype.requestAsyncId=function(t,n,s){return s===void 0&&(s=0),$n.setInterval(t.flush.bind(t,this),s)},e.prototype.recycleAsyncId=function(t,n,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return n;n!=null&&$n.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(t,n);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var s=!1,o;try{this.work(t)}catch(a){s=!0,o=a||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,s=t.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,qt(o,this),n!=null&&(this.id=this.recycleAsyncId(s,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(wc),Un=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=vc.now,r}(),kc=function(r){xe(e,r);function e(t,n){n===void 0&&(n=Un.now);var s=r.call(this,t,n)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var s;this._active=!0;do if(s=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,s){for(;t=n.shift();)t.unsubscribe();throw s}},e}(Un),Ec=new kc(bc),Sc=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function Cc(r){return Z(r==null?void 0:r.then)}function xc(r){return Z(r[Er])}function Pc(r){return Symbol.asyncIterator&&Z(r==null?void 0:r[Symbol.asyncIterator])}function Ac(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Tc(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ic=Tc();function Oc(r){return Z(r==null?void 0:r[Ic])}function Rc(r){return sc(this,arguments,function(){var t,n,s,o;return An(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Ke(t.read())];case 3:return n=a.sent(),s=n.value,o=n.done,o?[4,Ke(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ke(s)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Nc(r){return Z(r==null?void 0:r.getReader)}function Mc(r){if(r instanceof ye)return r;if(r!=null){if(xc(r))return jc(r);if(Sc(r))return Dc(r);if(Cc(r))return Lc(r);if(Pc(r))return Zn(r);if(Oc(r))return Fc(r);if(Nc(r))return $c(r)}throw Ac(r)}function jc(r){return new ye(function(e){var t=r[Er]();if(Z(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Dc(r){return new ye(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Lc(r){return new ye(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Mn)})}function Fc(r){return new ye(function(e){var t,n;try{for(var s=He(r),o=s.next();!o.done;o=s.next()){var a=o.value;if(e.next(a),e.closed)return}}catch(c){t={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}e.complete()})}function Zn(r){return new ye(function(e){Uc(r,e).catch(function(t){return e.error(t)})})}function $c(r){return Zn(Rc(r))}function Uc(r,e){var t,n,s,o;return nc(this,void 0,void 0,function(){var a,c;return An(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),t=oc(r),u.label=1;case 1:return[4,t.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=u.sent(),s={error:c},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Zc(r,e,t,n,s){n===void 0&&(n=0),s===void 0&&(s=!1);var o=e.schedule(function(){t(),s?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!s)return o}function Vc(r,e){var t=Z(r)?r:function(){return r},n=function(s){return s.error(t())};return new ye(n)}var zc=Bt(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function Bc(r,e){return new Promise(function(t,n){var s=!1,o;r.subscribe({next:function(a){o=a,s=!0},error:n,complete:function(){s?t(o):n(new zc)}})})}function qc(r){return r instanceof Date&&!isNaN(r)}var Gc=Bt(function(r){return function(t){t===void 0&&(t=null),r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function Yc(r,e){var t=qc(r)?{first:r}:typeof r=="number"?{each:r}:r,n=t.first,s=t.each,o=t.with,a=o===void 0?Wc:o,c=t.scheduler,u=c===void 0?Ec:c,l=t.meta,d=l===void 0?null:l;if(n==null&&s==null)throw new TypeError("No timeout provided.");return mc(function(m,w){var h,g,E=null,P=0,T=function(A){g=Zc(w,u,function(){try{h.unsubscribe(),Mc(a({meta:d,lastValue:E,seen:P})).subscribe(w)}catch(I){w.error(I)}},A)};h=m.subscribe(yc(w,function(A){g==null||g.unsubscribe(),P++,w.next(E=A),s>0&&T(s)},void 0,void 0,function(){g!=null&&g.closed||g==null||g.unsubscribe(),E=null})),!P&&T(n!=null?typeof n=="number"?n:+n-u.now():s)})}function Wc(r){throw new Gc(r)}class Wt{constructor(){this.set=e=>{if(this._current.status==="success")throw new Error("LoadedOnce is already in success state");this._current={status:"success",isSuccess:!0,loadedValue:e},this._subject.next(e),this._subject.complete()},this.throw=(e,t)=>{if(this._current.status==="success")throw new Error("LoadedOnce is already in success state");this._current={status:"error",isSuccess:!1,error:e,errMsg:t},this._subject.error(e)},this.getValueIfLoadedElse=e=>this._current.status==="success"?this._current.loadedValue:e,this.subscribe=e=>{if(this._current.status==="success"){e(this._current);return}this._current.status==="error"&&e(this._current);const t=this._subject.subscribe({next:()=>{if(this._current.status!=="success")throw new Error("Invalid state (next): please make sure to update _current before the subject");e(this._current),t.unsubscribe()},error:()=>{if(this._current.status!=="error")throw new Error("Invalid state (error): please make sure to update _current before the subject");e(this._current)}})},this.waitForLoad=e=>{if(this._current.status==="success")return Promise.resolve(this._current.loadedValue);if(this._current.status==="error")return Promise.reject(this._current.error);this._current.status!=="initial"&&ar(this._current);const t={first:e.timeoutSec*1e3,with:()=>Vc(()=>new Error(e.timeoutErrMsg))};return Bc(this._subject.pipe(Yc(t)))},this._current={status:"initial",isSuccess:!1},this._subject=new Ln}get current(){return this._current}}const{log__:Hc,err__:Kc}=$("init-flows"),Ht=(r,e)=>{const t=new Wt;return{publisher:t,initialize:async n=>{try{if(t.current.isSuccess)throw new Error("This flow has already been initialized.");const s=await e(n);Hc(`✔ ${r} flow initialized successfully. Result:`,s),t.set(s)}catch(s){Kc(`𝙭 ${r} flow initialization failed. Error:`,he(s),"Details:",s),t.throw(s,he(s))}}}},Jc=async(r,e,t)=>{await Promise.all(Object.values(r).map(n=>n.initialize({context:e,formCallbacks:t})))},Xc=()=>({stripePR:Ht("Stripe PR",ne.stripePR.init),stripeLink:Ht("Stripe Link",ne.stripeLink.init),airwallexGooglePay:Ht("Airwallex GPay",ne.airwallexGooglePay.init),airwallexApplePay:Ht("Airwallex ApplePay",ne.airwallexApplePay.init)}),{err__:Qc}=$("form-callbacks"),se=i.function().optional(),Vn=i.object({onFocus:se,onBlur:se,onChange:se,onLoad:se,onLoadError:se,onValidationError:se,onCheckoutStarted:se,onCheckoutSuccess:se,onSetupPaymentMethodSuccess:se,onCheckoutError:se,onPaymentRequestLoad:se}),ue=class ue{constructor(){this.setCallbacks=e=>{this._callbacks=ue.createEmptyCallbacks(),Object.entries(e).forEach(([t,n])=>{const s=Js(t,n??ue.NOOP,Qc);this._callbacks[t]=s})},this._callbacks=ue.createEmptyCallbacks()}get get(){return{...this._callbacks}}};ue.NOOP=()=>{},ue.createEmptyCallbacks=()=>{const e={};return Object.keys(Vn.keyof().enum).forEach(t=>{e[t]=ue.NOOP}),e},ue.fromObject=e=>{const t=new ue;return t.setCallbacks(Vn.parse(e)),t};let Sr=ue;class el{constructor(e,t,n,s){this.handleMessage=o=>{if(!o.source)throw new Error("No source found");if(zn(o.origin)!==zn(this.baseUrl)||typeof o.data=="object"&&o.data.penpal)return;const a=zo(JSON.parse(o.data));if(!this.validateEvent(a))return;const{elementId:u,payload:l}=a,d=l.type;switch(d){case"LAYOUT":this.internalCallbacks.setFormHeight(l.height?`${l.height}px`:"100%");break;case"FOCUS":this.formCallbacks.get.onFocus(u,l.elementType);break;case"BLUR":this.formCallbacks.get.onBlur(u,l.elementType);break;case"CHANGE":this.formCallbacks.get.onChange(u,l.elementType,l.errors);break;case"LOADED":this.eventTargets[u]=o.source,this.internalCallbacks.onCdeLoaded(l);break;case"LOAD_ERROR":this.internalCallbacks.onCdeLoadError(l.message);break;case"VALIDATION_ERROR":this.formCallbacks.get.onValidationError(l.elementType,l.errors,u);break;default:console.warn("[form] Unhandled event type:",d)}},this.validateEvent=o=>o.formId!==this.formId||!o.elementId?(console.log("[OJS] formId",this.formId,o.formId),console.warn("[form] Ignoring unknown event:",o),!1):this.nonces.has(o.nonce)?(console.warn("[form] Ignoring duplicate event:",o),!1):(this.nonces.add(o.nonce),!0),this.eventTargets={},this.nonces=new Set,this.formId=e,this.baseUrl=t,this.formCallbacks=n,this.internalCallbacks=s}}const zn=r=>new URL(r).origin;async function tl(r,e){const n=await Kr({iframe:r,debug:!1,childOrigin:e}).promise,s=await di(n);if(!pi(n,s))throw new Error("Got invalid CDE connection object");return n}class rl{constructor(){this.connections=new Map}addConnection(e,t){this.connections.set(e,t)}getConnection(){const e=this.connections.values().next().value;if(!e)throw new Error("Connection not found");return e}getAllConnections(){return this.connections}}const nl=(r,e,t)=>{const{stripePR:n}=r;n.publisher.subscribe(s=>{if(s.isSuccess){const o=s.loadedValue,a=o.isAvailable&&o.availableProviders.applePay,c=o.isAvailable&&o.availableProviders.googlePay,u={apple_pay:{isLoading:!1,isAvailable:a,startFlow:async l=>{a&&Bn("apple_pay",o,e,t,l)}},google_pay:{isLoading:!1,isAvailable:c,startFlow:async l=>{c&&Bn("google_pay",o,e,t,l)}}};t.get.onPaymentRequestLoad(u)}})},Bn=(r,e,t,n,s)=>ne.stripePR.run({context:t,checkoutPaymentMethod:_r(t.checkoutPaymentMethods,r),nonCdeFormInputs:ze(t.formDiv),formCallbacks:n,customParams:{provider:r,overridePaymentRequest:s==null?void 0:s.overridePaymentRequest},initResult:e}),qn="The secure form failed to load properly. Please check your internet connection, or try again later.",{log__:Pe,err__:Kt}=$("op-form"),_e=class _e{constructor(e){this.cdeLoadEvent=new Wt,this.anyCdeConn=new Wt,this.context=new Wt,this.initFlows=Xc(),this.startFormInit=async()=>{try{Pe("Initializing OpenPay form:"),Pe("├ Waiting for CDE load event...");const t=await this.cdeLoadEvent.waitForLoad({timeoutSec:120,timeoutErrMsg:qn});Pe("├ CDE load event received"),Pe("├ Waiting for CDE connection...");const n=await this.anyCdeConn.waitForLoad({timeoutSec:120,timeoutErrMsg:qn});Pe("├ CDE connection received"),Pe("├ Creating OJS context, setting up handlers...");const s=_e.buildOjsFlowContext(this.config,t,n,this.getFormDiv());this.context.set(s),nl(this.initFlows,s,this.formCallbacks),Pe("├ Starting OJS init flows..."),await Jc(this.initFlows,s,this.formCallbacks),this.formCallbacks.get.onLoad(t.totalAmountAtoms,t.currency),Pe("╰ Done initializing OJS flows.")}catch(t){const n=he(t);Kt("╰ Error initializing OP form:",n),this.formCallbacks.get.onLoadError(n)}},this.setFormHeight=t=>{this.formProperties.height=t,this.registeredElements&&Object.values(this.registeredElements).forEach(n=>{n&&(n.node.style.height=t)})},this.onCdeLoaded=t=>{this.cdeLoadEvent.current.isSuccess||this.cdeLoadEvent.set(t)},this.onCdeLoadError=t=>{this.cdeLoadEvent.current.isSuccess||this.cdeLoadEvent.throw(new Error(t),t)},this.createElement=(t,n={})=>{if(!this.config)throw new Error("OpenPay form not initialized");const s=Xs.parse(t),o=document.createElement("iframe"),a=this.buildQueryString(n);o.name=`${s}-element`;const c=new URL(`/app/v1/${o.name}/`,this.config.baseUrl);return c.search=a.toString(),o.src=c.href,o.style.border="none",o.style.width="100%",this.registerIframe(s,o)},this.registerIframe=(t,n)=>{const s={type:t,node:n,mount:o=>{var a;return(a=document.querySelector(o))==null?void 0:a.appendChild(n)}};return this.connectToElement({type:s.type,node:s.node}),this.registeredElements||(this.registeredElements={[Ve.CARD]:void 0,[Ve.CARD_NUMBER]:void 0,[Ve.CARD_EXPIRY]:void 0,[Ve.CARD_CVC]:void 0}),this.registeredElements[t]=s,s},this.buildQueryString=t=>{const n=new URLSearchParams;return n.append("referer",this.referrer),n.append("formId",this.formId),t.styles&&n.append("styles",Lo(t.styles)),n.append("secureToken",this.config.checkoutSecureToken),n},this.connectToElement=t=>{tl(t.node).then(n=>{this.connectionManager.addConnection(t.type,n),this.anyCdeConn.current.isSuccess||this.anyCdeConn.set(n)}).catch(n=>Kt("[FORM] Error connecting to CDE iframe",n))},this.getFormDiv=()=>document.querySelector(this.formTarget)??document.body,this.submitCard=()=>{const t=this.context.getValueIfLoadedElse(null);if(!t){Kt("Please wait for the form to finish loading before submitting.");return}ne.commonCC.run({context:t,checkoutPaymentMethod:_r(t.checkoutPaymentMethods,"credit_card"),nonCdeFormInputs:ze(t.formDiv),formCallbacks:this.formCallbacks,customParams:{currentCdeConnections:this.connectionManager.getAllConnections()},initResult:void 0})},this.generalSubmit=(t,n)=>{const s=this.context.getValueIfLoadedElse(null);if(!s){Kt("Please wait for the form to finish loading before submitting.");return}switch(t){case"pockyt-paypal":return ne.pockytPaypal.run({context:s,checkoutPaymentMethod:_r(s.checkoutPaymentMethods,"paypal","pockyt"),nonCdeFormInputs:ze(s.formDiv),formCallbacks:this.formCallbacks,customParams:{settings:n},initResult:void 0});case"airwallex-google-pay":return this.initFlows.airwallexGooglePay.publisher.subscribe(o=>{o.isSuccess&&o.loadedValue.isAvailable&&o.loadedValue.startFlow()});case"airwallex-apple-pay":return this.initFlows.airwallexApplePay.publisher.subscribe(o=>{o.isSuccess&&o.loadedValue.isAvailable&&o.loadedValue.startFlow()});default:ar(t)}},this.submit=this.submitCard,this.destroy=()=>{for(const t of Object.values(this.registeredElements??{}))t&&t.node.remove();window.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.registeredElements=null,delete window.ojs},this.updateCallbacks=t=>{this.formCallbacks.setCallbacks(t)},_e.assignAsSingleton(this),this.ojsVersion="0.2.4",this.ojsReleaseVersion="0.2.4-alpha.4cdb512",this.baseUrl=e.baseUrl??"https://cde.getopenpay.com",this.config={...e,baseUrl:this.baseUrl},this.formCallbacks=Sr.fromObject(e),this.registeredElements=null,this.formId=`opjs-form-${Vo()}`,this.referrer=window.location.origin,this.formTarget=e.formTarget??"body",this.formProperties={height:"1px"},this.connectionManager=new rl,this.eventHandler=new el(this.formId,this.baseUrl,this.formCallbacks,{setFormHeight:this.setFormHeight,onCdeLoaded:this.onCdeLoaded,onCdeLoadError:this.onCdeLoadError}),window.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.startFormInit()}get checkoutSecureToken(){return this.config.checkoutSecureToken}};_e.ojsFlows=ne,_e.assignAsSingleton=e=>{if(_e.getInstance())throw new Error("OpenPay instance already exists. Only one instance is allowed.");window.ojs=e},_e.getInstance=()=>window.ojs??null,_e.buildOjsFlowContext=(e,t,n,s)=>({checkoutSecureToken:e.checkoutSecureToken,baseUrl:new URL(e.baseUrl??je).origin,formDiv:s,elementsSessionId:t.sessionId,checkoutPaymentMethods:t.checkoutPaymentMethods,anyCdeConnection:n,customInitParams:e.customInitParams??{}});let Cr=_e;Te.FieldName=f,Te.OpenPayForm=Cr,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
|
|
25
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function qt(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var wt=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,s,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=He(a),u=c.next();!u.done;u=c.next()){var l=u.value;l.remove(this)}}catch(E){e={error:E}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var d=this.initialTeardown;if(Z(d))try{d()}catch(E){o=E instanceof vr?E.errors:[E]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var w=He(m),h=w.next();!h.done;h=w.next()){var g=h.value;try{On(g)}catch(E){o=o??[],E instanceof vr?o=zt(zt([],Vt(o)),Vt(E.errors)):o.push(E)}}}catch(E){n={error:E}}finally{try{h&&!h.done&&(s=w.return)&&s.call(w)}finally{if(n)throw n.error}}}if(o)throw new vr(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)On(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&qt(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&qt(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),Tn=wt.EMPTY;function In(r){return r instanceof wt||r&&"closed"in r&&Z(r.remove)&&Z(r.add)&&Z(r.unsubscribe)}function On(r){Z(r)?r():r.unsubscribe()}var Rn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Nn={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setTimeout.apply(void 0,zt([r,e],Vt(t)))},clearTimeout:function(r){var e=Nn.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function Mn(r){Nn.setTimeout(function(){throw r})}function jn(){}function Gt(r){r()}var wr=function(r){xe(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,In(t)&&t.add(n)):n.destination=lc,n}return e.create=function(t,n,s){return new kr(t,n,s)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(wt),ic=Function.prototype.bind;function br(r,e){return ic.call(r,e)}var ac=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Yt(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Yt(n)}else Yt(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Yt(t)}},r}(),kr=function(r){xe(e,r);function e(t,n,s){var o=r.call(this)||this,a;if(Z(t)||!t)a={next:t??void 0,error:n??void 0,complete:s??void 0};else{var c;o&&Rn.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&br(t.next,c),error:t.error&&br(t.error,c),complete:t.complete&&br(t.complete,c)}):a=t}return o.destination=new ac(a),o}return e}(wr);function Yt(r){Mn(r)}function cc(r){throw r}var lc={closed:!0,next:jn,error:cc,complete:jn},Er=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function uc(r){return r}function dc(r){return r.length===0?uc:r.length===1?r[0]:function(t){return r.reduce(function(n,s){return s(n)},t)}}var ye=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var s=this,o=fc(e)?e:new kr(e,t,n);return Gt(function(){var a=s,c=a.operator,u=a.source;o.add(c?c.call(o,u):u?s._subscribe(o):s._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Dn(t),new t(function(s,o){var a=new kr({next:function(c){try{e(c)}catch(u){o(u),a.unsubscribe()}},error:o,complete:s});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[Er]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return dc(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Dn(e),new e(function(n,s){var o;t.subscribe(function(a){return o=a},function(a){return s(a)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function Dn(r){var e;return(e=r??Rn.Promise)!==null&&e!==void 0?e:Promise}function pc(r){return r&&Z(r.next)&&Z(r.error)&&Z(r.complete)}function fc(r){return r&&r instanceof wr||pc(r)&&In(r)}function hc(r){return Z(r==null?void 0:r.lift)}function mc(r){return function(e){if(hc(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function yc(r,e,t,n,s){return new _c(r,e,t,n,s)}var _c=function(r){xe(e,r);function e(t,n,s,o,a,c){var u=r.call(this,t)||this;return u.onFinalize=a,u.shouldUnsubscribe=c,u._next=n?function(l){try{n(l)}catch(d){t.error(d)}}:r.prototype._next,u._error=o?function(l){try{o(l)}catch(d){t.error(d)}finally{this.unsubscribe()}}:r.prototype._error,u._complete=s?function(){try{s()}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._complete,u}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(wr),gc=Bt(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ln=function(r){xe(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Fn(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new gc},e.prototype.next=function(t){var n=this;Gt(function(){var s,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=He(n.currentObservers),c=a.next();!c.done;c=a.next()){var u=c.value;u.next(t)}}catch(l){s={error:l}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(s)throw s.error}}}})},e.prototype.error=function(t){var n=this;Gt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var s=n.observers;s.length;)s.shift().error(t)}})},e.prototype.complete=function(){var t=this;Gt(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,s=this,o=s.hasError,a=s.isStopped,c=s.observers;return o||a?Tn:(this.currentObservers=null,c.push(t),new wt(function(){n.currentObservers=null,qt(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,s=n.hasError,o=n.thrownError,a=n.isStopped;s?t.error(o):a&&t.complete()},e.prototype.asObservable=function(){var t=new ye;return t.source=this,t},e.create=function(t,n){return new Fn(t,n)},e}(ye),Fn=function(r){xe(e,r);function e(t,n){var s=r.call(this)||this;return s.destination=t,s.source=n,s}return e.prototype.next=function(t){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,t)},e.prototype.error=function(t){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&s!==void 0?s:Tn},e}(Ln),vc={now:function(){return Date.now()},delegate:void 0},wc=function(r){xe(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return this},e}(wt),$n={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return setInterval.apply(void 0,zt([r,e],Vt(t)))},clearInterval:function(r){return clearInterval(r)},delegate:void 0},bc=function(r){xe(e,r);function e(t,n){var s=r.call(this,t,n)||this;return s.scheduler=t,s.work=n,s.pending=!1,s}return e.prototype.schedule=function(t,n){var s;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var o=this.id,a=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(a,o,n)),this.pending=!0,this.delay=n,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(a,this.id,n),this},e.prototype.requestAsyncId=function(t,n,s){return s===void 0&&(s=0),$n.setInterval(t.flush.bind(t,this),s)},e.prototype.recycleAsyncId=function(t,n,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return n;n!=null&&$n.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(t,n);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var s=!1,o;try{this.work(t)}catch(a){s=!0,o=a||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,s=t.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,qt(o,this),n!=null&&(this.id=this.recycleAsyncId(s,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(wc),Un=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=vc.now,r}(),kc=function(r){xe(e,r);function e(t,n){n===void 0&&(n=Un.now);var s=r.call(this,t,n)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var s;this._active=!0;do if(s=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,s){for(;t=n.shift();)t.unsubscribe();throw s}},e}(Un),Ec=new kc(bc),Sc=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function Cc(r){return Z(r==null?void 0:r.then)}function xc(r){return Z(r[Er])}function Pc(r){return Symbol.asyncIterator&&Z(r==null?void 0:r[Symbol.asyncIterator])}function Ac(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Tc(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ic=Tc();function Oc(r){return Z(r==null?void 0:r[Ic])}function Rc(r){return sc(this,arguments,function(){var t,n,s,o;return An(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Ke(t.read())];case 3:return n=a.sent(),s=n.value,o=n.done,o?[4,Ke(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Ke(s)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Nc(r){return Z(r==null?void 0:r.getReader)}function Mc(r){if(r instanceof ye)return r;if(r!=null){if(xc(r))return jc(r);if(Sc(r))return Dc(r);if(Cc(r))return Lc(r);if(Pc(r))return Zn(r);if(Oc(r))return Fc(r);if(Nc(r))return $c(r)}throw Ac(r)}function jc(r){return new ye(function(e){var t=r[Er]();if(Z(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Dc(r){return new ye(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Lc(r){return new ye(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Mn)})}function Fc(r){return new ye(function(e){var t,n;try{for(var s=He(r),o=s.next();!o.done;o=s.next()){var a=o.value;if(e.next(a),e.closed)return}}catch(c){t={error:c}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}e.complete()})}function Zn(r){return new ye(function(e){Uc(r,e).catch(function(t){return e.error(t)})})}function $c(r){return Zn(Rc(r))}function Uc(r,e){var t,n,s,o;return nc(this,void 0,void 0,function(){var a,c;return An(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),t=oc(r),u.label=1;case 1:return[4,t.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=u.sent(),s={error:c},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Zc(r,e,t,n,s){n===void 0&&(n=0),s===void 0&&(s=!1);var o=e.schedule(function(){t(),s?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!s)return o}function Vc(r,e){var t=Z(r)?r:function(){return r},n=function(s){return s.error(t())};return new ye(n)}var zc=Bt(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function Bc(r,e){return new Promise(function(t,n){var s=!1,o;r.subscribe({next:function(a){o=a,s=!0},error:n,complete:function(){s?t(o):n(new zc)}})})}function qc(r){return r instanceof Date&&!isNaN(r)}var Gc=Bt(function(r){return function(t){t===void 0&&(t=null),r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function Yc(r,e){var t=qc(r)?{first:r}:typeof r=="number"?{each:r}:r,n=t.first,s=t.each,o=t.with,a=o===void 0?Wc:o,c=t.scheduler,u=c===void 0?Ec:c,l=t.meta,d=l===void 0?null:l;if(n==null&&s==null)throw new TypeError("No timeout provided.");return mc(function(m,w){var h,g,E=null,P=0,T=function(A){g=Zc(w,u,function(){try{h.unsubscribe(),Mc(a({meta:d,lastValue:E,seen:P})).subscribe(w)}catch(I){w.error(I)}},A)};h=m.subscribe(yc(w,function(A){g==null||g.unsubscribe(),P++,w.next(E=A),s>0&&T(s)},void 0,void 0,function(){g!=null&&g.closed||g==null||g.unsubscribe(),E=null})),!P&&T(n!=null?typeof n=="number"?n:+n-u.now():s)})}function Wc(r){throw new Gc(r)}class Wt{constructor(){this.set=e=>{if(this._current.status==="success")throw new Error("LoadedOnce is already in success state");this._current={status:"success",isSuccess:!0,loadedValue:e},this._subject.next(e),this._subject.complete()},this.throw=(e,t)=>{if(this._current.status==="success")throw new Error("LoadedOnce is already in success state");this._current={status:"error",isSuccess:!1,error:e,errMsg:t},this._subject.error(e)},this.getValueIfLoadedElse=e=>this._current.status==="success"?this._current.loadedValue:e,this.subscribe=e=>{if(this._current.status==="success"){e(this._current);return}this._current.status==="error"&&e(this._current);const t=this._subject.subscribe({next:()=>{if(this._current.status!=="success")throw new Error("Invalid state (next): please make sure to update _current before the subject");e(this._current),t.unsubscribe()},error:()=>{if(this._current.status!=="error")throw new Error("Invalid state (error): please make sure to update _current before the subject");e(this._current)}})},this.waitForLoad=e=>{if(this._current.status==="success")return Promise.resolve(this._current.loadedValue);if(this._current.status==="error")return Promise.reject(this._current.error);this._current.status!=="initial"&&ar(this._current);const t={first:e.timeoutSec*1e3,with:()=>Vc(()=>new Error(e.timeoutErrMsg))};return Bc(this._subject.pipe(Yc(t)))},this._current={status:"initial",isSuccess:!1},this._subject=new Ln}get current(){return this._current}}const{log__:Hc,err__:Kc}=$("init-flows"),Ht=(r,e)=>{const t=new Wt;return{publisher:t,initialize:async n=>{try{if(t.current.isSuccess)throw new Error("This flow has already been initialized.");const s=await e(n);Hc(`✔ ${r} flow initialized successfully. Result:`,s),t.set(s)}catch(s){Kc(`𝙭 ${r} flow initialization failed. Error:`,he(s),"Details:",s),t.throw(s,he(s))}}}},Jc=async(r,e,t)=>{await Promise.all(Object.values(r).map(n=>n.initialize({context:e,formCallbacks:t})))},Xc=()=>({stripePR:Ht("Stripe PR",ne.stripePR.init),stripeLink:Ht("Stripe Link",ne.stripeLink.init),airwallexGooglePay:Ht("Airwallex GPay",ne.airwallexGooglePay.init),airwallexApplePay:Ht("Airwallex ApplePay",ne.airwallexApplePay.init)}),{err__:Qc}=$("form-callbacks"),se=i.function().optional(),Vn=i.object({onFocus:se,onBlur:se,onChange:se,onLoad:se,onLoadError:se,onValidationError:se,onCheckoutStarted:se,onCheckoutSuccess:se,onSetupPaymentMethodSuccess:se,onCheckoutError:se,onPaymentRequestLoad:se}),ue=class ue{constructor(){this.setCallbacks=e=>{this._callbacks=ue.createEmptyCallbacks(),Object.entries(e).forEach(([t,n])=>{const s=Js(t,n??ue.NOOP,Qc);this._callbacks[t]=s})},this._callbacks=ue.createEmptyCallbacks()}get get(){return{...this._callbacks}}};ue.NOOP=()=>{},ue.createEmptyCallbacks=()=>{const e={};return Object.keys(Vn.keyof().enum).forEach(t=>{e[t]=ue.NOOP}),e},ue.fromObject=e=>{const t=new ue;return t.setCallbacks(Vn.parse(e)),t};let Sr=ue;class el{constructor(e,t,n,s){this.handleMessage=o=>{if(!o.source)throw new Error("No source found");if(zn(o.origin)!==zn(this.baseUrl)||typeof o.data=="object"&&o.data.penpal)return;const a=zo(JSON.parse(o.data));if(!this.validateEvent(a))return;const{elementId:u,payload:l}=a,d=l.type;switch(d){case"LAYOUT":this.internalCallbacks.setFormHeight(l.height?`${l.height}px`:"100%");break;case"FOCUS":this.formCallbacks.get.onFocus(u,l.elementType);break;case"BLUR":this.formCallbacks.get.onBlur(u,l.elementType);break;case"CHANGE":this.formCallbacks.get.onChange(u,l.elementType,l.errors);break;case"LOADED":this.eventTargets[u]=o.source,this.internalCallbacks.onCdeLoaded(l);break;case"LOAD_ERROR":this.internalCallbacks.onCdeLoadError(l.message);break;case"VALIDATION_ERROR":this.formCallbacks.get.onValidationError(l.elementType,l.errors,u);break;default:console.warn("[form] Unhandled event type:",d)}},this.validateEvent=o=>o.formId!==this.formId||!o.elementId?(console.log("[OJS] formId",this.formId,o.formId),console.warn("[form] Ignoring unknown event:",o),!1):this.nonces.has(o.nonce)?(console.warn("[form] Ignoring duplicate event:",o),!1):(this.nonces.add(o.nonce),!0),this.eventTargets={},this.nonces=new Set,this.formId=e,this.baseUrl=t,this.formCallbacks=n,this.internalCallbacks=s}}const zn=r=>new URL(r).origin;async function tl(r,e){const n=await Kr({iframe:r,debug:!1,childOrigin:e}).promise,s=await di(n);if(!pi(n,s))throw new Error("Got invalid CDE connection object");return n}class rl{constructor(){this.connections=new Map}addConnection(e,t){this.connections.set(e,t)}getConnection(){const e=this.connections.values().next().value;if(!e)throw new Error("Connection not found");return e}getAllConnections(){return this.connections}}const nl=(r,e,t)=>{const{stripePR:n}=r;n.publisher.subscribe(s=>{if(s.isSuccess){const o=s.loadedValue,a=o.isAvailable&&o.availableProviders.applePay,c=o.isAvailable&&o.availableProviders.googlePay,u={apple_pay:{isLoading:!1,isAvailable:a,startFlow:async l=>{a&&Bn("apple_pay",o,e,t,l)}},google_pay:{isLoading:!1,isAvailable:c,startFlow:async l=>{c&&Bn("google_pay",o,e,t,l)}}};t.get.onPaymentRequestLoad(u)}})},Bn=(r,e,t,n,s)=>ne.stripePR.run({context:t,checkoutPaymentMethod:_r(t.checkoutPaymentMethods,r),nonCdeFormInputs:ze(t.formDiv),formCallbacks:n,customParams:{provider:r,overridePaymentRequest:s==null?void 0:s.overridePaymentRequest},initResult:e}),qn="The secure form failed to load properly. Please check your internet connection, or try again later.",{log__:Pe,err__:Kt}=$("op-form"),_e=class _e{constructor(e){this.cdeLoadEvent=new Wt,this.anyCdeConn=new Wt,this.context=new Wt,this.initFlows=Xc(),this.startFormInit=async()=>{try{Pe("Initializing OpenPay form:"),Pe("├ Waiting for CDE load event...");const t=await this.cdeLoadEvent.waitForLoad({timeoutSec:120,timeoutErrMsg:qn});Pe("├ CDE load event received"),Pe("├ Waiting for CDE connection...");const n=await this.anyCdeConn.waitForLoad({timeoutSec:120,timeoutErrMsg:qn});Pe("├ CDE connection received"),Pe("├ Creating OJS context, setting up handlers...");const s=_e.buildOjsFlowContext(this.config,t,n,this.getFormDiv());this.context.set(s),nl(this.initFlows,s,this.formCallbacks),Pe("├ Starting OJS init flows..."),await Jc(this.initFlows,s,this.formCallbacks),this.formCallbacks.get.onLoad(t.totalAmountAtoms,t.currency),Pe("╰ Done initializing OJS flows.")}catch(t){const n=he(t);Kt("╰ Error initializing OP form:",n),this.formCallbacks.get.onLoadError(n)}},this.setFormHeight=t=>{this.formProperties.height=t,this.registeredElements&&Object.values(this.registeredElements).forEach(n=>{n&&(n.node.style.height=t)})},this.onCdeLoaded=t=>{this.cdeLoadEvent.current.isSuccess||this.cdeLoadEvent.set(t)},this.onCdeLoadError=t=>{this.cdeLoadEvent.current.isSuccess||this.cdeLoadEvent.throw(new Error(t),t)},this.createElement=(t,n={})=>{if(!this.config)throw new Error("OpenPay form not initialized");const s=Xs.parse(t),o=document.createElement("iframe"),a=this.buildQueryString(n);o.name=`${s}-element`;const c=new URL(`/app/v1/${o.name}/`,this.config.baseUrl);return c.search=a.toString(),o.src=c.href,o.style.border="none",o.style.width="100%",this.registerIframe(s,o)},this.registerIframe=(t,n)=>{const s={type:t,node:n,mount:o=>{var a;return(a=document.querySelector(o))==null?void 0:a.appendChild(n)}};return this.connectToElement({type:s.type,node:s.node}),this.registeredElements||(this.registeredElements={[Ve.CARD]:void 0,[Ve.CARD_NUMBER]:void 0,[Ve.CARD_EXPIRY]:void 0,[Ve.CARD_CVC]:void 0}),this.registeredElements[t]=s,s},this.buildQueryString=t=>{const n=new URLSearchParams;return n.append("referer",this.referrer),n.append("formId",this.formId),t.styles&&n.append("styles",Lo(t.styles)),n.append("secureToken",this.config.checkoutSecureToken),n},this.connectToElement=t=>{tl(t.node).then(n=>{this.connectionManager.addConnection(t.type,n),this.anyCdeConn.current.isSuccess||this.anyCdeConn.set(n)}).catch(n=>Kt("[FORM] Error connecting to CDE iframe",n))},this.getFormDiv=()=>document.querySelector(this.formTarget)??document.body,this.submitCard=()=>{const t=this.context.getValueIfLoadedElse(null);if(!t){Kt("Please wait for the form to finish loading before submitting.");return}ne.commonCC.run({context:t,checkoutPaymentMethod:_r(t.checkoutPaymentMethods,"credit_card"),nonCdeFormInputs:ze(t.formDiv),formCallbacks:this.formCallbacks,customParams:{currentCdeConnections:this.connectionManager.getAllConnections()},initResult:void 0})},this.generalSubmit=(t,n)=>{const s=this.context.getValueIfLoadedElse(null);if(!s){Kt("Please wait for the form to finish loading before submitting.");return}switch(t){case"pockyt-paypal":return ne.pockytPaypal.run({context:s,checkoutPaymentMethod:_r(s.checkoutPaymentMethods,"paypal","pockyt"),nonCdeFormInputs:ze(s.formDiv),formCallbacks:this.formCallbacks,customParams:{settings:n},initResult:void 0});case"airwallex-google-pay":return this.initFlows.airwallexGooglePay.publisher.subscribe(o=>{o.isSuccess&&o.loadedValue.isAvailable&&o.loadedValue.startFlow()});case"airwallex-apple-pay":return this.initFlows.airwallexApplePay.publisher.subscribe(o=>{o.isSuccess&&o.loadedValue.isAvailable&&o.loadedValue.startFlow()});default:ar(t)}},this.submit=this.submitCard,this.destroy=()=>{for(const t of Object.values(this.registeredElements??{}))t&&t.node.remove();window.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.registeredElements=null,delete window.ojs},this.updateCallbacks=t=>{this.formCallbacks.setCallbacks(t)},_e.assignAsSingleton(this),this.ojsVersion="0.2.4",this.ojsReleaseVersion="0.2.4",this.baseUrl=e.baseUrl??"https://cde.getopenpay.com",this.config={...e,baseUrl:this.baseUrl},this.formCallbacks=Sr.fromObject(e),this.registeredElements=null,this.formId=`opjs-form-${Vo()}`,this.referrer=window.location.origin,this.formTarget=e.formTarget??"body",this.formProperties={height:"1px"},this.connectionManager=new rl,this.eventHandler=new el(this.formId,this.baseUrl,this.formCallbacks,{setFormHeight:this.setFormHeight,onCdeLoaded:this.onCdeLoaded,onCdeLoadError:this.onCdeLoadError}),window.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.startFormInit()}get checkoutSecureToken(){return this.config.checkoutSecureToken}};_e.ojsFlows=ne,_e.assignAsSingleton=e=>{if(_e.getInstance())throw new Error("OpenPay instance already exists. Only one instance is allowed.");window.ojs=e},_e.getInstance=()=>window.ojs??null,_e.buildOjsFlowContext=(e,t,n,s)=>({checkoutSecureToken:e.checkoutSecureToken,baseUrl:new URL(e.baseUrl??je).origin,formDiv:s,elementsSessionId:t.sessionId,checkoutPaymentMethods:t.checkoutPaymentMethods,anyCdeConnection:n,customInitParams:e.customInitParams??{}});let Cr=_e;Te.FieldName=f,Te.OpenPayForm=Cr,Object.defineProperty(Te,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED