@solvimon/solvimon-web 0.1.0-alpha.16 → 0.1.0-alpha.17

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 (151) hide show
  1. package/README.md +5 -5
  2. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BrPsTuoW.mjs} +2 -2
  3. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js → BillingInformation.vue_vue_type_script_setup_true_lang-BuQ8bzar.js} +1 -1
  4. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-1Op9GjGZ.js} +1 -1
  5. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CuWrBcoK.mjs} +3 -3
  6. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C66beqgf.js +1 -0
  7. package/dist/{useWalletBalanceItems-COQDLfoZ.mjs → CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs} +24 -56
  8. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BbuEBiY3.js +1 -0
  9. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs +147 -0
  10. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-dwIv_xxf.js} +1 -1
  11. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-wxP5IaGt.mjs} +1 -1
  12. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-05NKI2A0.js} +1 -1
  13. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-17v07F58.mjs} +1 -1
  14. package/dist/{PaymentHistoryBlock-BKMttUyk.mjs → PaymentHistoryBlock-BitwS9Re.mjs} +1 -1
  15. package/dist/{PaymentHistoryBlock-BGbTy4Se.js → PaymentHistoryBlock-ZtmPXXwI.js} +1 -1
  16. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3ZUDUdw.mjs} +1 -1
  17. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CMGK71zZ.js} +1 -1
  18. package/dist/{PaymentIntegrationForm-CypW6fZY.mjs → PaymentIntegrationForm-BK2aLPCo.mjs} +1 -1
  19. package/dist/{PaymentIntegrationForm-D4QupHWl.js → PaymentIntegrationForm-BZTzCUiu.js} +1 -1
  20. package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-B_yDNGK8.mjs} +5 -5
  21. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-GN3WAr10.js +1 -0
  22. package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-CIQ0vsko.mjs} +25 -14
  23. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js +1 -0
  24. package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-BQIN3zuf.mjs +156 -0
  25. package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js +1 -0
  26. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-DVeB_mqK.mjs} +5 -5
  27. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js → PaymentMethodsList.vue_vue_type_script_setup_true_lang-OvGGejpX.js} +1 -1
  28. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js +1 -0
  29. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D1TcP9PR.mjs} +115 -68
  30. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BKz2QQn9.js +1 -0
  31. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs +37 -0
  32. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BDqX6OaE.mjs} +22 -119
  33. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CyAFjCh7.js +1 -0
  34. package/dist/component-CUJ_G2Nw.mjs +962 -0
  35. package/dist/component-CiKxWtdx.js +1 -0
  36. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  37. package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
  38. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  39. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +3 -3
  40. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  41. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
  42. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  43. package/dist/components/Invoice/Invoice.es.js +7 -7
  44. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  45. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
  46. package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
  47. package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
  48. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  49. package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
  50. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  51. package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
  52. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  53. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
  54. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  55. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -58
  56. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  57. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
  58. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
  59. package/dist/components/WalletBalances/WalletBalances.es.js +8 -6
  60. package/dist/core/action-request.types.d.ts +3 -3
  61. package/dist/core/index.cjs.js +1 -1
  62. package/dist/core/index.es.js +1 -1
  63. package/dist/core/types.d.ts +4 -2
  64. package/dist/{customer-_W8gIX5m.js → customer-AfRcAZ5P.js} +1 -1
  65. package/dist/{customer-Bv_fqXzO.mjs → customer-DAgdegIW.mjs} +1 -1
  66. package/dist/{en-US-DAgOSlgv.mjs → en-US-DSzSbgL5.mjs} +68 -36
  67. package/dist/en-US-QzQnGXP1.js +1 -0
  68. package/dist/index.cjs.js +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.es.js +7 -4
  71. package/dist/invoices-BHgajZHq.js +1 -0
  72. package/dist/{invoices-BGb0AwVF.mjs → invoices-BXDgW8ch.mjs} +32 -16
  73. package/dist/nl-NL-C4rr-1tr.js +1 -0
  74. package/dist/{nl-NL-DCsmrA8A.mjs → nl-NL-Li7RW89R.mjs} +72 -40
  75. package/dist/{paymentMethods-DIbB759g.js → paymentMethods-BMcc-eTl.js} +1 -1
  76. package/dist/{paymentMethods-DvqlWe96.mjs → paymentMethods-xzFD2L30.mjs} +2 -2
  77. package/dist/{payments-DMDDI3MK.js → payments-DMvmB5vg.js} +1 -1
  78. package/dist/{payments-CpzTVrQM.mjs → payments-DV6csRej.mjs} +1 -1
  79. package/dist/pricing-B1uImUm4.mjs +19 -0
  80. package/dist/pricing-BEjY_5wb.js +1 -0
  81. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  82. package/dist/pricingPlanSchedule-C_cqUyTk.mjs +144 -0
  83. package/dist/registry-CeMxLjwU.js +1 -0
  84. package/dist/{registry-B-If1W_u.mjs → registry-CyENvS6l.mjs} +7 -4
  85. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  86. package/dist/screens/Checkout/Checkout.es.js +414 -675
  87. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  88. package/dist/screens/CustomerOverview/CustomerOverview.es.js +65 -19
  89. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  90. package/dist/screens/PayInvoice/PayInvoice.es.js +10 -9
  91. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
  92. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +8 -8
  93. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +3 -0
  94. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -0
  95. package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +542 -0
  96. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +3 -0
  97. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -0
  98. package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +725 -0
  99. package/dist/solvimon-web.css +1 -1
  100. package/dist/subscription-B4dBAY9C.mjs +89 -0
  101. package/dist/subscription-b0OPx8Du.js +1 -0
  102. package/dist/{subscriptions-BPYyv09M.mjs → subscriptions-CrNDM9qa.mjs} +6 -2
  103. package/dist/{subscriptions-CC61I6Nj.js → subscriptions-DC-mxa17.js} +1 -1
  104. package/dist/{url-1Lbg5Yni.mjs → url-BjZ1Pg0l.mjs} +1 -1
  105. package/dist/url-D8GJi5rF.js +1 -0
  106. package/dist/{useActionDispatchProvider-BHTknMoH.js → useActionDispatchProvider-bqR_FeM4.js} +1 -1
  107. package/dist/{useActionDispatchProvider-Dz8-e4gZ.mjs → useActionDispatchProvider-zB_GKeUR.mjs} +1 -1
  108. package/dist/{useCustomer-VVJi8z2w.mjs → useCustomer-VfeQ6rG2.mjs} +2 -2
  109. package/dist/{useCustomer-Z24KchWC.js → useCustomer-bO4D6e4Z.js} +1 -1
  110. package/dist/{useIncrementalLoading-CuSndpP2.js → useIncrementalLoading-BgWuwoMo.js} +1 -1
  111. package/dist/{useIncrementalLoading-DmOT2MXH.mjs → useIncrementalLoading-C59FXHzp.mjs} +1 -1
  112. package/dist/{useInvoiceData-Bl87gzIS.js → useInvoiceData-CxxkBTGY.js} +1 -1
  113. package/dist/{useInvoiceData-Di5pLPM0.mjs → useInvoiceData-Dhg-hx8C.mjs} +2 -2
  114. package/dist/useInvoicesList-BXZ9uV9i.js +1 -0
  115. package/dist/{useInvoicesList-z19cteaD.mjs → useInvoicesList-DBz7T7sM.mjs} +4 -4
  116. package/dist/{useLoadInitialData-CkpryfjF.mjs → useLoadInitialData-BhpIg7OF.mjs} +1 -1
  117. package/dist/{useLoadInitialData-CTqfiMTN.js → useLoadInitialData-BqiAFNFi.js} +1 -1
  118. package/dist/{usePaymentMethodOptions-BsCZnCQW.js → usePaymentMethodOptions-DszFvgKX.js} +1 -1
  119. package/dist/{usePaymentMethodOptions-BoGHJjng.mjs → usePaymentMethodOptions-PcMjtMSF.mjs} +2 -2
  120. package/dist/{usePaymentMethods-ocHmNoP7.mjs → usePaymentMethods-B5AbGWsn.mjs} +2 -2
  121. package/dist/{usePaymentMethods-AC-4rrR9.js → usePaymentMethods-Bb1Xbads.js} +1 -1
  122. package/dist/{usePayments-D85eB5l4.mjs → usePayments-DgoZoBZh.mjs} +3 -3
  123. package/dist/{usePayments-CgXZeWrU.js → usePayments-is5c66Z6.js} +1 -1
  124. package/dist/{usePortal-DVD7PcWI.js → usePortal-C4qWsJeq.js} +1 -1
  125. package/dist/{usePortal-B1O1zgdV.mjs → usePortal-DWLtNqBB.mjs} +1 -1
  126. package/dist/{useService-DF57xuDd.mjs → useService-BZqFkz7p.mjs} +1 -1
  127. package/dist/{useService-CHrkefKd.js → useService-DKm3QtT4.js} +1 -1
  128. package/dist/useSubscription-CEZJw6wZ.mjs +23 -0
  129. package/dist/useSubscription-DuUNc1_l.js +1 -0
  130. package/dist/useTopUpModal-DNyWrHDv.mjs +1012 -0
  131. package/dist/useTopUpModal-DeF-cfCK.js +1 -0
  132. package/dist/{vendor-ui-B8IlviSs.mjs → vendor-ui-BoGKOJ36.mjs} +8642 -7077
  133. package/dist/vendor-ui-BuRqLx74.js +1 -0
  134. package/package.json +14 -7
  135. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +0 -1
  136. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js +0 -1
  137. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +0 -1
  138. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js +0 -1
  139. package/dist/component-Bg2JVC_O.mjs +0 -933
  140. package/dist/component-Bs8oszfD.js +0 -1
  141. package/dist/en-US-C0gIE4Q1.js +0 -1
  142. package/dist/invoices-D-OKipCg.js +0 -1
  143. package/dist/nl-NL-Br7muSHK.js +0 -1
  144. package/dist/registry-uG2isab0.js +0 -1
  145. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  146. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  147. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1102
  148. package/dist/url-B6-3PkW2.js +0 -1
  149. package/dist/useInvoicesList-CFk-_oVK.js +0 -1
  150. package/dist/useWalletBalanceItems-BL-R5foK.js +0 -1
  151. package/dist/vendor-ui-C3Tq-qY_.js +0 -1
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./vendor-ui-BuRqLx74.js"),i=require("./invoices-BHgajZHq.js"),n=require("./useWatchDebounced-C_YxgoQ6.js"),o=require("./component-CiKxWtdx.js"),a=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),l=require("./PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js"),u=require("./url-D8GJi5rF.js"),r=require("./usePaymentMethodOptions-DszFvgKX.js"),d=require("./PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js"),c=["TOP_UP","ADD_PAYMENT_METHOD","SUCCESS"],s=e=>((null==e?void 0:e.charge_on_demand_pricing_items)??[]).flatMap(i=>{var n,o;if(!(e=>"object"==typeof e&&null!==e&&"pricing_item"in e)(i))return[];const a=i.pricing_item_id??(null==(n=i.pricing_item)?void 0:n.id);return a?((null==(o=i.pricing_item)?void 0:o.configs)??[]).map(n=>{const o=function(e,i){var n,o,a,l,u,r,d;if(!e.on_demand||!t.isFlexiblePricing(e))return;const c=null==(o=null==(n=e.details)?void 0:n.bands)?void 0:o[0],s=(null==(a=null==c?void 0:c.minimum_amount)?void 0:a.currency)??(null==(l=null==c?void 0:c.maximum_amount)?void 0:l.currency)??(null==(r=null==(u=null==i?void 0:i.wallet_balance.balance)?void 0:u.amount)?void 0:r.currency);if(!s)return;const p=m(i),_=p?v(e,i):void 0,h=null==(d=null==p?void 0:p.credit_type)?void 0:d.unit_name,b=e=>{if(!e)return;const t=p&&_?g(e.quantity,_.rate):void 0;return void 0!==t&&p?f(t,p):{amount:e}};return{config:{...(null==c?void 0:c.minimum_amount)&&{minimum_amount:c.minimum_amount},...(null==c?void 0:c.maximum_amount)&&{maximum_amount:c.maximum_amount}},currency:s,..._&&{creditsConfiguration:{conversionRate:_.rate,...(null==h?void 0:h.singular)&&{unitNameSingle:h.singular},...(null==h?void 0:h.plural)&&{unitNamePlural:h.plural}}},bounds:{...b(null==c?void 0:c.minimum_amount)&&{minimum:b(null==c?void 0:c.minimum_amount)},...b(null==c?void 0:c.maximum_amount)&&{maximum:b(null==c?void 0:c.maximum_amount)}}}}(n,e),l=function(e,i){var n,o,a;if(!e.on_demand||!t.hasOneOfPricingTypes(e,["FIXED"]))return;const l=null==(a=null==(o=null==(n=e.details)?void 0:n.bands)?void 0:o[0])?void 0:a.fixed_amount;if(!l)return;const u=m(i),r=u?_(e,i):void 0;return{amount:l,value:r&&u?f(r.quantity,u):{amount:l}}}(n,e);return{pricingItemId:a,...i.pricing_plan_schedule_id&&{pricingPlanScheduleId:i.pricing_plan_schedule_id},config:n,...o&&{flexiblePricing:o},...l&&{fixedPricing:l}}}):[]});const m=e=>{var t;return null==(t=null==e?void 0:e.wallet_balance.balance)?void 0:t.credits},p=(e,t)=>{const i=null==t?void 0:t.wallet_type_id;return(e.wallet_grants??[]).filter(({wallet_type_id:e})=>!i||e===i)},v=(e,t)=>{var i,n;return null==(n=null==(i=p(e,t).find(({credits_grant:e})=>null==e?void 0:e.conversion))?void 0:i.credits_grant)?void 0:n.conversion},_=(e,t)=>{var i,n;return null==(n=null==(i=p(e,t).find(({credits_grant:e})=>null==e?void 0:e.credits))?void 0:i.credits_grant)?void 0:n.credits},f=(e,t)=>({credits:{...t,quantity:e}}),g=(e,t)=>{const i=Number(e),n=Number(t);return Number.isFinite(i)&&Number.isFinite(n)?String(i*n):void 0};const h={class:"sv-top-up-form"},b={class:"grid grid-cols-1 gap-4"},y={class:"grid grid-cols-1 gap-1"},P={class:"sv-top-up-form__option-details"},x=e.defineComponent({__name:"TopUpModalForm",props:{topUpPricingItems:{type:null},paymentMethods:{type:Array}},emits:["add-payment-method","success","failure"],setup(u,{expose:r,emit:d}){const c=u,s=d,{$t:m,formatNumber:p}=t.useIntl(),v=e.ref({pricing_plan_schedule_id:"",pricing_items:[],start_at:"",finalize_immediately:!1,payment_method_id:void 0,preview:!0}),_=e.computed(()=>(c.topUpPricingItems??[]).filter(e=>e.flexiblePricing||e.fixedPricing)),x=e=>_.value.find(t=>t.pricingItemId===e),w=e.computed(()=>{var e,t;return null==(t=null==(e=c.topUpPricingItems)?void 0:e.find(e=>e.pricingPlanScheduleId))?void 0:t.pricingPlanScheduleId});e.watch(w,e=>{v.value.pricing_plan_schedule_id=e??""},{immediate:!0});const M=e.computed({get:()=>{var e;return null==(e=v.value.pricing_items[0])?void 0:e.pricing_item_id},set:e=>{const t=x("string"==typeof e?e:void 0);if(!t)return void(v.value.pricing_items=[]);const i=(e=>{const{config:t,currency:i}=e.flexiblePricing??{},n=null==t?void 0:t.minimum_amount;return n&&i?{quantity:n.quantity,currency:i}:void 0})(t);v.value.pricing_items=[{pricing_item_id:t.pricingItemId,...i&&{flexible_amount:i}}]}});e.watch(_,e=>{var t;e.some(({pricingItemId:e})=>{var t;return e===(null==(t=v.value.pricing_items[0])?void 0:t.pricing_item_id)})||(M.value=null==(t=e.find(({flexiblePricing:e})=>e))?void 0:t.pricingItemId)},{immediate:!0});const k=e.computed({get:()=>{var e;return null==(e=v.value.pricing_items[0])?void 0:e.flexible_amount},set:e=>{var t;const i=null==(t=v.value.pricing_items[0])?void 0:t.pricing_item_id;i&&(v.value.pricing_items=[{pricing_item_id:i,...e&&{flexible_amount:e}}])}}),E=e=>t.formatWalletBalanceValue(m,p,e),N=e=>{var i;const n=null==(i=x(String(e)))?void 0:i.fixedPricing;return(null==n?void 0:n.value.credits)?t.formatAmount(n.amount):void 0},V=e=>{var t;const i=null==(t=x(String(e)))?void 0:t.flexiblePricing;return i?[i]:[]},C=e=>{var t;return!!(null==(t=x(String(e)))?void 0:t.flexiblePricing)},S=e.computed(()=>_.value.map(e=>{var t;return{value:e.pricingItemId,label:e.fixedPricing?E(e.fixedPricing.value):m({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:m({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:E(e.flexiblePricing.bounds.minimum),maximum:E(e.flexiblePricing.bounds.maximum)})}}})),T=e.computed(()=>{const e=v.value.pricing_items.filter(e=>{var t;return!(null==(t=x(e.pricing_item_id))?void 0:t.flexiblePricing)||!!e.flexible_amount});return e.length>0?e:void 0}),{invoicePreview:B}=function({pricingPlanScheduleId:t,pricingItems:a}){const{previewChargeOnDemandPricingItems:l}=i.createInvoicesService(),u=o.useLogger(),r=e.ref(),d=e.ref(!1);let c=0;const s=async()=>{const e=t.value,i=++c;if(!e||!a.value)return a.value&&!e&&u.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 l({pricingPlanScheduleId:e,pricingItems:a.value});i===c&&(r.value=t)}catch(n){i===c&&(r.value=void 0),u.error("INVOICE_PREVIEW_FAILED","Failed to load top-up invoice preview",{},n)}finally{i===c&&(d.value=!1)}};return n.useWatchDebounced(a,()=>{s()},{debounce:400,deep:!0}),s(),{invoicePreview:r,isPreviewPending:d,loadPreview:s}}({pricingPlanScheduleId:w,pricingItems:T}),{chargeOnDemandPricingItems:D}=i.createInvoicesService(),I=o.useLogger(),O=e.ref(!1),A=e.computed(()=>!!v.value.pricing_plan_schedule_id&&!!T.value),U=e.computed(()=>{const[e]=v.value.pricing_items,t=x(null==e?void 0:e.pricing_item_id);return t?((e,t)=>{var i;if(e.fixedPricing)return e.fixedPricing.value;if(!e.flexiblePricing||!t)return;const{bounds:n,creditsConfiguration:o}=e.flexiblePricing,a=null==(i=n.minimum??n.maximum)?void 0:i.credits,l=o?g(t.quantity,o.conversionRate):void 0;return a&&void 0!==l?f(l,a):{amount:t}})(t,null==e?void 0:e.flexible_amount):void 0});r({submit:async function(){if(A.value&&!O.value){O.value=!0;try{const e=await D({pricing_plan_schedule_id:v.value.pricing_plan_schedule_id,pricing_items:T.value??[],payment_method_id:v.value.payment_method_id,preview:!1});s("success",e)}catch(e){I.error("TOP_UP_FAILED","Failed to charge the wallet top-up",{},e),s("failure",e)}finally{O.value=!1}}},isCharging:O,canSubmit:A,chargedValue:U});const q=e.computed({get:()=>v.value.payment_method_id??void 0,set:e=>{v.value.payment_method_id=e}}),$=e=>{const t=Date.parse(e??"");return Number.isFinite(t)?t:0},F=e.computed(()=>[...c.paymentMethods??[]].sort((e,t)=>$(t.created_at)-$(e.created_at)));return e.watch(()=>c.paymentMethods,(e,t)=>{var i;const n=null==e?void 0:e.find(({id:e})=>!(null==t?void 0:t.some(t=>t.id===e)));if(n&&(null==t?void 0:t.length))return void(q.value=n.id);(null==e?void 0:e.some(({id:e})=>e===v.value.payment_method_id))||(q.value=null==(i=(null==e?void 0:e.find(({is_default:e})=>e))??F.value[0])?void 0:i.id)},{immediate:!0}),(i,n)=>(e.openBlock(),e.createElementBlock("form",h,[e.createElementVNode("div",b,[e.createElementVNode("div",y,[S.value.length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$7),{key:0,modelValue:M.value,"onUpdate:modelValue":n[3]||(n[3]=e=>M.value=e),class:"sv-top-up-form__options",name:"top-up-pricing-item",direction:"column",required:"",disabled:O.value,options:S.value,"show-radio":!1,label:e.unref(m)({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:i,optionValue:n})=>[e.createElementVNode("span",null,e.toDisplayString(i.label),1),N(n)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{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(N(n)),1)]),_:2},1024)):e.createCommentVNode("",!0)]),description:e.withCtx(({option:i,optionValue:o})=>[e.createElementVNode("div",P,[i.description&&!C(o)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.description),1)]),_:2},1024)):e.createCommentVNode("",!0),V(o).length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{key:1,"is-open":String(o)===M.value,lazy:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V(o),o=>(e.openBlock(),e.createElementBlock("div",{key:o.currency,class:"sv-top-up-form__amount grid grid-cols-1 gap-3",onClick:n[1]||(n[1]=e.withModifiers(()=>{},["stop"])),onKeydown:n[2]||(n[2]=e.withModifiers(()=>{},["stop"]))},[i.description?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.description),1)]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$28),{modelValue:k.value,"onUpdate:modelValue":n[0]||(n[0]=e=>k.value=e),config:o.config,currency:o.currency,"credits-configuration":o.creditsConfiguration,required:"",disabled:O.value,"show-range-hint":!1},null,8,["modelValue","config","currency","credits-configuration","disabled"])],32))),128))]),_:2},1032,["is-open"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue","disabled","options","label"])):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createBlock(a._sfc_main,{key:1,class:"h-[152px]","data-testid":"top-up-invoice-preview-skeleton"},{default:e.withCtx(()=>[e.unref(B)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{invoice:e.unref(B),"is-customer-facing":""},null,8,["invoice"])]),_:1})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$30),{spacing:"xs"})]),e.createElementVNode("div",null,[e.createVNode(l._sfc_main,{modelValue:q.value,"onUpdate:modelValue":n[4]||(n[4]=e=>q.value=e),class:"sv-top-up-form__payment-methods","payment-methods":F.value,required:"",disabled:O.value,label:e.unref(m)({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:n[5]||(n[5]=e=>s("add-payment-method"))},null,8,["modelValue","payment-methods","disabled","label"])])])]))}}),w={class:"sv-top-up-success grid grid-cols-1 gap-4"},M={key:0,class:"sv-top-up-success__added"},k=e.defineComponent({__name:"TopUpModalSuccess",props:{addedValue:{type:Object},invoice:{type:Object}},setup(i){const n=i,{$t:o,formatNumber:a}=t.useIntl(),l=e.computed(()=>o({defaultMessage:"Top-up successful",description:"Title of the top-up modal once the top-up has been charged",id:"topup_modal.success.title"})),r=e.computed(()=>n.addedValue?o({defaultMessage:"Your balance was topped up with {value}. Please be aware that it can take some time to reflect this change in your wallet.",description:"Confirmation of what a completed top-up added to the wallet balance",id:"topup_modal.success.added"},{value:t.formatWalletBalanceValue(o,a,n.addedValue)}):void 0);return(n,a)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(u._sfc_main,{status:"success",title:l.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("span",M,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)]),_:1},8,["title"]),i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold",class:"mb-2 block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({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:i.invoice,"is-customer-facing":""},null,8,["invoice"])]),_:1})):e.createCommentVNode("",!0)]))}});function E(t){const i=e.ref(0),n=e=>{i.value=(null==e?void 0:e.offsetHeight)??0},o="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(e=>{var t;const i=null==(t=e[0])?void 0:t.target;n(i instanceof HTMLElement?i:void 0)});return e.watch(t,(e,t)=>{t&&(null==o||o.unobserve(t)),n(e),e&&(null==o||o.observe(e))},{immediate:!0,flush:"post"}),e.onBeforeUnmount(()=>{null==o||o.disconnect()}),i}const N={class:"grid grid-cols-1 gap-4 pb-4"},V=["inert"],C=["inert"],S=["inert"],T={class:"flex flex-col gap-2"},B=e.defineComponent({__name:"TopUpModal",props:{showModal:{type:Boolean},selectedBalanceItem:{type:Object},paymentMethods:{type:Array},customer:{type:Object}},emits:["confirm","close","payment-success","payment-failed"],setup(i,{emit:n}){const o=i,a=n,{$t:l,formatNumber:u}=t.useIntl(),m=e.computed(()=>{var e;return t.formatWalletBalanceValue(l,u,null==(e=o.selectedBalanceItem)?void 0:e.wallet_balance.open_balance)}),p=e.computed(()=>s(o.selectedBalanceItem)),{paymentMethodOptions:v,get:_,isPending:f}=r.usePaymentMethodOptions();e.watch(()=>[o.showModal,o.customer],([e,i])=>{e&&i&&_({customerId:i.id,country:t.getCustomerCountry(i)})},{immediate:!0});const g=e.ref("TOP_UP"),h=e.ref(),b=e.ref(),y=()=>{g.value="TOP_UP",a("payment-success")},P=e.computed(()=>({variant:"TOKENIZE"})),w=e.ref(!1),M=e.ref(!1);let B;e.watch(g,e=>{w.value=w.value||"ADD_PAYMENT_METHOD"===e,M.value=!0,clearTimeout(B),B=setTimeout(()=>{M.value=!1},300)}),e.onBeforeUnmount(()=>{clearTimeout(B)});const D=e.ref(),I=e.ref(),O=e.ref(),A={TOP_UP:E(D),ADD_PAYMENT_METHOD:E(I),SUCCESS:E(O)},U=e.computed(()=>A[g.value].value),q=e.computed(()=>{const e=c.indexOf(g.value);return 0===e?"translateX(0px)":`translateX(calc(${-e} * (100% + 1rem)))`}),$=e.ref(),F=e.computed(()=>{var e;return"ADD_PAYMENT_METHOD"===g.value&&!!(null==(e=$.value)?void 0:e.isPaymentPending)}),H=e.ref(),L=e.computed(()=>{var e;return null==(e=H.value)?void 0:e.chargedValue}),Y=e.computed(()=>{var e;return F.value||!!(null==(e=H.value)?void 0:e.isCharging)}),{title:j,subTitle:R,cancelButtonText:z,confirmButtonText:W}=function({step:i,currentBalance:n,topUpValue:o}){const{$t:a,formatNumber:l}=t.useIntl();return{title:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({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"===i.value?a({defaultMessage:"Top-up complete",description:"Title of the top-up modal once the top-up has been charged",id:"topup_modal.success.modal_title"}):a({defaultMessage:"Top up balance",description:"Title of the wallet top-up modal",id:"topup_modal.title"})),subTitle:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({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"===i.value?a({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"}):a({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"===i.value?a({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"}):a({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"===i.value?a({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"===i.value?a({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"}):o.value?a({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(a,l,o.value)}):a({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:g,currentBalance:m,topUpValue:L}),K=()=>{var e,t;"ADD_PAYMENT_METHOD"!==g.value?null==(t=H.value)||t.submit():null==(e=$.value)||e.submit()},X=e=>{var t;h.value=e,b.value=null==(t=H.value)?void 0:t.chargedValue,g.value="SUCCESS"},Z=()=>{a("confirm"),a("close")},G=()=>{Y.value||("ADD_PAYMENT_METHOD"!==g.value?"SUCCESS"!==g.value?a("close"):Z():g.value="TOP_UP")},J=e.ref(0);return e.watch(()=>o.showModal,e=>{e&&(g.value="TOP_UP",h.value=void 0,b.value=void 0,J.value+=1)}),(n,o)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{"no-click-away":"","show-modal":i.showModal,size:"lg",title:e.unref(j),"sub-title":e.unref(R),"cancel-button-text":e.unref(z),"confirm-button-text":e.unref(W),"is-loading":Y.value,onConfirm:K,onClose:G},e.createSlots({body:e.withCtx(()=>[e.createElementVNode("div",N,[e.createElementVNode("div",{class:e.normalizeClass(["sv-topup-modal__viewport relative -mx-2 overflow-hidden px-2",M.value?"transition-[height] duration-300 ease-in-out motion-reduce:transition-none":""]),style:e.normalizeStyle(U.value?{height:`${U.value}px`}:void 0)},[e.createElementVNode("div",{class:"sv-topup-modal__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",style:e.normalizeStyle({transform:q.value})},[e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"TOP_UP"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"topUpPaneRef",ref:D},[(e.openBlock(),e.createBlock(x,{key:J.value,ref_key:"topUpFormRef",ref:H,"top-up-pricing-items":p.value,"payment-methods":i.paymentMethods,onAddPaymentMethod:o[0]||(o[0]=e=>g.value="ADD_PAYMENT_METHOD"),onSuccess:X},null,8,["top-up-pricing-items","payment-methods"]))],512)],8,V),e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"ADD_PAYMENT_METHOD"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"addPaneRef",ref:I},[i.customer&&w.value?(e.openBlock(),e.createBlock(d._sfc_main,{key:0,ref_key:"paymentMethodFormRef",ref:$,"hide-submit-button":"",customer:i.customer,"payment-method-options":e.unref(v),"is-loading":e.unref(f),configuration:P.value,onSuccess:y,onFailure:o[1]||(o[1]=e=>n.$emit("payment-failed",e))},null,8,["customer","payment-method-options","is-loading","configuration"])):e.createCommentVNode("",!0)],512)],8,C),e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"SUCCESS"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"successPaneRef",ref:O},[h.value?(e.openBlock(),e.createBlock(k,{key:0,"added-value":b.value,invoice:h.value},null,8,["added-value","invoice"])):e.createCommentVNode("",!0)],512)],8,S)],4)],6)])]),_:2},["SUCCESS"===g.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",T,[e.createVNode(e.unref(t._sfc_main$1),{size:"lg","data-testid":"done",onClick:Z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(W)),1)]),_:1})])]),key:"0"}:void 0]),1032,["show-modal","title","sub-title","cancel-button-text","confirm-button-text","is-loading"]))}});exports._sfc_main=B,exports.useTopUpModal=function(t){return{showModal:e.computed(()=>!!t.value)}};