@solvimon/solvimon-web 0.1.0-alpha.17 → 0.1.0-alpha.18
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/README.md +28 -26
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BrPsTuoW.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BuQ8bzar.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CuWrBcoK.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-wxP5IaGt.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-05NKI2A0.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-17v07F58.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
- package/dist/{PaymentHistoryBlock-BitwS9Re.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
- package/dist/{PaymentHistoryBlock-ZtmPXXwI.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3ZUDUdw.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-BZTzCUiu.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
- package/dist/{PaymentIntegrationForm-BK2aLPCo.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
- package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
- package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
- package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
- package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
- package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
- package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-CIQ0vsko.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +2 -2
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js → PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js} +1 -1
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DVeB_mqK.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +76 -30
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
- package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D1TcP9PR.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +2 -2
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
- package/dist/{SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs → SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs} +1 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
- package/dist/{EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs → SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs} +16 -63
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-BDqX6OaE.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +5 -5
- package/dist/adyen-BMDZQBUG.js +1 -0
- package/dist/{url-BjZ1Pg0l.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
- package/dist/component--Y7Igv5i.mjs +1022 -0
- package/dist/component-DIy1hvJM.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +4 -4
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +7 -7
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +4 -4
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
- package/dist/components/WalletBalances/WalletBalances.es.js +21 -7
- package/dist/core/action-request.types.d.ts +1 -13
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/{customer-DAgdegIW.mjs → customer-DovIxTG1.mjs} +1 -1
- package/dist/{customer-AfRcAZ5P.js → customer-brfznoHY.js} +1 -1
- package/dist/en-US-BvOHPudj.js +1 -0
- package/dist/{en-US-DSzSbgL5.mjs → en-US-CXDO3qhq.mjs} +53 -0
- package/dist/index-BMWWP8xj.js +1 -0
- package/dist/index-Do7kzLpg.mjs +265 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-BHgajZHq.js → invoices-Cf3dSYSj.js} +1 -1
- package/dist/{invoices-BXDgW8ch.mjs → invoices-Dk-z04lg.mjs} +2 -2
- package/dist/{nl-NL-Li7RW89R.mjs → nl-NL-BgL_PuBn.mjs} +55 -1
- package/dist/nl-NL-COGUFg60.js +1 -0
- package/dist/{paymentMethods-xzFD2L30.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
- package/dist/paymentMethods-DVDC_WfL.js +1 -0
- package/dist/{payments-DMvmB5vg.js → payments-DVZFO5yb.js} +1 -1
- package/dist/{payments-DV6csRej.mjs → payments-TnRjtlOw.mjs} +1 -1
- package/dist/{pricing-BEjY_5wb.js → pricing-CuYndX6t.js} +1 -1
- package/dist/{pricing-B1uImUm4.mjs → pricing-GwLCiSzs.mjs} +1 -1
- package/dist/{pricingPlanSchedule-C_cqUyTk.mjs → pricingPlanSchedule-CXG3CQ61.mjs} +3 -1
- package/dist/{registry-CyENvS6l.mjs → registry-Ck0Gb6rj.mjs} +1 -1
- package/dist/{registry-CeMxLjwU.js → registry-Cra6yoB4.js} +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +37 -36
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +32 -56
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +28 -12
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -1
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +436 -89
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -1
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +28 -37
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscription-B4dBAY9C.mjs → subscription-C41lG-rH.mjs} +1 -1
- package/dist/subscriptions-BFCKVHnP.js +1 -0
- package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
- package/dist/{useActionDispatchProvider-zB_GKeUR.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
- package/dist/{useActionDispatchProvider-bqR_FeM4.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
- package/dist/{useCustomer-bO4D6e4Z.js → useCustomer-C1XTqmrQ.js} +1 -1
- package/dist/{useCustomer-VfeQ6rG2.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
- package/dist/{useIncrementalLoading-C59FXHzp.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
- package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
- package/dist/{useInvoiceData-CxxkBTGY.js → useInvoiceData-BrxMo4Zt.js} +1 -1
- package/dist/{useInvoiceData-Dhg-hx8C.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
- package/dist/{useInvoicesList-DBz7T7sM.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
- package/dist/{useInvoicesList-BXZ9uV9i.js → useInvoicesList-DmisMQzy.js} +1 -1
- package/dist/{useLoadInitialData-BhpIg7OF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
- package/dist/{useLoadInitialData-BqiAFNFi.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
- package/dist/{usePaymentMethodOptions-PcMjtMSF.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
- package/dist/{usePaymentMethodOptions-DszFvgKX.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
- package/dist/{usePaymentMethods-Bb1Xbads.js → usePaymentMethods-CAFMvSOr.js} +1 -1
- package/dist/{usePaymentMethods-B5AbGWsn.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
- package/dist/{usePayments-is5c66Z6.js → usePayments-BieVBaz-.js} +1 -1
- package/dist/{usePayments-DgoZoBZh.mjs → usePayments-D88XSZfS.mjs} +10 -4
- package/dist/{usePortal-DWLtNqBB.mjs → usePortal-0NDlbFr9.mjs} +1 -1
- package/dist/{usePortal-C4qWsJeq.js → usePortal-B954nyEB.js} +1 -1
- package/dist/{useService-DKm3QtT4.js → useService-BiljI7XA.js} +1 -1
- package/dist/{useService-BZqFkz7p.mjs → useService-CqfJi5ST.mjs} +1 -1
- package/dist/{useSubscription-CEZJw6wZ.mjs → useSubscription-9rJpFNUF.mjs} +9 -3
- package/dist/{useSubscription-DuUNc1_l.js → useSubscription-k3limdu_.js} +1 -1
- package/dist/vendor-ui-Dfh3_g4q.js +1 -0
- package/dist/{vendor-ui-BoGKOJ36.mjs → vendor-ui-ItGf7wJV.mjs} +1912 -1800
- package/package.json +12 -5
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-1Op9GjGZ.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C66beqgf.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs +0 -77
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BbuEBiY3.js +0 -1
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-dwIv_xxf.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CMGK71zZ.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-B_yDNGK8.mjs +0 -1537
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-GN3WAr10.js +0 -1
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-BQIN3zuf.mjs +0 -156
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js +0 -1
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-OvGGejpX.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BKz2QQn9.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CyAFjCh7.js +0 -1
- package/dist/component-CUJ_G2Nw.mjs +0 -962
- package/dist/component-CiKxWtdx.js +0 -1
- package/dist/en-US-QzQnGXP1.js +0 -1
- package/dist/index-CzL1ZcGi.mjs +0 -85
- package/dist/index-DRdBmZ2-.js +0 -1
- package/dist/nl-NL-C4rr-1tr.js +0 -1
- package/dist/paymentMethods-BMcc-eTl.js +0 -1
- package/dist/subscriptions-CrNDM9qa.mjs +0 -79
- package/dist/subscriptions-DC-mxa17.js +0 -1
- package/dist/url-D8GJi5rF.js +0 -1
- package/dist/useIncrementalLoading-BgWuwoMo.js +0 -1
- package/dist/useTopUpModal-DNyWrHDv.mjs +0 -1012
- package/dist/useTopUpModal-DeF-cfCK.js +0 -1
- package/dist/vendor-ui-BuRqLx74.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),n=require("./adyen-BMDZQBUG.js"),r=require("./PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js"),a=require("./payments-DVZFO5yb.js"),o=require("./paymentMethods-DVDC_WfL.js"),i=require("./component-DIy1hvJM.js"),s="https://js.stripe.com/dahlia/stripe.js",c=`<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<style>\n* { box-sizing: border-box; margin: 0; padding: 0; }\nbody { overflow: hidden; }\n</style>\n</head>\n<body>\n<div id="stripe-root"></div>\n<script src="${s}"><\/script>\n<script>\n(function () {\n let stripe, elements, countryCode, email, name, parentOrigin;\n\n window.addEventListener('message', function (event) {\n if (!event.data || typeof event.data !== 'object') return;\n if (event.source !== window.parent) return;\n\n if (event.data.type === 'stripe:init') {\n parentOrigin = event.origin;\n countryCode = event.data.countryCode;\n email = event.data.email;\n name = event.data.name;\n stripe = Stripe(event.data.publicKey);\n elements = stripe.elements(event.data.options);\n const paymentElement = elements.create('payment', { layout: { type: 'accordion', defaultCollapsed: false }, wallets: event.data.options.wallets, fields: event.data.options.fields });\n\n paymentElement.on('ready', function () {\n parent.postMessage({ type: 'stripe:ready' }, parentOrigin);\n });\n\n paymentElement.on('change', function (e) {\n parent.postMessage({ type: 'stripe:change', paymentMethodType: e.value.type }, parentOrigin);\n });\n\n paymentElement.on('loaderror', function (e) {\n parent.postMessage({\n type: 'stripe:loaderror',\n error: { message: e.error.message, type: e.error.type }\n }, parentOrigin);\n });\n\n paymentElement.mount('#stripe-root');\n\n new ResizeObserver(function () {\n parent.postMessage({\n type: 'stripe:resize',\n height: document.documentElement.scrollHeight\n }, parentOrigin);\n }).observe(document.documentElement);\n }\n\n if (event.data.type === 'stripe:submit') {\n if (!elements || !parentOrigin || event.origin !== parentOrigin) return;\n const submitEmail = 'email' in event.data ? event.data.email : email;\n const submitName = 'name' in event.data ? event.data.name : name;\n elements.submit().then(function (submitResult) {\n if (submitResult.error) {\n parent.postMessage({\n type: 'stripe:submit:error',\n error: {\n message: submitResult.error.message,\n type: submitResult.error.type,\n code: submitResult.error.code\n }\n }, parentOrigin);\n return;\n }\n const billingDetails = {};\n if (countryCode) billingDetails.address = { country: countryCode };\n if (submitEmail) billingDetails.email = submitEmail;\n if (submitName) billingDetails.name = submitName;\n const tokenParams = Object.keys(billingDetails).length\n ? { payment_method_data: { billing_details: billingDetails } }\n : {};\n stripe.createConfirmationToken({ elements: elements, params: tokenParams }).then(function (tokenResult) {\n if (tokenResult.error) {\n parent.postMessage({\n type: 'stripe:submit:error',\n error: {\n message: tokenResult.error.message,\n type: tokenResult.error.type,\n code: tokenResult.error.code\n }\n }, parentOrigin);\n return;\n }\n parent.postMessage({\n type: 'stripe:submit:success',\n confirmationTokenId: tokenResult.confirmationToken.id\n }, parentOrigin);\n });\n });\n }\n });\n})();\n<\/script>\n</body>\n</html>`,u=["src","height"],p=e.defineComponent({__name:"PaymentIntegrationFormStripeFrame",props:{publicKey:{type:String},options:{type:Object},countryCode:{type:String},email:{type:String},name:{type:String}},emits:["ready","change","loaderror","submit-success","submit-error"],setup(n,{expose:r,emit:a}){const o=n,i=a;r({triggerSubmit:function(){var e,t;null==(t=null==(e=s.value)?void 0:e.contentWindow)||t.postMessage({type:"stripe:submit",email:o.email,name:o.name},"*")}});const s=e.ref(),p=e.ref(0),m=e.ref();function l(){var e,t;null==(t=null==(e=s.value)?void 0:e.contentWindow)||t.postMessage({type:"stripe:init",publicKey:o.publicKey,options:o.options,countryCode:o.countryCode,email:o.email,name:o.name},"*")}function d(e){return"object"==typeof e&&null!==e}function y(e){if(!s.value||e.source!==s.value.contentWindow)return;if(!d(e.data))return;const t=e.data,n=t.type;if("string"==typeof n&&n.startsWith("stripe:"))switch(n){case"stripe:ready":i("ready");break;case"stripe:change":i("change","string"==typeof t.paymentMethodType?t.paymentMethodType:"card");break;case"stripe:loaderror":{const e=d(t.error)?t.error:{};i("loaderror",{message:"string"==typeof e.message?e.message:void 0,type:"string"==typeof e.type?e.type:void 0});break}case"stripe:resize":"number"==typeof t.height&&(p.value=t.height);break;case"stripe:submit:success":"string"==typeof t.confirmationTokenId&&i("submit-success",t.confirmationTokenId);break;case"stripe:submit:error":{const e=d(t.error)?t.error:{};i("submit-error",{message:"string"==typeof e.message?e.message:void 0,type:"string"==typeof e.type?e.type:void 0,code:"string"==typeof e.code?e.code:void 0});break}}}return e.onMounted(()=>{const e=new Blob([c],{type:"text/html"});m.value=URL.createObjectURL(e),window.addEventListener("message",y)}),e.onBeforeUnmount(()=>{window.removeEventListener("message",y),m.value&&URL.revokeObjectURL(m.value)}),e.watch(()=>o.options,(e,n)=>{t.isEqual(e,n)||l()},{deep:!0}),(t,n)=>(e.openBlock(),e.createElementBlock("iframe",{ref_key:"iframeRef",ref:s,src:m.value,height:p.value||void 0,frameborder:"0",style:{width:"100%",display:"block",border:"none"},title:"Payment form",onLoad:l},null,40,u))}}),m={link:"never"},l={variables:{borderRadius:"4px",colorBackground:"rgba(243, 244, 246, 0.5)"},rules:{".TermsText":{fontSize:"14px"},".Input":{backgroundColor:"rgba(243, 244, 246, 0.5)",fontSize:"14px",borderColor:"rgb(229, 231, 235)"}}};const d="STRIPE",y=e.defineComponent({__name:"PaymentIntegrationFormStripe",props:{countryCode:{type:String},customerId:{type:String},invoiceId:{type:String},paymentMethodOptionResponseEntry:{type:Object},variant:{type:String},selected:{type:Boolean},amount:{type:Object},validateOnSubmit:{type:Function,default:()=>Promise.resolve(!0)},context:{type:Object},email:{type:String},name:{type:String},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(t,{expose:c,emit:u}){const y=t,f=u;c({submit:function(){(async function(){var e;if(!(await y.validateOnSubmit()))return;null==(e=_.value)||e.triggerSubmit()})().catch(e=>{R.error("STRIPE_SUBMIT_FAILED","Unexpected error during Stripe submission",{},e)})}});const g=e.ref(!1),v=e.ref(),_=e.ref(),b=e.computed(()=>function({amount:e,email:t,name:r,variant:a}){const o=e.currency.toLowerCase(),i=function(e,t){return{billingDetails:{address:{country:"never"},...e?{email:"never"}:{},...t?{name:"never"}:{}}}}(t,r);return"TOKENIZE"===a?{mode:"setup",currency:o,setup_future_usage:"off_session",wallets:m,fields:i,appearance:l}:{mode:"payment",currency:o,amount:n.toMinorUnitAmount(e).value,setup_future_usage:"off_session",wallets:m,fields:i,appearance:l}}({amount:y.amount,email:y.email,name:y.name,variant:y.variant})),E=e.ref(null),R=i.useLogger(),{authorizePayment:h}=a.createPaymentsService(),{tokenizePaymentMethod:O}=o.createPaymentMethodsService(),w=e.computed(()=>{var e,t;return null==(t=null==(e=y.paymentMethodOptionResponseEntry.integration.payment_gateway)?void 0:e.stripe)?void 0:t.public_key});async function S(){if(E.value)return E.value;const e=w.value;if(!e)throw new Error("Missing Stripe public key");const t=await function(e){return new Promise((t,n)=>{if(window.Stripe)return void t(window.Stripe(e));const r=document.createElement("script");r.src=s,r.onload=()=>{window.Stripe?t(window.Stripe(e)):n(new Error("Stripe not available after script load"))},r.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(r)})}(e);return E.value=t,t}async function I(e){const t=y.paymentMethodOptionResponseEntry.payment_acceptor.id,r=n.createReturnUrl({paymentAcceptorId:t,redirectUrl:window.location.href});if("AUTHORIZE"!==y.variant){if("TOKENIZE"===y.variant){if(!y.customerId)return void R.error("TOKENIZATION_FAILED",`Missing customer id for payment acceptor with id ${t}`);try{const n=await O({customer_id:y.customerId,payment_acceptor_id:t,payment_gateway_variant:d,stripe:{confirmation_token_id:e},return_url:r});await N(n)}catch(a){R.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${t}`,{error:a}),P({code:"UNKNOWN_ERROR",message:"Tokenization failed",error:a})}}}else try{const n=await h({payment_acceptor_id:t,...y.customerId?{customer_id:y.customerId}:{},payment_gateway_variant:d,stripe:{confirmation_token_id:e},amount:y.amount,...y.context&&"CHARGE_ON_DEMAND"!==y.context.type?{context:y.context}:{},return_url:r});await N(n)}catch(a){R.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${t}`,{error:a}),P({code:"UNKNOWN_ERROR",message:"Payment authorization failed",error:a})}}async function N(e){var t;if("ACTION_REQUIRED"===e.status&&e.action.payment_gateway_variant===d){const r=e.action.client_secret||(null==(t=e.action.data)?void 0:t.client_secret);if(!r)return R.error("STRIPE_ACTION_FAILED","Missing client_secret in Stripe ACTION_REQUIRED response"),void P({code:"UNKNOWN_ERROR",message:"Payment action failed",error:e});let a;try{a=await S()}catch(n){return R.error("STRIPE_ACTION_FAILED","Failed to load Stripe.js",{error:n}),void P({code:"UNKNOWN_ERROR",message:"Payment action failed",error:n})}const{error:o}=await a.handleNextAction({clientSecret:r});return o?(R.error("STRIPE_ACTION_FAILED","Stripe handleNextAction failed",{error:o}),void P({code:"UNKNOWN_ERROR",message:"Payment action failed",error:o})):(g.value=!0,void f("payment-success"))}if("SUCCESS"===e.status)return g.value=!0,void f("payment-success");R.error("STRIPE_ACTION_FAILED","Unexpected payment result status",{error:e}),P({code:"UNKNOWN_ERROR",message:"Payment failed",error:e})}function T(){f("select",{paymentMethodType:"card",paymentGatewayVariant:d}),f("ready")}function k(e){P({code:"UNKNOWN_ERROR",message:e.message??"Failed to load payment form",error:e})}function P(e){v.value=e,f("payment-failed",e)}return e.onMounted(()=>{(async function(){const e=y.paymentMethodOptionResponseEntry.payment_acceptor.id;if(n.getQueryParam(n.PAYMENT_ACCEPTOR_ID_QUERY_STRING)!==e)return;const t=n.getQueryParam("redirect_status"),r=n.getQueryParam("payment_intent_client_secret"),a=n.getQueryParam("setup_intent_client_secret");if(t&&(r||a)){if("succeeded"===t)return g.value=!0,void f("payment-success");R.error("STRIPE_REDIRECT_RETURN_FAILED","Stripe redirect returned non-succeeded status",{redirectStatus:t}),P({code:"UNKNOWN_ERROR",message:"Payment failed",error:new globalThis.Error(`Stripe redirect returned status: ${t}`)})}})().catch(e=>{R.error("STRIPE_REDIRECT_RETURN_FAILED","handleRedirectReturn threw unexpectedly",{error:e})})}),e.onBeforeUnmount(()=>{E.value=null}),(n,a)=>g.value?(e.openBlock(),e.createBlock(r._sfc_main,{key:0,variant:t.variant},null,8,["variant"])):v.value?(e.openBlock(),e.createBlock(r._sfc_main$1,{key:1,error:v.value},null,8,["error"])):w.value?(e.openBlock(),e.createBlock(p,{key:2,ref_key:"frameRef",ref:_,"public-key":w.value,options:b.value,"country-code":t.countryCode,email:t.email,name:t.name,onReady:T,onChange:a[0]||(a[0]=e=>f("select",{paymentMethodType:e,paymentGatewayVariant:d})),onLoaderror:k,onSubmitSuccess:I,onSubmitError:a[1]||(a[1]=t=>e.unref(R).error("STRIPE_CONFIRMATION_TOKEN_FAILED","Stripe submission failed",{error:t}))},null,8,["public-key","options","country-code","email","name"])):e.createCommentVNode("",!0)}});exports.default=y;
|
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onBeforeUnmount, watch, openBlock, createElementBlock, computed, createBlock, unref, createCommentVNode } from "vue";
|
|
2
|
+
import { q as isEqual } from "./vendor-ui-ItGf7wJV.mjs";
|
|
3
|
+
import { t as toMinorUnitAmount, d as createReturnUrl, g as getQueryParam, P as PAYMENT_ACCEPTOR_ID_QUERY_STRING } from "./adyen-Ba-mF3Jy.mjs";
|
|
4
|
+
import { _ as _sfc_main$2, a as _sfc_main$3 } from "./PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs";
|
|
5
|
+
import { c as createPaymentsService } from "./payments-TnRjtlOw.mjs";
|
|
6
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-BnF1XYS1.mjs";
|
|
7
|
+
import { a as useLogger } from "./component--Y7Igv5i.mjs";
|
|
8
|
+
const STRIPE_SCRIPT_URL = "https://js.stripe.com/dahlia/stripe.js";
|
|
9
|
+
const STRIPE_FRAME_SRCDOC = `<!DOCTYPE html>
|
|
10
|
+
<html>
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="UTF-8">
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
14
|
+
<style>
|
|
15
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
16
|
+
body { overflow: hidden; }
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="stripe-root"></div>
|
|
21
|
+
<script src="${STRIPE_SCRIPT_URL}"><\/script>
|
|
22
|
+
<script>
|
|
23
|
+
(function () {
|
|
24
|
+
let stripe, elements, countryCode, email, name, parentOrigin;
|
|
25
|
+
|
|
26
|
+
window.addEventListener('message', function (event) {
|
|
27
|
+
if (!event.data || typeof event.data !== 'object') return;
|
|
28
|
+
if (event.source !== window.parent) return;
|
|
29
|
+
|
|
30
|
+
if (event.data.type === 'stripe:init') {
|
|
31
|
+
parentOrigin = event.origin;
|
|
32
|
+
countryCode = event.data.countryCode;
|
|
33
|
+
email = event.data.email;
|
|
34
|
+
name = event.data.name;
|
|
35
|
+
stripe = Stripe(event.data.publicKey);
|
|
36
|
+
elements = stripe.elements(event.data.options);
|
|
37
|
+
const paymentElement = elements.create('payment', { layout: { type: 'accordion', defaultCollapsed: false }, wallets: event.data.options.wallets, fields: event.data.options.fields });
|
|
38
|
+
|
|
39
|
+
paymentElement.on('ready', function () {
|
|
40
|
+
parent.postMessage({ type: 'stripe:ready' }, parentOrigin);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
paymentElement.on('change', function (e) {
|
|
44
|
+
parent.postMessage({ type: 'stripe:change', paymentMethodType: e.value.type }, parentOrigin);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
paymentElement.on('loaderror', function (e) {
|
|
48
|
+
parent.postMessage({
|
|
49
|
+
type: 'stripe:loaderror',
|
|
50
|
+
error: { message: e.error.message, type: e.error.type }
|
|
51
|
+
}, parentOrigin);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
paymentElement.mount('#stripe-root');
|
|
55
|
+
|
|
56
|
+
new ResizeObserver(function () {
|
|
57
|
+
parent.postMessage({
|
|
58
|
+
type: 'stripe:resize',
|
|
59
|
+
height: document.documentElement.scrollHeight
|
|
60
|
+
}, parentOrigin);
|
|
61
|
+
}).observe(document.documentElement);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (event.data.type === 'stripe:submit') {
|
|
65
|
+
if (!elements || !parentOrigin || event.origin !== parentOrigin) return;
|
|
66
|
+
const submitEmail = 'email' in event.data ? event.data.email : email;
|
|
67
|
+
const submitName = 'name' in event.data ? event.data.name : name;
|
|
68
|
+
elements.submit().then(function (submitResult) {
|
|
69
|
+
if (submitResult.error) {
|
|
70
|
+
parent.postMessage({
|
|
71
|
+
type: 'stripe:submit:error',
|
|
72
|
+
error: {
|
|
73
|
+
message: submitResult.error.message,
|
|
74
|
+
type: submitResult.error.type,
|
|
75
|
+
code: submitResult.error.code
|
|
76
|
+
}
|
|
77
|
+
}, parentOrigin);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const billingDetails = {};
|
|
81
|
+
if (countryCode) billingDetails.address = { country: countryCode };
|
|
82
|
+
if (submitEmail) billingDetails.email = submitEmail;
|
|
83
|
+
if (submitName) billingDetails.name = submitName;
|
|
84
|
+
const tokenParams = Object.keys(billingDetails).length
|
|
85
|
+
? { payment_method_data: { billing_details: billingDetails } }
|
|
86
|
+
: {};
|
|
87
|
+
stripe.createConfirmationToken({ elements: elements, params: tokenParams }).then(function (tokenResult) {
|
|
88
|
+
if (tokenResult.error) {
|
|
89
|
+
parent.postMessage({
|
|
90
|
+
type: 'stripe:submit:error',
|
|
91
|
+
error: {
|
|
92
|
+
message: tokenResult.error.message,
|
|
93
|
+
type: tokenResult.error.type,
|
|
94
|
+
code: tokenResult.error.code
|
|
95
|
+
}
|
|
96
|
+
}, parentOrigin);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
parent.postMessage({
|
|
100
|
+
type: 'stripe:submit:success',
|
|
101
|
+
confirmationTokenId: tokenResult.confirmationToken.id
|
|
102
|
+
}, parentOrigin);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
})();
|
|
108
|
+
<\/script>
|
|
109
|
+
</body>
|
|
110
|
+
</html>`;
|
|
111
|
+
const _hoisted_1 = ["src", "height"];
|
|
112
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
113
|
+
__name: "PaymentIntegrationFormStripeFrame",
|
|
114
|
+
props: {
|
|
115
|
+
publicKey: { type: String },
|
|
116
|
+
options: { type: Object },
|
|
117
|
+
countryCode: { type: String },
|
|
118
|
+
email: { type: String },
|
|
119
|
+
name: { type: String }
|
|
120
|
+
},
|
|
121
|
+
emits: ["ready", "change", "loaderror", "submit-success", "submit-error"],
|
|
122
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
123
|
+
const props = __props;
|
|
124
|
+
const emit = __emit;
|
|
125
|
+
__expose({ triggerSubmit });
|
|
126
|
+
const iframeRef = ref();
|
|
127
|
+
const iframeHeight = ref(0);
|
|
128
|
+
const iframeSrc = ref();
|
|
129
|
+
function sendInit() {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
(_b = (_a = iframeRef.value) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(
|
|
132
|
+
{
|
|
133
|
+
type: "stripe:init",
|
|
134
|
+
publicKey: props.publicKey,
|
|
135
|
+
options: props.options,
|
|
136
|
+
countryCode: props.countryCode,
|
|
137
|
+
email: props.email,
|
|
138
|
+
name: props.name
|
|
139
|
+
},
|
|
140
|
+
"*"
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function triggerSubmit() {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
(_b = (_a = iframeRef.value) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(
|
|
146
|
+
{ type: "stripe:submit", email: props.email, name: props.name },
|
|
147
|
+
"*"
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function isRecord(value) {
|
|
151
|
+
return typeof value === "object" && value !== null;
|
|
152
|
+
}
|
|
153
|
+
function handleMessage(event) {
|
|
154
|
+
if (!iframeRef.value || event.source !== iframeRef.value.contentWindow) return;
|
|
155
|
+
if (!isRecord(event.data)) return;
|
|
156
|
+
const data = event.data;
|
|
157
|
+
const type = data["type"];
|
|
158
|
+
if (typeof type !== "string" || !type.startsWith("stripe:")) return;
|
|
159
|
+
switch (type) {
|
|
160
|
+
case "stripe:ready":
|
|
161
|
+
emit("ready");
|
|
162
|
+
break;
|
|
163
|
+
case "stripe:change":
|
|
164
|
+
emit(
|
|
165
|
+
"change",
|
|
166
|
+
typeof data["paymentMethodType"] === "string" ? data["paymentMethodType"] : "card"
|
|
167
|
+
);
|
|
168
|
+
break;
|
|
169
|
+
case "stripe:loaderror": {
|
|
170
|
+
const raw = isRecord(data["error"]) ? data["error"] : {};
|
|
171
|
+
emit("loaderror", {
|
|
172
|
+
message: typeof raw["message"] === "string" ? raw["message"] : void 0,
|
|
173
|
+
type: typeof raw["type"] === "string" ? raw["type"] : void 0
|
|
174
|
+
});
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case "stripe:resize":
|
|
178
|
+
if (typeof data["height"] === "number") {
|
|
179
|
+
iframeHeight.value = data["height"];
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case "stripe:submit:success":
|
|
183
|
+
if (typeof data["confirmationTokenId"] === "string") {
|
|
184
|
+
emit("submit-success", data["confirmationTokenId"]);
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case "stripe:submit:error": {
|
|
188
|
+
const raw = isRecord(data["error"]) ? data["error"] : {};
|
|
189
|
+
emit("submit-error", {
|
|
190
|
+
message: typeof raw["message"] === "string" ? raw["message"] : void 0,
|
|
191
|
+
type: typeof raw["type"] === "string" ? raw["type"] : void 0,
|
|
192
|
+
code: typeof raw["code"] === "string" ? raw["code"] : void 0
|
|
193
|
+
});
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
onMounted(() => {
|
|
199
|
+
const blob = new Blob([STRIPE_FRAME_SRCDOC], { type: "text/html" });
|
|
200
|
+
iframeSrc.value = URL.createObjectURL(blob);
|
|
201
|
+
window.addEventListener("message", handleMessage);
|
|
202
|
+
});
|
|
203
|
+
onBeforeUnmount(() => {
|
|
204
|
+
window.removeEventListener("message", handleMessage);
|
|
205
|
+
if (iframeSrc.value) URL.revokeObjectURL(iframeSrc.value);
|
|
206
|
+
});
|
|
207
|
+
watch(
|
|
208
|
+
() => props.options,
|
|
209
|
+
(newOptions, oldOptions) => {
|
|
210
|
+
if (isEqual(newOptions, oldOptions)) return;
|
|
211
|
+
sendInit();
|
|
212
|
+
},
|
|
213
|
+
{ deep: true }
|
|
214
|
+
);
|
|
215
|
+
return (_ctx, _cache) => {
|
|
216
|
+
return openBlock(), createElementBlock("iframe", {
|
|
217
|
+
ref_key: "iframeRef",
|
|
218
|
+
ref: iframeRef,
|
|
219
|
+
src: iframeSrc.value,
|
|
220
|
+
height: iframeHeight.value || void 0,
|
|
221
|
+
frameborder: "0",
|
|
222
|
+
style: { "width": "100%", "display": "block", "border": "none" },
|
|
223
|
+
title: "Payment form",
|
|
224
|
+
onLoad: sendInit
|
|
225
|
+
}, null, 40, _hoisted_1);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const STRIPE_WALLETS = { link: "never" };
|
|
230
|
+
const STRIPE_APPEARANCE = {
|
|
231
|
+
variables: { borderRadius: "4px", colorBackground: "rgba(243, 244, 246, 0.5)" },
|
|
232
|
+
rules: {
|
|
233
|
+
".TermsText": { fontSize: "14px" },
|
|
234
|
+
".Input": {
|
|
235
|
+
backgroundColor: "rgba(243, 244, 246, 0.5)",
|
|
236
|
+
fontSize: "14px",
|
|
237
|
+
borderColor: "rgb(229, 231, 235)"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
function getFields(email, name) {
|
|
242
|
+
return {
|
|
243
|
+
billingDetails: {
|
|
244
|
+
address: { country: "never" },
|
|
245
|
+
...email ? { email: "never" } : {},
|
|
246
|
+
...name ? { name: "never" } : {}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function getFrameOptions({
|
|
251
|
+
amount,
|
|
252
|
+
email,
|
|
253
|
+
name,
|
|
254
|
+
variant
|
|
255
|
+
}) {
|
|
256
|
+
const currency = amount.currency.toLowerCase();
|
|
257
|
+
const fields = getFields(email, name);
|
|
258
|
+
if (variant === "TOKENIZE") {
|
|
259
|
+
return {
|
|
260
|
+
mode: "setup",
|
|
261
|
+
currency,
|
|
262
|
+
setup_future_usage: "off_session",
|
|
263
|
+
wallets: STRIPE_WALLETS,
|
|
264
|
+
fields,
|
|
265
|
+
appearance: STRIPE_APPEARANCE
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
mode: "payment",
|
|
270
|
+
currency,
|
|
271
|
+
amount: toMinorUnitAmount(amount).value,
|
|
272
|
+
setup_future_usage: "off_session",
|
|
273
|
+
wallets: STRIPE_WALLETS,
|
|
274
|
+
fields,
|
|
275
|
+
appearance: STRIPE_APPEARANCE
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const PAYMENT_GATEWAY_VARIANT_STRIPE = "STRIPE";
|
|
279
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
280
|
+
__name: "PaymentIntegrationFormStripe",
|
|
281
|
+
props: {
|
|
282
|
+
countryCode: { type: String },
|
|
283
|
+
customerId: { type: String },
|
|
284
|
+
invoiceId: { type: String },
|
|
285
|
+
paymentMethodOptionResponseEntry: { type: Object },
|
|
286
|
+
variant: { type: String },
|
|
287
|
+
selected: { type: Boolean },
|
|
288
|
+
amount: { type: Object },
|
|
289
|
+
validateOnSubmit: { type: Function, default: () => Promise.resolve(true) },
|
|
290
|
+
context: { type: Object },
|
|
291
|
+
email: { type: String },
|
|
292
|
+
name: { type: String },
|
|
293
|
+
forceStorePaymentMethod: { type: Boolean }
|
|
294
|
+
},
|
|
295
|
+
emits: ["select", "payment-failed", "payment-success", "ready"],
|
|
296
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
297
|
+
const props = __props;
|
|
298
|
+
const emit = __emit;
|
|
299
|
+
__expose({ submit });
|
|
300
|
+
const showPaymentSuccess = ref(false);
|
|
301
|
+
const integrationError = ref();
|
|
302
|
+
const frameRef = ref();
|
|
303
|
+
const frameOptions = computed(
|
|
304
|
+
() => getFrameOptions({
|
|
305
|
+
amount: props.amount,
|
|
306
|
+
email: props.email,
|
|
307
|
+
name: props.name,
|
|
308
|
+
variant: props.variant
|
|
309
|
+
})
|
|
310
|
+
);
|
|
311
|
+
const stripeInstance = ref(null);
|
|
312
|
+
const logger = useLogger();
|
|
313
|
+
const { authorizePayment } = createPaymentsService();
|
|
314
|
+
const { tokenizePaymentMethod } = createPaymentMethodsService();
|
|
315
|
+
const publicKey = computed(
|
|
316
|
+
() => {
|
|
317
|
+
var _a, _b;
|
|
318
|
+
return (_b = (_a = props.paymentMethodOptionResponseEntry.integration.payment_gateway) == null ? void 0 : _a.stripe) == null ? void 0 : _b.public_key;
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
function submit() {
|
|
322
|
+
handleSubmit().catch((error) => {
|
|
323
|
+
logger.error(
|
|
324
|
+
"STRIPE_SUBMIT_FAILED",
|
|
325
|
+
"Unexpected error during Stripe submission",
|
|
326
|
+
{},
|
|
327
|
+
error
|
|
328
|
+
);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
async function handleSubmit() {
|
|
332
|
+
var _a;
|
|
333
|
+
const isValid = await props.validateOnSubmit();
|
|
334
|
+
if (!isValid) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
(_a = frameRef.value) == null ? void 0 : _a.triggerSubmit();
|
|
338
|
+
}
|
|
339
|
+
function loadStripeDahlia(key) {
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
if (window.Stripe) {
|
|
342
|
+
resolve(window.Stripe(key));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const script = document.createElement("script");
|
|
346
|
+
script.src = STRIPE_SCRIPT_URL;
|
|
347
|
+
script.onload = () => {
|
|
348
|
+
if (!window.Stripe) {
|
|
349
|
+
reject(new Error("Stripe not available after script load"));
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
resolve(window.Stripe(key));
|
|
353
|
+
};
|
|
354
|
+
script.onerror = () => reject(new Error("Failed to load Stripe.js"));
|
|
355
|
+
document.head.appendChild(script);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
async function getStripeInstance() {
|
|
359
|
+
if (stripeInstance.value) {
|
|
360
|
+
return stripeInstance.value;
|
|
361
|
+
}
|
|
362
|
+
const key = publicKey.value;
|
|
363
|
+
if (!key) {
|
|
364
|
+
throw new Error("Missing Stripe public key");
|
|
365
|
+
}
|
|
366
|
+
const stripe = await loadStripeDahlia(key);
|
|
367
|
+
stripeInstance.value = stripe;
|
|
368
|
+
return stripe;
|
|
369
|
+
}
|
|
370
|
+
async function handleConfirmationToken(confirmationTokenId) {
|
|
371
|
+
const paymentAcceptorId = props.paymentMethodOptionResponseEntry.payment_acceptor.id;
|
|
372
|
+
const returnUrl = createReturnUrl({
|
|
373
|
+
paymentAcceptorId,
|
|
374
|
+
redirectUrl: window.location.href
|
|
375
|
+
});
|
|
376
|
+
if (props.variant === "AUTHORIZE") {
|
|
377
|
+
try {
|
|
378
|
+
const result = await authorizePayment({
|
|
379
|
+
payment_acceptor_id: paymentAcceptorId,
|
|
380
|
+
...props.customerId ? { customer_id: props.customerId } : {},
|
|
381
|
+
payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_STRIPE,
|
|
382
|
+
stripe: { confirmation_token_id: confirmationTokenId },
|
|
383
|
+
amount: props.amount,
|
|
384
|
+
...props.context && props.context.type !== "CHARGE_ON_DEMAND" ? { context: props.context } : {},
|
|
385
|
+
return_url: returnUrl
|
|
386
|
+
});
|
|
387
|
+
await handlePaymentResult(result);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
logger.error(
|
|
390
|
+
"PAYMENT_AUTHORIZATION_FAILED",
|
|
391
|
+
`Failed payment authorization for payment acceptor with id ${paymentAcceptorId}`,
|
|
392
|
+
{ error }
|
|
393
|
+
);
|
|
394
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment authorization failed", error });
|
|
395
|
+
}
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (props.variant === "TOKENIZE") {
|
|
399
|
+
if (!props.customerId) {
|
|
400
|
+
logger.error(
|
|
401
|
+
"TOKENIZATION_FAILED",
|
|
402
|
+
`Missing customer id for payment acceptor with id ${paymentAcceptorId}`
|
|
403
|
+
);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
const result = await tokenizePaymentMethod({
|
|
408
|
+
customer_id: props.customerId,
|
|
409
|
+
payment_acceptor_id: paymentAcceptorId,
|
|
410
|
+
payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_STRIPE,
|
|
411
|
+
stripe: { confirmation_token_id: confirmationTokenId },
|
|
412
|
+
return_url: returnUrl
|
|
413
|
+
});
|
|
414
|
+
await handlePaymentResult(result);
|
|
415
|
+
} catch (error) {
|
|
416
|
+
logger.error(
|
|
417
|
+
"TOKENIZATION_FAILED",
|
|
418
|
+
`Tokenization failed for payment acceptor with id ${paymentAcceptorId}`,
|
|
419
|
+
{ error }
|
|
420
|
+
);
|
|
421
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Tokenization failed", error });
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
async function handlePaymentResult(result) {
|
|
426
|
+
var _a;
|
|
427
|
+
if (result.status === "ACTION_REQUIRED" && result.action.payment_gateway_variant === PAYMENT_GATEWAY_VARIANT_STRIPE) {
|
|
428
|
+
const clientSecret = result.action.client_secret || ((_a = result.action.data) == null ? void 0 : _a.client_secret);
|
|
429
|
+
if (!clientSecret) {
|
|
430
|
+
logger.error(
|
|
431
|
+
"STRIPE_ACTION_FAILED",
|
|
432
|
+
"Missing client_secret in Stripe ACTION_REQUIRED response"
|
|
433
|
+
);
|
|
434
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error: result });
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
let stripe;
|
|
438
|
+
try {
|
|
439
|
+
stripe = await getStripeInstance();
|
|
440
|
+
} catch (error2) {
|
|
441
|
+
logger.error("STRIPE_ACTION_FAILED", "Failed to load Stripe.js", { error: error2 });
|
|
442
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error: error2 });
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const { error } = await stripe.handleNextAction({ clientSecret });
|
|
446
|
+
if (error) {
|
|
447
|
+
logger.error("STRIPE_ACTION_FAILED", "Stripe handleNextAction failed", { error });
|
|
448
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error });
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
showPaymentSuccess.value = true;
|
|
452
|
+
emit("payment-success");
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (result.status === "SUCCESS") {
|
|
456
|
+
showPaymentSuccess.value = true;
|
|
457
|
+
emit("payment-success");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
logger.error("STRIPE_ACTION_FAILED", "Unexpected payment result status", { error: result });
|
|
461
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment failed", error: result });
|
|
462
|
+
}
|
|
463
|
+
async function handleRedirectReturn() {
|
|
464
|
+
const paymentAcceptorId = props.paymentMethodOptionResponseEntry.payment_acceptor.id;
|
|
465
|
+
const urlPaymentAcceptorId = getQueryParam(PAYMENT_ACCEPTOR_ID_QUERY_STRING);
|
|
466
|
+
if (urlPaymentAcceptorId !== paymentAcceptorId) return;
|
|
467
|
+
const redirectStatus = getQueryParam("redirect_status");
|
|
468
|
+
const paymentIntentClientSecret = getQueryParam("payment_intent_client_secret");
|
|
469
|
+
const setupIntentClientSecret = getQueryParam("setup_intent_client_secret");
|
|
470
|
+
if (!redirectStatus || !paymentIntentClientSecret && !setupIntentClientSecret) return;
|
|
471
|
+
if (redirectStatus === "succeeded") {
|
|
472
|
+
showPaymentSuccess.value = true;
|
|
473
|
+
emit("payment-success");
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
logger.error("STRIPE_REDIRECT_RETURN_FAILED", "Stripe redirect returned non-succeeded status", {
|
|
477
|
+
redirectStatus
|
|
478
|
+
});
|
|
479
|
+
emitError({
|
|
480
|
+
code: "UNKNOWN_ERROR",
|
|
481
|
+
message: "Payment failed",
|
|
482
|
+
error: new globalThis.Error(`Stripe redirect returned status: ${redirectStatus}`)
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
function handleReady() {
|
|
486
|
+
emit("select", {
|
|
487
|
+
paymentMethodType: "card",
|
|
488
|
+
paymentGatewayVariant: PAYMENT_GATEWAY_VARIANT_STRIPE
|
|
489
|
+
});
|
|
490
|
+
emit("ready");
|
|
491
|
+
}
|
|
492
|
+
function handleLoadError(error) {
|
|
493
|
+
emitError({
|
|
494
|
+
code: "UNKNOWN_ERROR",
|
|
495
|
+
message: error.message ?? "Failed to load payment form",
|
|
496
|
+
error
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function emitError(err) {
|
|
500
|
+
integrationError.value = err;
|
|
501
|
+
emit("payment-failed", err);
|
|
502
|
+
}
|
|
503
|
+
onMounted(() => {
|
|
504
|
+
handleRedirectReturn().catch((error) => {
|
|
505
|
+
logger.error("STRIPE_REDIRECT_RETURN_FAILED", "handleRedirectReturn threw unexpectedly", {
|
|
506
|
+
error
|
|
507
|
+
});
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
onBeforeUnmount(() => {
|
|
511
|
+
stripeInstance.value = null;
|
|
512
|
+
});
|
|
513
|
+
return (_ctx, _cache) => {
|
|
514
|
+
return showPaymentSuccess.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
515
|
+
key: 0,
|
|
516
|
+
variant: __props.variant
|
|
517
|
+
}, null, 8, ["variant"])) : integrationError.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
518
|
+
key: 1,
|
|
519
|
+
error: integrationError.value
|
|
520
|
+
}, null, 8, ["error"])) : publicKey.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
521
|
+
key: 2,
|
|
522
|
+
ref_key: "frameRef",
|
|
523
|
+
ref: frameRef,
|
|
524
|
+
"public-key": publicKey.value,
|
|
525
|
+
options: frameOptions.value,
|
|
526
|
+
"country-code": __props.countryCode,
|
|
527
|
+
email: __props.email,
|
|
528
|
+
name: __props.name,
|
|
529
|
+
onReady: handleReady,
|
|
530
|
+
onChange: _cache[0] || (_cache[0] = (type) => emit("select", {
|
|
531
|
+
paymentMethodType: type,
|
|
532
|
+
paymentGatewayVariant: PAYMENT_GATEWAY_VARIANT_STRIPE
|
|
533
|
+
})),
|
|
534
|
+
onLoaderror: handleLoadError,
|
|
535
|
+
onSubmitSuccess: handleConfirmationToken,
|
|
536
|
+
onSubmitError: _cache[1] || (_cache[1] = (error) => unref(logger).error("STRIPE_CONFIRMATION_TOKEN_FAILED", "Stripe submission failed", {
|
|
537
|
+
error
|
|
538
|
+
}))
|
|
539
|
+
}, null, 8, ["public-key", "options", "country-code", "email", "name"])) : createCommentVNode("", true);
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
export {
|
|
544
|
+
_sfc_main as default
|
|
545
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js");exports.default=e._sfc_main;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createVNode, mergeProps, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
import { u as useIntl,
|
|
2
|
+
import { u as useIntl, o as getCustomerCountry, p as getCustomerName, b as _sfc_main$2, k as _sfc_main$4 } from "./vendor-ui-ItGf7wJV.mjs";
|
|
3
3
|
import { _ as _sfc_main$1 } from "./Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
4
|
-
import { _ as _sfc_main$3 } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _ as _sfc_main$3 } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs";
|
|
5
5
|
const FALLBACK_COUNTRY_CODE = "NL";
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
7
|
__name: "PaymentMethodForm",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./vendor-ui-
|
|
1
|
+
const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),o=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js"),a=e.defineComponent({__name:"PaymentMethodForm",props:{customer:{type:Object},paymentMethodOptions:{type:Array},configuration:{type:Object},isLoading:{type:Boolean,default:!1},countryCode:{type:String},title:{type:String},hideSubmitButton:{type:Boolean}},emits:["success","failure"],setup(a,{expose:r,emit:i}){const u={currency:"EUR",quantity:"0"},s=a,m=i,{$t:c}=t.useIntl(),l=e.ref(),d=e.ref(),p=e.ref(!1);function v(){var e;p.value=!0,null==(e=l.value)||e.submit()}const y=e.computed(()=>c({defaultMessage:"Save payment method",description:"Label of the button that stores the entered payment method",id:"components.payment_method_form.submit_button.label"}));function f(){p.value=!1,m("success")}function _(e){p.value=!1,m("failure",e)}r({submit:v,isPaymentPending:p});const h=e.computed(()=>{return"AUTHORIZE"===(null==(e=s.configuration)?void 0:e.variant)?e:{...e,variant:"TOKENIZE"};var e}),g=e.computed(()=>{let e="NL";if(s.countryCode)return e=s.countryCode,e;if(s.customer){const o=t.getCustomerCountry(s.customer);if(o)return e=o,e}return"NL"}),b=e.computed(()=>{const e=h.value.variant,o=t.getCustomerName(s.customer),n={amount:h.value.amount??u,paymentMethodOptions:s.paymentMethodOptions,countryCode:g.value,...s.customer.email?{email:s.customer.email}:{},...o?{name:o}:{},validateOnSubmit:h.value.validateOnSubmit,forceStorePaymentMethod:h.value.forceStorePaymentMethod,selectedOption:h.value.selectedOption,invoiceId:h.value.invoiceId};return"AUTHORIZE"===e?{...n,variant:e,context:h.value.context}:{...n,variant:"TOKENIZE",customerId:s.customer.id}});return(r,i)=>a.isLoading?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,variant:"section",class:"sv-payment-method-form sv-root sv-component sv-loading min-h-[180px]","data-testid":"payment-method-form-skeleton"})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),{key:1,class:"sv-payment-method-form sv-root sv-component","no-border":"","no-spacing":"","content-background":"none",title:a.title??e.unref(c)({defaultMessage:"Available payment methods",description:"Title of the available payment methods form",id:"components.payment_method_form.section_title"})},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":p.value})},[e.createVNode(n._sfc_main,e.mergeProps({ref_key:"paymentIntegrationFormRef",ref:l,class:"sv-payment-method-form__integration"},b.value,{onSelect:i[0]||(i[0]=e=>d.value=e),onPaymentSuccess:f,onPaymentFailed:_}),null,16)],2),a.hideSubmitButton?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$6),{key:0,color:"primary",class:"mt-4 w-full",loading:p.value,onClick:v},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.value),1)]),_:1},8,["loading"]))]),_:1},8,["title"]))}});exports._sfc_main=a;
|