@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
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),o=require("./component-DIy1hvJM.js"),n=require("./useService-BiljI7XA.js"),a=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),i=require("./index-BMWWP8xj.js"),l=require("./invoices-Cf3dSYSj.js"),u=require("./useWatchDebounced-C_YxgoQ6.js"),r=require("./AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js"),d=require("./SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js"),s=require("./usePaymentMethodOptions-xeSTmaVo.js");const c=(e=[],t)=>{if(null==t?void 0:t.pricing_item_id)return e.find(e=>(e.charge_on_demand_pricing_items??[]).some(({pricing_item_id:e})=>e===t.pricing_item_id))},p=["TOP_UP","ADD_PAYMENT_METHOD","SUCCESS"],m=e=>"object"==typeof e&&null!==e&&"pricing_item"in e,v=(e,t)=>{const o=new Set((e=>[...new Set(((null==e?void 0:e.charge_on_demand_pricing_items)??[]).flatMap(e=>m(e)&&e.pricing_plan_schedule_id?[e.pricing_plan_schedule_id]:[]))])(e));return t.flatMap(e=>{const t=(e.pricing_plan_schedule_infos??[]).filter(({id:e})=>o.has(e));return 0===t.length?[]:[{id:e.id,name:e.name||e.reference||e.id,scheduleIds:t.map(({id:e})=>e),enabledPricingIds:t.flatMap(e=>{var t;return((null==(t=e.pricing_plan_schedule)?void 0:t.enabled_pricings)??[]).flatMap(({pricing_id:e})=>e?[e]:[])})}]})},f=e=>((null==e?void 0:e.charge_on_demand_pricing_items)??[]).flatMap(o=>{var n,a;if(!m(o))return[];const i=o.pricing_item_id??(null==(n=o.pricing_item)?void 0:n.id);return i?((null==(a=o.pricing_item)?void 0:a.configs)??[]).map(n=>{const a=function(e,o){var n,a,i,l,u,r,d;if(!e.on_demand||!t.isFlexiblePricing(e))return;const s=null==(a=null==(n=e.details)?void 0:n.bands)?void 0:a[0],c=(null==(i=null==s?void 0:s.minimum_amount)?void 0:i.currency)??(null==(l=null==s?void 0:s.maximum_amount)?void 0:l.currency)??(null==(r=null==(u=null==o?void 0:o.wallet_balance.balance)?void 0:u.amount)?void 0:r.currency);if(!c)return;const p=h(o),m=p?g(e,o):void 0,v=null==(d=null==p?void 0:p.credit_type)?void 0:d.unit_name,f=e=>{if(!e)return;const t=p&&m?w(e.quantity,m.rate):void 0;return void 0!==t&&p?b(t,p):{amount:e}};return{config:{...(null==s?void 0:s.minimum_amount)&&{minimum_amount:s.minimum_amount},...(null==s?void 0:s.maximum_amount)&&{maximum_amount:s.maximum_amount}},currency:c,...m&&{creditsConfiguration:{conversionRate:m.rate,...(null==v?void 0:v.singular)&&{unitNameSingle:v.singular},...(null==v?void 0:v.plural)&&{unitNamePlural:v.plural}}},bounds:{...f(null==s?void 0:s.minimum_amount)&&{minimum:f(null==s?void 0:s.minimum_amount)},...f(null==s?void 0:s.maximum_amount)&&{maximum:f(null==s?void 0:s.maximum_amount)}}}}(n,e),l=function(e,o){var n,a,i;if(!e.on_demand||!t.hasOneOfPricingTypes(e,["FIXED"]))return;const l=null==(i=null==(a=null==(n=e.details)?void 0:n.bands)?void 0:a[0])?void 0:i.fixed_amount;if(!l)return;const u=h(o),r=u?y(e,o):void 0;return{amount:l,value:r&&u?b(r.quantity,u):{amount:l}}}(n,e);return{pricingItemId:i,...o.pricing_plan_schedule_id&&{pricingPlanScheduleId:o.pricing_plan_schedule_id},config:n,...a&&{flexiblePricing:a},...l&&{fixedPricing:l}}}):[]});const h=e=>{var t;return null==(t=null==e?void 0:e.wallet_balance.balance)?void 0:t.credits},_=(e,t)=>{var o;const n=null==(o=null==t?void 0:t.wallet)?void 0:o.wallet_type_id;return(e.wallet_grants??[]).filter(({wallet_type_id:e})=>!n||e===n)},g=(e,t)=>{var o,n;return null==(n=null==(o=_(e,t).find(({credits_grant:e})=>null==e?void 0:e.conversion))?void 0:o.credits_grant)?void 0:n.conversion},y=(e,t)=>{var o,n;return null==(n=null==(o=_(e,t).find(({credits_grant:e})=>null==e?void 0:e.credits))?void 0:o.credits_grant)?void 0:n.credits},b=(e,t)=>({credits:{...t,quantity:e}}),w=(e,t)=>{const o=Number(e),n=Number(t);return Number.isFinite(o)&&Number.isFinite(n)?String(o*n):void 0};const x=e=>{var t,o,n,a,i;return!!(null==(t=e.fixedPricing)?void 0:t.value.credits)||!!(null==(o=e.flexiblePricing)?void 0:o.creditsConfiguration)||!!(null==(i=(null==(n=e.flexiblePricing)?void 0:n.bounds.minimum)??(null==(a=e.flexiblePricing)?void 0:a.bounds.maximum))?void 0:i.credits)},M=(e=[])=>{for(const{flexiblePricing:t,fixedPricing:o}of e){const e=(null==t?void 0:t.currency)??(null==o?void 0:o.amount.currency);if(e)return e}},C=(e=[])=>{var t,o,n;for(const{fixedPricing:a,flexiblePricing:i}of e){const e=(null==a?void 0:a.value.credits)??(null==(t=(null==i?void 0:i.bounds.minimum)??(null==i?void 0:i.bounds.maximum))?void 0:t.credits);if(null==(n=null==(o=null==e?void 0:e.credit_type)?void 0:o.unit_name)?void 0:n.plural)return e.credit_type.unit_name.plural}},B=(e=[])=>{var t;for(const{flexiblePricing:o}of e){const e=null==(t=null==o?void 0:o.creditsConfiguration)?void 0:t.conversionRate;if(e)return e}},P=(e=[])=>{for(const{flexiblePricing:t}of e){const{minimum_amount:e,maximum_amount:o}=(null==t?void 0:t.config)??{};if(e||o)return{...e&&{minimum:e},...o&&{maximum:o}}}return{}},S=(e=[])=>{const t=((e=[])=>{if(e.some(x)){const t=(e=>{var t;for(const{fixedPricing:o,flexiblePricing:n}of e){const e=(null==o?void 0:o.value.credits)??(null==(t=(null==n?void 0:n.bounds.minimum)??(null==n?void 0:n.bounds.maximum))?void 0:t.credits);if(null==e?void 0:e.credit_type_id)return e.credit_type_id}})(e);return t?{creditTypeId:t}:void 0}for(const{flexiblePricing:t,fixedPricing:o}of e){const e=(null==t?void 0:t.currency)??(null==o?void 0:o.amount.currency);if(e)return{currency:e}}})(e);if(t)return{denomination:t,chargeCurrency:M(e)??"",creditUnitName:C(e),conversionRate:B(e),topUpBounds:P(e)}};const T={key:0},I=e.defineComponent({__name:"TopUpInvoicePreview",props:{pricingPlanScheduleId:{type:String},pricingItems:{type:Array}},setup(n){const i=n,{$t:r}=t.useIntl(),d=e.computed(()=>i.pricingPlanScheduleId),s=e.computed(()=>i.pricingItems),{invoicePreview:c}=function({pricingPlanScheduleId:t,pricingItems:n}){const{previewChargeOnDemandPricingItems:a}=l.createInvoicesService(),i=o.useLogger(),r=e.ref(),d=e.ref(!1);let s=0;const c=async()=>{const e=t.value,o=++s;if(!e||!n.value)return n.value&&!e&&i.warn("INVOICE_PREVIEW_SKIPPED","Skipped the top-up invoice preview: no schedule to charge it on",{missing:["pricingPlanScheduleId"]}),r.value=void 0,void(d.value=!1);d.value=!0;try{const t=await a({pricingPlanScheduleId:e,pricingItems:n.value});o===s&&(r.value=t)}catch(l){o===s&&(r.value=void 0),i.error("INVOICE_PREVIEW_FAILED","Failed to load top-up invoice preview",{},l)}finally{o===s&&(d.value=!1)}};return u.useWatchDebounced(n,()=>{c()},{debounce:400,deep:!0}),c(),{invoicePreview:r,isPreviewPending:d,loadPreview:c}}({pricingPlanScheduleId:d,pricingItems:s});return(o,n)=>(e.openBlock(),e.createBlock(a._sfc_main,{class:"sv-top-up-invoice-preview h-[152px]","data-testid":"top-up-invoice-preview-skeleton"},{default:e.withCtx(()=>[e.unref(c)?(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(e.unref(t._sfc_main$31),{required:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"You will pay",description:"Label above the preview of what topping up will be invoiced for",id:"topup_modal.invoice_preview.label"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$2),{"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{invoice:e.unref(c),"is-customer-facing":""},null,8,["invoice"])]),_:1})])):e.createCommentVNode("",!0)]),_:1}))}}),k=(e,t)=>e.currency??t??e.creditTypeId??"",N=(e,t)=>({quantity:e??null,currency:t}),V=(e,{denomination:t,chargeCurrency:o,creditUnitName:n,minimumTopUp:a})=>{var i,l,u,r,d;return{enabled:"ACTIVE"===(null==e?void 0:e.status),threshold:N((null==(l=null==(i=null==e?void 0:e.threshold)?void 0:i.amount)?void 0:l.quantity)??(null==(r=null==(u=null==e?void 0:e.threshold)?void 0:u.credits)?void 0:r.quantity),k(t,n)),topUpAmount:N((null==(d=null==e?void 0:e.topup_amount)?void 0:d.quantity)??a,o)}},E=(e,t)=>{var o;const n=null==(o=e.threshold)?void 0:o.quantity;return n?t.creditTypeId?{credits:{quantity:n,credit_type_id:t.creditTypeId}}:{amount:{quantity:n,currency:t.currency??""}}:{}},U=(e,t)=>{var o;return(null==(o=e.topUpAmount)?void 0:o.quantity)?{quantity:e.topUpAmount.quantity,currency:e.topUpAmount.currency??t}:void 0},A=(e,{denomination:t,chargeCurrency:o})=>({status:e.enabled?"ACTIVE":"INACTIVE",threshold:E(e,t),...U(e,o)&&{topup_amount:U(e,o)}}),O=(e,t)=>A(V(e,t),t),$=(e,t)=>JSON.stringify(e)===JSON.stringify(t),D=e=>{const t=Number(null==e?void 0:e.quantity);return(null==e?void 0:e.quantity)&&Number.isFinite(t)?t:void 0},q=e=>{const t=Number(e);return null!=e&&""!==e&&Number.isFinite(t)?t:void 0},R=(e,t,o)=>{const n=q(e),a=q(o);if(!(void 0===n||void 0===a||a<=0))return"CREDITS"===t?n/a:n*a},L=(e,t,o,n)=>t===o?q(e):R(e,t,n),F=e=>e.toFixed(2),j=(e,t)=>"AMOUNT"===t?F(e):String(Number(e.toFixed(6))),Y=(e,t,o,n)=>{const a=((e,t,o)=>"CREDITS"===t?R(e,"AMOUNT",o):q(e))(null==e?void 0:e.quantity,t,o);if(void 0!==a)return"CREDITS"===t?n(a):F(a)},H=["data-testid"],z=e.defineComponent({__name:"ConvertedAmountInput",props:e.mergeModels({unit:{type:String},modelBase:{type:String},entryBase:{type:String},conversionRate:{type:String},showConversionHint:{type:Boolean},currency:{type:String},creditUnitName:{type:String},bounds:{type:Object},label:{type:String},name:{type:String},required:{type:Boolean},disabled:{type:Boolean},error:{type:[String,Object,Array]}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const n=o,a=e.useModel(o,"modelValue"),{$t:i,formatNumber:l}=t.useIntl(),u=e.computed(()=>n.entryBase??n.modelBase),r=e.computed(()=>u.value!==n.modelBase&&void 0!==q(n.conversionRate)),d=e.ref("");function s(e){const t=L(e,u.value,n.modelBase,n.conversionRate);return void 0===t?"":j(t,n.modelBase)}e.watch(()=>[a.value,u.value,n.modelBase,n.conversionRate],([e])=>{if(!r.value)return void(d.value=e??"");if(e===s(d.value))return;const t=L(e,n.modelBase,u.value,n.conversionRate);d.value=void 0===t?"":j(t,u.value)},{immediate:!0});const c=e.computed({get:()=>d.value,set:e=>{d.value=function(e){return"string"==typeof e?e:"number"==typeof e?String(e):""}(e),a.value=r.value?s(d.value):d.value}}),p=e.computed(()=>R(d.value,u.value,n.conversionRate)),m=e.computed(()=>n.creditUnitName?n.creditUnitName:"CREDITS"===u.value?n.unit:i({defaultMessage:"credits",description:"Generic name for a wallet credit, where its credit type does not name one",id:"converted_amount_input.credits"})),v=e=>`${l(e)} ${m.value}`,f=e.computed(()=>{const e=p.value;var o,a;if(n.showConversionHint&&void 0!==e)return"CREDITS"===u.value?n.currency?i({defaultMessage:"Will cost {amount} excluding taxes",description:"Helper text under a credits field, naming what those credits cost in money",id:"converted_amount_input.cost"},{amount:(o=e,a=n.currency,t.formatAmount({quantity:F(o),currency:a}))}):void 0:i({defaultMessage:"Buys about {credits}",description:"Helper text under a money field, naming the credits that amount converts into",id:"converted_amount_input.buys"},{credits:v(e)})}),h=e=>Y(e,u.value,n.conversionRate,l),_=e.computed(()=>{var e,t,o,a;return"CREDITS"===u.value?m.value:(null==(t=null==(e=n.bounds)?void 0:e.minimum)?void 0:t.currency)??(null==(a=null==(o=n.bounds)?void 0:o.maximum)?void 0:a.currency)??n.unit}),g=e.computed(()=>{var e,t;const o=h(null==(e=n.bounds)?void 0:e.minimum),a=h(null==(t=n.bounds)?void 0:t.maximum),l=_.value;return o&&a?i({defaultMessage:"Between {minimum} and {maximum} {unit}",description:"Range of what a flexible top-up may be charged for, beside its label",id:"converted_amount_input.bounds.range"},{minimum:o,maximum:a,unit:l}):o?i({defaultMessage:"At least {minimum} {unit}",description:"Smallest amount a flexible top-up may be charged for, beside its label",id:"converted_amount_input.bounds.minimum"},{minimum:o,unit:l}):a?i({defaultMessage:"Up to {maximum} {unit}",description:"Largest amount a flexible top-up may be charged for, beside its label",id:"converted_amount_input.bounds.maximum"},{maximum:a,unit:l}):void 0});return(n,a)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$24),{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=e=>c.value=e),class:"sv-converted-amount-input",type:"number","as-text-type":"",name:o.name,label:o.label,required:o.required,disabled:o.disabled,error:o.error},e.createSlots({suffix:e.withCtx(()=>[e.createElementVNode("span",{"data-testid":`${o.name}-unit`},e.toDisplayString(o.unit),9,H)]),_:2},[g.value?{name:"label-suffix",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1),{tag:"span",variant:"body-xs",shade:"lighter","no-spacing":"","data-testid":`${o.name}-bounds`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.value),1)]),_:1},8,["data-testid"])]),key:"0"}:void 0,f.value?{name:"helper",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1),{tag:"span",variant:"body-xs",shade:"lighter","no-spacing":"","data-testid":`${o.name}-conversion`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1},8,["data-testid"])]),key:"1"}:void 0]),1032,["modelValue","name","label","required","disabled","error"]))}}),W=e.defineComponent({__name:"Section",props:{emphasized:{type:Boolean,default:!1},contentClasses:{type:String},contentBackground:{type:String},title:{type:String},noSpacing:{type:Boolean},hasError:{type:Boolean},noBorder:{type:Boolean}},setup(o){const n=o,a=["sv-section__accent relative","before:absolute before:inset-y-0.5 before:left-0.5 before:w-0.5","before:rounded-full before:bg-primary-600"].join(" "),i=e.computed(()=>[n.emphasized?a:void 0,n.contentClasses].filter(Boolean).join(" ")),l=e.computed(()=>{const{emphasized:e,...t}=n;return t});return(o,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),e.mergeProps(l.value,{class:"sv-section","content-classes":i.value}),e.createSlots({default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:2},[o.$slots.right?{name:"right",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"right")]),key:"0"}:void 0]),1040,["content-classes"]))}}),X={class:"flex grow flex-col"},J=e.defineComponent({__name:"AutoTopUpConfig",props:{config:{type:Object},denomination:{type:Object},creditUnitName:{type:String},chargeCurrency:{type:String},conversionRate:{type:String},topUpBounds:{type:Object},showThresholdConversion:{type:Boolean,default:!0},contained:{type:Boolean},alwaysEnabled:{type:Boolean},disabled:{type:Boolean}},emits:["save"],setup(o,{expose:n,emit:a}){const l=o,u=a,{$t:r,formatNumber:d}=t.useIntl(),s=e.computed(()=>{var e,t;return{denomination:l.denomination,chargeCurrency:l.chargeCurrency,creditUnitName:l.creditUnitName,minimumTopUp:null==(t=null==(e=l.topUpBounds)?void 0:e.minimum)?void 0:t.quantity}}),c=e.ref(V(l.config,s.value)),p=e.computed(()=>k(l.denomination,l.creditUnitName)),m=e.computed(()=>l.denomination.creditTypeId?"CREDITS":"AMOUNT"),v=e.computed(()=>"CREDITS"===m.value?p.value:l.chargeCurrency),f=e.computed({get:()=>{var e;return(null==(e=c.value.threshold)?void 0:e.quantity)??""},set:e=>{c.value.threshold={quantity:e||null,currency:p.value}}}),h=e.computed({get:()=>{var e;return(null==(e=c.value.topUpAmount)?void 0:e.quantity)??""},set:e=>{c.value.topUpAmount={quantity:e||null,currency:l.chargeCurrency}}});e.watch(()=>[l.config,s.value],([e,t])=>{$(O(e,t),y())||(c.value=V(e,t))});const _=e.computed({get:()=>l.alwaysEnabled||c.value.enabled,set:e=>{c.value.enabled=e}}),g=e.computed(()=>A({...c.value,enabled:_.value},s.value)),y=()=>g.value,b=e.reactive({threshold:e.computed(()=>D(c.value.threshold)??null),topUpAmount:e.computed(()=>D(c.value.topUpAmount)??null)}),w=e=>{if(!e)return"";const o=Y(e,m.value,l.conversionRate,d);return void 0===o?t.formatAmount(e):`${o} ${v.value}`},x=i.requiredIf(()=>_.value),M=t.useValidation({threshold:{required:i.common.withMessage(()=>r({defaultMessage:"Enter the balance to top up at.",description:"Error shown under the auto top-up threshold when it is left empty",id:"auto_topup_config.threshold.required"}),x),notNegative:i.common.withMessage(()=>r({defaultMessage:"The balance to top up at cannot be negative.",description:"Error shown under the auto top-up threshold when it is below zero",id:"auto_topup_config.threshold.not_negative"}),e=>null===e||e>=0)},topUpAmount:{required:i.common.withMessage(()=>r({defaultMessage:"Enter the amount to top up with.",description:"Error shown under the auto top-up amount when it is left empty",id:"auto_topup_config.amount.required"}),x),positive:i.common.withMessage(()=>r({defaultMessage:"Top up with more than zero.",description:"Error shown under the auto top-up amount when it is zero or negative",id:"auto_topup_config.amount.positive"}),e=>null===e||e>0),atLeastMinimum:i.common.withMessage(()=>{var e;return r({defaultMessage:"Top up with at least {minimum}.",description:"Error shown under the auto top-up amount when it is below what the pricing allows",id:"auto_topup_config.amount.at_least_minimum"},{minimum:w(null==(e=l.topUpBounds)?void 0:e.minimum)})},e=>{var t;return((e,t)=>{const o=Number(null==t?void 0:t.quantity);return null===e||!(null==t?void 0:t.quantity)||!Number.isFinite(o)||e>=o})(e,null==(t=l.topUpBounds)?void 0:t.minimum)}),withinMaximum:i.common.withMessage(()=>{var e;return r({defaultMessage:"Top up with at most {maximum}.",description:"Error shown under the auto top-up amount when it is above what the pricing allows",id:"auto_topup_config.amount.within_maximum"},{maximum:w(null==(e=l.topUpBounds)?void 0:e.maximum)})},e=>{var t;return((e,t)=>{const o=Number(null==t?void 0:t.quantity);return null===e||!(null==t?void 0:t.quantity)||!Number.isFinite(o)||e<=o})(e,null==(t=l.topUpBounds)?void 0:t.maximum)})}},b),C=e.computed(()=>!$(y(),O(l.config,s.value)));function B(){return M.value.$touch(),M.value.$invalid?void 0:y()}return n({submit:function(){const e=B();e&&u("save",e)},validate:B,rule:g,hasChanges:C,isInvalid:e.computed(()=>M.value.$invalid)}),(n,a)=>(e.openBlock(),e.createBlock(W,{class:"sv-auto-topup-config","content-background":o.contained?"gray":"none","no-spacing":!o.contained,"no-border":!o.contained},{default:e.withCtx(()=>[o.alwaysEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$26),{key:0,modelValue:_.value,"onUpdate:modelValue":a[0]||(a[0]=e=>_.value=e),"no-spacing":"","label-position":"before",class:"!flex",disabled:o.disabled},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",X,[e.createVNode(e.unref(t._sfc_main$1),{tag:"span",variant:"body-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Auto top-up",description:"Title of the automatic wallet top-up settings",id:"auto_topup_config.title"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Automatically top up your balance when it runs low.",description:"Subtitle of the automatic wallet top-up settings",id:"auto_topup_config.subtitle"})),1)]),_:1})])]),_:1},8,["modelValue","disabled"])),e.createVNode(e.unref(t._sfc_main$32),{"is-open":_.value},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["grid grid-cols-1 gap-3",{"mt-4":!o.alwaysEnabled}])},[e.createVNode(z,{modelValue:f.value,"onUpdate:modelValue":a[1]||(a[1]=e=>f.value=e),name:"auto-top-up-threshold",unit:p.value,"model-base":m.value,"entry-base":m.value,currency:o.chargeCurrency,"conversion-rate":o.conversionRate,"show-conversion-hint":o.showThresholdConversion,required:"",disabled:o.disabled,error:e.unref(M).threshold.$errors,label:e.unref(r)({defaultMessage:"When your balance falls below",description:"Label of the balance at which an automatic top-up is charged",id:"auto_topup_config.threshold.label"})},null,8,["modelValue","unit","model-base","entry-base","currency","conversion-rate","show-conversion-hint","disabled","error","label"]),e.createVNode(z,{modelValue:h.value,"onUpdate:modelValue":a[2]||(a[2]=e=>h.value=e),name:"auto-top-up-amount",unit:v.value,"model-base":"AMOUNT","entry-base":m.value,currency:o.chargeCurrency,"credit-unit-name":o.creditUnitName,"conversion-rate":o.conversionRate,bounds:o.topUpBounds,"show-conversion-hint":"",required:"",disabled:o.disabled,error:e.unref(M).topUpAmount.$errors,label:e.unref(r)({defaultMessage:"Top-up with",description:"Label of the amount every automatic top-up adds",id:"auto_topup_config.amount.label"})},null,8,["modelValue","unit","entry-base","currency","credit-unit-name","conversion-rate","bounds","disabled","error","label"])],2)):e.createCommentVNode("",!0)]),_:1},8,["is-open"])]),_:1},8,["content-background","no-spacing","no-border"]))}}),K=e=>{const t=Date.parse(e??"");return Number.isFinite(t)?t:0};function G({paymentMethods:t,selectedPaymentMethodId:o,preferredPaymentMethodId:n}){const a=e.computed(()=>[...t.value??[]].sort((e,t)=>K(t.created_at)-K(e.created_at)));return e.watch(()=>[t.value,null==n?void 0:n.value,o.value],([e,t,n],i)=>{var l;const u=null==i?void 0:i[0],r=null==e?void 0:e.find(({id:e})=>!(null==u?void 0:u.some(t=>t.id===e)));if(r&&(null==u?void 0:u.length))return void(o.value=r.id);const d=t=>!!t&&!!(null==e?void 0:e.some(e=>e.id===t));d(n)||(o.value=d(t)?t:null==(l=(null==e?void 0:e.find(({is_default:e})=>e))??a.value[0])?void 0:l.id)},{immediate:!0}),{sortedPaymentMethods:a}}function Q(){const{$t:e,formatNumber:o}=t.useIntl(),n=n=>t.formatWalletBalanceValue(e,o,n);return{formatValue:n,formatOpenBalance:e=>n(null==e?void 0:e.wallet_balance.open_balance)}}const Z={class:"sv-top-up-form"},ee={class:"grid grid-cols-1 gap-4"},te={class:"grid grid-cols-1 gap-1"},oe={class:"sv-top-up-form__option-details"},ne={key:0},ae=e.defineComponent({__name:"TopUpModalForm",props:{topUpPricingItems:{type:null},paymentMethods:{type:Array},paymentMethodOptions:{type:Array},autoTopUpConfig:{type:Object}},emits:["add-payment-method","success","save-auto-top-up","failure"],setup(n,{expose:a,emit:u}){const d=n,s=u,{$t:c}=t.useIntl(),{formatValue:p}=Q(),m=e.ref({pricing_plan_schedule_id:"",pricing_items:[],start_at:"",finalize_immediately:!1,payment_method_id:void 0,preview:!0}),v=e.computed(()=>{const e=(d.topUpPricingItems??[]).filter(e=>e.flexiblePricing||e.fixedPricing);return[...e.filter(({flexiblePricing:e})=>e),...e.filter(({flexiblePricing:e})=>!e)]}),f=e=>v.value.find(t=>t.pricingItemId===e),h=e.computed(()=>{var e,t;return null==(t=null==(e=d.topUpPricingItems)?void 0:e.find(e=>e.pricingPlanScheduleId))?void 0:t.pricingPlanScheduleId});e.watch(h,e=>{m.value.pricing_plan_schedule_id=e??""},{immediate:!0});const _=e.computed({get:()=>{var e;return null==(e=m.value.pricing_items[0])?void 0:e.pricing_item_id},set:e=>{const t=f("string"==typeof e?e:void 0);if(!t)return void(m.value.pricing_items=[]);const o=(e=>{const{config:t,currency:o}=e.flexiblePricing??{},n=null==t?void 0:t.minimum_amount;return n&&o?{quantity:n.quantity,currency:o}:void 0})(t);m.value.pricing_items=[{pricing_item_id:t.pricingItemId,...o&&{flexible_amount:o}}]}});e.watch(v,e=>{if(e.some(({pricingItemId:e})=>{var t;return e===(null==(t=m.value.pricing_items[0])?void 0:t.pricing_item_id)}))return;const t=e.find(({flexiblePricing:e})=>e)??e[0];_.value=null==t?void 0:t.pricingItemId},{immediate:!0});const g=e.computed({get:()=>{var e;return null==(e=m.value.pricing_items[0])?void 0:e.flexible_amount},set:e=>{var t;const o=null==(t=m.value.pricing_items[0])?void 0:t.pricing_item_id;o&&(m.value.pricing_items=[{pricing_item_id:o,...e&&{flexible_amount:e}}])}}),y=e=>{var o;const n=null==(o=f(String(e)))?void 0:o.fixedPricing;return(null==n?void 0:n.value.credits)?t.formatAmount(n.amount):void 0},x=e.computed(()=>{var e;return null==(e=f(String(_.value)))?void 0:e.flexiblePricing}),M=e.computed({get:()=>{var e;return(null==(e=g.value)?void 0:e.quantity)??""},set:e=>{var t;const o=null==(t=x.value)?void 0:t.currency;g.value=e&&o?{quantity:e,currency:o}:void 0}}),B=e=>e.creditsConfiguration?"CREDITS":"AMOUNT",P=e.computed(()=>C(d.topUpPricingItems)),T=e=>{var t;const o=null==(t=f(String(e)))?void 0:t.flexiblePricing;return o?[o]:[]},k=e=>{var t;return!!(null==(t=f(String(e)))?void 0:t.flexiblePricing)},N=e.computed(()=>v.value.map(e=>{var t;return{value:e.pricingItemId,label:e.fixedPricing?p(e.fixedPricing.value):c({defaultMessage:"Choose your own amount",description:"Label of the choose-your-amount option in the top-up modal",id:"topup_modal.flexible_option.label"}),...(null==(t=e.flexiblePricing)?void 0:t.bounds.minimum)&&e.flexiblePricing.bounds.maximum&&{description:c({defaultMessage:"Between {minimum} and {maximum}",description:"Bounds of the choose-your-amount option in the top-up modal",id:"topup_modal.flexible_option.bounds"},{minimum:p(e.flexiblePricing.bounds.minimum),maximum:p(e.flexiblePricing.bounds.maximum)})}}})),V=e.computed(()=>{const e=m.value.pricing_items.filter(e=>{var t;return!(null==(t=f(e.pricing_item_id))?void 0:t.flexiblePricing)||!!e.flexible_amount});return e.length>0?e:void 0}),E=e.computed(()=>!d.autoTopUpConfig&&v.value.some(({flexiblePricing:e})=>e)?S(d.topUpPricingItems):void 0),U=e.ref(),{chargeOnDemandPricingItems:A}=l.createInvoicesService(),O=o.useLogger(),$=e.ref(!1),D=e.computed(()=>!!m.value.pricing_plan_schedule_id&&!!V.value&&!!m.value.payment_method_id),q=e.reactive({paymentMethodId:e.computed(()=>m.value.payment_method_id??null)}),R=t.useValidation({paymentMethodId:{required:i.common.withMessage(()=>c({defaultMessage:"Select a payment method to pay for this top-up.",description:"Error shown under the payment methods in the top-up modal when none is selected on submit",id:"topup_modal.payment_method_required"}),i.required)}},q),L=e.computed(()=>{const[e]=m.value.pricing_items,t=f(null==e?void 0:e.pricing_item_id);return t?((e,t)=>{var o;if(e.fixedPricing)return e.fixedPricing.value;if(!e.flexiblePricing||!t)return;const{bounds:n,creditsConfiguration:a}=e.flexiblePricing,i=null==(o=n.minimum??n.maximum)?void 0:o.credits,l=a?w(t.quantity,a.conversionRate):void 0;return i&&void 0!==l?b(l,i):{amount:t}})(t,null==e?void 0:e.flexible_amount):void 0});a({submit:async function(){var e,t,o;R.value.$touch();const n=null==(e=U.value)?void 0:e.validate();if(!R.value.$invalid&&!(null==(t=U.value)?void 0:t.isInvalid)&&D.value&&!$.value){$.value=!0;try{const e=await A({pricing_plan_schedule_id:m.value.pricing_plan_schedule_id,pricing_items:V.value??[],payment_method_id:m.value.payment_method_id,preview:!1});n&&(null==(o=U.value)?void 0:o.hasChanges)&&m.value.payment_method_id&&s("save-auto-top-up",{rule:n,paymentMethodId:m.value.payment_method_id}),s("success",e)}catch(a){O.error("TOP_UP_FAILED","Failed to charge the wallet top-up",{},a),s("failure",a)}finally{$.value=!1}}},isCharging:$,canSubmit:D,chargedValue:L});const F=e.computed({get:()=>m.value.payment_method_id??void 0,set:e=>{m.value.payment_method_id=e}}),{sortedPaymentMethods:j}=G({paymentMethods:e.computed(()=>d.paymentMethods),selectedPaymentMethodId:F});return(o,a)=>(e.openBlock(),e.createElementBlock("form",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[N.value.length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$10),{key:0,modelValue:_.value,"onUpdate:modelValue":a[3]||(a[3]=e=>_.value=e),class:"sv-top-up-form__options",name:"top-up-pricing-item",direction:"column",required:"",disabled:$.value,options:N.value,"show-radio":!1,label:e.unref(c)({defaultMessage:"Top up amount",description:"Label above the list of ways to top up the wallet in the top-up modal",id:"topup_modal.pricing_items.label"})},{label:e.withCtx(({option:o,optionValue:n})=>[e.createElementVNode("span",null,e.toDisplayString(o.label),1),y(n)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,tag:"span",variant:"body-sm",shade:"lighter",weight:"normal","no-spacing":"",class:"sv-top-up-form__option-cost"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y(n)),1)]),_:2},1024)):e.createCommentVNode("",!0)]),description:e.withCtx(({option:o,optionValue:n})=>[e.createElementVNode("div",oe,[o.description&&!k(n)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.description),1)]),_:2},1024)):e.createCommentVNode("",!0),T(n).length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$32),{key:1,"is-open":String(n)===_.value,lazy:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T(n),n=>{var i,l;return e.openBlock(),e.createElementBlock("div",{key:n.currency,class:"sv-top-up-form__amount grid grid-cols-1 gap-3",onClick:a[1]||(a[1]=e.withModifiers(()=>{},["stop"])),onKeydown:a[2]||(a[2]=e.withModifiers(()=>{},["stop"]))},[o.description?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.description),1)]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(z,{modelValue:M.value,"onUpdate:modelValue":a[0]||(a[0]=e=>M.value=e),name:"top-up-amount","model-base":"AMOUNT",unit:(l=n,l.creditsConfiguration?P.value??l.creditsConfiguration.unitNamePlural??l.creditsConfiguration.unitNameSingle??"":l.currency),"entry-base":B(n),currency:n.currency,"conversion-rate":null==(i=n.creditsConfiguration)?void 0:i.conversionRate,required:"",disabled:$.value},null,8,["modelValue","unit","entry-base","currency","conversion-rate","disabled"])],32)}),128))]),_:2},1032,["is-open"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue","disabled","options","label"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(I,{"pricing-plan-schedule-id":h.value,"pricing-items":V.value},null,8,["pricing-plan-schedule-id","pricing-items"])]),E.value?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(J,e.mergeProps({ref_key:"autoTopUpFormRef",ref:U,class:"sv-top-up-form__auto-top-up"},E.value,{contained:"","show-threshold-conversion":!1,disabled:$.value}),null,16,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$27),{spacing:"xs"})]),e.createElementVNode("div",null,[e.renderSlot(o.$slots,"payment-method",{},()=>[e.createVNode(r._sfc_main,{modelValue:F.value,"onUpdate:modelValue":a[4]||(a[4]=e=>F.value=e),class:"sv-top-up-form__payment-methods","payment-methods":e.unref(j),required:"",error:e.unref(R).paymentMethodId.$errors,"payment-method-options":n.paymentMethodOptions,disabled:$.value,label:e.unref(c)({defaultMessage:"Payment method",description:"Label above the payment method that pays for the top-up, in the top-up modal",id:"topup_modal.payment_method_selector.label"}),onAddPaymentMethod:a[5]||(a[5]=e=>s("add-payment-method"))},null,8,["modelValue","payment-methods","error","payment-method-options","disabled","label"])])])])]))}}),ie={class:"sv-top-up-success grid grid-cols-1 gap-4"},le=e.defineComponent({__name:"TopUpModalSuccess",props:{addedValue:{type:Object},invoice:{type:Object}},setup(o){const{$t:n}=t.useIntl();return(a,i)=>(e.openBlock(),e.createElementBlock("div",ie,[o.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),{key:0,"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1),{tag:"span",variant:"body-sm",weight:"semibold",class:"mb-2 block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Receipt",description:"Heading above the invoice a completed top-up produced",id:"topup_modal.success.receipt.heading"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$29),{invoice:o.invoice,"is-customer-facing":""},null,8,["invoice"])]),_:1})):e.createCommentVNode("",!0)]))}});function ue({isOpen:o,customer:n}){const{paymentMethodOptions:a,get:i,isPending:l}=s.usePaymentMethodOptions();e.watch(()=>[o.value,n.value],([e,o])=>{e&&o&&i({customerId:o.id,country:t.getCustomerCountry(o)})},{immediate:!0});const u=e.computed(()=>l.value?void 0:a.value);return{paymentMethodOptions:a,settledOptions:u,isPending:l}}const re=["inert"],de=e.defineComponent({__name:"SlidingPanes",props:{panes:{type:Array},current:{type:String}},setup(t){const o=t,n=e.ref(!1);let a;e.watch(()=>o.current,()=>{n.value=!0,clearTimeout(a),a=setTimeout(()=>{n.value=!1},300)}),e.onBeforeUnmount(()=>{clearTimeout(a)});const i=e.ref({}),l={},u=e=>l[e]??(l[e]=t=>{i.value[e]=t instanceof HTMLElement?t:void 0}),r=function(t){const o=e.ref(0),n=e=>{o.value=(null==e?void 0:e.offsetHeight)??0},a="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(e=>{var t;const o=null==(t=e[0])?void 0:t.target;n(o instanceof HTMLElement?o:void 0)});return e.watch(t,(e,t)=>{t&&(null==a||a.unobserve(t)),n(e),e&&(null==a||a.observe(e))},{immediate:!0,flush:"post"}),e.onBeforeUnmount(()=>{null==a||a.disconnect()}),o}(e.computed(()=>i.value[o.current])),d=e.computed(()=>{const e=o.panes.indexOf(o.current);return e>0?`translateX(calc(${-e} * (100% + 1rem)))`:"translateX(0px)"});return(o,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sv-sliding-panes__viewport relative -mx-2 overflow-hidden px-2",n.value?"transition-[height] duration-300 ease-in-out motion-reduce:transition-none":""]),style:e.normalizeStyle(e.unref(r)?{height:`${e.unref(r)}px`}:void 0)},[e.createElementVNode("div",{class:"sv-sliding-panes__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",style:e.normalizeStyle({transform:d.value})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.panes,n=>(e.openBlock(),e.createElementBlock("div",{key:n,class:"sv-sliding-panes__pane w-full shrink-0",inert:n!==t.current||void 0},[e.createElementVNode("div",{ref_for:!0,ref:u(n)},[e.renderSlot(o.$slots,n)],512)],8,re))),128))],4)],6))}}),se=e=>{var t;return((null==(t=null==e?void 0:e.wallet)?void 0:t.auto_top_up_configs)??[]).find(({status:e})=>"ACTIVE"===e)},ce=e=>e?{status:e.status,threshold:e.threshold,...e.topup_amount&&{topup_amount:e.topup_amount}}:void 0,pe=(e,t=[])=>{if((null==e?void 0:e.pricing_item_id)&&e.pricing_plan_schedule_id)return{pricingItemId:e.pricing_item_id,pricingPlanScheduleId:e.pricing_plan_schedule_id};const o=t.find(({flexiblePricing:e,pricingPlanScheduleId:t})=>e&&t);return(null==o?void 0:o.pricingPlanScheduleId)?{pricingItemId:o.pricingItemId,pricingPlanScheduleId:o.pricingPlanScheduleId}:void 0},me=({rule:e,walletBalanceItem:t,chargeTarget:o,paymentMethodId:n})=>{var a,i;const l=!!((null==(a=null==e?void 0:e.threshold)?void 0:a.amount)??(null==(i=null==e?void 0:e.threshold)?void 0:i.credits));if(e&&l&&(null==t?void 0:t.wallet_id)&&o&&n)return{wallet_id:t.wallet_id,status:e.status,threshold:e.threshold,pricing_plan_schedule_id:o.pricingPlanScheduleId,pricing_item_id:o.pricingItemId,payment_method_id:n,...e.topup_amount&&{topup_amount:e.topup_amount}}};function ve({step:t,name:o,returnTo:n}){const a=e.ref();return{paneRef:a,isActive:e.computed(()=>t.value===o),isSaving:e.computed(()=>{var e;return!!(null==(e=a.value)?void 0:e.isSaving)}),open:()=>{t.value=o},leave:()=>{t.value=n},submit:()=>{var e;return null==(e=a.value)?void 0:e.submit()}}}function fe(){const e=o.createRequestService(),t=o.useConfig(),n="/portal/auto-top-up-configs";return{getAutoTopUpConfigs:function(o){return e({url:`${t.apiUrls.config}${n}`,query:{...o},isCollection:!0})},getAutoTopUpConfig:function(o){return e({url:`${t.apiUrls.config}${n}/${o}`})},createAutoTopUpConfig:function(o){return e({url:`${t.apiUrls.config}${n}`,options:{method:"POST"},data:o})},deactivateAutoTopUpConfig:function(o){return e({url:`${t.apiUrls.config}${n}/${o}/deactivate`,options:{method:"POST"}})}}}function he(){const{createAutoTopUpConfig:t}=fe(),n=o.useLogger(),a=e.ref(!1);return{save:async e=>{if(!e||a.value)return{saved:!1};a.value=!0;try{return await t(e),{saved:!0}}catch(o){return n.error("AUTO_TOP_UP_SAVE_FAILED","Failed to save the automatic top-up rule",{},o),{saved:!1,error:o}}finally{a.value=!1}},isSaving:a}}const _e={class:"grid grid-cols-1 gap-4 pb-4"},ge={key:0,class:"mb-4"},ye={class:"sr-only"},be={class:"flex flex-col gap-2"},we=e.defineComponent({__name:"TopUpModal",props:{showModal:{type:Boolean},selectedBalanceItem:{type:Object},paymentMethods:{type:Array},customer:{type:Object},subscriptions:{type:Array}},emits:["confirm","close","auto-top-up-saved","payment-success","payment-failed"],setup(o,{emit:n}){const a=o,i=n,{$t:l}=t.useIntl(),{formatOpenBalance:u}=Q(),s=e.computed(()=>ce(se(a.selectedBalanceItem))),c=e.computed(()=>u(a.selectedBalanceItem)),h=e.computed(()=>v(a.selectedBalanceItem,a.subscriptions??[])),_=e.ref();e.watch(h,e=>{var t;e.some(({id:e})=>e===_.value)||(_.value=null==(t=e[0])?void 0:t.id)},{immediate:!0});const g=e.computed(()=>h.value.length>1),y=e.computed(()=>h.value.map(({id:e,name:t})=>({value:e,label:t}))),b=e.computed(()=>Object.fromEntries(h.value.flatMap(({id:e,enabledPricingIds:t})=>{const o=(a.subscriptions??[]).find(({id:t})=>t===e);return o?[[e,{subscription:o,enabledPricingIds:t}]]:[]}))),w=e.computed(()=>{var e;if(!a.selectedBalanceItem||!(null==(e=a.subscriptions)?void 0:e.length))return a.selectedBalanceItem;const t=h.value.find(({id:e})=>e===_.value);return t?((e,t)=>{if(!e||0===t.length)return e;const o=new Set(t);return{...e,charge_on_demand_pricing_items:(e.charge_on_demand_pricing_items??[]).filter(e=>m(e)&&!!e.pricing_plan_schedule_id&&o.has(e.pricing_plan_schedule_id))}})(a.selectedBalanceItem,t.scheduleIds):{...a.selectedBalanceItem,charge_on_demand_pricing_items:[]}}),x=e.computed(()=>f(w.value)),{paymentMethodOptions:M,settledOptions:C,isPending:B}=ue({isOpen:e.computed(()=>a.showModal),customer:e.computed(()=>a.customer)}),P=e.ref("TOP_UP"),S=e.computed(()=>(a.paymentMethods??[]).length>0),T=e.computed(()=>!B.value&&0===(M.value??[]).length),I=e.computed(()=>"TOP_UP"===P.value&&!S.value&&T.value),k=e.ref(),N=e.ref(),V=()=>{$(),i("payment-success")},{paneRef:E,isActive:U,isSaving:A,open:O,leave:$,submit:D}=ve({step:P,name:"ADD_PAYMENT_METHOD",returnTo:"TOP_UP"}),{save:q}=he(),R=e.ref(),L=e.computed(()=>{var e;return null==(e=R.value)?void 0:e.chargedValue}),F=e.computed(()=>{var e;return A.value||!!(null==(e=R.value)?void 0:e.isCharging)}),{title:j,subTitle:Y,cancelButtonText:H,confirmButtonText:z}=function({step:o,currentBalance:n,topUpValue:a}){const{$t:i,formatNumber:l}=t.useIntl();return{title:e.computed(()=>"ADD_PAYMENT_METHOD"===o.value?i({defaultMessage:"Add payment method",description:"Title of the top-up modal while the customer is adding a payment method",id:"topup_modal.add_payment_method.title"}):"SUCCESS"===o.value?i({defaultMessage:"Top-up complete",description:"Title of the top-up modal once the top-up has been charged",id:"topup_modal.success.modal_title"}):i({defaultMessage:"Top up balance",description:"Title of the wallet top-up modal",id:"topup_modal.title"})),subTitle:e.computed(()=>"ADD_PAYMENT_METHOD"===o.value?i({defaultMessage:"Add a new payment method for topping up your balance.",description:"Subtitle of the top-up modal while the customer is adding a payment method",id:"topup_modal.add_payment_method.subtitle"}):"SUCCESS"===o.value?i({defaultMessage:"Your payment went through.",description:"Subtitle of the top-up modal once the top-up has been charged",id:"topup_modal.success.modal_subtitle"}):i({defaultMessage:"Your current balance is {balance}.",description:"Subtitle of the top-up modal showing the current wallet balance",id:"topup_modal.subtitle"},{balance:n.value})),cancelButtonText:e.computed(()=>"ADD_PAYMENT_METHOD"===o.value?i({defaultMessage:"Back",description:"Label of the button that leaves the add payment method step in the top-up modal",id:"topup_modal.back_button.label"}):i({defaultMessage:"Cancel",description:"Label of the button that closes the top-up modal",id:"topup_modal.cancel_button.label"})),confirmButtonText:e.computed(()=>"ADD_PAYMENT_METHOD"===o.value?i({defaultMessage:"Save payment method",description:"Label of the confirm button in the top-up modal while adding a payment method",id:"topup_modal.save_payment_method.label"}):"SUCCESS"===o.value?i({defaultMessage:"Done",description:"Label of the button that dismisses the top-up modal once the top-up has been charged",id:"topup_modal.done_button.label"}):a.value?i({defaultMessage:"Top up balance with {value}",description:"Label of the confirm button in the top-up modal once an amount is entered",id:"topup_modal.confirm_button.label"},{value:t.formatWalletBalanceValue(i,l,a.value)}):i({defaultMessage:"Top up balance",description:"Label of the confirm button in the top-up modal while no amount is entered",id:"topup_modal.confirm_button.empty.label"}))}}({step:P,currentBalance:c,topUpValue:L}),W=()=>{var e;U.value?D():null==(e=R.value)||e.submit()},X=async({rule:e,paymentMethodId:t})=>{const{saved:o}=await q(me({rule:e,walletBalanceItem:a.selectedBalanceItem,chargeTarget:pe(void 0,x.value),paymentMethodId:t}));o&&i("auto-top-up-saved")},J=e=>{var t;k.value=e,N.value=null==(t=R.value)?void 0:t.chargedValue,P.value="SUCCESS"},K=()=>{i("confirm"),i("close")},G=()=>{F.value||(U.value?$():"SUCCESS"!==P.value?i("close"):K())},Z=e.ref(0);return e.watch(()=>a.showModal,e=>{e&&(P.value="TOP_UP",k.value=void 0,N.value=void 0,Z.value+=1)}),(n,a)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{"no-click-away":"","show-modal":o.showModal,size:"lg",title:e.unref(j),"sub-title":e.unref(Y),"cancel-button-text":e.unref(H),"confirm-button-text":e.unref(z),"is-loading":F.value,onConfirm:W,onClose:G},e.createSlots({body:e.withCtx(()=>[e.createElementVNode("div",_e,[e.createVNode(de,{panes:e.unref(p),current:P.value},{TOP_UP:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(t._sfc_main$10),{modelValue:_.value,"onUpdate:modelValue":a[0]||(a[0]=e=>_.value=e),class:"sv-topup-modal__subscription",name:"top-up-subscription",direction:"column",required:"",options:y.value,"show-radio":!1,label:e.unref(l)({defaultMessage:"Subscription to top up",description:"Label above the list of subscriptions a top-up can be charged against, in the top-up modal",id:"topup_modal.subscriptions.label"})},{prefix:e.withCtx(({optionValue:t})=>[b.value[String(t)]?(e.openBlock(),e.createBlock(d._sfc_main,{key:0,class:"sv-topup-modal__subscription-option grow","no-spacing":"",subscription:b.value[String(t)].subscription,"enabled-pricing-ids":b.value[String(t)].enabledPricingIds},null,8,["subscription","enabled-pricing-ids"])):e.createCommentVNode("",!0)]),label:e.withCtx(({option:t})=>[e.createElementVNode("span",ye,e.toDisplayString(t.label),1)]),_:1},8,["modelValue","options","label"])])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(ae,{key:Z.value,ref_key:"topUpFormRef",ref:R,"top-up-pricing-items":x.value,"payment-methods":o.paymentMethods,"auto-top-up-config":s.value,"payment-method-options":e.unref(C),onAddPaymentMethod:e.unref(O),onSuccess:J,onSaveAutoTopUp:X},null,8,["top-up-pricing-items","payment-methods","auto-top-up-config","payment-method-options","onAddPaymentMethod"]))]),ADD_PAYMENT_METHOD:e.withCtx(()=>[e.createVNode(r._sfc_main$1,{ref_key:"addPaymentMethodRef",ref:E,customer:o.customer,"payment-method-options":e.unref(M),"is-loading":e.unref(B),"is-active":e.unref(U),onSuccess:V,onFailure:a[1]||(a[1]=e=>n.$emit("payment-failed",e))},null,8,["customer","payment-method-options","is-loading","is-active"])]),SUCCESS:e.withCtx(()=>[k.value?(e.openBlock(),e.createBlock(le,{key:0,"added-value":N.value,invoice:k.value},null,8,["added-value","invoice"])):e.createCommentVNode("",!0)]),_:1},8,["panes","current"])])]),_:2},["SUCCESS"===P.value||I.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",be,["SUCCESS"===P.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$6),{key:0,size:"lg","data-testid":"done",onClick:K},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(z)),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$6),{size:"lg",disabled:"","data-testid":"confirm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(z)),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$6),{size:"lg",color:"gray",variant:"ghost","data-testid":"cancel",onClick:G},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(H)),1)]),_:1})],64))])]),key:"0"}:void 0]),1032,["show-modal","title","sub-title","cancel-button-text","confirm-button-text","is-loading"]))}}),xe=["AUTO_TOP_UP","ADD_PAYMENT_METHOD"],Me={class:"grid grid-cols-1 gap-4 pb-4"},Ce={class:"grid grid-cols-1 gap-4"},Be=e.defineComponent({__name:"AutoTopUpModal",props:{showModal:{type:Boolean},walletBalanceItem:{type:Object},topUpItem:{type:Object},paymentMethods:{type:Array},customer:{type:Object}},emits:["saved","close","payment-success","payment-failed"],setup(o,{emit:n}){const a=o,l=n,{$t:u}=t.useIntl(),{formatOpenBalance:d}=Q(),s=e.ref("AUTO_TOP_UP"),c=e.computed(()=>d(a.walletBalanceItem)),p=e.computed(()=>f(a.walletBalanceItem)),m=e.computed(()=>S(p.value)),v=e.computed(()=>se(a.walletBalanceItem)),h=e.computed(()=>ce(v.value)),_=e.computed(()=>pe(a.topUpItem,p.value)),g=e.ref(),y=e.computed(()=>{var e,t;const o=null==(t=null==(e=g.value)?void 0:e.rule)?void 0:t.topup_amount;return(null==o?void 0:o.quantity)&&_.value?[{pricing_item_id:_.value.pricingItemId,flexible_amount:o}]:void 0}),b=e.computed(()=>{var e;return null==(e=_.value)?void 0:e.pricingPlanScheduleId}),w=e.ref(),{sortedPaymentMethods:x}=G({paymentMethods:e.computed(()=>a.paymentMethods),selectedPaymentMethodId:w,preferredPaymentMethodId:e.computed(()=>{var e;return null==(e=v.value)?void 0:e.payment_method_id})}),{paymentMethodOptions:M,settledOptions:C,isPending:B}=ue({isOpen:e.computed(()=>a.showModal),customer:e.computed(()=>a.customer)}),{paneRef:P,isActive:T,isSaving:k,open:N,leave:V,submit:E}=ve({step:s,name:"ADD_PAYMENT_METHOD",returnTo:"AUTO_TOP_UP"}),{save:U,isSaving:A}=he(),O=e.computed(()=>k.value||A.value),$=e.reactive({paymentMethodId:e.computed(()=>w.value??null)}),D=t.useValidation({paymentMethodId:{required:i.common.withMessage(()=>u({defaultMessage:"Select a payment method to pay for automatic top-ups.",description:"Error shown in the auto top-up modal when no payment method is selected",id:"auto_topup_modal.payment_method.required"}),i.required)}},$),q=e.computed(()=>"ADD_PAYMENT_METHOD"===s.value?u({defaultMessage:"Add payment method",description:"Title of the auto top-up modal while the customer is adding a payment method",id:"auto_topup_modal.add_payment_method.title"}):u({defaultMessage:"Automatic top-up",description:"Title of the automatic wallet top-up modal",id:"auto_topup_modal.title"})),R=e.computed(()=>"ADD_PAYMENT_METHOD"===s.value?u({defaultMessage:"This method pays for every automatic top-up.",description:"Subtitle of the auto top-up modal while the customer is adding a payment method",id:"auto_topup_modal.add_payment_method.subtitle"}):u({defaultMessage:"Your current balance is {balance}. Enable auto top so you can stay productive",description:"Subtitle of the automatic wallet top-up modal, naming the balance",id:"auto_topup_modal.subtitle"},{balance:c.value})),L=e.computed(()=>"ADD_PAYMENT_METHOD"===s.value?u({defaultMessage:"Back",description:"Button returning from adding a payment method to the auto top-up rule",id:"auto_topup_modal.add_payment_method.cancel"}):u({defaultMessage:"Cancel",description:"Button dismissing the auto top-up modal",id:"auto_topup_modal.cancel"})),F=e.computed(()=>"ADD_PAYMENT_METHOD"===s.value?u({defaultMessage:"Add payment method",description:"Button storing the payment method being added in the auto top-up modal",id:"auto_topup_modal.add_payment_method.confirm"}):u({defaultMessage:"Save",description:"Button saving the automatic top-up rule",id:"auto_topup_modal.confirm"}));const j=()=>{T.value?E():async function(){var e;if(D.value.$touch(),O.value)return;const{saved:t,error:o}=await U(me({rule:null==(e=g.value)?void 0:e.validate(),walletBalanceItem:a.walletBalanceItem,chargeTarget:_.value,paymentMethodId:w.value}));if(t)return l("saved"),void l("close");o&&l("payment-failed",o)}()},Y=()=>{V(),l("payment-success")},H=()=>{O.value||(T.value?V():l("close"))},z=e.ref(0);return e.watch(()=>a.showModal,e=>{e&&(s.value="AUTO_TOP_UP",w.value=void 0,z.value+=1)}),(n,a)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{"no-click-away":"","show-modal":o.showModal,size:"lg",title:q.value,"sub-title":R.value,"cancel-button-text":L.value,"confirm-button-text":F.value,"is-loading":O.value,onConfirm:j,onClose:H},{body:e.withCtx(()=>[e.createElementVNode("div",Me,[e.createVNode(de,{panes:e.unref(xe),current:s.value},{AUTO_TOP_UP:e.withCtx(()=>[e.createElementVNode("div",Ce,[m.value?(e.openBlock(),e.createBlock(J,e.mergeProps({key:z.value,ref_key:"autoTopUpFormRef",ref:g,class:"sv-auto-topup-modal__rule"},m.value,{config:h.value,"always-enabled":"",disabled:O.value}),null,16,["config","disabled"])):e.createCommentVNode("",!0),e.createVNode(I,{"pricing-plan-schedule-id":b.value,"pricing-items":y.value},null,8,["pricing-plan-schedule-id","pricing-items"]),e.createVNode(r._sfc_main,{modelValue:w.value,"onUpdate:modelValue":a[0]||(a[0]=e=>w.value=e),class:"sv-auto-topup-modal__payment-method","payment-methods":e.unref(x),"payment-method-options":e.unref(C),disabled:O.value,error:e.unref(D).paymentMethodId.$errors,label:e.unref(u)({defaultMessage:"Pay automatic top-ups with",description:"Label above the payment method an automatic top-up is charged to",id:"auto_topup_modal.payment_method.label"}),onAddPaymentMethod:e.unref(N)},null,8,["modelValue","payment-methods","payment-method-options","disabled","error","label","onAddPaymentMethod"])])]),ADD_PAYMENT_METHOD:e.withCtx(()=>[e.createVNode(r._sfc_main$1,{ref_key:"addPaymentMethodRef",ref:P,customer:o.customer,"payment-method-options":e.unref(M),"is-loading":e.unref(B),"is-active":e.unref(T),onSuccess:Y,onFailure:a[1]||(a[1]=e=>n.$emit("payment-failed",e))},null,8,["customer","payment-method-options","is-loading","is-active"])]),_:1},8,["panes","current"])])]),_:1},8,["show-modal","title","sub-title","cancel-button-text","confirm-button-text","is-loading"]))}}),Pe={class:"sv-auto-topup-cancellation-modal sv-auto-topup-cancellation-modal__body flex flex-col gap-3"},Se=e.defineComponent({__name:"AutoTopUpCancellationModal",props:{showModal:{type:Boolean},config:{type:Object}},emits:["confirmed","close"],setup(n,{emit:a}){const i=n,l=a,{$t:u}=t.useIntl(),r=o.useLogger(),{formatValue:d}=Q(),{deactivateAutoTopUpConfig:s}=fe(),c=e.ref(!1),p=e.ref(!1);e.watch(()=>i.showModal,e=>{e&&(p.value=!1)});const m=e.computed(()=>{var e,t;const o=null==(e=i.config)?void 0:e.threshold,n=null==(t=i.config)?void 0:t.topup_amount;return(null==o?void 0:o.amount)||(null==o?void 0:o.credits)?n?u({defaultMessage:"Your balance will no longer be topped up with {amount} when it falls below {threshold}. You can still top up whenever you want to.",description:"Explanation in the modal that turns a wallet automatic top-up off, naming what it charged and when",id:"auto_topup_cancellation_modal.explanation_with_amount"},{amount:d({amount:n}),threshold:d(o)}):u({defaultMessage:"Your balance will no longer be topped up automatically when it falls below {threshold}. You can still top up whenever you want to.",description:"Explanation in the modal that turns a wallet automatic top-up off, naming the threshold",id:"auto_topup_cancellation_modal.explanation_with_threshold"},{threshold:d(o)}):u({defaultMessage:"Your balance will no longer be topped up automatically. You can still top up whenever you want to.",description:"Explanation in the modal that turns a wallet automatic top-up off",id:"auto_topup_cancellation_modal.explanation"})}),v=async()=>{var e;const t=null==(e=i.config)?void 0:e.id;if(t&&!c.value){c.value=!0,p.value=!1;try{await s(t),l("confirmed"),l("close")}catch(o){r.error("AUTO_TOP_UP_CANCELLATION_FAILED","Failed to turn off a wallet's automatic top-up",{},o),p.value=!0}finally{c.value=!1}}},f=()=>{c.value||l("close")};return(o,a)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{size:"sm","show-modal":n.showModal,"is-loading":c.value,"no-click-away":c.value,"no-backdrop-close":c.value,title:e.unref(u)({defaultMessage:"Turn off automatic top-up",description:"Title of the modal that turns a wallet automatic top-up off",id:"auto_topup_cancellation_modal.title"}),"confirm-button-text":e.unref(u)({defaultMessage:"Yes, turn it off",description:"Button confirming that a wallet automatic top-up is turned off",id:"auto_topup_cancellation_modal.confirm"}),"cancel-button-text":e.unref(u)({defaultMessage:"Cancel",description:"Button dismissing the modal that turns a wallet automatic top-up off",id:"auto_topup_cancellation_modal.cancel"}),onConfirm:v,onClose:f},{body:e.withCtx(()=>[e.createElementVNode("div",Pe,[e.createVNode(e.unref(t._sfc_main$1),{variant:"body-sm",shade:"lighter",tag:"p",class:"sv-auto-topup-cancellation-modal__explanation"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value),1)]),_:1}),p.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),{key:0,class:"sv-auto-topup-cancellation-modal__error sv-error",title:e.unref(u)({defaultMessage:"Could not turn off the automatic top-up. Please try again later.",description:"Error shown when turning a wallet automatic top-up off failed",id:"auto_topup_cancellation_modal.failed"})},null,8,["title"])):e.createCommentVNode("",!0)])]),_:1},8,["show-modal","is-loading","no-click-away","no-backdrop-close","title","confirm-button-text","cancel-button-text"]))}}),Te=e.defineComponent({inheritAttrs:!1,__name:"CustomerWalletBalances",props:{hasError:{type:Boolean},isLoading:{type:Boolean},walletBalances:{type:Array},showTopUpButton:{type:Boolean},customer:{type:Object},paymentMethods:{type:Array},subscriptions:{type:Array}},emits:["top-up-charged","auto-top-up-saved","auto-top-up-cancelled","payment-method-stored","payment-failed"],setup(o,{emit:n}){const i=o,l=n,{$t:u}=t.useIntl(),r=e.ref(),d=e.computed(()=>c(i.walletBalances,r.value)),s=e.computed(()=>!!d.value),p=e.ref(),m=e.computed(()=>!!p.value),v=e.computed(()=>c(i.walletBalances,p.value)),f=e.ref(),h=e.computed(()=>!!f.value);return(n,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o.isLoading?(e.openBlock(),e.createBlock(a._sfc_main,e.mergeProps({key:0,variant:"section"},n.$attrs,{class:"sv-wallet-balances sv-root sv-component sv-loading min-h-48","data-testid":"customer-wallet-balances-skeleton"}),null,16)):o.hasError?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),e.mergeProps({key:1},n.$attrs,{class:"sv-wallet-balances sv-root sv-component sv-error",title:e.unref(u)({defaultMessage:"Could not load wallet balances",description:"Error shown when wallet balances fail to load",id:"wallet_balance.load_failed"})}),null,16,["title"])):o.walletBalances.length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$33),e.mergeProps({key:2},n.$attrs,{class:"sv-wallet-balances sv-root sv-component","customer-wallet-balances":o.walletBalances,"show-auto-top-up":"","show-manual-top-up":"",title:e.unref(u)({defaultMessage:"{count, plural, one {Wallet} other {Wallets}}",description:"Title for the wallets block on the customer overview page",id:"customer_overview.wallet_balances_block.title"},{count:String(o.walletBalances.length)}),onTopUp:i[0]||(i[0]=e=>r.value=e),onAutoTopUp:i[1]||(i[1]=e=>p.value=e),onCancelAutoTopUp:i[2]||(i[2]=e=>f.value=e)}),null,16,["customer-wallet-balances","title"])):e.createCommentVNode("",!0),o.showTopUpButton?(e.openBlock(),e.createBlock(we,{key:3,"show-modal":s.value,"selected-balance-item":d.value,"payment-methods":o.paymentMethods,customer:o.customer,subscriptions:o.subscriptions,onClose:i[3]||(i[3]=e=>r.value=void 0),onConfirm:i[4]||(i[4]=e=>l("top-up-charged")),onPaymentSuccess:i[5]||(i[5]=e=>l("payment-method-stored")),onPaymentFailed:i[6]||(i[6]=e=>l("payment-failed",e))},null,8,["show-modal","selected-balance-item","payment-methods","customer","subscriptions"])):e.createCommentVNode("",!0),o.showTopUpButton?(e.openBlock(),e.createBlock(Be,{key:4,"show-modal":m.value,"wallet-balance-item":v.value,"top-up-item":p.value,"payment-methods":o.paymentMethods,customer:o.customer,onClose:i[7]||(i[7]=e=>p.value=void 0),onSaved:i[8]||(i[8]=e=>l("auto-top-up-saved")),onPaymentSuccess:i[9]||(i[9]=e=>l("payment-method-stored")),onPaymentFailed:i[10]||(i[10]=e=>l("payment-failed",e))},null,8,["show-modal","wallet-balance-item","top-up-item","payment-methods","customer"])):e.createCommentVNode("",!0),o.showTopUpButton?(e.openBlock(),e.createBlock(Se,{key:5,"show-modal":h.value,config:f.value,onClose:i[11]||(i[11]=e=>f.value=void 0),onConfirmed:i[12]||(i[12]=e=>l("auto-top-up-cancelled"))},null,8,["show-modal","config"])):e.createCommentVNode("",!0)],64))}});exports._sfc_main=Te,exports.useCustomerWalletBalances=function({customerId:a}){const{getCustomerWalletBalances:i}=function(){const e=o.createRequestService(),n=o.useConfig();return{getCustomerWalletBalances:function(a){const i=t.withExpand({expandParams:o.EXPAND_ALL});return e({url:`${n.apiUrls.config}/portal/customers/${a}/wallets/balance${t.serializeQueryParams(i)}`,options:{method:"POST"},data:{}})}}}(),{data:l,execute:u,apiStatus:r,error:d,isPending:s}=n.useService({service:()=>i(a)});return{walletBalances:e.computed(()=>l.value??null),apiStatus:r,error:d,fetch:u,isPending:s}};
@@ -0,0 +1,53 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, renderSlot } from "vue";
2
+ import { b as _sfc_main$1, c as _sfc_main$2, a as _sfc_main$3 } from "./vendor-ui-ItGf7wJV.mjs";
3
+ const _hoisted_1 = { class: "sv-empty-state__body flex flex-col items-center justify-center py-2" };
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "EmptyStatePlaceholder",
6
+ props: {
7
+ icon: { type: null }
8
+ },
9
+ setup(__props) {
10
+ return (_ctx, _cache) => {
11
+ return openBlock(), createBlock(unref(_sfc_main$1), { class: "sv-empty-state" }, {
12
+ default: withCtx(() => [
13
+ createElementVNode("div", _hoisted_1, [
14
+ createVNode(unref(_sfc_main$2), {
15
+ icon: __props.icon,
16
+ size: "md",
17
+ class: "sv-empty-state__icon text-gray-500"
18
+ }, null, 8, ["icon"]),
19
+ createVNode(unref(_sfc_main$3), {
20
+ center: "",
21
+ tag: "span",
22
+ variant: "body-xs",
23
+ weight: "semibold",
24
+ shade: "lighter",
25
+ class: "sv-empty-state__title mt-1"
26
+ }, {
27
+ default: withCtx(() => [
28
+ renderSlot(_ctx.$slots, "title")
29
+ ]),
30
+ _: 3
31
+ }),
32
+ createVNode(unref(_sfc_main$3), {
33
+ center: "",
34
+ tag: "span",
35
+ variant: "body-xs",
36
+ shade: "lightest",
37
+ class: "sv-empty-state__message mt-1"
38
+ }, {
39
+ default: withCtx(() => [
40
+ renderSlot(_ctx.$slots, "message")
41
+ ]),
42
+ _: 3
43
+ })
44
+ ])
45
+ ]),
46
+ _: 3
47
+ });
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ _sfc_main as _
53
+ };
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),s={class:"sv-empty-state__body flex flex-col items-center justify-center py-2"},a=e.defineComponent({__name:"EmptyStatePlaceholder",props:{icon:{type:null}},setup:a=>(n,c)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),{class:"sv-empty-state"},{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$3),{icon:a.icon,size:"md",class:"sv-empty-state__icon text-gray-500"},null,8,["icon"]),e.createVNode(e.unref(t._sfc_main$1),{center:"",tag:"span",variant:"body-xs",weight:"semibold",shade:"lighter",class:"sv-empty-state__title mt-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"title")]),_:3}),e.createVNode(e.unref(t._sfc_main$1),{center:"",tag:"span",variant:"body-xs",shade:"lightest",class:"sv-empty-state__message mt-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"message")]),_:3})])]),_:3}))});exports._sfc_main=a;
@@ -0,0 +1 @@
1
+ const e=require("vue"),i=require("./vendor-ui-Dfh3_g4q.js"),t={key:0,class:"sv-invoice-details__body flex flex-col gap-2"},o={class:"sv-invoice-details__row"},a={class:"sv-invoice-details__row"},n=e.defineComponent({__name:"InvoiceDetailsBlock",props:{invoice:{type:Object}},setup(n){const{$t:c,formatDate:s}=i.useIntl();return(d,l)=>(e.openBlock(),e.createBlock(e.unref(i._sfc_main$2),{class:"sv-invoice-details",title:e.unref(c)({defaultMessage:"Invoice details",description:"Title for the invoice details block on the invoice overview page",id:"sdk.invoice_details.invoice_details_block.title"})},{default:e.withCtx(()=>[n.invoice?(e.openBlock(),e.createElementBlock("div",t,[e.createElementVNode("div",o,[e.createVNode(e.unref(i._sfc_main$1),{variant:"caps-heading",class:"sv-invoice-details__label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({defaultMessage:"Invoice date",description:"Title for the invoice date in invoice details block on the invoice overview page",id:"sdk.invoice_details.invoice_details_block.invoice_date"})),1)]),_:1}),n.invoice.invoice_date?(e.openBlock(),e.createBlock(e.unref(i._sfc_main$1),{key:0,variant:"body-xs",class:"sv-invoice-details__value"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)({date:n.invoice.invoice_date,format:"date",timezone:n.invoice.customer.timezone,offsetType:"offsetted"})),1)]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",a,[e.createVNode(e.unref(i._sfc_main$1),{variant:"caps-heading",class:"sv-invoice-details__label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({defaultMessage:"Due date",description:"Title for the due date in invoice details block on the invoice overview page",id:"sdk.invoice_details.invoice_details_block.due_date"})),1)]),_:1}),n.invoice.due_date?(e.openBlock(),e.createBlock(e.unref(i._sfc_main$1),{key:0,variant:"body-xs",class:"sv-invoice-details__value"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)({date:n.invoice.due_date,format:"date",timezone:n.invoice.customer.timezone,offsetType:"offsetted"})),1)]),_:1})):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),_:1},8,["title"]))}});exports._sfc_main=n;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, withCtx, createElementBlock, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
- import { u as useIntl, _ as _sfc_main$1, e as _sfc_main$2 } from "./vendor-ui-B8IlviSs.mjs";
2
+ import { u as useIntl, b as _sfc_main$1, a as _sfc_main$2 } from "./vendor-ui-ItGf7wJV.mjs";
3
3
  const _hoisted_1 = {
4
4
  key: 0,
5
5
  class: "sv-invoice-details__body flex flex-col gap-2"
@@ -1 +1 @@
1
- const e=require("vue"),o=require("./vendor-ui-C3Tq-qY_.js"),n=e.defineComponent({__name:"InvoiceHeader",props:{isLoading:{type:Boolean},invoice:{type:Object},payments:{type:Array},invoiceDownloadService:{type:Function},configuration:{type:Object}},setup:n=>(i,t)=>(e.openBlock(),e.createBlock(e.unref(o._sfc_main$2),{class:"sv-invoice-header sv-root sv-component","payment-attempts":n.payments??[],invoice:n.invoice,"download-service":()=>n.invoiceDownloadService(n.invoice.id),"show-download-button":n.configuration.enableDownloadButton,variant:"external"},null,8,["payment-attempts","invoice","download-service","show-download-button"]))});exports._sfc_main=n;
1
+ const e=require("vue"),o=require("./vendor-ui-Dfh3_g4q.js"),n=e.defineComponent({__name:"InvoiceHeader",props:{isLoading:{type:Boolean},invoice:{type:Object},payments:{type:Array},invoiceDownloadService:{type:Function},configuration:{type:Object}},setup:n=>(i,t)=>(e.openBlock(),e.createBlock(e.unref(o._sfc_main$4),{class:"sv-invoice-header sv-root sv-component","payment-attempts":n.payments??[],invoice:n.invoice,"download-service":()=>n.invoiceDownloadService(n.invoice.id),"show-download-button":n.configuration.enableDownloadButton,variant:"external"},null,8,["payment-attempts","invoice","download-service","show-download-button"]))});exports._sfc_main=n;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createBlock, unref } from "vue";
2
- import { d as _sfc_main$1 } from "./vendor-ui-B8IlviSs.mjs";
2
+ import { e as _sfc_main$1 } from "./vendor-ui-ItGf7wJV.mjs";
3
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
4
  __name: "InvoiceHeader",
5
5
  props: {
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),a=require("./PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js"),n=e.defineComponent({__name:"PaymentCompletedCard",props:{amount:{type:Object},variant:{type:String}},setup(n){const i=n,{$t:s}=t.useIntl(),o=e.computed(()=>"AUTHORIZE"===i.variant?s({defaultMessage:"Payment successful",description:"The title for when a payment has been successful",id:"payment_completed_card.title.authorize"}):s({defaultMessage:"Your payment method is added",description:"The title for when a payment method was successfully added",id:"payment_completed_card.title.tokenize"}));return(i,r)=>(e.openBlock(),e.createBlock(a._sfc_main,{status:"success",title:o.value},{default:e.withCtx(()=>[n.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(t.formatAmount)(n.amount)),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$1),{variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)({defaultMessage:"You are being redirected...",description:"The text shown after a successful message before a redirect",id:"payment_completed_card.redirect_message"})),1)]),_:1})]),_:1},8,["title"]))}}),i={UNKNOWN_ERROR:{title:"Something went wrong",message:"An unknown error has occurred",isReloadButtonVisible:!0},AUTHORIZATION_FAILED:{title:"Payment failed",message:"The payment failed"},PAYMENT_DETAILS_CALL_FAILED:{title:"Payment details call failed",message:"There was a problem getting the payment details"},PAYMENT_METHOD_STORAGE_FAILED:{title:"Failed storing payment method",message:"Something went wrong with storing the payment method"},REDIRECT_RESULT_PAYMENT_ACCEPTOR_MISSING:{title:"Missing payment acceptor",message:"A redirect result is set, but a payment acceptor is missing in the url"},TOKENIZE_FAILED:{title:"Tokenization failed",message:"The tokenization of the payment method has failed"},PAYMENT_INTEGRATION_INITIALIZATION_FAILED:{title:"Failed loading payment methods",message:"Failed loading payment integration",isReloadButtonVisible:!0},RESOURCE_REVOKED:{title:"Resource revoked",message:"The resource has been revoked",isReloadButtonVisible:!0}},s={class:"flex flex-col items-center gap-6"},o=e.defineComponent({__name:"PaymentErrorCard",props:{error:{type:Object}},setup(n){const o=n,{$t:r}=t.useIntl(),l=e.computed(()=>i[o.error.code]),d=()=>{window.location.reload()};return(n,i)=>(e.openBlock(),e.createBlock(a._sfc_main,{status:"error",title:l.value.title},{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$1),{variant:"body-xs",shade:"lighter",class:"mt-3"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.message),1)]),_:1}),l.value.isReloadButtonVisible?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$6),{key:0,type:"button",color:"gray",variant:"outline",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Try again",description:"Retry button text when an error has happened during a payment",id:"payments.retry_button.label"})),1)]),_:1})):e.createCommentVNode("",!0)])]),_:1},8,["title"]))}});exports._sfc_main=n,exports._sfc_main$1=o;
@@ -0,0 +1,153 @@
1
+ import { defineComponent, computed, openBlock, createBlock, withCtx, unref, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
2
+ import { u as useIntl, a as _sfc_main$3, c as _sfc_main$4, E as formatAmount, k as _sfc_main$5 } from "./vendor-ui-ItGf7wJV.mjs";
3
+ import { _ as _sfc_main$2 } from "./PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs";
4
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5
+ __name: "PaymentCompletedCard",
6
+ props: {
7
+ amount: { type: Object },
8
+ variant: { type: String }
9
+ },
10
+ setup(__props) {
11
+ const props = __props;
12
+ const { $t } = useIntl();
13
+ const title = computed(
14
+ () => props.variant === "AUTHORIZE" ? $t({
15
+ defaultMessage: "Payment successful",
16
+ description: "The title for when a payment has been successful",
17
+ id: "payment_completed_card.title.authorize"
18
+ }) : $t({
19
+ defaultMessage: "Your payment method is added",
20
+ description: "The title for when a payment method was successfully added",
21
+ id: "payment_completed_card.title.tokenize"
22
+ })
23
+ );
24
+ return (_ctx, _cache) => {
25
+ return openBlock(), createBlock(_sfc_main$2, {
26
+ status: "success",
27
+ title: title.value
28
+ }, {
29
+ default: withCtx(() => [
30
+ __props.amount ? (openBlock(), createBlock(unref(_sfc_main$3), {
31
+ key: 0,
32
+ variant: "body-sm",
33
+ class: "mt-1"
34
+ }, {
35
+ default: withCtx(() => [
36
+ createVNode(unref(_sfc_main$4), { icon: "check" }),
37
+ createTextVNode(toDisplayString(unref(formatAmount)(__props.amount)), 1)
38
+ ]),
39
+ _: 1
40
+ })) : createCommentVNode("", true),
41
+ createVNode(unref(_sfc_main$3), {
42
+ variant: "body-xs",
43
+ shade: "lighter"
44
+ }, {
45
+ default: withCtx(() => [
46
+ createTextVNode(toDisplayString(unref($t)({
47
+ defaultMessage: "You are being redirected...",
48
+ description: "The text shown after a successful message before a redirect",
49
+ id: "payment_completed_card.redirect_message"
50
+ })), 1)
51
+ ]),
52
+ _: 1
53
+ })
54
+ ]),
55
+ _: 1
56
+ }, 8, ["title"]);
57
+ };
58
+ }
59
+ });
60
+ const ErrorMap = {
61
+ UNKNOWN_ERROR: {
62
+ title: "Something went wrong",
63
+ message: "An unknown error has occurred",
64
+ isReloadButtonVisible: true
65
+ },
66
+ AUTHORIZATION_FAILED: {
67
+ title: "Payment failed",
68
+ message: "The payment failed"
69
+ },
70
+ PAYMENT_DETAILS_CALL_FAILED: {
71
+ title: "Payment details call failed",
72
+ message: "There was a problem getting the payment details"
73
+ },
74
+ PAYMENT_METHOD_STORAGE_FAILED: {
75
+ title: "Failed storing payment method",
76
+ message: "Something went wrong with storing the payment method"
77
+ },
78
+ REDIRECT_RESULT_PAYMENT_ACCEPTOR_MISSING: {
79
+ title: "Missing payment acceptor",
80
+ message: "A redirect result is set, but a payment acceptor is missing in the url"
81
+ },
82
+ TOKENIZE_FAILED: {
83
+ title: "Tokenization failed",
84
+ message: "The tokenization of the payment method has failed"
85
+ },
86
+ PAYMENT_INTEGRATION_INITIALIZATION_FAILED: {
87
+ title: "Failed loading payment methods",
88
+ message: "Failed loading payment integration",
89
+ isReloadButtonVisible: true
90
+ },
91
+ RESOURCE_REVOKED: {
92
+ title: "Resource revoked",
93
+ message: "The resource has been revoked",
94
+ isReloadButtonVisible: true
95
+ }
96
+ };
97
+ const _hoisted_1 = { class: "flex flex-col items-center gap-6" };
98
+ const _sfc_main = /* @__PURE__ */ defineComponent({
99
+ __name: "PaymentErrorCard",
100
+ props: {
101
+ error: { type: Object }
102
+ },
103
+ setup(__props) {
104
+ const props = __props;
105
+ const { $t } = useIntl();
106
+ const errorConfig = computed(() => ErrorMap[props.error.code]);
107
+ const reload = () => {
108
+ window.location.reload();
109
+ };
110
+ return (_ctx, _cache) => {
111
+ return openBlock(), createBlock(_sfc_main$2, {
112
+ status: "error",
113
+ title: errorConfig.value.title
114
+ }, {
115
+ default: withCtx(() => [
116
+ createElementVNode("div", _hoisted_1, [
117
+ createVNode(unref(_sfc_main$3), {
118
+ variant: "body-xs",
119
+ shade: "lighter",
120
+ class: "mt-3"
121
+ }, {
122
+ default: withCtx(() => [
123
+ createTextVNode(toDisplayString(errorConfig.value.message), 1)
124
+ ]),
125
+ _: 1
126
+ }),
127
+ errorConfig.value.isReloadButtonVisible ? (openBlock(), createBlock(unref(_sfc_main$5), {
128
+ key: 0,
129
+ type: "button",
130
+ color: "gray",
131
+ variant: "outline",
132
+ onClick: reload
133
+ }, {
134
+ default: withCtx(() => [
135
+ createTextVNode(toDisplayString(unref($t)({
136
+ defaultMessage: "Try again",
137
+ description: "Retry button text when an error has happened during a payment",
138
+ id: "payments.retry_button.label"
139
+ })), 1)
140
+ ]),
141
+ _: 1
142
+ })) : createCommentVNode("", true)
143
+ ])
144
+ ]),
145
+ _: 1
146
+ }, 8, ["title"]);
147
+ };
148
+ }
149
+ });
150
+ export {
151
+ _sfc_main$1 as _,
152
+ _sfc_main as a
153
+ };
@@ -0,0 +1,52 @@
1
+ import { defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, normalizeClass, createTextVNode, toDisplayString, renderSlot, createCommentVNode } from "vue";
2
+ import { b as _sfc_main$1, c as _sfc_main$2, a as _sfc_main$3 } from "./vendor-ui-ItGf7wJV.mjs";
3
+ const _hoisted_1 = { class: "flex flex-col items-center py-10" };
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "PaymentFeedbackCard",
6
+ props: {
7
+ status: { default: "success", type: String },
8
+ title: { type: String }
9
+ },
10
+ setup(__props) {
11
+ return (_ctx, _cache) => {
12
+ return openBlock(), createBlock(unref(_sfc_main$1), null, {
13
+ default: withCtx(() => [
14
+ createElementVNode("div", _hoisted_1, [
15
+ createVNode(unref(_sfc_main$2), {
16
+ icon: __props.status === "success" ? "check_circle" : "error",
17
+ class: normalizeClass({
18
+ "text-green-400": __props.status === "success",
19
+ "text-red-600": __props.status === "error"
20
+ }),
21
+ size: "lg"
22
+ }, null, 8, ["icon", "class"]),
23
+ createVNode(unref(_sfc_main$3), {
24
+ variant: "heading-3",
25
+ tag: "span",
26
+ class: "mt-2"
27
+ }, {
28
+ default: withCtx(() => [
29
+ createTextVNode(toDisplayString(__props.title), 1)
30
+ ]),
31
+ _: 1
32
+ }),
33
+ _ctx.$slots.default ? (openBlock(), createBlock(unref(_sfc_main$3), {
34
+ key: 0,
35
+ tag: "div",
36
+ variant: "body-sm"
37
+ }, {
38
+ default: withCtx(() => [
39
+ renderSlot(_ctx.$slots, "default")
40
+ ]),
41
+ _: 3
42
+ })) : createCommentVNode("", true)
43
+ ])
44
+ ]),
45
+ _: 3
46
+ });
47
+ };
48
+ }
49
+ });
50
+ export {
51
+ _sfc_main as _
52
+ };
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),s={class:"flex flex-col items-center py-10"},a=e.defineComponent({__name:"PaymentFeedbackCard",props:{status:{default:"success",type:String},title:{type:String}},setup:a=>(r,c)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),null,{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$3),{icon:"success"===a.status?"check_circle":"error",class:e.normalizeClass({"text-green-400":"success"===a.status,"text-red-600":"error"===a.status}),size:"lg"},null,8,["icon","class"]),e.createVNode(e.unref(t._sfc_main$1),{variant:"heading-3",tag:"span",class:"mt-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.title),1)]),_:1}),r.$slots.default?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,tag:"div",variant:"body-sm"},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])]),_:3}))});exports._sfc_main=a;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs";
1
+ import { _ as _sfc_main } from "./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js");exports.default=e._sfc_main;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js");exports.default=e._sfc_main;
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),a={class:"sv-payment-history"},n={class:"sv-payment-history__items flex flex-col-reverse gap-1"},s={class:"sv-payment-history__item-header mb-2 flex items-center justify-between"},r=e.defineComponent({__name:"PaymentHistoryBlock",props:{paymentAttempts:{type:Array},customer:{type:Object}},setup(r){const{$t:o,formatDate:i}=t.useIntl(),m={AUTHORIZED:"green",CANCELLED:"red",ERROR:"red",PENDING:"orange",PENDING_REFUND:"orange",REFUNDED:"orange",CHARGED_BACK:"orange",REFUSED:"red"};return(c,l)=>(e.openBlock(),e.createElementBlock("div",a,[e.createVNode(e.unref(t._sfc_main$1),{tag:"h2",variant:"heading-3",class:"sv-payment-history__title"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Payment history",description:"Title for the payment history block on the invoice details page",id:"sdk.invoice_details.payment_history.title"})),1)]),_:1}),e.createElementVNode("div",n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.paymentAttempts,a=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2),{key:a.id,class:"sv-payment-history__item mt-1 md:mt-2"},{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$1),{variant:"caps-heading",class:"sv-payment-history__item-title"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Payment attempt",description:"Title for the payment attempt block",id:"sdk.invoice_details.payment_history.payment_attempt"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$7),{class:"sv-payment-history__item-status",color:m[a.result]},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t.formatEnum)(a.result)),1)]),_:2},1032,["color"])]),a.payment_method_details?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$8),{key:0,class:"sv-payment-history__payment-method","payment-method":a.payment_method_details},{description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({date:a.created_at,format:"dateTime",offsetType:"offsetted",timezone:r.customer.timezone})),1)]),_:2},1032,["payment-method"])):e.createCommentVNode("",!0)]),_:2},1024))),128))])]))}});exports._sfc_main=r;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList, createBlock, createCommentVNode } from "vue";
2
- import { u as useIntl, e as _sfc_main$1, _ as _sfc_main$2, k as _sfc_main$3, l as formatEnum, m as _sfc_main$4 } from "./vendor-ui-B8IlviSs.mjs";
2
+ import { u as useIntl, a as _sfc_main$1, b as _sfc_main$2, l as _sfc_main$3, m as formatEnum, n as _sfc_main$4 } from "./vendor-ui-ItGf7wJV.mjs";
3
3
  const _hoisted_1 = { class: "sv-payment-history" };
4
4
  const _hoisted_2 = { class: "sv-payment-history__items flex flex-col-reverse gap-1" };
5
5
  const _hoisted_3 = { class: "sv-payment-history__item-header mb-2 flex items-center justify-between" };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js");exports.default=e._sfc_main;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js");exports.default=e._sfc_main;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs";
1
+ import { _ as _sfc_main } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-Dfh3_g4q.js"),n=e=>{var t;return"ADYEN"===(null==(t=e.integration.payment_gateway)?void 0:t.variant)},o=e=>{var t;return"STRIPE"===(null==(t=e.integration.payment_gateway)?void 0:t.variant)},a=({selectedIntegration:e,paymentMethodOption:t})=>{var n,o;return e===(null==(o=null==(n=t.integration)?void 0:n.payment_gateway)?void 0:o.variant)},r=e.defineComponent({__name:"PaymentIntegrationForm",props:{customerId:{type:String},variant:{type:String},context:{type:Object},paymentMethodOptions:{type:Array},countryCode:{type:String},invoiceId:{type:String},amount:{type:Object},selectedOption:{type:String},email:{type:String},name:{type:String},validateOnSubmit:{type:Function},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(r,{expose:i,emit:m}){const c=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./PaymentIntegrationFormStripe-Bnn8S1o5.js")).then(e=>e.default)),l=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./PaymentIntegrationFormAdyen-B-Jbu2hU.js")).then(e=>e.default)),d=r,u=m;i({submit:function(){var e,t;p.value||(f.value=!0,null==(e=d.validateOnSubmit)||e.call(d));null==(t=v.value.get(p.value))||t.submit()}});const{$t:y}=t.useIntl(),s=e.ref(),p=e.computed(()=>{var e,t;return s.value??(null==(t=null==(e=d.paymentMethodOptions[0])?void 0:e.integration.payment_gateway)?void 0:t.variant)}),v=e.ref(new Map),f=e.ref(!1),g=({paymentGatewayVariant:e,paymentMethodType:t})=>{f.value=!1,s.value=e,u("select",{paymentGatewayVariant:e,paymentMethodType:t})},h=e=>t=>{var n;return v.value.set(null==(n=e.integration.payment_gateway)?void 0:n.variant,t)};return(i,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.paymentMethodOptions,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.integration.id},[e.unref(n)(t)?(e.openBlock(),e.createBlock(e.unref(l),{key:0,ref_for:!0,ref:h(t),context:r.context,"payment-method-option-response-entry":t,"country-code":r.countryCode,"customer-id":r.customerId,variant:r.variant,amount:r.amount,"invoice-id":r.invoiceId,selected:e.unref(a)({selectedIntegration:p.value,paymentMethodOption:t}),"validate-on-submit":r.validateOnSubmit,"force-store-payment-method":r.forceStorePaymentMethod,onSelect:g,onPaymentFailed:m[0]||(m[0]=e=>i.$emit("payment-failed",e)),onPaymentSuccess:m[1]||(m[1]=e=>i.$emit("payment-success")),onReady:m[2]||(m[2]=e=>i.$emit("ready"))},null,8,["context","payment-method-option-response-entry","country-code","customer-id","variant","amount","invoice-id","selected","validate-on-submit","force-store-payment-method"])):e.unref(o)(t)?(e.openBlock(),e.createBlock(e.unref(c),{key:1,ref_for:!0,ref:h(t),context:r.context,"payment-method-option-response-entry":t,"country-code":r.countryCode,"customer-id":r.customerId,variant:r.variant,amount:r.amount,"invoice-id":r.invoiceId,selected:e.unref(a)({selectedIntegration:p.value,paymentMethodOption:t}),email:r.email,name:r.name,"validate-on-submit":r.validateOnSubmit,"force-store-payment-method":r.forceStorePaymentMethod,onSelect:g,onPaymentFailed:m[3]||(m[3]=e=>i.$emit("payment-failed",e)),onPaymentSuccess:m[4]||(m[4]=e=>i.$emit("payment-success")),onReady:m[5]||(m[5]=e=>i.$emit("ready"))},null,8,["context","payment-method-option-response-entry","country-code","customer-id","variant","amount","invoice-id","selected","email","name","validate-on-submit","force-store-payment-method"])):e.createCommentVNode("",!0)],64))),128)),f.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$9),{key:0,variant:"error",class:"mt-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y)({defaultMessage:"Select a payment method",id:"payment_integration_form.select_payment_method_error",description:"Error shown when no payment method is selected"})),1)]),_:1})):e.createCommentVNode("",!0)],64))}});exports._sfc_main=r;