@solvimon/solvimon-web 0.1.0-alpha.16 → 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.
Files changed (175) hide show
  1. package/README.md +33 -31
  2. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
  3. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
  5. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
  6. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
  7. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
  8. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
  9. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
  10. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
  11. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
  12. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
  13. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
  14. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
  15. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
  16. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
  17. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
  18. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
  19. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
  20. package/dist/{PaymentHistoryBlock-BKMttUyk.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
  21. package/dist/{PaymentHistoryBlock-BGbTy4Se.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
  22. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
  23. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
  24. package/dist/{PaymentIntegrationForm-D4QupHWl.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
  25. package/dist/{PaymentIntegrationForm-CypW6fZY.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
  26. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
  27. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
  28. package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
  29. package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
  30. package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
  31. package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
  32. package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
  33. package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
  34. package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +25 -14
  35. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js +1 -0
  36. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +77 -31
  37. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
  38. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +115 -68
  39. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
  40. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs +37 -0
  41. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
  42. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
  43. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs +100 -0
  44. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
  45. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +22 -119
  46. package/dist/adyen-BMDZQBUG.js +1 -0
  47. package/dist/{url-1Lbg5Yni.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
  48. package/dist/component--Y7Igv5i.mjs +1022 -0
  49. package/dist/component-DIy1hvJM.js +1 -0
  50. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  51. package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
  52. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  53. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +4 -4
  54. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  55. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
  56. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  57. package/dist/components/Invoice/Invoice.es.js +7 -7
  58. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  59. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
  60. package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
  61. package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
  62. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  63. package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
  64. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  65. package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
  66. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  67. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
  68. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  69. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -58
  70. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  71. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
  72. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
  73. package/dist/components/WalletBalances/WalletBalances.es.js +25 -9
  74. package/dist/core/action-request.types.d.ts +3 -15
  75. package/dist/core/index.cjs.js +1 -1
  76. package/dist/core/index.es.js +1 -1
  77. package/dist/core/types.d.ts +4 -2
  78. package/dist/{customer-Bv_fqXzO.mjs → customer-DovIxTG1.mjs} +1 -1
  79. package/dist/{customer-_W8gIX5m.js → customer-brfznoHY.js} +1 -1
  80. package/dist/en-US-BvOHPudj.js +1 -0
  81. package/dist/{en-US-DAgOSlgv.mjs → en-US-CXDO3qhq.mjs} +121 -36
  82. package/dist/index-BMWWP8xj.js +1 -0
  83. package/dist/index-Do7kzLpg.mjs +265 -0
  84. package/dist/index.cjs.js +1 -1
  85. package/dist/index.d.ts +2 -1
  86. package/dist/index.es.js +7 -4
  87. package/dist/invoices-Cf3dSYSj.js +1 -0
  88. package/dist/{invoices-BGb0AwVF.mjs → invoices-Dk-z04lg.mjs} +32 -16
  89. package/dist/{nl-NL-DCsmrA8A.mjs → nl-NL-BgL_PuBn.mjs} +126 -40
  90. package/dist/nl-NL-COGUFg60.js +1 -0
  91. package/dist/{paymentMethods-DvqlWe96.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
  92. package/dist/paymentMethods-DVDC_WfL.js +1 -0
  93. package/dist/{payments-DMDDI3MK.js → payments-DVZFO5yb.js} +1 -1
  94. package/dist/{payments-CpzTVrQM.mjs → payments-TnRjtlOw.mjs} +1 -1
  95. package/dist/pricing-CuYndX6t.js +1 -0
  96. package/dist/pricing-GwLCiSzs.mjs +19 -0
  97. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  98. package/dist/pricingPlanSchedule-CXG3CQ61.mjs +146 -0
  99. package/dist/{registry-B-If1W_u.mjs → registry-Ck0Gb6rj.mjs} +7 -4
  100. package/dist/registry-Cra6yoB4.js +1 -0
  101. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  102. package/dist/screens/Checkout/Checkout.es.js +429 -689
  103. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  104. package/dist/screens/CustomerOverview/CustomerOverview.es.js +61 -39
  105. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  106. package/dist/screens/PayInvoice/PayInvoice.es.js +30 -13
  107. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
  108. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
  109. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +3 -0
  110. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -0
  111. package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +889 -0
  112. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +3 -0
  113. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -0
  114. package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +716 -0
  115. package/dist/solvimon-web.css +1 -1
  116. package/dist/subscription-C41lG-rH.mjs +89 -0
  117. package/dist/subscription-b0OPx8Du.js +1 -0
  118. package/dist/subscriptions-BFCKVHnP.js +1 -0
  119. package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
  120. package/dist/{useActionDispatchProvider-Dz8-e4gZ.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
  121. package/dist/{useActionDispatchProvider-BHTknMoH.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
  122. package/dist/{useCustomer-Z24KchWC.js → useCustomer-C1XTqmrQ.js} +1 -1
  123. package/dist/{useCustomer-VVJi8z2w.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
  124. package/dist/{useIncrementalLoading-DmOT2MXH.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
  125. package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
  126. package/dist/{useInvoiceData-Bl87gzIS.js → useInvoiceData-BrxMo4Zt.js} +1 -1
  127. package/dist/{useInvoiceData-Di5pLPM0.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
  128. package/dist/{useInvoicesList-z19cteaD.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
  129. package/dist/useInvoicesList-DmisMQzy.js +1 -0
  130. package/dist/{useLoadInitialData-CkpryfjF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
  131. package/dist/{useLoadInitialData-CTqfiMTN.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
  132. package/dist/{usePaymentMethodOptions-BoGHJjng.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
  133. package/dist/{usePaymentMethodOptions-BsCZnCQW.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
  134. package/dist/{usePaymentMethods-AC-4rrR9.js → usePaymentMethods-CAFMvSOr.js} +1 -1
  135. package/dist/{usePaymentMethods-ocHmNoP7.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
  136. package/dist/{usePayments-CgXZeWrU.js → usePayments-BieVBaz-.js} +1 -1
  137. package/dist/{usePayments-D85eB5l4.mjs → usePayments-D88XSZfS.mjs} +10 -4
  138. package/dist/{usePortal-B1O1zgdV.mjs → usePortal-0NDlbFr9.mjs} +1 -1
  139. package/dist/{usePortal-DVD7PcWI.js → usePortal-B954nyEB.js} +1 -1
  140. package/dist/{useService-CHrkefKd.js → useService-BiljI7XA.js} +1 -1
  141. package/dist/{useService-DF57xuDd.mjs → useService-CqfJi5ST.mjs} +1 -1
  142. package/dist/useSubscription-9rJpFNUF.mjs +29 -0
  143. package/dist/useSubscription-k3limdu_.js +1 -0
  144. package/dist/vendor-ui-Dfh3_g4q.js +1 -0
  145. package/dist/{vendor-ui-B8IlviSs.mjs → vendor-ui-ItGf7wJV.mjs} +8006 -6329
  146. package/package.json +23 -9
  147. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js +0 -1
  148. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js +0 -1
  149. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js +0 -1
  150. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +0 -1
  151. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs +0 -1537
  152. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js +0 -1
  153. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js +0 -1
  154. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +0 -1
  155. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js +0 -1
  156. package/dist/component-Bg2JVC_O.mjs +0 -933
  157. package/dist/component-Bs8oszfD.js +0 -1
  158. package/dist/en-US-C0gIE4Q1.js +0 -1
  159. package/dist/index-CzL1ZcGi.mjs +0 -85
  160. package/dist/index-DRdBmZ2-.js +0 -1
  161. package/dist/invoices-D-OKipCg.js +0 -1
  162. package/dist/nl-NL-Br7muSHK.js +0 -1
  163. package/dist/paymentMethods-DIbB759g.js +0 -1
  164. package/dist/registry-uG2isab0.js +0 -1
  165. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  166. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  167. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1102
  168. package/dist/subscriptions-BPYyv09M.mjs +0 -75
  169. package/dist/subscriptions-CC61I6Nj.js +0 -1
  170. package/dist/url-B6-3PkW2.js +0 -1
  171. package/dist/useIncrementalLoading-CuSndpP2.js +0 -1
  172. package/dist/useInvoicesList-CFk-_oVK.js +0 -1
  173. package/dist/useWalletBalanceItems-BL-R5foK.js +0 -1
  174. package/dist/useWalletBalanceItems-COQDLfoZ.mjs +0 -109
  175. package/dist/vendor-ui-C3Tq-qY_.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,4 @@
1
+ import { _ as _sfc_main } from "./PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -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
- import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createVNode, mergeProps, createTextVNode } from "vue";
2
- import { u as useIntl, g as getCustomerCountry, b as getCustomerName, _ as _sfc_main$2, c as _sfc_main$4 } from "./vendor-ui-B8IlviSs.mjs";
1
+ import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createVNode, mergeProps, createTextVNode, toDisplayString, createCommentVNode } from "vue";
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-CrGSfZZs.mjs";
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",
@@ -10,10 +10,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10
10
  paymentMethodOptions: { type: Array },
11
11
  configuration: { type: Object },
12
12
  isLoading: { type: Boolean, default: false },
13
- countryCode: { type: String }
13
+ countryCode: { type: String },
14
+ title: { type: String },
15
+ hideSubmitButton: { type: Boolean }
14
16
  },
15
- emits: ["payment-success", "payment-failed"],
16
- setup(__props, { emit: __emit }) {
17
+ emits: ["success", "failure"],
18
+ setup(__props, { expose: __expose, emit: __emit }) {
17
19
  const DEFAULT_AMOUNT = {
18
20
  currency: "EUR",
19
21
  quantity: "0"
@@ -29,13 +31,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
31
  isPaymentPending.value = true;
30
32
  (_a = paymentIntegrationFormRef.value) == null ? void 0 : _a.submit();
31
33
  }
34
+ const submitLabel = computed(
35
+ () => $t({
36
+ defaultMessage: "Save payment method",
37
+ description: "Label of the button that stores the entered payment method",
38
+ id: "components.payment_method_form.submit_button.label"
39
+ })
40
+ );
41
+ __expose({ submit: handleSubmit, isPaymentPending });
32
42
  function handlePaymentSuccess() {
33
43
  isPaymentPending.value = false;
34
- emit("payment-success");
44
+ emit("success");
35
45
  }
36
46
  function handlePaymentFailed(error) {
37
47
  isPaymentPending.value = false;
38
- emit("payment-failed", error);
48
+ emit("failure", error);
39
49
  }
40
50
  const resolveConfiguration = (configuration2) => {
41
51
  if ((configuration2 == null ? void 0 : configuration2.variant) === "AUTHORIZE") {
@@ -103,7 +113,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
103
113
  "no-border": "",
104
114
  "no-spacing": "",
105
115
  "content-background": "none",
106
- title: unref($t)({
116
+ title: __props.title ?? unref($t)({
107
117
  defaultMessage: "Available payment methods",
108
118
  description: "Title of the available payment methods form",
109
119
  id: "components.payment_method_form.section_title"
@@ -123,17 +133,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
123
133
  onPaymentFailed: handlePaymentFailed
124
134
  }), null, 16)
125
135
  ], 2),
126
- createVNode(unref(_sfc_main$4), {
136
+ !__props.hideSubmitButton ? (openBlock(), createBlock(unref(_sfc_main$4), {
137
+ key: 0,
127
138
  color: "primary",
128
139
  class: "mt-4 w-full",
129
140
  loading: isPaymentPending.value,
130
141
  onClick: handleSubmit
131
142
  }, {
132
- default: withCtx(() => [..._cache[1] || (_cache[1] = [
133
- createTextVNode("Save payment method", -1)
134
- ])]),
143
+ default: withCtx(() => [
144
+ createTextVNode(toDisplayString(submitLabel.value), 1)
145
+ ]),
135
146
  _: 1
136
- }, 8, ["loading"])
147
+ }, 8, ["loading"])) : createCommentVNode("", true)
137
148
  ]),
138
149
  _: 1
139
150
  }, 8, ["title"]));
@@ -0,0 +1 @@
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;