@solvimon/solvimon-web 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (724) hide show
  1. package/README.md +244 -49
  2. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Ce30EXY5.mjs +240 -0
  3. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-kmam2c7P.js +1 -0
  4. package/dist/Amount.vue.es-BO5sS1UX.mjs +25 -0
  5. package/dist/Amount.vue.es-JDVa_3H-.js +1 -0
  6. package/dist/Avatar.vue.es-BGTZSAqU.js +1 -0
  7. package/dist/Avatar.vue.es-DJzJiYtv.mjs +91 -0
  8. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-DQAp1xwu.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-Bq2mTdUs.mjs} +23 -13
  9. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-BtNTRSqH.js +1 -0
  10. package/dist/Button.vue.es-Cm9pLU9i.mjs +421 -0
  11. package/dist/Button.vue.es-O8mNivLL.js +1 -0
  12. package/dist/Chip.vue.es-BBmn-qJp.mjs +120 -0
  13. package/dist/Chip.vue.es-DmCjC1hi.js +1 -0
  14. package/dist/Comparators.vue.es-CYfxd5H-.mjs +120 -0
  15. package/dist/Comparators.vue.es-DK8wGjxM.js +1 -0
  16. package/dist/ContentWithAsideLayout-DHpnJfGA.js +1 -0
  17. package/dist/ContentWithAsideLayout-Dy9xgxuF.mjs +39 -0
  18. package/dist/ContextMenu.vue.es-CTc1ktXb.mjs +681 -0
  19. package/dist/ContextMenu.vue.es-DaW0yp4Y.js +1 -0
  20. package/dist/CustomerBillingInformation.vue.es-BX0Da7Kr.js +1 -0
  21. package/dist/CustomerBillingInformation.vue.es-CMZO8oLj.mjs +175 -0
  22. package/dist/CustomerPaymentMethods.lib-BKgQTCtc.js +1 -0
  23. package/dist/CustomerPaymentMethods.lib-CcSt0sl1.mjs +4 -0
  24. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bi_dCntQ.js +1 -0
  25. package/dist/{useCustomerPaymentMethodOptions-BzEquyUV.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CtdFharm.mjs} +43 -62
  26. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-BDqBXbJq.mjs +3264 -0
  27. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-ZyN2vlNu.js +1 -0
  28. package/dist/Divider.vue.es-ClFG8QtG.js +1 -0
  29. package/dist/Divider.vue.es-wKkIVBgb.mjs +24 -0
  30. package/dist/DividerText.vue.es-CeAHAe_Y.mjs +72 -0
  31. package/dist/DividerText.vue.es-DjT4i_YD.js +1 -0
  32. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DLE5-9wz.mjs +562 -0
  33. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DkIK-lID.js +1 -0
  34. package/dist/ErrorNotification.vue.es-CHyVTBGs.mjs +38 -0
  35. package/dist/ErrorNotification.vue.es-CaEFTi2k.js +1 -0
  36. package/dist/Expand.vue.es-C-lnbA1v.js +1 -0
  37. package/dist/Expand.vue.es-C4_XmqbR.mjs +50 -0
  38. package/dist/FormMessage.vue.es-Bd4_NG9H.js +1 -0
  39. package/dist/FormMessage.vue.es-C3oxwq_8.mjs +46 -0
  40. package/dist/IconButton.vue.es-BHdQskx0.js +1 -0
  41. package/dist/IconButton.vue.es-KywqWWvr.mjs +228 -0
  42. package/dist/IconTitle.vue.es-BmjBdZb_.mjs +107 -0
  43. package/dist/IconTitle.vue.es-D9Wc3PIq.js +1 -0
  44. package/dist/Input.vue.es-DqKJhFTr.js +1 -0
  45. package/dist/Input.vue.es-WZGF8dfr.mjs +251 -0
  46. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0ie9Krt.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-B6efz7NU.mjs} +21 -9
  47. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-LE6zBLKM.js +1 -0
  48. package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-C2aLMfu6.mjs +49 -0
  49. package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-CtpFzWU3.js +1 -0
  50. package/dist/InvoiceSummary.vue.es-BI5sD_8F.mjs +2944 -0
  51. package/dist/InvoiceSummary.vue.es-BWYIHezU.js +1 -0
  52. package/dist/Modal.vue.es-B_1aqm_m.js +1 -0
  53. package/dist/Modal.vue.es-qdUHDOnU.mjs +483 -0
  54. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-BKKXQbge.js +1 -0
  55. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-Ch1TFO7x.mjs +154 -0
  56. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CsH47WSM.mjs +54 -0
  57. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-mKNNYnMU.js +1 -0
  58. package/dist/PaymentHistoryBlock-CgNUV8Gy.mjs +4 -0
  59. package/dist/PaymentHistoryBlock-Ci8aSJeb.js +1 -0
  60. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DZwnDzha.js +1 -0
  61. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DVDOsMnT.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Uj1aK-dp.mjs} +34 -23
  62. package/dist/PaymentIntegrationForm-CLokpXvK.mjs +4 -0
  63. package/dist/PaymentIntegrationForm-CsuueDE0.js +1 -0
  64. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CRUs7sP4.mjs +167 -0
  65. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-kKkzRi6w.js +1 -0
  66. package/dist/PaymentIntegrationFormAdyen-C885o8IE.mjs +699 -0
  67. package/dist/PaymentIntegrationFormAdyen-Co19AgvG.js +1 -0
  68. package/dist/PaymentIntegrationFormStripe-BjMdJmDC.mjs +547 -0
  69. package/dist/PaymentIntegrationFormStripe-DWff6wzK.js +1 -0
  70. package/dist/PaymentMethod.vue.es-CdskNJ3Z.js +1 -0
  71. package/dist/PaymentMethod.vue.es-rv-pu1CC.mjs +677 -0
  72. package/dist/PaymentMethodForm-IEuDxEPN.mjs +4 -0
  73. package/dist/PaymentMethodForm-hZuVHAti.js +1 -0
  74. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-Cj60U90J.js +1 -0
  75. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-gA74Rak9.mjs +172 -0
  76. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-B3H_AWMM.js +1 -0
  77. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-CTn-OxM6.mjs +189 -0
  78. package/dist/PricingGroupRangeInput.vue.es-ButaePib.mjs +632 -0
  79. package/dist/PricingGroupRangeInput.vue.es-Cls2lm80.js +1 -0
  80. package/dist/Section.vue.es-CAJvEDn6.js +1 -0
  81. package/dist/Section.vue.es-DX_9ueCG.mjs +79 -0
  82. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-CQAkPfJz.js +1 -0
  83. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DVtMzgjc.mjs +1044 -0
  84. package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-C-taYlG4.mjs → Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs} +23 -8
  85. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js +1 -0
  86. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BJVXCHny.js +1 -0
  87. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-ByO-L6nm.mjs +6171 -0
  88. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-C5zB3CgZ.mjs +101 -0
  89. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-CabskT-r.js +1 -0
  90. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-D-T1wGg7.js +1 -0
  91. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-Bp5RvQVS.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-DKd2DIVb.mjs} +61 -125
  92. package/dist/TooltipParagraph.vue.es-C5RTcrid.mjs +136 -0
  93. package/dist/TooltipParagraph.vue.es-H9fI7zzt.js +1 -0
  94. package/dist/TrialChip.vue.es-B1puKyR-.mjs +56 -0
  95. package/dist/TrialChip.vue.es-CCs50m02.js +1 -0
  96. package/dist/accel.svg.es-CE5tIWtm.mjs +4 -0
  97. package/dist/accel.svg.es-Dt_1wJmV.js +1 -0
  98. package/dist/ach.svg.es-B4tn0_IV.js +1 -0
  99. package/dist/ach.svg.es-D4QPcIU-.mjs +4 -0
  100. package/dist/adyen-51SvcyqV.mjs +4 -0
  101. package/dist/adyen-BXi_D9TQ.mjs +123 -0
  102. package/dist/adyen-DZsyEXkw.js +1 -0
  103. package/dist/adyen-VS2sDW0m.js +1 -0
  104. package/dist/amazon-pay.svg.es-B428S4f3.js +1 -0
  105. package/dist/amazon-pay.svg.es-DUScOW15.mjs +4 -0
  106. package/dist/amex.svg.es-BCXkaVLN.mjs +4 -0
  107. package/dist/amex.svg.es-Bn9e31C3.js +1 -0
  108. package/dist/api.es-C5pe8LUl.mjs +62 -0
  109. package/dist/api.es-Czekkp_X.js +1 -0
  110. package/dist/apple-pay.svg.es-Cfgn0K28.js +1 -0
  111. package/dist/apple-pay.svg.es-DlCfkt39.mjs +4 -0
  112. package/dist/bacs.svg.es-BKsvSeIP.mjs +4 -0
  113. package/dist/bacs.svg.es-hL7hLPkQ.js +1 -0
  114. package/dist/bancontact.svg.es-BbRqGgZ9.mjs +4 -0
  115. package/dist/bancontact.svg.es-DU2ejvNL.js +1 -0
  116. package/dist/carnet.svg.es-C5SFaOsa.js +1 -0
  117. package/dist/carnet.svg.es-Db-KEb13.mjs +4 -0
  118. package/dist/cartes-bancaires.svg.es-ByD-JAAi.mjs +4 -0
  119. package/dist/cartes-bancaires.svg.es-CbBJQZrk.js +1 -0
  120. package/dist/cashapp.svg.es-CnS5r_D8.mjs +4 -0
  121. package/dist/cashapp.svg.es-DE4vMu_p.js +1 -0
  122. package/dist/cn.es-BEU5D0Wz.mjs +3298 -0
  123. package/dist/cn.es-DxSeYcoP.js +1 -0
  124. package/dist/comparators.es-9VsCB-JI.mjs +175 -0
  125. package/dist/comparators.es-wrKHduVq.js +1 -0
  126. package/dist/component-BG6DmXcy.mjs +9 -0
  127. package/dist/component-hDuDTBt5.js +1 -0
  128. package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -3
  129. package/dist/components/BillingInformation/BillingInformation.cjs +1 -0
  130. package/dist/components/BillingInformation/{BillingInformation.es.js → BillingInformation.mjs} +26 -34
  131. package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -3
  132. package/dist/components/BillingInformationForm/BillingInformationForm.cjs +1 -0
  133. package/dist/components/BillingInformationForm/{BillingInformationForm.es.js → BillingInformationForm.mjs} +68 -154
  134. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -3
  135. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs +1 -0
  136. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.mjs +95 -0
  137. package/dist/components/Invoice/Invoice.ce.d.ts +1 -3
  138. package/dist/components/Invoice/Invoice.cjs +1 -0
  139. package/dist/components/Invoice/{Invoice.es.js → Invoice.mjs} +133 -180
  140. package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -3
  141. package/dist/components/InvoiceDetails/InvoiceDetails.cjs +1 -0
  142. package/dist/components/InvoiceDetails/{InvoiceDetails.es.js → InvoiceDetails.mjs} +17 -29
  143. package/dist/components/InvoiceHeader/InvoiceHeader.ce.d.ts +1 -0
  144. package/dist/components/InvoiceHeader/InvoiceHeader.cjs +1 -0
  145. package/dist/components/InvoiceHeader/InvoiceHeader.mjs +73 -0
  146. package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -3
  147. package/dist/components/InvoicesList/InvoicesList.cjs +1 -0
  148. package/dist/components/InvoicesList/{InvoicesList.es.js → InvoicesList.mjs} +21 -29
  149. package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -3
  150. package/dist/components/PaymentHistory/PaymentHistory.cjs +1 -0
  151. package/dist/components/PaymentHistory/{PaymentHistory.es.js → PaymentHistory.mjs} +17 -29
  152. package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -3
  153. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs +1 -0
  154. package/dist/components/PaymentMethodForm/PaymentMethodForm.mjs +108 -0
  155. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -3
  156. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs +1 -0
  157. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.mjs +93 -0
  158. package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -3
  159. package/dist/components/SubscriptionsList/SubscriptionsList.cjs +1 -0
  160. package/dist/components/SubscriptionsList/SubscriptionsList.mjs +103 -0
  161. package/dist/components/WalletBalances/WalletBalances.ce.d.ts +1 -3
  162. package/dist/components/WalletBalances/WalletBalances.cjs +1 -0
  163. package/dist/components/WalletBalances/{WalletBalances.es.js → WalletBalances.mjs} +38 -34
  164. package/dist/configuration-BjYwV4_B.js +1 -0
  165. package/dist/configuration-CD8cOXAJ.mjs +15 -0
  166. package/dist/core/action-request.types.d.ts +1 -58
  167. package/dist/core/configuration.d.ts +1 -3
  168. package/dist/core/index.cjs +1 -0
  169. package/dist/core/index.d.ts +1 -10
  170. package/dist/core/index.mjs +197 -0
  171. package/dist/core/registry.ce.d.ts +1 -2
  172. package/dist/core/registry.d.ts +1 -6
  173. package/dist/core/types.d.ts +1 -111
  174. package/dist/countryData.es--zJAd6LA.mjs +252 -0
  175. package/dist/countryData.es-D3MFzU92.js +1 -0
  176. package/dist/customElements-B-89a5oH.mjs +6810 -0
  177. package/dist/customElements-DD7bpqkx.js +1 -0
  178. package/dist/customer-DozNwS_a.js +1 -0
  179. package/dist/customer-Dzj1g9lV.mjs +32 -0
  180. package/dist/customer.es-C_vSWcVA.mjs +30 -0
  181. package/dist/customer.es-D42Md24r.js +1 -0
  182. package/dist/dana.svg.es-Bbn6_ktN.mjs +4 -0
  183. package/dist/dana.svg.es-DKZaseoJ.js +1 -0
  184. package/dist/dankort.svg.es-D8FgSiFf.js +1 -0
  185. package/dist/dankort.svg.es-DtAdliQq.mjs +4 -0
  186. package/dist/de-DE-BeyQVhTv.mjs +299 -0
  187. package/dist/de-DE-BvHD68Ay.js +1 -0
  188. package/dist/de-DE-CI2zQkiP.mjs +266 -0
  189. package/dist/de-DE-_40QfLNJ.js +1 -0
  190. package/dist/diners.svg.es-DhchsD1D.mjs +4 -0
  191. package/dist/diners.svg.es-SydF_H-Z.js +1 -0
  192. package/dist/discover.svg.es-B8vgzVNG.js +1 -0
  193. package/dist/discover.svg.es-BnqYPvnV.mjs +4 -0
  194. package/dist/eftpos.svg.es-DO0YPaY1.js +1 -0
  195. package/dist/eftpos.svg.es-DRLaafYa.mjs +4 -0
  196. package/dist/elo.svg.es-CTOm1rvj.js +1 -0
  197. package/dist/elo.svg.es-CgkEOP_O.mjs +4 -0
  198. package/dist/en-US--NRsi7Hz.js +1 -0
  199. package/dist/en-US-5YWNEi-V.mjs +299 -0
  200. package/dist/en-US-DksUWPIu.mjs +266 -0
  201. package/dist/en-US-dqfKx3GS.js +1 -0
  202. package/dist/eps.svg.es-CApyGjyU.js +1 -0
  203. package/dist/eps.svg.es-D6IHsRYP.mjs +4 -0
  204. package/dist/error-Cg-i7gGl.js +1 -0
  205. package/dist/error-DY_I2hPx.mjs +13 -0
  206. package/dist/floating-ui.vue.es-Bv94BfDm.js +1 -0
  207. package/dist/floating-ui.vue.es-DWY7pdz8.mjs +1573 -0
  208. package/dist/formatting.es-DBtYnvI5.js +1 -0
  209. package/dist/formatting.es-eYgXv_AK.mjs +70 -0
  210. package/dist/gcash.svg.es-BhJ-eA2z.mjs +4 -0
  211. package/dist/gcash.svg.es-JaL4fpZr.js +1 -0
  212. package/dist/getComposedString.es-CELkn0I7.mjs +14 -0
  213. package/dist/getComposedString.es-DvSNX-_z.js +1 -0
  214. package/dist/getCountryNameByCode.es-fP52nO_7.js +1 -0
  215. package/dist/getCountryNameByCode.es-ymC9R46j.mjs +8 -0
  216. package/dist/girocard.svg.es-D_3LML4l.mjs +4 -0
  217. package/dist/girocard.svg.es-tVgtT23w.js +1 -0
  218. package/dist/go-pay.svg.es-6UtgwVBA.mjs +4 -0
  219. package/dist/go-pay.svg.es-fYX6yMzJ.js +1 -0
  220. package/dist/google-pay.svg.es-BYXX1em8.js +1 -0
  221. package/dist/google-pay.svg.es-CRxXgFVl.mjs +4 -0
  222. package/dist/hipercard.svg.es-Ct1-mF9F.mjs +4 -0
  223. package/dist/hipercard.svg.es-D-nmiFXB.js +1 -0
  224. package/dist/icon-sprite.svg.es-BpwT0GQ5.js +1 -0
  225. package/dist/icon-sprite.svg.es-YYqtl2IP.mjs +4 -0
  226. package/dist/ideal.svg.es-D23EhJJ2.mjs +4 -0
  227. package/dist/ideal.svg.es-DXtHE0Jb.js +1 -0
  228. package/dist/index-Cai7laNY.mjs +1069 -0
  229. package/dist/index-DIFK3mcJ.js +6 -0
  230. package/dist/index-DyvRdSR7.mjs +9673 -0
  231. package/dist/index-IZaUTAsE.js +1 -0
  232. package/dist/index.cjs +1 -0
  233. package/dist/index.d.ts +1 -15
  234. package/dist/index.es-2JWHHSgP.js +1 -0
  235. package/dist/index.es-D5xOw_SJ.mjs +542 -0
  236. package/dist/index.mjs +42 -0
  237. package/dist/invoices-1oYkdQQV.mjs +121 -0
  238. package/dist/invoices-BAoh6X2a.js +1 -0
  239. package/dist/it-IT-B6blp8MI.mjs +299 -0
  240. package/dist/it-IT-CEP3oeWs.js +1 -0
  241. package/dist/it-IT-CMy1tHKZ.mjs +266 -0
  242. package/dist/it-IT-aPQY57ht.js +1 -0
  243. package/dist/jcb.svg.es-Bz6J-c0s.js +1 -0
  244. package/dist/jcb.svg.es-CcH08OoO.mjs +4 -0
  245. package/dist/kakao-pay.svg.es-DcgRDAsc.mjs +4 -0
  246. package/dist/kakao-pay.svg.es-qVTABboW.js +1 -0
  247. package/dist/klarna.svg.es-Clu-7zkp.js +1 -0
  248. package/dist/klarna.svg.es-DfIPX0gr.mjs +4 -0
  249. package/dist/maestro.svg.es-CVmNVokN.mjs +4 -0
  250. package/dist/maestro.svg.es-e8E_H2QU.js +1 -0
  251. package/dist/mastercard.svg.es-B8z0ZySS.mjs +4 -0
  252. package/dist/mastercard.svg.es-YO3_jGD6.js +1 -0
  253. package/dist/momo.svg.es-BXTQlQRy.js +1 -0
  254. package/dist/momo.svg.es-Bm5zCTOT.mjs +4 -0
  255. package/dist/nl-NL-CckNM7R9.mjs +266 -0
  256. package/dist/nl-NL-CjoW8r_M.mjs +314 -0
  257. package/dist/nl-NL-e_vf6OuT.js +1 -0
  258. package/dist/nl-NL-zRUAuEHg.js +1 -0
  259. package/dist/nyce.svg.es-CgurqLKH.mjs +4 -0
  260. package/dist/nyce.svg.es-DM6esO47.js +1 -0
  261. package/dist/object.es-DFXiU9p3.js +1 -0
  262. package/dist/object.es-jvvnR8Kr.mjs +12 -0
  263. package/dist/open-banking.svg.es-DUM360xB.js +1 -0
  264. package/dist/open-banking.svg.es-DzzLCVp_.mjs +4 -0
  265. package/dist/paymentMethods-CZ3ydybI.js +1 -0
  266. package/dist/{paymentMethods-CqKUfc3w.mjs → paymentMethods-DIV78w0O.mjs} +31 -18
  267. package/dist/payments--lkjiwCt.js +1 -0
  268. package/dist/{payments-CosaPZwo.mjs → payments-Cvqdrprv.mjs} +1 -1
  269. package/dist/paypal.svg.es-BdkNTf3c.js +1 -0
  270. package/dist/paypal.svg.es-DltWzW4V.mjs +4 -0
  271. package/dist/pricing-3W7XLwL6.js +1 -0
  272. package/dist/pricing-CJxS2hr2.mjs +17 -0
  273. package/dist/pricingItemConfigs.es-BPIm6S8M.mjs +107 -0
  274. package/dist/pricingItemConfigs.es-C73cQlxQ.js +1 -0
  275. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  276. package/dist/pricingPlanSchedule-CXG3CQ61.mjs +146 -0
  277. package/dist/pulse.svg.es-BdpWAuIN.js +1 -0
  278. package/dist/pulse.svg.es-BecAwT-p.mjs +4 -0
  279. package/dist/screens/Checkout/Checkout.ce.d.ts +1 -3
  280. package/dist/screens/Checkout/Checkout.cjs +1 -0
  281. package/dist/screens/Checkout/{Checkout.es.js → Checkout.mjs} +1531 -1434
  282. package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -3
  283. package/dist/screens/CustomerOverview/CustomerOverview.cjs +1 -0
  284. package/dist/screens/CustomerOverview/CustomerOverview.mjs +175 -0
  285. package/dist/screens/PayInvoice/PayInvoice.ce.d.ts +1 -0
  286. package/dist/screens/PayInvoice/PayInvoice.cjs +1 -0
  287. package/dist/screens/PayInvoice/PayInvoice.mjs +582 -0
  288. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.ce.d.ts +1 -0
  289. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs +1 -0
  290. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.mjs +227 -0
  291. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +1 -0
  292. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs +1 -0
  293. package/dist/screens/SubscriptionDetails/SubscriptionDetails.mjs +882 -0
  294. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +1 -0
  295. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs +1 -0
  296. package/dist/screens/SubscriptionManagement/SubscriptionManagement.mjs +707 -0
  297. package/dist/sepa.svg.es-BF8PYKZg.js +1 -0
  298. package/dist/sepa.svg.es-cbE9g8gV.mjs +4 -0
  299. package/dist/slots.es-BpwYO3A3.mjs +18 -0
  300. package/dist/slots.es-Dq1PTUOv.js +1 -0
  301. package/dist/sorting.es-CjTrRfSW.mjs +105 -0
  302. package/dist/sorting.es-RyvcgbSL.js +1 -0
  303. package/dist/star.svg.es-DsCD-tSp.mjs +4 -0
  304. package/dist/star.svg.es-Q50IzqXr.js +1 -0
  305. package/dist/subscription-C41lG-rH.mjs +89 -0
  306. package/dist/subscription-b0OPx8Du.js +1 -0
  307. package/dist/subscriptions-300o4ae0.js +1 -0
  308. package/dist/subscriptions-DcMHBPVJ.mjs +58 -0
  309. package/dist/trustly.svg.es-C0Ou1HWk.mjs +4 -0
  310. package/dist/trustly.svg.es-CHojqNqm.js +1 -0
  311. package/dist/twint.svg.es-CQ-ZDfy8.js +1 -0
  312. package/dist/twint.svg.es-WrZYquRs.mjs +4 -0
  313. package/dist/typeGuards.es-C4nR5FkL.js +1 -0
  314. package/dist/typeGuards.es-fwUoeMCe.mjs +12 -0
  315. package/dist/types/components/InvoiceTable/InvoiceTable.types.d.ts +19 -0
  316. package/dist/types/components/checkout/CheckoutTitle.types.d.ts +10 -0
  317. package/dist/types/components/checkout/EmptyStatePlaceholder.types.d.ts +4 -0
  318. package/dist/types/components/checkout/PromotionCodeSection.types.d.ts +8 -0
  319. package/dist/types/components/customer/BillingInformationForm/BillingInformationForm.types.d.ts +24 -0
  320. package/dist/types/components/customer/CheckoutForm/CheckoutForm.types.d.ts +32 -0
  321. package/dist/types/components/customer/CustomerPaymentMethodsBlock/CustomerPaymentMethodsBlock.types.d.ts +12 -0
  322. package/dist/types/components/payments/AddPaymentMethodModal/AddPaymentMethodModal.types.d.ts +14 -0
  323. package/dist/types/components/payments/AddPaymentMethodPane/AddPaymentMethodPane.types.d.ts +19 -0
  324. package/dist/types/components/payments/ExpressPaymentMethod/ExpressPaymentMethod.types.d.ts +74 -0
  325. package/dist/types/components/payments/ExpressPaymentMethod/ExpressPaymentMethodApplePay.types.d.ts +9 -0
  326. package/dist/types/components/payments/ExpressPaymentMethodButton/ExpressPaymentMethodButton.types.d.ts +3 -0
  327. package/dist/types/components/payments/ExpressPaymentMethods/ExpressPaymentMethods.types.d.ts +21 -0
  328. package/dist/types/components/payments/PayButton/PayButton.types.d.ts +10 -0
  329. package/dist/types/components/payments/PaymentCompletedCard/PaymentCompletedCard.types.d.ts +5 -0
  330. package/dist/types/components/payments/PaymentErrorCard/PaymentErrorCard.types.d.ts +4 -0
  331. package/dist/types/components/payments/PaymentFeedbackCard/PaymentFeedbackCard.types.d.ts +4 -0
  332. package/dist/types/components/payments/PaymentIntegrationForm/PaymentIntegrationForm.types.d.ts +74 -0
  333. package/dist/types/components/payments/PaymentIntegrationFormAdyen/PaymentIntegrationFormAdyen.types.d.ts +6 -0
  334. package/dist/types/components/payments/PaymentIntegrationFormStripe/PaymentIntegrationFormStripe.types.d.ts +7 -0
  335. package/dist/types/components/payments/PaymentIntegrationFormStripe/PaymentIntegrationFormStripeFrame.types.d.ts +61 -0
  336. package/dist/types/components/payments/PaymentMethodSelector/PaymentMethodSelector.types.d.ts +53 -0
  337. package/dist/types/components/payments/PaymentMethodsList/PaymentMethodsList.types.d.ts +8 -0
  338. package/dist/types/components/payments/PaymentMethodsUnavailableCard/PaymentMethodsUnavailableCard.types.d.ts +8 -0
  339. package/dist/types/components/payments/SubscriptionPaymentCompletedCard/SubscriptionPaymentCompletedCard.types.d.ts +3 -0
  340. package/dist/types/components/providers/ActionDispatchProvider/ActionDispatchProvider.lib.d.ts +4 -0
  341. package/dist/types/components/providers/ActionDispatchProvider/ActionDispatchProvider.lib.types.d.ts +3 -0
  342. package/dist/types/components/providers/ActionDispatchProvider/ActionDispatchProvider.vue.d.ts +17 -0
  343. package/dist/types/components/providers/ActionDispatchProvider/composables/useActionDispatchProvider.d.ts +3 -0
  344. package/dist/types/components/providers/AuthProvider/AuthProvider.lib.d.ts +5 -0
  345. package/dist/types/components/providers/AuthProvider/AuthProvider.types.d.ts +8 -0
  346. package/dist/types/components/providers/AuthProvider/AuthProvider.vue.d.ts +18 -0
  347. package/dist/types/components/providers/AuthProvider/composables/useAuth.d.ts +3 -0
  348. package/dist/types/components/providers/AuthProvider/index.d.ts +3 -0
  349. package/dist/types/components/providers/ConfigProvider/ConfigProvider.lib.d.ts +5 -0
  350. package/dist/types/components/providers/ConfigProvider/ConfigProvider.types.d.ts +9 -0
  351. package/dist/types/components/providers/ConfigProvider/ConfigProvider.vue.d.ts +18 -0
  352. package/dist/types/components/providers/ConfigProvider/composables/useConfig.d.ts +3 -0
  353. package/dist/types/components/providers/CssOverridesProvider/CssOverridesProvider.types.d.ts +3 -0
  354. package/dist/types/components/providers/CssOverridesProvider/CssOverridesProvider.vue.d.ts +18 -0
  355. package/dist/types/components/providers/EntryProvider/EntryProvider.types.d.ts +10 -0
  356. package/dist/types/components/providers/EntryProvider/EntryProvider.vue.d.ts +22 -0
  357. package/dist/types/components/providers/ErrorBoundary/ErrorBoundary.vue.d.ts +17 -0
  358. package/dist/types/components/providers/ExperimentalFeatureProvider/ExperimentalFeatureProvider.lib.d.ts +5 -0
  359. package/dist/types/components/providers/ExperimentalFeatureProvider/ExperimentalFeatureProvider.types.d.ts +4 -0
  360. package/dist/types/components/providers/ExperimentalFeatureProvider/ExperimentalFeatureProvider.vue.d.ts +18 -0
  361. package/dist/types/components/providers/ExperimentalFeatureProvider/composables/useExperimentalFeature.d.ts +1 -0
  362. package/dist/types/components/providers/HostElementProvider/HostElementProvider.lib.d.ts +12 -0
  363. package/dist/types/components/providers/HostElementProvider/HostElementProvider.types.d.ts +3 -0
  364. package/dist/types/components/providers/HostElementProvider/HostElementProvider.vue.d.ts +18 -0
  365. package/dist/types/components/providers/HostElementProvider/composables/useHostElementProvider.d.ts +1 -0
  366. package/dist/types/components/providers/LoggerProvider/LoggerProvider.lib.d.ts +32 -0
  367. package/dist/types/components/providers/LoggerProvider/LoggerProvider.types.d.ts +70 -0
  368. package/dist/types/components/providers/LoggerProvider/LoggerProvider.vue.d.ts +20 -0
  369. package/dist/types/components/providers/LoggerProvider/composables/useLogger.d.ts +6 -0
  370. package/dist/types/components/providers/PortalProvider/PortalProvider.lib.d.ts +7 -0
  371. package/dist/types/components/providers/PortalProvider/PortalProvider.types.d.ts +11 -0
  372. package/dist/types/components/providers/PortalProvider/PortalProvider.vue.d.ts +18 -0
  373. package/dist/types/components/providers/PortalProvider/composables/usePortal.d.ts +3 -0
  374. package/dist/types/components/providers/Provider/Provider.types.d.ts +15 -0
  375. package/dist/types/components/providers/Provider/Provider.vue.d.ts +21 -0
  376. package/dist/types/components/providers/TeleportProvider/TeleportProvider.vue.d.ts +17 -0
  377. package/dist/types/components/providers/TranslationProvider/TranslationOverride.vue.d.ts +18 -0
  378. package/dist/types/components/providers/TranslationProvider/TranslationProvider.lib.d.ts +9 -0
  379. package/dist/types/components/providers/TranslationProvider/TranslationProvider.types.d.ts +22 -0
  380. package/dist/types/components/providers/TranslationProvider/TranslationProvider.vue.d.ts +18 -0
  381. package/dist/types/components/providers/index.d.ts +9 -0
  382. package/dist/types/components/shared/ScreenTitle/ScreenTitle.types.d.ts +4 -0
  383. package/dist/types/components/shared/Section/Section.types.d.ts +21 -0
  384. package/dist/types/components/shared/Skeleton.types.d.ts +5 -0
  385. package/dist/types/components/shared/SlidingPanes/SlidingPanes.types.d.ts +12 -0
  386. package/dist/types/components/subscriptions/EnabledPricingsList/EnabledPricingsList.types.d.ts +15 -0
  387. package/dist/types/components/subscriptions/EnabledPricingsList/EnabledPricingsListItem.types.d.ts +7 -0
  388. package/dist/types/components/subscriptions/OrderSummary.types.d.ts +65 -0
  389. package/dist/types/components/subscriptions/PlanCustomizationForm/AddonSingleEditor.types.d.ts +5 -0
  390. package/dist/types/components/subscriptions/PlanCustomizationForm/PlanCustomizationEditor.types.d.ts +8 -0
  391. package/dist/types/components/subscriptions/PlanCustomizationForm/PricingGroupContent.types.d.ts +4 -0
  392. package/dist/types/components/subscriptions/PlanCustomizationForm/PricingGroupEditorBase.types.d.ts +8 -0
  393. package/dist/types/components/subscriptions/PlanCustomizationForm/SeatsEditor.types.d.ts +6 -0
  394. package/dist/types/components/subscriptions/PlanCustomizationForm/SeatsEditorItem.types.d.ts +6 -0
  395. package/dist/types/components/subscriptions/PlanCustomizationForm/TieredTable.types.d.ts +5 -0
  396. package/dist/types/components/subscriptions/PlanCustomizationForm/TieredTableRow.types.d.ts +7 -0
  397. package/dist/types/components/subscriptions/SubscriptionCancellationModal/SubscriptionCancellationModal.types.d.ts +12 -0
  398. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagement.types.d.ts +47 -0
  399. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementForm.types.d.ts +28 -0
  400. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementSuccess.types.d.ts +7 -0
  401. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementSummary.types.d.ts +7 -0
  402. package/dist/types/components/subscriptions/SubscriptionSummary.types.d.ts +33 -0
  403. package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsList.types.d.ts +16 -0
  404. package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsListItem.types.d.ts +13 -0
  405. package/dist/types/components/wallets/AutoTopUpCancellationModal/AutoTopUpCancellationModal.types.d.ts +9 -0
  406. package/dist/types/components/wallets/AutoTopUpConfig/AutoTopUpConfig.types.d.ts +56 -0
  407. package/dist/types/components/wallets/AutoTopUpModal/AutoTopUpModal.types.d.ts +16 -0
  408. package/dist/types/components/wallets/ConvertedAmountInput/ConvertedAmountInput.types.d.ts +32 -0
  409. package/dist/types/components/wallets/TopUpModal/TopUpInvoicePreview.types.d.ts +11 -0
  410. package/dist/types/components/wallets/TopUpModal/TopUpModal.types.d.ts +31 -0
  411. package/dist/types/components/wallets/TopUpModal/TopUpModalForm.types.d.ts +23 -0
  412. package/dist/types/components/wallets/TopUpModal/TopUpModalSuccess.types.d.ts +11 -0
  413. package/dist/types/components/wallets/WalletModalShell.types.d.ts +24 -0
  414. package/dist/types/composables/useInvoicePreview.types.d.ts +9 -0
  415. package/dist/types/config/config.beta.d.ts +2 -0
  416. package/dist/types/config/config.dev.d.ts +2 -0
  417. package/dist/types/config/config.live.d.ts +2 -0
  418. package/dist/types/config/internalEnvironments.d.ts +11 -0
  419. package/dist/types/config/internalEnvironments.published.d.ts +7 -0
  420. package/dist/types/config/lib.d.ts +6 -0
  421. package/dist/types/config/types.d.ts +13 -0
  422. package/dist/types/index.d.ts +23 -0
  423. package/dist/types/public/components/BillingInformation/BillingInformation.entry.ce.d.ts +1 -0
  424. package/dist/types/public/components/BillingInformation/BillingInformation.entry.types.d.ts +4 -0
  425. package/dist/types/public/components/BillingInformation/BillingInformation.types.d.ts +12 -0
  426. package/dist/types/public/components/BillingInformationForm/BillingInformationForm.entry.ce.d.ts +1 -0
  427. package/dist/types/public/components/BillingInformationForm/BillingInformationForm.entry.types.d.ts +4 -0
  428. package/dist/types/public/components/BillingInformationForm/BillingInformationForm.types.d.ts +10 -0
  429. package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.entry.ce.d.ts +1 -0
  430. package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.entry.types.d.ts +6 -0
  431. package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.types.d.ts +22 -0
  432. package/dist/types/public/components/CustomerWalletBalances/CustomerWalletBalances.types.d.ts +22 -0
  433. package/dist/types/public/components/Invoice/Invoice.entry.ce.d.ts +1 -0
  434. package/dist/types/public/components/Invoice/Invoice.entry.types.d.ts +5 -0
  435. package/dist/types/public/components/Invoice/Invoice.types.d.ts +26 -0
  436. package/dist/types/public/components/InvoiceDetails/InvoiceDetails.entry.ce.d.ts +1 -0
  437. package/dist/types/public/components/InvoiceDetails/InvoiceDetails.entry.types.d.ts +5 -0
  438. package/dist/types/public/components/InvoiceDetails/InvoiceDetails.types.d.ts +9 -0
  439. package/dist/types/public/components/InvoiceHeader/InvoiceHeader.entry.ce.d.ts +1 -0
  440. package/dist/types/public/components/InvoiceHeader/InvoiceHeader.entry.types.d.ts +5 -0
  441. package/dist/types/public/components/InvoiceHeader/InvoiceHeader.types.d.ts +16 -0
  442. package/dist/types/public/components/InvoicesList/InvoicesList.entry.ce.d.ts +1 -0
  443. package/dist/types/public/components/InvoicesList/InvoicesList.entry.types.d.ts +5 -0
  444. package/dist/types/public/components/InvoicesList/InvoicesList.types.d.ts +37 -0
  445. package/dist/types/public/components/PaymentHistory/PaymentHistory.entry.ce.d.ts +1 -0
  446. package/dist/types/public/components/PaymentHistory/PaymentHistory.entry.types.d.ts +5 -0
  447. package/dist/types/public/components/PaymentHistory/PaymentHistory.types.d.ts +10 -0
  448. package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.entry.ce.d.ts +1 -0
  449. package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.entry.types.d.ts +5 -0
  450. package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.types.d.ts +38 -0
  451. package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.entry.ce.d.ts +1 -0
  452. package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.entry.types.d.ts +5 -0
  453. package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.types.d.ts +9 -0
  454. package/dist/types/public/components/SubscriptionsList/SubscriptionsList.entry.ce.d.ts +1 -0
  455. package/dist/types/public/components/SubscriptionsList/SubscriptionsList.entry.types.d.ts +5 -0
  456. package/dist/types/public/components/SubscriptionsList/SubscriptionsList.types.d.ts +16 -0
  457. package/dist/types/public/components/WalletBalances/WalletBalances.entry.ce.d.ts +1 -0
  458. package/dist/types/public/components/WalletBalances/WalletBalances.entry.types.d.ts +5 -0
  459. package/dist/types/public/components/WalletBalances/WalletBalances.types.d.ts +3 -0
  460. package/dist/types/public/core/action-request.types.d.ts +55 -0
  461. package/dist/types/public/core/configuration.d.ts +3 -0
  462. package/dist/types/public/core/index.d.ts +14 -0
  463. package/dist/types/public/core/registry.ce.d.ts +8 -0
  464. package/dist/types/public/core/registry.d.ts +6 -0
  465. package/dist/types/public/core/types.d.ts +120 -0
  466. package/dist/types/public/screens/Checkout/Checkout.entry.ce.d.ts +1 -0
  467. package/dist/types/public/screens/Checkout/Checkout.entry.types.d.ts +18 -0
  468. package/dist/types/public/screens/Checkout/Checkout.types.d.ts +46 -0
  469. package/dist/types/public/screens/CustomerOverview/CustomerOverview.entry.ce.d.ts +1 -0
  470. package/dist/types/public/screens/CustomerOverview/CustomerOverview.entry.types.d.ts +5 -0
  471. package/dist/types/public/screens/CustomerOverview/CustomerOverview.types.d.ts +2 -0
  472. package/dist/types/public/screens/PayInvoice/PayInvoice.entry.ce.d.ts +1 -0
  473. package/dist/types/public/screens/PayInvoice/PayInvoice.entry.types.d.ts +4 -0
  474. package/dist/types/public/screens/PayInvoice/PayInvoice.types.d.ts +23 -0
  475. package/dist/types/public/screens/PaymentMethodsManagement/PaymentMethodsManagement.entry.ce.d.ts +1 -0
  476. package/dist/types/public/screens/PaymentMethodsManagement/PaymentMethodsManagement.entry.types.d.ts +3 -0
  477. package/dist/types/public/screens/PaymentMethodsManagement/PaymentMethodsManagement.types.d.ts +7 -0
  478. package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.entry.ce.d.ts +1 -0
  479. package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.entry.types.d.ts +6 -0
  480. package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.types.d.ts +23 -0
  481. package/dist/types/public/screens/SubscriptionManagement/SubscriptionManagement.entry.ce.d.ts +1 -0
  482. package/dist/types/public/screens/SubscriptionManagement/SubscriptionManagement.entry.types.d.ts +5 -0
  483. package/dist/types/public/screens/SubscriptionManagement/SubscriptionManagement.types.d.ts +13 -0
  484. package/dist/types/public/screens/types.d.ts +4 -0
  485. package/dist/types/public/types/index.d.ts +23 -0
  486. package/dist/types/services/invoices.types.d.ts +26 -0
  487. package/dist/types/services/paymentMethods.types.d.ts +31 -0
  488. package/dist/types/services/portals.types.d.ts +68 -0
  489. package/dist/types/services/requests.types.d.ts +24 -0
  490. package/dist/types/translations/supported.d.ts +1 -0
  491. package/dist/types/types/EntryBaseProps.d.ts +10 -0
  492. package/dist/types/types/errors.d.ts +7 -0
  493. package/dist/types/types/subscription.d.ts +4 -0
  494. package/dist/types/vendor/@solvimon/solvimon-types/index.d.ts +111 -0
  495. package/dist/types/vendor/@solvimon/solvimon-types/types/Address.d.ts +17 -0
  496. package/dist/types/vendor/@solvimon/solvimon-types/types/Alerts.d.ts +72 -0
  497. package/dist/types/vendor/@solvimon/solvimon-types/types/Amount.d.ts +4 -0
  498. package/dist/types/vendor/@solvimon/solvimon-types/types/Api.d.ts +50 -0
  499. package/dist/types/vendor/@solvimon/solvimon-types/types/ApiError.d.ts +7 -0
  500. package/dist/types/vendor/@solvimon/solvimon-types/types/ApiKey.d.ts +21 -0
  501. package/dist/types/vendor/@solvimon/solvimon-types/types/ApiStatus.d.ts +7 -0
  502. package/dist/types/vendor/@solvimon/solvimon-types/types/ApprovalPolicies.d.ts +77 -0
  503. package/dist/types/vendor/@solvimon/solvimon-types/types/ApprovalRequests.d.ts +22 -0
  504. package/dist/types/vendor/@solvimon/solvimon-types/types/Attachment.d.ts +14 -0
  505. package/dist/types/vendor/@solvimon/solvimon-types/types/Band.d.ts +30 -0
  506. package/dist/types/vendor/@solvimon/solvimon-types/types/BaseResourceStatus.d.ts +3 -0
  507. package/dist/types/vendor/@solvimon/solvimon-types/types/BillingEntity.d.ts +45 -0
  508. package/dist/types/vendor/@solvimon/solvimon-types/types/BillingPeriod.d.ts +5 -0
  509. package/dist/types/vendor/@solvimon/solvimon-types/types/BillingTime.d.ts +1 -0
  510. package/dist/types/vendor/@solvimon/solvimon-types/types/ChargeOnDemandPricingItems.d.ts +24 -0
  511. package/dist/types/vendor/@solvimon/solvimon-types/types/Commitment.d.ts +9 -0
  512. package/dist/types/vendor/@solvimon/solvimon-types/types/CommitmentItem.d.ts +17 -0
  513. package/dist/types/vendor/@solvimon/solvimon-types/types/Comparator.d.ts +1 -0
  514. package/dist/types/vendor/@solvimon/solvimon-types/types/ConfigMeterProperties.d.ts +12 -0
  515. package/dist/types/vendor/@solvimon/solvimon-types/types/ConfiguredMeterValue.d.ts +9 -0
  516. package/dist/types/vendor/@solvimon/solvimon-types/types/Country.d.ts +1 -0
  517. package/dist/types/vendor/@solvimon/solvimon-types/types/CreateMeterData.d.ts +5 -0
  518. package/dist/types/vendor/@solvimon/solvimon-types/types/CreatePricingPlanVersion.d.ts +3 -0
  519. package/dist/types/vendor/@solvimon/solvimon-types/types/CreditType.d.ts +16 -0
  520. package/dist/types/vendor/@solvimon/solvimon-types/types/Currency.d.ts +8 -0
  521. package/dist/types/vendor/@solvimon/solvimon-types/types/CustomFields.d.ts +39 -0
  522. package/dist/types/vendor/@solvimon/solvimon-types/types/CustomerContact.d.ts +12 -0
  523. package/dist/types/vendor/@solvimon/solvimon-types/types/Customers.d.ts +75 -0
  524. package/dist/types/vendor/@solvimon/solvimon-types/types/Discount.d.ts +12 -0
  525. package/dist/types/vendor/@solvimon/solvimon-types/types/DiscountItem.d.ts +24 -0
  526. package/dist/types/vendor/@solvimon/solvimon-types/types/Document.d.ts +22 -0
  527. package/dist/types/vendor/@solvimon/solvimon-types/types/DueDateConfiguration.d.ts +8 -0
  528. package/dist/types/vendor/@solvimon/solvimon-types/types/Entitlement.d.ts +16 -0
  529. package/dist/types/vendor/@solvimon/solvimon-types/types/Environment.d.ts +1 -0
  530. package/dist/types/vendor/@solvimon/solvimon-types/types/EventTrace.d.ts +23 -0
  531. package/dist/types/vendor/@solvimon/solvimon-types/types/EventTraceExtended.d.ts +22 -0
  532. package/dist/types/vendor/@solvimon/solvimon-types/types/EventTraceLink.d.ts +14 -0
  533. package/dist/types/vendor/@solvimon/solvimon-types/types/EventTraceLinkExtended.d.ts +15 -0
  534. package/dist/types/vendor/@solvimon/solvimon-types/types/Features.d.ts +25 -0
  535. package/dist/types/vendor/@solvimon/solvimon-types/types/IdentityProvider.d.ts +40 -0
  536. package/dist/types/vendor/@solvimon/solvimon-types/types/IndexingSettings.d.ts +24 -0
  537. package/dist/types/vendor/@solvimon/solvimon-types/types/Integrations.d.ts +367 -0
  538. package/dist/types/vendor/@solvimon/solvimon-types/types/Invoice.d.ts +349 -0
  539. package/dist/types/vendor/@solvimon/solvimon-types/types/JWT.d.ts +22 -0
  540. package/dist/types/vendor/@solvimon/solvimon-types/types/Markup.d.ts +8 -0
  541. package/dist/types/vendor/@solvimon/solvimon-types/types/MarkupItem.d.ts +11 -0
  542. package/dist/types/vendor/@solvimon/solvimon-types/types/Meter.d.ts +32 -0
  543. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterConditions.d.ts +26 -0
  544. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterData.d.ts +25 -0
  545. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterDataExpanded.d.ts +5 -0
  546. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterProperty.d.ts +34 -0
  547. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterPropertyValue.d.ts +5 -0
  548. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterValue.d.ts +16 -0
  549. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterValueCalculation.d.ts +20 -0
  550. package/dist/types/vendor/@solvimon/solvimon-types/types/MeterValueValue.d.ts +7 -0
  551. package/dist/types/vendor/@solvimon/solvimon-types/types/ModelType.d.ts +1 -0
  552. package/dist/types/vendor/@solvimon/solvimon-types/types/Name.d.ts +5 -0
  553. package/dist/types/vendor/@solvimon/solvimon-types/types/NotificationPreferences.d.ts +9 -0
  554. package/dist/types/vendor/@solvimon/solvimon-types/types/Payment.d.ts +124 -0
  555. package/dist/types/vendor/@solvimon/solvimon-types/types/PaymentAcceptor.d.ts +120 -0
  556. package/dist/types/vendor/@solvimon/solvimon-types/types/PaymentAction.d.ts +74 -0
  557. package/dist/types/vendor/@solvimon/solvimon-types/types/PaymentMethod.d.ts +173 -0
  558. package/dist/types/vendor/@solvimon/solvimon-types/types/PaymentMethodOptions.d.ts +45 -0
  559. package/dist/types/vendor/@solvimon/solvimon-types/types/PaymentSchedules.d.ts +142 -0
  560. package/dist/types/vendor/@solvimon/solvimon-types/types/Permission.d.ts +1 -0
  561. package/dist/types/vendor/@solvimon/solvimon-types/types/Platform.d.ts +118 -0
  562. package/dist/types/vendor/@solvimon/solvimon-types/types/Portal.d.ts +58 -0
  563. package/dist/types/vendor/@solvimon/solvimon-types/types/Pricing.d.ts +41 -0
  564. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingCategory.d.ts +18 -0
  565. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingCategoryExtended.d.ts +9 -0
  566. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingExtended.d.ts +9 -0
  567. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingGroup.d.ts +29 -0
  568. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingItem.d.ts +40 -0
  569. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingItemConfig.d.ts +130 -0
  570. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanSchedule.d.ts +103 -0
  571. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanScheduleInfo.d.ts +7 -0
  572. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanScheduleWithPlanData.d.ts +9 -0
  573. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanSubscription.d.ts +80 -0
  574. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanSubscriptionGroup.d.ts +10 -0
  575. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanVersion.d.ts +71 -0
  576. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlanVersionExtended.d.ts +7 -0
  577. package/dist/types/vendor/@solvimon/solvimon-types/types/PricingPlans.d.ts +44 -0
  578. package/dist/types/vendor/@solvimon/solvimon-types/types/Product.d.ts +22 -0
  579. package/dist/types/vendor/@solvimon/solvimon-types/types/ProductCategory.d.ts +10 -0
  580. package/dist/types/vendor/@solvimon/solvimon-types/types/ProductItem.d.ts +60 -0
  581. package/dist/types/vendor/@solvimon/solvimon-types/types/PromotionCodes.d.ts +14 -0
  582. package/dist/types/vendor/@solvimon/solvimon-types/types/QuoteTemplates.d.ts +43 -0
  583. package/dist/types/vendor/@solvimon/solvimon-types/types/QuoteVersions.d.ts +93 -0
  584. package/dist/types/vendor/@solvimon/solvimon-types/types/Quotes.d.ts +65 -0
  585. package/dist/types/vendor/@solvimon/solvimon-types/types/ReprocessLog.d.ts +31 -0
  586. package/dist/types/vendor/@solvimon/solvimon-types/types/Resource.d.ts +5 -0
  587. package/dist/types/vendor/@solvimon/solvimon-types/types/ResourceStatus.d.ts +2 -0
  588. package/dist/types/vendor/@solvimon/solvimon-types/types/Role.d.ts +19 -0
  589. package/dist/types/vendor/@solvimon/solvimon-types/types/SignatureRequest.d.ts +27 -0
  590. package/dist/types/vendor/@solvimon/solvimon-types/types/TaxCategory.d.ts +1 -0
  591. package/dist/types/vendor/@solvimon/solvimon-types/types/TaxIdentifier.d.ts +17 -0
  592. package/dist/types/vendor/@solvimon/solvimon-types/types/TaxSummary.d.ts +21 -0
  593. package/dist/types/vendor/@solvimon/solvimon-types/types/TimePeriod.d.ts +5 -0
  594. package/dist/types/vendor/@solvimon/solvimon-types/types/Timestamp.d.ts +4 -0
  595. package/dist/types/vendor/@solvimon/solvimon-types/types/Token.d.ts +6 -0
  596. package/dist/types/vendor/@solvimon/solvimon-types/types/User.d.ts +106 -0
  597. package/dist/types/vendor/@solvimon/solvimon-types/types/ValueType.d.ts +1 -0
  598. package/dist/types/vendor/@solvimon/solvimon-types/types/Wallet.d.ts +44 -0
  599. package/dist/types/vendor/@solvimon/solvimon-types/types/WalletAutoTopUpConfigs.d.ts +28 -0
  600. package/dist/types/vendor/@solvimon/solvimon-types/types/WalletType.d.ts +54 -0
  601. package/dist/types/vendor/@solvimon/solvimon-types/types/Webhook.d.ts +48 -0
  602. package/dist/types/vendor/@solvimon/solvimon-types/types/WebhookEvent.d.ts +18 -0
  603. package/dist/types/vendor/@solvimon/solvimon-types/types/Workflows.d.ts +95 -0
  604. package/dist/types/vendor/@solvimon/solvimon-types/types/forms.d.ts +1 -0
  605. package/dist/types/vendor/@solvimon/solvimon-types/utils.d.ts +17 -0
  606. package/dist/unionpay.svg.es-DYgo83Hf.mjs +4 -0
  607. package/dist/unionpay.svg.es-YqJKKFEj.js +1 -0
  608. package/dist/url-CjULBkjW.js +1 -0
  609. package/dist/url-CvNDq4wp.mjs +22 -0
  610. package/dist/{useActionDispatchProvider-CgRcOqv3.mjs → useActionDispatchProvider-BVOBO0Jx.mjs} +1 -1
  611. package/dist/useActionDispatchProvider-Cv9amjTf.js +1 -0
  612. package/dist/useCustomer-DLHOs4BR.js +1 -0
  613. package/dist/useCustomer-EDhref7T.mjs +25 -0
  614. package/dist/useCustomerFormLabels-B61-4xQ7.mjs +1168 -0
  615. package/dist/useCustomerFormLabels-C6wW4n2e.js +1 -0
  616. package/dist/useExperimentalFeature-0yFoaEzV.js +1 -0
  617. package/dist/useExperimentalFeature-DvxOrFPU.mjs +9 -0
  618. package/dist/{useIncrementalLoading-C7ToTmZK.mjs → useIncrementalLoading-BK9pRYAU.mjs} +9 -9
  619. package/dist/useIncrementalLoading-CdtGJm_Y.js +1 -0
  620. package/dist/useInvoiceData-BSjVeJrI.js +1 -0
  621. package/dist/{useInvoiceData-CcueV3We.mjs → useInvoiceData-C0Y5WrbT.mjs} +6 -12
  622. package/dist/useInvoicesList-BRDZqsaB.js +1 -0
  623. package/dist/useInvoicesList-CYoE7q0u.mjs +580 -0
  624. package/dist/{useLoadInitialData-Dm48tlSO.mjs → useLoadInitialData-Cp1OA8y6.mjs} +5 -0
  625. package/dist/useLoadInitialData-u7IyXqb6.js +1 -0
  626. package/dist/usePaymentMethodAvailability-B3s1lqQ2.js +1 -0
  627. package/dist/usePaymentMethodAvailability-EuhZPghG.mjs +141 -0
  628. package/dist/usePaymentMethodOptions--8QpMvNm.js +1 -0
  629. package/dist/usePaymentMethodOptions-Cljh7HYp.mjs +36 -0
  630. package/dist/{usePaymentMethods-Db-1R6rI.mjs → usePaymentMethods-BJzoI8dZ.mjs} +2 -2
  631. package/dist/{usePaymentMethods-DCGVRXA4.js → usePaymentMethods-DvEnJWmB.js} +1 -1
  632. package/dist/usePayments-CANj0QVc.js +1 -0
  633. package/dist/usePayments-CaT1CBzE.mjs +362 -0
  634. package/dist/usePortal-BjGoSeLy.js +1 -0
  635. package/dist/usePortal-CMPQ0M9R.mjs +12 -0
  636. package/dist/useService-D73FNBjT.js +1 -0
  637. package/dist/useService-W3Kxems4.mjs +72 -0
  638. package/dist/useSubscription-D1UKnZAx.mjs +250 -0
  639. package/dist/useSubscription-DZfRHbL7.js +1 -0
  640. package/dist/useViewport-Bu0cyeSi.mjs +38 -0
  641. package/dist/useViewport-CKRY1CKR.js +1 -0
  642. package/dist/useWatchDebounced-C_YxgoQ6.js +1 -0
  643. package/dist/useWatchDebounced-Zmxd6InB.mjs +16 -0
  644. package/dist/visa.svg.es-B6aU_qRs.mjs +4 -0
  645. package/dist/visa.svg.es-D6sc4YTE.js +1 -0
  646. package/dist/vpay.svg.es-4qIqS4aX.mjs +4 -0
  647. package/dist/vpay.svg.es-CLGTyB09.js +1 -0
  648. package/dist/zip.svg.es-3PzSBe1E.mjs +4 -0
  649. package/dist/zip.svg.es-BRsgmur-.js +1 -0
  650. package/package.json +112 -61
  651. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-BD3CrJzj.js +0 -1
  652. package/dist/ContentWithAsideLayout-CRsFr9TH.mjs +0 -42
  653. package/dist/ContentWithAsideLayout-DczcgSrt.js +0 -1
  654. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-BE3I7Oe1.js +0 -1
  655. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-sNdlKgdU.js +0 -1
  656. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DJEZEEwZ.mjs +0 -6568
  657. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Sn1Jq19s.js +0 -1
  658. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-Bifo4jTH.js +0 -1
  659. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-DWp42_G4.mjs +0 -75
  660. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-C_BwMlBE.js +0 -1
  661. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-yyhwzYSM.js +0 -1
  662. package/dist/_Uint8Array-DHE03FZr.mjs +0 -507
  663. package/dist/_Uint8Array-DxISR7XF.js +0 -1
  664. package/dist/auto-DzZuCneB.mjs +0 -14387
  665. package/dist/auto-PpnAChnH.js +0 -6
  666. package/dist/cloneDeep-DranHQkY.js +0 -1
  667. package/dist/cloneDeep-sm9cY-u2.mjs +0 -212
  668. package/dist/component-DEo_ndpK.mjs +0 -58668
  669. package/dist/component-XHQYFLA_.js +0 -1
  670. package/dist/components/BillingInformation/BillingInformation.cjs.js +0 -1
  671. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +0 -1
  672. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +0 -1
  673. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +0 -134
  674. package/dist/components/Invoice/Invoice.cjs.js +0 -1
  675. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +0 -1
  676. package/dist/components/InvoicesList/InvoicesList.cjs.js +0 -1
  677. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +0 -1
  678. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +0 -1
  679. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +0 -238
  680. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +0 -1
  681. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +0 -152
  682. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +0 -1
  683. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +0 -134
  684. package/dist/components/WalletBalances/WalletBalances.cjs.js +0 -1
  685. package/dist/core/index.cjs.js +0 -1
  686. package/dist/core/index.es.js +0 -6
  687. package/dist/index-2jo9BSPM.js +0 -1
  688. package/dist/index-BFZ0dPh9.mjs +0 -179
  689. package/dist/index-CWSXne1Q.js +0 -1
  690. package/dist/index-CzL1ZcGi.mjs +0 -85
  691. package/dist/index-D3v7hAtc.mjs +0 -253
  692. package/dist/index-DRdBmZ2-.js +0 -1
  693. package/dist/index.cjs.js +0 -1
  694. package/dist/index.es.js +0 -45
  695. package/dist/invoices-BW1notiX.js +0 -1
  696. package/dist/invoices-M5oYVch6.mjs +0 -84
  697. package/dist/paymentMethods-BX80t2zk.js +0 -1
  698. package/dist/payments-BHv4hCeJ.js +0 -1
  699. package/dist/registry-BwKEYOf7.js +0 -1
  700. package/dist/registry-Cag1Jj7P.mjs +0 -143
  701. package/dist/screens/Checkout/Checkout.cjs.js +0 -1
  702. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +0 -1
  703. package/dist/screens/CustomerOverview/CustomerOverview.es.js +0 -136
  704. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  705. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  706. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1012
  707. package/dist/solvimon-web.css +0 -1
  708. package/dist/sprite-i5T7eZnk-C55G-dBo.js +0 -1
  709. package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +0 -4
  710. package/dist/subscriptions-Bs4DIE8f.mjs +0 -74
  711. package/dist/subscriptions-CnxvsBXd.js +0 -1
  712. package/dist/useActionDispatchProvider-Cru69mAl.js +0 -1
  713. package/dist/useCustomer-B0NK96dA.js +0 -1
  714. package/dist/useCustomer-DlcjY3fP.mjs +0 -45
  715. package/dist/useCustomerPaymentMethodOptions-C-8BLzqb.js +0 -1
  716. package/dist/useIncrementalLoading-D60Vttil.js +0 -1
  717. package/dist/useInvoiceData-DstXfI7t.js +0 -1
  718. package/dist/useInvoicesList-CXng3aUm.mjs +0 -294
  719. package/dist/useInvoicesList-DmzjgMlW.js +0 -1
  720. package/dist/useLoadInitialData-BRg7IWqW.js +0 -1
  721. package/dist/useService-B4qv5N2D.mjs +0 -281
  722. package/dist/useService-D-CUtlp3.js +0 -1
  723. package/dist/useWalletBalanceItems-BZyiAhcV.js +0 -1
  724. package/dist/useWalletBalanceItems-CHkLaccm.mjs +0 -105
@@ -0,0 +1,3264 @@
1
+ import { defineComponent, ref, onMounted, onBeforeUnmount, computed, openBlock, createBlock, withCtx, createElementVNode, toDisplayString, createVNode, createTextVNode, createElementBlock, unref, createCommentVNode, renderSlot, createSlots, Fragment, renderList, useModel, watch, isRef, mergeModels, mergeProps, reactive, normalizeClass, withModifiers, normalizeStyle } from "vue";
2
+ import { w as withExpand } from "./api.es-C5pe8LUl.mjs";
3
+ import { u as useIntl, _ as _sfc_main$h, c as createRequestService, a as useConfig, b as useLogger, g as createLatestGuard } from "./customElements-B-89a5oH.mjs";
4
+ import { E as EXPAND_ALL } from "./component-BG6DmXcy.mjs";
5
+ import { u as useService } from "./useService-W3Kxems4.mjs";
6
+ import { _ as _sfc_main$w } from "./ErrorNotification.vue.es-CHyVTBGs.mjs";
7
+ import { i as isFixedPricing, a as isFlexiblePricing, h as hasOneOfPricingTypes } from "./pricingItemConfigs.es-BPIm6S8M.mjs";
8
+ import { f as formatAmount } from "./formatting.es-eYgXv_AK.mjs";
9
+ import { a as _sfc_main$i, _ as _sfc_main$j } from "./Button.vue.es-Cm9pLU9i.mjs";
10
+ import { _ as _sfc_main$f, T as TooltipContent, a as _sfc_main$g } from "./TooltipParagraph.vue.es-C5RTcrid.mjs";
11
+ import { _ as _sfc_main$k } from "./Section.vue.es-DX_9ueCG.mjs";
12
+ import { _ as _sfc_main$l } from "./Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
13
+ import { b as _sfc_main$n, a as _sfc_main$r } from "./EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DLE5-9wz.mjs";
14
+ import { u as useValidation, c as common, _ as _sfc_main$p, a as requiredIf, r as required } from "./index-Cai7laNY.mjs";
15
+ import { _ as _sfc_main$s } from "./Divider.vue.es-wKkIVBgb.mjs";
16
+ import { _ as _sfc_main$q } from "./Expand.vue.es-C4_XmqbR.mjs";
17
+ import { _ as _sfc_main$m } from "./cn.es-BEU5D0Wz.mjs";
18
+ import { c as createInvoicesService } from "./invoices-1oYkdQQV.mjs";
19
+ import { u as useWatchDebounced } from "./useWatchDebounced-Zmxd6InB.mjs";
20
+ import { _ as _sfc_main$o } from "./Input.vue.es-WZGF8dfr.mjs";
21
+ import { _ as _sfc_main$t, a as _sfc_main$u } from "./AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Ce30EXY5.mjs";
22
+ import { _ as _sfc_main$v } from "./SubscriptionSummary.vue_vue_type_script_setup_true_lang-C5zB3CgZ.mjs";
23
+ import { g as getCustomerCountry } from "./customer.es-C_vSWcVA.mjs";
24
+ import { u as usePaymentMethodOptions } from "./usePaymentMethodOptions-Cljh7HYp.mjs";
25
+ import { M as Modal } from "./Modal.vue.es-qdUHDOnU.mjs";
26
+ const formatWalletBalanceValue = (formatMessage, formatNumber, balanceValue) => {
27
+ var _a, _b, _c, _d, _e, _f;
28
+ if (balanceValue == null ? void 0 : balanceValue.amount) {
29
+ return formatAmount(balanceValue.amount);
30
+ }
31
+ if (balanceValue == null ? void 0 : balanceValue.credits) {
32
+ const quantity = Number(balanceValue.credits.quantity);
33
+ const unitLabel = quantity === 1 ? (_b = (_a = balanceValue.credits.credit_type) == null ? void 0 : _a.unit_name) == null ? void 0 : _b.singular : ((_d = (_c = balanceValue.credits.credit_type) == null ? void 0 : _c.unit_name) == null ? void 0 : _d.plural) ?? ((_f = (_e = balanceValue.credits.credit_type) == null ? void 0 : _e.unit_name) == null ? void 0 : _f.singular);
34
+ const unit = unitLabel ?? formatMessage({
35
+ defaultMessage: "credits",
36
+ description: "Wallet balances credits default message",
37
+ id: "wB/wXs"
38
+ });
39
+ return `${formatNumber(quantity)} ${unit}`;
40
+ }
41
+ return formatMessage({
42
+ defaultMessage: "N/A",
43
+ description: "Fallback wallet balance label when no balance is available",
44
+ id: "PW+sL4"
45
+ });
46
+ };
47
+ const REFRESH_INTERVAL_MS = 3e4;
48
+ const SECONDS_PER_MINUTE = 60;
49
+ const MONTHS_PER_YEAR = 12;
50
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
51
+ __name: "DateTimeAgo",
52
+ props: {
53
+ date: {},
54
+ actionVerb: {}
55
+ },
56
+ setup(__props) {
57
+ const SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;
58
+ const SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
59
+ const props = __props;
60
+ const { $t, formatDate } = useIntl();
61
+ const now = ref(Date.now());
62
+ let refreshTimer;
63
+ onMounted(() => {
64
+ refreshTimer = setInterval(() => {
65
+ now.value = Date.now();
66
+ }, REFRESH_INTERVAL_MS);
67
+ });
68
+ onBeforeUnmount(() => {
69
+ clearInterval(refreshTimer);
70
+ });
71
+ const elapsedMonths = (from, to) => {
72
+ const months = (to.getFullYear() - from.getFullYear()) * MONTHS_PER_YEAR + (to.getMonth() - from.getMonth());
73
+ return to.getDate() < from.getDate() ? months - 1 : months;
74
+ };
75
+ const timeAgo = computed(() => {
76
+ const elapsed = Math.max(0, (now.value - props.date.getTime()) / 1e3);
77
+ if (elapsed < SECONDS_PER_MINUTE) {
78
+ return $t(
79
+ {
80
+ defaultMessage: "{count, plural, one {# second} other {# seconds}} ago",
81
+ id: "dateTimeAgo.seconds",
82
+ description: "Relative time in whole seconds"
83
+ },
84
+ { count: Math.trunc(elapsed) }
85
+ );
86
+ }
87
+ if (elapsed < SECONDS_PER_HOUR) {
88
+ return $t(
89
+ {
90
+ defaultMessage: "{count, plural, one {# minute} other {# minutes}} ago",
91
+ id: "dateTimeAgo.minutes",
92
+ description: "Relative time in whole minutes"
93
+ },
94
+ { count: Math.trunc(elapsed / SECONDS_PER_MINUTE) }
95
+ );
96
+ }
97
+ if (elapsed < SECONDS_PER_DAY) {
98
+ return $t(
99
+ {
100
+ defaultMessage: "{count, plural, one {# hour} other {# hours}} ago",
101
+ id: "dateTimeAgo.hours",
102
+ description: "Relative time in whole hours"
103
+ },
104
+ { count: Math.trunc(elapsed / SECONDS_PER_HOUR) }
105
+ );
106
+ }
107
+ const months = elapsedMonths(props.date, new Date(now.value));
108
+ if (months < 1) {
109
+ const days = Math.trunc(elapsed / SECONDS_PER_DAY);
110
+ if (days === 1) {
111
+ return $t({
112
+ defaultMessage: "yesterday",
113
+ id: "dateTimeAgo.yesterday",
114
+ description: 'Relative time for a single day ago, reading as "updated yesterday" once the action verb is in front'
115
+ });
116
+ }
117
+ return $t(
118
+ {
119
+ defaultMessage: "{count, plural, one {# day} other {# days}} ago",
120
+ id: "dateTimeAgo.days",
121
+ description: "Relative time in whole days"
122
+ },
123
+ { count: days }
124
+ );
125
+ }
126
+ if (months < MONTHS_PER_YEAR) {
127
+ return $t(
128
+ {
129
+ defaultMessage: "{count, plural, one {# month} other {# months}} ago",
130
+ id: "dateTimeAgo.months",
131
+ description: "Relative time in whole months"
132
+ },
133
+ { count: months }
134
+ );
135
+ }
136
+ return $t(
137
+ {
138
+ defaultMessage: "{count, plural, one {# year} other {# years}} ago",
139
+ id: "dateTimeAgo.years",
140
+ description: "Relative time in whole years"
141
+ },
142
+ { count: Math.trunc(months / MONTHS_PER_YEAR) }
143
+ );
144
+ });
145
+ const label = computed(
146
+ () => props.actionVerb ? `${props.actionVerb} ${timeAgo.value}` : timeAgo.value
147
+ );
148
+ const fullDate = computed(
149
+ () => formatDate({ date: props.date, format: "dateTime", offsetType: "local" })
150
+ );
151
+ return (_ctx, _cache) => {
152
+ return openBlock(), createBlock(_sfc_main$f, null, {
153
+ tooltip: withCtx(() => [
154
+ createVNode(TooltipContent, null, {
155
+ default: withCtx(() => [
156
+ createVNode(_sfc_main$g, null, {
157
+ default: withCtx(() => [
158
+ createTextVNode(toDisplayString(fullDate.value), 1)
159
+ ]),
160
+ _: 1
161
+ })
162
+ ]),
163
+ _: 1
164
+ })
165
+ ]),
166
+ default: withCtx(() => [
167
+ createElementVNode("span", null, toDisplayString(label.value), 1)
168
+ ]),
169
+ _: 1
170
+ });
171
+ };
172
+ }
173
+ });
174
+ const useWalletBalancesItem = (props) => {
175
+ const { $t, formatNumber } = useIntl();
176
+ const formatBalance = (balanceValue) => formatWalletBalanceValue($t, formatNumber, balanceValue);
177
+ const walletName = computed(
178
+ () => {
179
+ var _a, _b;
180
+ return ((_b = (_a = props.walletBalance.wallet) == null ? void 0 : _a.wallet_type) == null ? void 0 : _b.name) || $t({
181
+ defaultMessage: "Balance",
182
+ id: "wallet_balance.balance_label",
183
+ description: "Label shown above a wallet's balance amount"
184
+ });
185
+ }
186
+ );
187
+ const getOnDemandConfigs = (chargeOnDemandItem) => {
188
+ var _a;
189
+ return (((_a = chargeOnDemandItem.pricing_item) == null ? void 0 : _a.configs) ?? []).filter((config) => !!config.on_demand);
190
+ };
191
+ const manualTopUpItems = computed(
192
+ () => (props.walletBalance.charge_on_demand_pricing_items ?? []).filter(
193
+ (chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem).some(
194
+ (config) => isFixedPricing(config) || isFlexiblePricing(config)
195
+ )
196
+ )
197
+ );
198
+ const flexibleManualTopUpItem = computed(
199
+ () => manualTopUpItems.value.find(
200
+ (chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem).some((config) => isFlexiblePricing(config))
201
+ )
202
+ );
203
+ const showManualTopUp = computed(
204
+ () => !!props.showManualTopUp && manualTopUpItems.value.length > 0
205
+ );
206
+ const showAutoTopUp = computed(() => !!props.showAutoTopUp && !!flexibleManualTopUpItem.value);
207
+ const activeTopUpConfig = computed(
208
+ () => {
209
+ var _a, _b;
210
+ return (_b = (_a = props.walletBalance.wallet) == null ? void 0 : _a.auto_top_up_configs) == null ? void 0 : _b.find(
211
+ (config) => config.status === "ACTIVE"
212
+ );
213
+ }
214
+ );
215
+ const balanceCreditType = computed(
216
+ () => {
217
+ var _a, _b;
218
+ return (_b = (_a = props.walletBalance.wallet_balance.open_balance) == null ? void 0 : _a.credits) == null ? void 0 : _b.credit_type;
219
+ }
220
+ );
221
+ const formatCredits = (quantity, creditTypeId) => formatBalance({
222
+ credits: {
223
+ quantity,
224
+ credit_type_id: creditTypeId,
225
+ credit_type: balanceCreditType.value
226
+ }
227
+ });
228
+ const formatThreshold = (threshold) => {
229
+ if (threshold.amount) {
230
+ return formatBalance({ amount: threshold.amount });
231
+ }
232
+ if (threshold.credits) {
233
+ return formatCredits(threshold.credits.quantity, threshold.credits.credit_type_id);
234
+ }
235
+ return "";
236
+ };
237
+ const autoTopUpWalletGrant = computed(() => {
238
+ var _a, _b;
239
+ const pricingItemId = (_a = activeTopUpConfig.value) == null ? void 0 : _a.pricing_item_id;
240
+ if (!pricingItemId) {
241
+ return void 0;
242
+ }
243
+ const grants = (props.walletBalance.charge_on_demand_pricing_items ?? []).filter((chargeOnDemandItem) => chargeOnDemandItem.pricing_item_id === pricingItemId).flatMap((chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem)).flatMap((config) => config.wallet_grants ?? []);
244
+ const walletTypeId = (_b = props.walletBalance.wallet) == null ? void 0 : _b.wallet_type_id;
245
+ return grants.find((grant) => grant.wallet_type_id === walletTypeId) ?? grants[0];
246
+ });
247
+ const autoTopUpCredits = computed(() => {
248
+ var _a, _b;
249
+ const topUpAmount = (_a = activeTopUpConfig.value) == null ? void 0 : _a.topup_amount;
250
+ const creditsGrant = (_b = autoTopUpWalletGrant.value) == null ? void 0 : _b.credits_grant;
251
+ if (!topUpAmount || !creditsGrant) {
252
+ return "";
253
+ }
254
+ if (creditsGrant.credits) {
255
+ return formatCredits(
256
+ creditsGrant.credits.quantity,
257
+ creditsGrant.credits.credit_type_id
258
+ );
259
+ }
260
+ if (creditsGrant.conversion) {
261
+ const quantity = Number(topUpAmount.quantity) * Number(creditsGrant.conversion.rate);
262
+ return formatCredits(String(quantity), creditsGrant.conversion.credit_type_id);
263
+ }
264
+ return "";
265
+ });
266
+ const autoTopUpLabel = computed(
267
+ () => activeTopUpConfig.value ? $t({
268
+ defaultMessage: "Auto top-up enabled",
269
+ id: "wallet_balance.auto_top_up_enabled_label",
270
+ description: "Label shown when a wallet tops itself up automatically"
271
+ }) : $t({
272
+ defaultMessage: "No auto top-up enabled",
273
+ id: "wallet_balance.auto_top_up_disabled_label",
274
+ description: "Label shown when a wallet has no automatic top-up configured"
275
+ })
276
+ );
277
+ const autoTopUpExplanation = computed(() => {
278
+ const config = activeTopUpConfig.value;
279
+ if (!config) {
280
+ return $t({
281
+ defaultMessage: "Set up an automatic top-up and your balance is increased for you whenever it drops below an amount you choose, so you never run out.",
282
+ id: "wallet_balance.auto_top_up_setup_explanation",
283
+ description: "Tooltip explaining what automatic top-ups do, shown when none is configured yet"
284
+ });
285
+ }
286
+ const topUpAmount = config.topup_amount ? formatBalance({ amount: config.topup_amount }) : "";
287
+ const threshold = formatThreshold(config.threshold);
288
+ if (!topUpAmount || !threshold) {
289
+ return $t({
290
+ defaultMessage: "Your balance is topped up automatically once it runs low.",
291
+ id: "wallet_balance.auto_top_up_generic_explanation",
292
+ description: "Tooltip shown for an active automatic top-up whose amount or threshold is unknown"
293
+ });
294
+ }
295
+ if (autoTopUpCredits.value) {
296
+ return $t(
297
+ {
298
+ defaultMessage: "Your balance is automatically increased with {topUpCredits} ({topUpAmount}) when it drops below {threshold}.",
299
+ id: "wallet_balance.auto_top_up_credits_explanation",
300
+ description: "Tooltip explaining an automatic top-up that grants credits for a paid amount"
301
+ },
302
+ { topUpCredits: autoTopUpCredits.value, topUpAmount, threshold }
303
+ );
304
+ }
305
+ return $t(
306
+ {
307
+ defaultMessage: "Your balance is automatically increased with {topUpAmount} when it drops below {threshold}.",
308
+ id: "wallet_balance.auto_top_up_explanation",
309
+ description: "Tooltip explaining how the automatic top-up of a wallet balance works"
310
+ },
311
+ { topUpAmount, threshold }
312
+ );
313
+ });
314
+ return {
315
+ walletName,
316
+ formatBalance,
317
+ manualTopUpItems,
318
+ flexibleManualTopUpItem,
319
+ showManualTopUp,
320
+ showAutoTopUp,
321
+ activeTopUpConfig,
322
+ autoTopUpLabel,
323
+ autoTopUpExplanation
324
+ };
325
+ };
326
+ const _hoisted_1$b = { class: "flex flex-col gap-3 py-3" };
327
+ const _hoisted_2$2 = { class: "flex flex-col gap-1 px-4" };
328
+ const _hoisted_3$2 = { class: "flex w-full justify-between gap-3" };
329
+ const _hoisted_4$1 = { class: "flex w-full items-center gap-4" };
330
+ const _hoisted_5$1 = { key: 0 };
331
+ const _hoisted_6 = {
332
+ key: 1,
333
+ class: "flex w-full justify-between gap-3 px-4"
334
+ };
335
+ const _hoisted_7 = { class: "flex min-w-0 items-center gap-1" };
336
+ const _hoisted_8 = { class: "flex min-w-0 items-center gap-1" };
337
+ const _hoisted_9 = { class: "shrink-0" };
338
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
339
+ __name: "WalletBalancesItem",
340
+ props: {
341
+ walletBalance: {},
342
+ showAutoTopUp: { type: Boolean },
343
+ showManualTopUp: { type: Boolean }
344
+ },
345
+ emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
346
+ setup(__props) {
347
+ const props = __props;
348
+ const { $t } = useIntl();
349
+ const {
350
+ walletName,
351
+ formatBalance,
352
+ manualTopUpItems,
353
+ flexibleManualTopUpItem,
354
+ showManualTopUp,
355
+ showAutoTopUp,
356
+ activeTopUpConfig,
357
+ autoTopUpLabel,
358
+ autoTopUpExplanation
359
+ } = useWalletBalancesItem(props);
360
+ return (_ctx, _cache) => {
361
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
362
+ createElementVNode("div", _hoisted_2$2, [
363
+ createElementVNode("div", _hoisted_3$2, [
364
+ createVNode(_sfc_main$h, {
365
+ variant: "body-xs",
366
+ color: "subtle",
367
+ "no-spacing": ""
368
+ }, {
369
+ default: withCtx(() => [
370
+ createTextVNode(toDisplayString(unref(walletName)), 1)
371
+ ]),
372
+ _: 1
373
+ }),
374
+ createVNode(_sfc_main$h, {
375
+ variant: "body-xs",
376
+ color: "subtle",
377
+ "no-spacing": ""
378
+ }, {
379
+ default: withCtx(() => {
380
+ var _a, _b;
381
+ return [
382
+ ((_a = __props.walletBalance.wallet_balance) == null ? void 0 : _a.balance_at) ? (openBlock(), createBlock(_sfc_main$e, {
383
+ key: 0,
384
+ date: new Date((_b = __props.walletBalance.wallet_balance) == null ? void 0 : _b.balance_at),
385
+ "action-verb": unref($t)({
386
+ defaultMessage: "updated",
387
+ id: "wallet_balance.updated_action_verb",
388
+ description: "Verb in front of when a wallet balance was last updated, e.g. 'updated 5 minutes ago'"
389
+ })
390
+ }, null, 8, ["date", "action-verb"])) : createCommentVNode("", true)
391
+ ];
392
+ }),
393
+ _: 1
394
+ })
395
+ ]),
396
+ createElementVNode("div", _hoisted_4$1, [
397
+ createVNode(_sfc_main$h, {
398
+ variant: "body-lg",
399
+ weight: "semibold",
400
+ "no-spacing": "",
401
+ class: "grow"
402
+ }, {
403
+ default: withCtx(() => [
404
+ createTextVNode(toDisplayString(unref(formatBalance)(props.walletBalance.wallet_balance.open_balance)), 1)
405
+ ]),
406
+ _: 1
407
+ }),
408
+ unref(showManualTopUp) ? (openBlock(), createBlock(unref(_sfc_main$i), {
409
+ key: 0,
410
+ size: "xs",
411
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up", unref(manualTopUpItems)[0]))
412
+ }, {
413
+ default: withCtx(() => [
414
+ createTextVNode(toDisplayString(unref($t)({
415
+ defaultMessage: "Top up",
416
+ id: "v1V8kA",
417
+ description: "Button to top up a wallet balance"
418
+ })), 1)
419
+ ]),
420
+ _: 1
421
+ })) : createCommentVNode("", true)
422
+ ])
423
+ ]),
424
+ _ctx.$slots["graph"] ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
425
+ renderSlot(_ctx.$slots, "graph")
426
+ ])) : createCommentVNode("", true),
427
+ unref(showAutoTopUp) ? (openBlock(), createElementBlock("div", _hoisted_6, [
428
+ createElementVNode("div", _hoisted_7, [
429
+ createVNode(_sfc_main$f, { class: "min-w-0" }, {
430
+ tooltip: withCtx(() => [
431
+ createVNode(TooltipContent, null, {
432
+ default: withCtx(() => [
433
+ createVNode(_sfc_main$g, null, {
434
+ default: withCtx(() => [
435
+ createTextVNode(toDisplayString(unref(autoTopUpExplanation)), 1)
436
+ ]),
437
+ _: 1
438
+ })
439
+ ]),
440
+ _: 1
441
+ })
442
+ ]),
443
+ default: withCtx(() => [
444
+ createElementVNode("div", _hoisted_8, [
445
+ createVNode(_sfc_main$h, {
446
+ variant: "body-sm",
447
+ color: "secondary",
448
+ "no-spacing": "",
449
+ class: "truncate"
450
+ }, {
451
+ default: withCtx(() => [
452
+ createTextVNode(toDisplayString(unref(autoTopUpLabel)), 1)
453
+ ]),
454
+ _: 1
455
+ }),
456
+ createVNode(_sfc_main$j, {
457
+ icon: "info",
458
+ size: "2xs",
459
+ class: "shrink-0 cursor-help text-gray-400"
460
+ })
461
+ ])
462
+ ]),
463
+ _: 1
464
+ })
465
+ ]),
466
+ createElementVNode("div", _hoisted_9, [
467
+ unref(activeTopUpConfig) ? (openBlock(), createBlock(unref(_sfc_main$i), {
468
+ key: 0,
469
+ size: "xs",
470
+ intent: "secondary",
471
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("cancel-auto-top-up", unref(activeTopUpConfig)))
472
+ }, {
473
+ default: withCtx(() => [
474
+ createTextVNode(toDisplayString(unref($t)({
475
+ defaultMessage: "Disable",
476
+ id: "wallet_balance.auto_top_up_disable_button",
477
+ description: "Button to turn off a wallet's automatic top-up"
478
+ })), 1)
479
+ ]),
480
+ _: 1
481
+ })) : (openBlock(), createBlock(unref(_sfc_main$i), {
482
+ key: 1,
483
+ size: "xs",
484
+ intent: "secondary",
485
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("auto-top-up", unref(flexibleManualTopUpItem)))
486
+ }, {
487
+ default: withCtx(() => [
488
+ createTextVNode(toDisplayString(unref($t)({
489
+ defaultMessage: "Enable",
490
+ id: "wallet_balance.auto_top_up_enable_button",
491
+ description: "Button to set up a wallet's automatic top-up"
492
+ })), 1)
493
+ ]),
494
+ _: 1
495
+ }))
496
+ ])
497
+ ])) : createCommentVNode("", true)
498
+ ]);
499
+ };
500
+ }
501
+ });
502
+ const _hoisted_1$a = { class: "flex flex-col gap-2" };
503
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
504
+ __name: "WalletBalances",
505
+ props: {
506
+ customerWalletBalances: {},
507
+ title: { default: void 0 },
508
+ showAutoTopUp: { type: Boolean, default: false },
509
+ showManualTopUp: { type: Boolean, default: false }
510
+ },
511
+ emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
512
+ setup(__props) {
513
+ return (_ctx, _cache) => {
514
+ return openBlock(), createBlock(_sfc_main$k, {
515
+ "no-spacing": "",
516
+ "no-border": "",
517
+ title: __props.title
518
+ }, createSlots({
519
+ default: withCtx(() => [
520
+ createElementVNode("div", _hoisted_1$a, [
521
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.customerWalletBalances, (walletBalance) => {
522
+ return openBlock(), createBlock(_sfc_main$k, {
523
+ key: walletBalance.wallet_id,
524
+ "no-spacing": ""
525
+ }, {
526
+ default: withCtx(() => [
527
+ createVNode(_sfc_main$d, {
528
+ "wallet-balance": walletBalance,
529
+ "show-auto-top-up": __props.showAutoTopUp,
530
+ "show-manual-top-up": __props.showManualTopUp,
531
+ onTopUp: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up", $event)),
532
+ onAutoTopUp: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("auto-top-up", $event)),
533
+ onCancelAutoTopUp: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("cancel-auto-top-up", $event))
534
+ }, null, 8, ["wallet-balance", "show-auto-top-up", "show-manual-top-up"])
535
+ ]),
536
+ _: 2
537
+ }, 1024);
538
+ }), 128))
539
+ ])
540
+ ]),
541
+ _: 2
542
+ }, [
543
+ _ctx.$slots["heading-right"] ? {
544
+ name: "right",
545
+ fn: withCtx(() => [
546
+ renderSlot(_ctx.$slots, "heading-right")
547
+ ]),
548
+ key: "0"
549
+ } : void 0
550
+ ]), 1032, ["title"]);
551
+ };
552
+ }
553
+ });
554
+ function createWalletsService() {
555
+ const request = createRequestService();
556
+ const config = useConfig();
557
+ function getCustomerWalletBalances(customerId) {
558
+ return request({
559
+ url: `${config.apiUrls.config}/portal/customers/${customerId}/wallets/balance`,
560
+ query: withExpand({ expandParams: EXPAND_ALL }),
561
+ options: { method: "POST" },
562
+ data: {}
563
+ });
564
+ }
565
+ return {
566
+ getCustomerWalletBalances
567
+ };
568
+ }
569
+ function useCustomerWalletBalances({ customerId }) {
570
+ const { getCustomerWalletBalances } = createWalletsService();
571
+ const { data, execute, apiStatus, error, isPending } = useService({
572
+ service: () => getCustomerWalletBalances(customerId)
573
+ });
574
+ const walletBalances = computed(
575
+ () => data.value ?? null
576
+ );
577
+ return { walletBalances, apiStatus, error, fetch: execute, isPending };
578
+ }
579
+ const getWalletBalanceForTopUpItem = (walletBalances = [], topUpItem) => {
580
+ if (!(topUpItem == null ? void 0 : topUpItem.pricing_item_id)) {
581
+ return void 0;
582
+ }
583
+ return walletBalances.find(
584
+ (balance) => (balance.charge_on_demand_pricing_items ?? []).some(
585
+ ({ pricing_item_id }) => pricing_item_id === topUpItem.pricing_item_id
586
+ )
587
+ );
588
+ };
589
+ const TOP_UP_MODAL_STEPS = ["TOP_UP", "ADD_PAYMENT_METHOD", "SUCCESS"];
590
+ const isChargeOnDemandPricingItem = (entry) => typeof entry === "object" && entry !== null && "pricing_item" in entry;
591
+ const getTopUpScheduleIds = (walletBalanceItem) => [
592
+ ...new Set(
593
+ ((walletBalanceItem == null ? void 0 : walletBalanceItem.charge_on_demand_pricing_items) ?? []).flatMap(
594
+ (entry) => isChargeOnDemandPricingItem(entry) && entry.pricing_plan_schedule_id ? [entry.pricing_plan_schedule_id] : []
595
+ )
596
+ )
597
+ ];
598
+ const getTopUpSubscriptions = (walletBalanceItem, subscriptions) => {
599
+ const toppedUpOn = new Set(getTopUpScheduleIds(walletBalanceItem));
600
+ return subscriptions.flatMap((subscription) => {
601
+ const scheduleInfos = (subscription.pricing_plan_schedule_infos ?? []).filter(
602
+ ({ id }) => toppedUpOn.has(id)
603
+ );
604
+ if (scheduleInfos.length === 0) {
605
+ return [];
606
+ }
607
+ return [
608
+ {
609
+ id: subscription.id,
610
+ name: subscription.name || subscription.reference || subscription.id,
611
+ scheduleIds: scheduleInfos.map(({ id }) => id),
612
+ enabledPricingIds: scheduleInfos.flatMap(
613
+ (info) => {
614
+ var _a;
615
+ return (((_a = info.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).flatMap(
616
+ ({ pricing_id }) => pricing_id ? [pricing_id] : []
617
+ );
618
+ }
619
+ )
620
+ }
621
+ ];
622
+ });
623
+ };
624
+ const withTopUpPricingItemsForSchedules = (walletBalanceItem, scheduleIds) => {
625
+ if (!walletBalanceItem || scheduleIds.length === 0) {
626
+ return walletBalanceItem;
627
+ }
628
+ const allowed = new Set(scheduleIds);
629
+ return {
630
+ ...walletBalanceItem,
631
+ charge_on_demand_pricing_items: (walletBalanceItem.charge_on_demand_pricing_items ?? []).filter(
632
+ (entry) => isChargeOnDemandPricingItem(entry) && !!entry.pricing_plan_schedule_id && allowed.has(entry.pricing_plan_schedule_id)
633
+ )
634
+ };
635
+ };
636
+ const getTopUpPricingItems = (walletBalanceItem) => ((walletBalanceItem == null ? void 0 : walletBalanceItem.charge_on_demand_pricing_items) ?? []).flatMap((entry) => {
637
+ var _a, _b;
638
+ if (!isChargeOnDemandPricingItem(entry)) {
639
+ return [];
640
+ }
641
+ const pricingItemId = entry.pricing_item_id ?? ((_a = entry.pricing_item) == null ? void 0 : _a.id);
642
+ if (!pricingItemId) {
643
+ return [];
644
+ }
645
+ return (((_b = entry.pricing_item) == null ? void 0 : _b.configs) ?? []).map((config) => {
646
+ const flexiblePricing = getFlexiblePricing(config, walletBalanceItem);
647
+ const fixedPricing = getFixedPricing(config, walletBalanceItem);
648
+ return {
649
+ pricingItemId,
650
+ ...entry.pricing_plan_schedule_id && {
651
+ pricingPlanScheduleId: entry.pricing_plan_schedule_id
652
+ },
653
+ config,
654
+ ...flexiblePricing && { flexiblePricing },
655
+ ...fixedPricing && { fixedPricing }
656
+ };
657
+ });
658
+ });
659
+ function getFixedPricing(config, walletBalanceItem) {
660
+ var _a, _b, _c;
661
+ if (!config.on_demand || !hasOneOfPricingTypes(config, ["FIXED"])) {
662
+ return void 0;
663
+ }
664
+ const amount = (_c = (_b = (_a = config.details) == null ? void 0 : _a.bands) == null ? void 0 : _b[0]) == null ? void 0 : _c.fixed_amount;
665
+ if (!amount) {
666
+ return void 0;
667
+ }
668
+ const walletCredits = getWalletCredits(walletBalanceItem);
669
+ const grantedCredits = walletCredits ? getGrantedCredits(config, walletBalanceItem) : void 0;
670
+ return {
671
+ amount,
672
+ value: grantedCredits && walletCredits ? toCreditsValue(grantedCredits.quantity, walletCredits) : { amount }
673
+ };
674
+ }
675
+ const getWalletCredits = (walletBalanceItem) => {
676
+ var _a;
677
+ return (_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_balance.balance) == null ? void 0 : _a.credits;
678
+ };
679
+ const getWalletGrants = (config, walletBalanceItem) => {
680
+ var _a;
681
+ const walletTypeId = (_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet) == null ? void 0 : _a.wallet_type_id;
682
+ return (config.wallet_grants ?? []).filter(
683
+ ({ wallet_type_id }) => !walletTypeId || wallet_type_id === walletTypeId
684
+ );
685
+ };
686
+ const getCreditsConversion = (config, walletBalanceItem) => {
687
+ var _a, _b;
688
+ return (_b = (_a = getWalletGrants(config, walletBalanceItem).find(
689
+ ({ credits_grant }) => credits_grant == null ? void 0 : credits_grant.conversion
690
+ )) == null ? void 0 : _a.credits_grant) == null ? void 0 : _b.conversion;
691
+ };
692
+ const getGrantedCredits = (config, walletBalanceItem) => {
693
+ var _a, _b;
694
+ return (_b = (_a = getWalletGrants(config, walletBalanceItem).find(({ credits_grant }) => credits_grant == null ? void 0 : credits_grant.credits)) == null ? void 0 : _a.credits_grant) == null ? void 0 : _b.credits;
695
+ };
696
+ const toCreditsValue = (quantity, walletCredits) => ({ credits: { ...walletCredits, quantity } });
697
+ const toCreditsQuantity = (quantity, rate) => {
698
+ const parsedQuantity = Number(quantity);
699
+ const parsedRate = Number(rate);
700
+ return Number.isFinite(parsedQuantity) && Number.isFinite(parsedRate) ? String(parsedQuantity * parsedRate) : void 0;
701
+ };
702
+ function getFlexiblePricing(config, walletBalanceItem) {
703
+ var _a, _b, _c, _d, _e, _f, _g;
704
+ if (!config.on_demand || !isFlexiblePricing(config)) {
705
+ return void 0;
706
+ }
707
+ const band = (_b = (_a = config.details) == null ? void 0 : _a.bands) == null ? void 0 : _b[0];
708
+ const currency = ((_c = band == null ? void 0 : band.minimum_amount) == null ? void 0 : _c.currency) ?? ((_d = band == null ? void 0 : band.maximum_amount) == null ? void 0 : _d.currency) ?? ((_f = (_e = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_balance.balance) == null ? void 0 : _e.amount) == null ? void 0 : _f.currency);
709
+ if (!currency) {
710
+ return void 0;
711
+ }
712
+ const credits = getWalletCredits(walletBalanceItem);
713
+ const conversion = credits ? getCreditsConversion(config, walletBalanceItem) : void 0;
714
+ const unitName = (_g = credits == null ? void 0 : credits.credit_type) == null ? void 0 : _g.unit_name;
715
+ const toBound = (amount) => {
716
+ if (!amount) {
717
+ return void 0;
718
+ }
719
+ const quantity = credits && conversion ? toCreditsQuantity(amount.quantity, conversion.rate) : void 0;
720
+ return quantity !== void 0 && credits ? toCreditsValue(quantity, credits) : { amount };
721
+ };
722
+ return {
723
+ config: {
724
+ ...(band == null ? void 0 : band.minimum_amount) && { minimum_amount: band.minimum_amount },
725
+ ...(band == null ? void 0 : band.maximum_amount) && { maximum_amount: band.maximum_amount }
726
+ },
727
+ currency,
728
+ ...conversion && {
729
+ creditsConfiguration: {
730
+ conversionRate: conversion.rate,
731
+ ...(unitName == null ? void 0 : unitName.singular) && { unitNameSingle: unitName.singular },
732
+ ...(unitName == null ? void 0 : unitName.plural) && { unitNamePlural: unitName.plural }
733
+ }
734
+ },
735
+ bounds: {
736
+ ...toBound(band == null ? void 0 : band.minimum_amount) && { minimum: toBound(band == null ? void 0 : band.minimum_amount) },
737
+ ...toBound(band == null ? void 0 : band.maximum_amount) && { maximum: toBound(band == null ? void 0 : band.maximum_amount) }
738
+ }
739
+ };
740
+ }
741
+ const isCreditBasedTopUp = (item) => {
742
+ var _a, _b, _c, _d, _e;
743
+ return !!((_a = item.fixedPricing) == null ? void 0 : _a.value.credits) || !!((_b = item.flexiblePricing) == null ? void 0 : _b.creditsConfiguration) || !!((_e = ((_c = item.flexiblePricing) == null ? void 0 : _c.bounds.minimum) ?? ((_d = item.flexiblePricing) == null ? void 0 : _d.bounds.maximum)) == null ? void 0 : _e.credits);
744
+ };
745
+ const getCreditTypeId = (items) => {
746
+ var _a;
747
+ for (const { fixedPricing, flexiblePricing } of items) {
748
+ const credits = (fixedPricing == null ? void 0 : fixedPricing.value.credits) ?? ((_a = (flexiblePricing == null ? void 0 : flexiblePricing.bounds.minimum) ?? (flexiblePricing == null ? void 0 : flexiblePricing.bounds.maximum)) == null ? void 0 : _a.credits);
749
+ if (credits == null ? void 0 : credits.credit_type_id) {
750
+ return credits.credit_type_id;
751
+ }
752
+ }
753
+ return void 0;
754
+ };
755
+ const getAutoTopUpChargeCurrency = (items = []) => {
756
+ for (const { flexiblePricing, fixedPricing } of items) {
757
+ const currency = (flexiblePricing == null ? void 0 : flexiblePricing.currency) ?? (fixedPricing == null ? void 0 : fixedPricing.amount.currency);
758
+ if (currency) {
759
+ return currency;
760
+ }
761
+ }
762
+ return void 0;
763
+ };
764
+ const getAutoTopUpCreditUnitName = (items = []) => {
765
+ var _a, _b, _c;
766
+ for (const { fixedPricing, flexiblePricing } of items) {
767
+ const credits = (fixedPricing == null ? void 0 : fixedPricing.value.credits) ?? ((_a = (flexiblePricing == null ? void 0 : flexiblePricing.bounds.minimum) ?? (flexiblePricing == null ? void 0 : flexiblePricing.bounds.maximum)) == null ? void 0 : _a.credits);
768
+ if ((_c = (_b = credits == null ? void 0 : credits.credit_type) == null ? void 0 : _b.unit_name) == null ? void 0 : _c.plural) {
769
+ return credits.credit_type.unit_name.plural;
770
+ }
771
+ }
772
+ return void 0;
773
+ };
774
+ const getAutoTopUpConversionRate = (items = []) => {
775
+ var _a;
776
+ for (const { flexiblePricing } of items) {
777
+ const rate = (_a = flexiblePricing == null ? void 0 : flexiblePricing.creditsConfiguration) == null ? void 0 : _a.conversionRate;
778
+ if (rate) {
779
+ return rate;
780
+ }
781
+ }
782
+ return void 0;
783
+ };
784
+ const getAutoTopUpBounds = (items = []) => {
785
+ for (const { flexiblePricing } of items) {
786
+ const { minimum_amount: minimum, maximum_amount: maximum } = (flexiblePricing == null ? void 0 : flexiblePricing.config) ?? {};
787
+ if (minimum || maximum) {
788
+ return { ...minimum && { minimum }, ...maximum && { maximum } };
789
+ }
790
+ }
791
+ return {};
792
+ };
793
+ const getAutoTopUpDenomination = (items = []) => {
794
+ if (items.some(isCreditBasedTopUp)) {
795
+ const creditTypeId = getCreditTypeId(items);
796
+ return creditTypeId ? { creditTypeId } : void 0;
797
+ }
798
+ for (const { flexiblePricing, fixedPricing } of items) {
799
+ const currency = (flexiblePricing == null ? void 0 : flexiblePricing.currency) ?? (fixedPricing == null ? void 0 : fixedPricing.amount.currency);
800
+ if (currency) {
801
+ return { currency };
802
+ }
803
+ }
804
+ return void 0;
805
+ };
806
+ const getTopUpValue = (item, amount) => {
807
+ var _a;
808
+ if (item.fixedPricing) {
809
+ return item.fixedPricing.value;
810
+ }
811
+ if (!item.flexiblePricing || !amount) {
812
+ return void 0;
813
+ }
814
+ const { bounds, creditsConfiguration } = item.flexiblePricing;
815
+ const credits = (_a = bounds.minimum ?? bounds.maximum) == null ? void 0 : _a.credits;
816
+ const quantity = creditsConfiguration ? toCreditsQuantity(amount.quantity, creditsConfiguration.conversionRate) : void 0;
817
+ return credits && quantity !== void 0 ? toCreditsValue(quantity, credits) : { amount };
818
+ };
819
+ const getAutoTopUpEditorConfig = (items = []) => {
820
+ const denomination = getAutoTopUpDenomination(items);
821
+ if (!denomination) {
822
+ return void 0;
823
+ }
824
+ return {
825
+ denomination,
826
+ chargeCurrency: getAutoTopUpChargeCurrency(items) ?? "",
827
+ creditUnitName: getAutoTopUpCreditUnitName(items),
828
+ conversionRate: getAutoTopUpConversionRate(items),
829
+ topUpBounds: getAutoTopUpBounds(items)
830
+ };
831
+ };
832
+ const PREVIEW_DEBOUNCE_MS = 400;
833
+ function useTopUpInvoicePreview({
834
+ pricingPlanScheduleId,
835
+ pricingItems
836
+ }) {
837
+ const { previewChargeOnDemandPricingItems } = createInvoicesService();
838
+ const logger = useLogger();
839
+ const invoicePreview = ref();
840
+ const isPreviewPending = ref(false);
841
+ const latestGuard = createLatestGuard();
842
+ const loadPreview = async () => {
843
+ const scheduleId = pricingPlanScheduleId.value;
844
+ const isLatest = latestGuard();
845
+ if (!scheduleId || !pricingItems.value) {
846
+ if (pricingItems.value && !scheduleId) {
847
+ logger.warn(
848
+ "INVOICE_PREVIEW_SKIPPED",
849
+ "Skipped the top-up invoice preview: no schedule to charge it on",
850
+ { missing: ["pricingPlanScheduleId"] }
851
+ );
852
+ }
853
+ invoicePreview.value = void 0;
854
+ isPreviewPending.value = false;
855
+ return;
856
+ }
857
+ isPreviewPending.value = true;
858
+ try {
859
+ const invoice = await previewChargeOnDemandPricingItems({
860
+ pricingPlanScheduleId: scheduleId,
861
+ pricingItems: pricingItems.value
862
+ });
863
+ if (isLatest()) {
864
+ invoicePreview.value = invoice;
865
+ }
866
+ } catch (error) {
867
+ if (isLatest()) {
868
+ invoicePreview.value = void 0;
869
+ }
870
+ logger.error(
871
+ "INVOICE_PREVIEW_FAILED",
872
+ "Failed to load top-up invoice preview",
873
+ {},
874
+ error
875
+ );
876
+ } finally {
877
+ if (isLatest()) {
878
+ isPreviewPending.value = false;
879
+ }
880
+ }
881
+ };
882
+ useWatchDebounced(pricingItems, () => void loadPreview(), {
883
+ debounce: PREVIEW_DEBOUNCE_MS,
884
+ deep: true
885
+ });
886
+ void loadPreview();
887
+ return { invoicePreview, isPreviewPending, loadPreview };
888
+ }
889
+ const _hoisted_1$9 = { key: 0 };
890
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
891
+ __name: "TopUpInvoicePreview",
892
+ props: {
893
+ pricingPlanScheduleId: { type: String },
894
+ pricingItems: { type: Array }
895
+ },
896
+ setup(__props) {
897
+ const props = __props;
898
+ const { $t } = useIntl();
899
+ const pricingPlanScheduleId = computed(() => props.pricingPlanScheduleId);
900
+ const pricingItems = computed(() => props.pricingItems);
901
+ const { invoicePreview } = useTopUpInvoicePreview({ pricingPlanScheduleId, pricingItems });
902
+ return (_ctx, _cache) => {
903
+ return openBlock(), createBlock(_sfc_main$l, {
904
+ class: "sv-top-up-invoice-preview h-[152px]",
905
+ "data-testid": "top-up-invoice-preview-skeleton"
906
+ }, {
907
+ default: withCtx(() => [
908
+ unref(invoicePreview) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
909
+ createVNode(unref(_sfc_main$m), { required: "" }, {
910
+ default: withCtx(() => [
911
+ createTextVNode(toDisplayString(unref($t)({
912
+ defaultMessage: "You will pay",
913
+ description: "Label above the preview of what topping up will be invoiced for",
914
+ id: "topup_modal.invoice_preview.label"
915
+ })), 1)
916
+ ]),
917
+ _: 1
918
+ }),
919
+ createVNode(unref(_sfc_main$k), { "content-background": "none" }, {
920
+ default: withCtx(() => [
921
+ createVNode(unref(_sfc_main$n), {
922
+ invoice: unref(invoicePreview),
923
+ "is-customer-facing": ""
924
+ }, null, 8, ["invoice"])
925
+ ]),
926
+ _: 1
927
+ })
928
+ ])) : createCommentVNode("", true)
929
+ ]),
930
+ _: 1
931
+ });
932
+ };
933
+ }
934
+ });
935
+ const getThresholdUnit = (denomination, creditUnitName) => denomination.currency ?? creditUnitName ?? denomination.creditTypeId ?? "";
936
+ const toInputValue = (quantity, unit) => ({
937
+ quantity: quantity ?? null,
938
+ currency: unit
939
+ });
940
+ const toFormState = (rule, { denomination, chargeCurrency, creditUnitName, minimumTopUp }) => {
941
+ var _a, _b, _c, _d, _e;
942
+ return {
943
+ enabled: (rule == null ? void 0 : rule.status) === "ACTIVE",
944
+ threshold: toInputValue(
945
+ ((_b = (_a = rule == null ? void 0 : rule.threshold) == null ? void 0 : _a.amount) == null ? void 0 : _b.quantity) ?? ((_d = (_c = rule == null ? void 0 : rule.threshold) == null ? void 0 : _c.credits) == null ? void 0 : _d.quantity),
946
+ getThresholdUnit(denomination, creditUnitName)
947
+ ),
948
+ topUpAmount: toInputValue(((_e = rule == null ? void 0 : rule.topup_amount) == null ? void 0 : _e.quantity) ?? minimumTopUp, chargeCurrency)
949
+ };
950
+ };
951
+ const toThreshold = (state, denomination) => {
952
+ var _a;
953
+ const quantity = (_a = state.threshold) == null ? void 0 : _a.quantity;
954
+ if (!quantity) {
955
+ return {};
956
+ }
957
+ return denomination.creditTypeId ? { credits: { quantity, credit_type_id: denomination.creditTypeId } } : { amount: { quantity, currency: denomination.currency ?? "" } };
958
+ };
959
+ const toTopUpAmount = (state, chargeCurrency) => {
960
+ var _a;
961
+ return ((_a = state.topUpAmount) == null ? void 0 : _a.quantity) ? {
962
+ quantity: state.topUpAmount.quantity,
963
+ currency: state.topUpAmount.currency ?? chargeCurrency
964
+ } : void 0;
965
+ };
966
+ const toAutoTopUpRule$1 = (state, { denomination, chargeCurrency }) => ({
967
+ status: state.enabled ? "ACTIVE" : "INACTIVE",
968
+ threshold: toThreshold(state, denomination),
969
+ ...toTopUpAmount(state, chargeCurrency) && {
970
+ topup_amount: toTopUpAmount(state, chargeCurrency)
971
+ }
972
+ });
973
+ const normalizeAutoTopUpRule = (rule, context) => toAutoTopUpRule$1(toFormState(rule, context), context);
974
+ const isSameAutoTopUpRule = (a, b) => JSON.stringify(a) === JSON.stringify(b);
975
+ const toQuantity = (value) => {
976
+ const quantity = Number(value == null ? void 0 : value.quantity);
977
+ return (value == null ? void 0 : value.quantity) && Number.isFinite(quantity) ? quantity : void 0;
978
+ };
979
+ const isAtLeastMinimum = (value, minimum) => {
980
+ const bound = Number(minimum == null ? void 0 : minimum.quantity);
981
+ return value === null || !(minimum == null ? void 0 : minimum.quantity) || !Number.isFinite(bound) || value >= bound;
982
+ };
983
+ const isWithinMaximum = (value, maximum) => {
984
+ const bound = Number(maximum == null ? void 0 : maximum.quantity);
985
+ return value === null || !(maximum == null ? void 0 : maximum.quantity) || !Number.isFinite(bound) || value <= bound;
986
+ };
987
+ const toNumber = (quantity) => {
988
+ const parsed = Number(quantity);
989
+ return quantity !== null && quantity !== void 0 && quantity !== "" && Number.isFinite(parsed) ? parsed : void 0;
990
+ };
991
+ const toConvertedQuantity = (quantity, base, conversionRate) => {
992
+ const value = toNumber(quantity);
993
+ const rate = toNumber(conversionRate);
994
+ if (value === void 0 || rate === void 0 || rate <= 0) {
995
+ return void 0;
996
+ }
997
+ return base === "CREDITS" ? value / rate : value * rate;
998
+ };
999
+ const toOtherBase = (quantity, from, to, conversionRate) => from === to ? toNumber(quantity) : toConvertedQuantity(quantity, from, conversionRate);
1000
+ const toBaseQuantity = (quantity, base, conversionRate) => base === "CREDITS" ? toConvertedQuantity(quantity, "AMOUNT", conversionRate) : toNumber(quantity);
1001
+ const toMoneyQuantity = (value) => value.toFixed(2);
1002
+ const toFieldQuantity = (value, base) => base === "AMOUNT" ? toMoneyQuantity(value) : String(Number(value.toFixed(6)));
1003
+ const toBoundQuantity = (bound, base, conversionRate, formatNumber) => {
1004
+ const quantity = toBaseQuantity(bound == null ? void 0 : bound.quantity, base, conversionRate);
1005
+ if (quantity === void 0) {
1006
+ return void 0;
1007
+ }
1008
+ return base === "CREDITS" ? formatNumber(quantity) : toMoneyQuantity(quantity);
1009
+ };
1010
+ const _hoisted_1$8 = ["data-testid"];
1011
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1012
+ __name: "ConvertedAmountInput",
1013
+ props: /* @__PURE__ */ mergeModels({
1014
+ unit: { type: String },
1015
+ modelBase: { type: String },
1016
+ entryBase: { type: String },
1017
+ conversionRate: { type: String },
1018
+ showConversionHint: { type: Boolean },
1019
+ currency: { type: String },
1020
+ creditUnitName: { type: String },
1021
+ bounds: { type: Object },
1022
+ label: { type: String },
1023
+ name: { type: String },
1024
+ required: { type: Boolean },
1025
+ disabled: { type: Boolean },
1026
+ error: { type: [String, Object, Array] }
1027
+ }, {
1028
+ "modelValue": { default: "" },
1029
+ "modelModifiers": {}
1030
+ }),
1031
+ emits: ["update:modelValue"],
1032
+ setup(__props) {
1033
+ const props = __props;
1034
+ const model = useModel(__props, "modelValue");
1035
+ const { $t, formatNumber } = useIntl();
1036
+ const entryBase = computed(() => props.entryBase ?? props.modelBase);
1037
+ const isConverted = computed(
1038
+ () => entryBase.value !== props.modelBase && toNumber(props.conversionRate) !== void 0
1039
+ );
1040
+ const entered = ref("");
1041
+ watch(
1042
+ () => [model.value, entryBase.value, props.modelBase, props.conversionRate],
1043
+ ([quantity]) => {
1044
+ if (!isConverted.value) {
1045
+ entered.value = quantity ?? "";
1046
+ return;
1047
+ }
1048
+ if (quantity === toEnteredAsModel(entered.value)) {
1049
+ return;
1050
+ }
1051
+ const converted = toOtherBase(
1052
+ quantity,
1053
+ props.modelBase,
1054
+ entryBase.value,
1055
+ props.conversionRate
1056
+ );
1057
+ entered.value = converted === void 0 ? "" : toFieldQuantity(converted, entryBase.value);
1058
+ },
1059
+ { immediate: true }
1060
+ );
1061
+ function toEnteredText(quantity) {
1062
+ if (typeof quantity === "string") {
1063
+ return quantity;
1064
+ }
1065
+ return typeof quantity === "number" ? String(quantity) : "";
1066
+ }
1067
+ function toEnteredAsModel(quantity) {
1068
+ const converted = toOtherBase(quantity, entryBase.value, props.modelBase, props.conversionRate);
1069
+ return converted === void 0 ? "" : toFieldQuantity(converted, props.modelBase);
1070
+ }
1071
+ const enteredQuantity = computed({
1072
+ get: () => entered.value,
1073
+ set: (quantity) => {
1074
+ entered.value = toEnteredText(quantity);
1075
+ model.value = isConverted.value ? toEnteredAsModel(entered.value) : entered.value;
1076
+ }
1077
+ });
1078
+ const convertedQuantity = computed(
1079
+ () => toConvertedQuantity(entered.value, entryBase.value, props.conversionRate)
1080
+ );
1081
+ const creditUnitName = computed(() => {
1082
+ if (props.creditUnitName) {
1083
+ return props.creditUnitName;
1084
+ }
1085
+ return entryBase.value === "CREDITS" ? props.unit : $t({
1086
+ defaultMessage: "credits",
1087
+ description: "Generic name for a wallet credit, where its credit type does not name one",
1088
+ id: "converted_amount_input.credits"
1089
+ });
1090
+ });
1091
+ const formatMoney = (quantity, currency) => formatAmount({ quantity: toMoneyQuantity(quantity), currency });
1092
+ const formatCredits = (quantity) => `${formatNumber(quantity)} ${creditUnitName.value}`;
1093
+ const hasError = computed(() => {
1094
+ const error = props.error;
1095
+ if (Array.isArray(error)) {
1096
+ return error.length > 0;
1097
+ }
1098
+ return Boolean(isRef(error) ? error.value : error);
1099
+ });
1100
+ const helperText = computed(() => {
1101
+ const converted = convertedQuantity.value;
1102
+ if (hasError.value || !props.showConversionHint || converted === void 0) {
1103
+ return void 0;
1104
+ }
1105
+ if (entryBase.value === "CREDITS") {
1106
+ return props.currency ? $t(
1107
+ {
1108
+ defaultMessage: "Will cost {amount} excluding taxes",
1109
+ description: "Helper text under a credits field, naming what those credits cost in money",
1110
+ id: "converted_amount_input.cost"
1111
+ },
1112
+ { amount: formatMoney(converted, props.currency) }
1113
+ ) : void 0;
1114
+ }
1115
+ return $t(
1116
+ {
1117
+ defaultMessage: "Buys about {credits}",
1118
+ description: "Helper text under a money field, naming the credits that amount converts into",
1119
+ id: "converted_amount_input.buys"
1120
+ },
1121
+ { credits: formatCredits(converted) }
1122
+ );
1123
+ });
1124
+ const toBound = (bound) => toBoundQuantity(bound, entryBase.value, props.conversionRate, formatNumber);
1125
+ const boundsUnit = computed(
1126
+ () => {
1127
+ var _a, _b, _c, _d;
1128
+ return entryBase.value === "CREDITS" ? creditUnitName.value : ((_b = (_a = props.bounds) == null ? void 0 : _a.minimum) == null ? void 0 : _b.currency) ?? ((_d = (_c = props.bounds) == null ? void 0 : _c.maximum) == null ? void 0 : _d.currency) ?? props.unit;
1129
+ }
1130
+ );
1131
+ const boundsText = computed(() => {
1132
+ var _a, _b;
1133
+ const minimum = toBound((_a = props.bounds) == null ? void 0 : _a.minimum);
1134
+ const maximum = toBound((_b = props.bounds) == null ? void 0 : _b.maximum);
1135
+ const unit = boundsUnit.value;
1136
+ if (minimum && maximum) {
1137
+ return $t(
1138
+ {
1139
+ defaultMessage: "Between {minimum} and {maximum} {unit}",
1140
+ description: "Range of what a flexible top-up may be charged for, beside its label",
1141
+ id: "converted_amount_input.bounds.range"
1142
+ },
1143
+ { minimum, maximum, unit }
1144
+ );
1145
+ }
1146
+ if (minimum) {
1147
+ return $t(
1148
+ {
1149
+ defaultMessage: "At least {minimum} {unit}",
1150
+ description: "Smallest amount a flexible top-up may be charged for, beside its label",
1151
+ id: "converted_amount_input.bounds.minimum"
1152
+ },
1153
+ { minimum, unit }
1154
+ );
1155
+ }
1156
+ if (maximum) {
1157
+ return $t(
1158
+ {
1159
+ defaultMessage: "Up to {maximum} {unit}",
1160
+ description: "Largest amount a flexible top-up may be charged for, beside its label",
1161
+ id: "converted_amount_input.bounds.maximum"
1162
+ },
1163
+ { maximum, unit }
1164
+ );
1165
+ }
1166
+ return void 0;
1167
+ });
1168
+ return (_ctx, _cache) => {
1169
+ return openBlock(), createBlock(unref(_sfc_main$o), {
1170
+ modelValue: enteredQuantity.value,
1171
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => enteredQuantity.value = $event),
1172
+ class: "sv-converted-amount-input",
1173
+ type: "number",
1174
+ "as-text-type": "",
1175
+ name: __props.name,
1176
+ label: __props.label,
1177
+ required: __props.required,
1178
+ disabled: __props.disabled,
1179
+ error: __props.error
1180
+ }, createSlots({
1181
+ suffix: withCtx(() => [
1182
+ createElementVNode("span", {
1183
+ "data-testid": `${__props.name}-unit`
1184
+ }, toDisplayString(__props.unit), 9, _hoisted_1$8)
1185
+ ]),
1186
+ _: 2
1187
+ }, [
1188
+ boundsText.value ? {
1189
+ name: "label-suffix",
1190
+ fn: withCtx(() => [
1191
+ createVNode(unref(_sfc_main$h), {
1192
+ tag: "span",
1193
+ variant: "body-xs",
1194
+ color: "subtle",
1195
+ "no-spacing": "",
1196
+ "data-testid": `${__props.name}-bounds`
1197
+ }, {
1198
+ default: withCtx(() => [
1199
+ createTextVNode(toDisplayString(boundsText.value), 1)
1200
+ ]),
1201
+ _: 1
1202
+ }, 8, ["data-testid"])
1203
+ ]),
1204
+ key: "0"
1205
+ } : void 0,
1206
+ helperText.value ? {
1207
+ name: "helper",
1208
+ fn: withCtx(() => [
1209
+ createVNode(unref(_sfc_main$h), {
1210
+ tag: "span",
1211
+ variant: "body-xs",
1212
+ color: "subtle",
1213
+ "no-spacing": "",
1214
+ "data-testid": `${__props.name}-conversion`
1215
+ }, {
1216
+ default: withCtx(() => [
1217
+ createTextVNode(toDisplayString(helperText.value), 1)
1218
+ ]),
1219
+ _: 1
1220
+ }, 8, ["data-testid"])
1221
+ ]),
1222
+ key: "1"
1223
+ } : void 0
1224
+ ]), 1032, ["modelValue", "name", "label", "required", "disabled", "error"]);
1225
+ };
1226
+ }
1227
+ });
1228
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1229
+ __name: "Section",
1230
+ props: {
1231
+ emphasized: { type: Boolean, default: false },
1232
+ contentClasses: { type: String },
1233
+ contentBackground: { type: String },
1234
+ title: { type: String },
1235
+ noSpacing: { type: Boolean },
1236
+ hasError: { type: Boolean },
1237
+ noBorder: { type: Boolean }
1238
+ },
1239
+ setup(__props) {
1240
+ const props = __props;
1241
+ const ACCENT = [
1242
+ "sv-section__accent relative",
1243
+ "before:absolute before:inset-y-0.5 before:left-0.5 before:w-0.5",
1244
+ "before:rounded-full before:bg-primary-600"
1245
+ ].join(" ");
1246
+ const contentClasses = computed(
1247
+ () => [props.emphasized ? ACCENT : void 0, props.contentClasses].filter(Boolean).join(" ")
1248
+ );
1249
+ const sectionProps = computed(() => {
1250
+ const { emphasized: _emphasized, ...rest } = props;
1251
+ return rest;
1252
+ });
1253
+ return (_ctx, _cache) => {
1254
+ return openBlock(), createBlock(unref(_sfc_main$k), mergeProps(sectionProps.value, {
1255
+ class: "sv-section",
1256
+ "content-classes": contentClasses.value
1257
+ }), createSlots({
1258
+ default: withCtx(() => [
1259
+ renderSlot(_ctx.$slots, "default")
1260
+ ]),
1261
+ _: 2
1262
+ }, [
1263
+ _ctx.$slots.right ? {
1264
+ name: "right",
1265
+ fn: withCtx(() => [
1266
+ renderSlot(_ctx.$slots, "right")
1267
+ ]),
1268
+ key: "0"
1269
+ } : void 0
1270
+ ]), 1040, ["content-classes"]);
1271
+ };
1272
+ }
1273
+ });
1274
+ const _hoisted_1$7 = { class: "flex grow flex-col" };
1275
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1276
+ __name: "AutoTopUpConfig",
1277
+ props: {
1278
+ config: { type: Object },
1279
+ denomination: { type: Object },
1280
+ creditUnitName: { type: String },
1281
+ chargeCurrency: { type: String },
1282
+ conversionRate: { type: String },
1283
+ topUpBounds: { type: Object },
1284
+ showThresholdConversion: { type: Boolean, default: true },
1285
+ contained: { type: Boolean },
1286
+ alwaysEnabled: { type: Boolean },
1287
+ disabled: { type: Boolean }
1288
+ },
1289
+ emits: ["save"],
1290
+ setup(__props, { expose: __expose, emit: __emit }) {
1291
+ const props = __props;
1292
+ const emit = __emit;
1293
+ const { $t, formatNumber } = useIntl();
1294
+ const formContext = computed(() => {
1295
+ var _a, _b;
1296
+ return {
1297
+ denomination: props.denomination,
1298
+ chargeCurrency: props.chargeCurrency,
1299
+ creditUnitName: props.creditUnitName,
1300
+ minimumTopUp: (_b = (_a = props.topUpBounds) == null ? void 0 : _a.minimum) == null ? void 0 : _b.quantity
1301
+ };
1302
+ });
1303
+ const model = ref(toFormState(props.config, formContext.value));
1304
+ const entryUnit = computed(() => getThresholdUnit(props.denomination, props.creditUnitName));
1305
+ const entryBase = computed(
1306
+ () => props.denomination.creditTypeId ? "CREDITS" : "AMOUNT"
1307
+ );
1308
+ const topUpUnit = computed(
1309
+ () => entryBase.value === "CREDITS" ? entryUnit.value : props.chargeCurrency
1310
+ );
1311
+ const thresholdQuantity = computed({
1312
+ get: () => {
1313
+ var _a;
1314
+ return ((_a = model.value.threshold) == null ? void 0 : _a.quantity) ?? "";
1315
+ },
1316
+ set: (quantity) => {
1317
+ model.value.threshold = { quantity: quantity || null, currency: entryUnit.value };
1318
+ }
1319
+ });
1320
+ const topUpQuantity = computed({
1321
+ get: () => {
1322
+ var _a;
1323
+ return ((_a = model.value.topUpAmount) == null ? void 0 : _a.quantity) ?? "";
1324
+ },
1325
+ set: (quantity) => {
1326
+ model.value.topUpAmount = { quantity: quantity || null, currency: props.chargeCurrency };
1327
+ }
1328
+ });
1329
+ watch(
1330
+ () => [props.config, formContext.value],
1331
+ ([config, context]) => {
1332
+ if (isSameAutoTopUpRule(normalizeAutoTopUpRule(config, context), currentRule())) {
1333
+ return;
1334
+ }
1335
+ model.value = toFormState(config, context);
1336
+ }
1337
+ );
1338
+ const isEnabled = computed({
1339
+ get: () => props.alwaysEnabled || model.value.enabled,
1340
+ set: (enabled) => {
1341
+ model.value.enabled = enabled;
1342
+ }
1343
+ });
1344
+ const rule = computed(
1345
+ () => toAutoTopUpRule$1({ ...model.value, enabled: isEnabled.value }, formContext.value)
1346
+ );
1347
+ const currentRule = () => rule.value;
1348
+ const validationState = reactive({
1349
+ threshold: computed(() => toQuantity(model.value.threshold) ?? null),
1350
+ topUpAmount: computed(() => toQuantity(model.value.topUpAmount) ?? null)
1351
+ });
1352
+ const formatBound = (bound) => {
1353
+ if (!bound) {
1354
+ return "";
1355
+ }
1356
+ const quantity = toBoundQuantity(bound, entryBase.value, props.conversionRate, formatNumber);
1357
+ return quantity === void 0 ? formatAmount(bound) : `${quantity} ${topUpUnit.value}`;
1358
+ };
1359
+ const isRequired = requiredIf(() => isEnabled.value);
1360
+ const validation = useValidation(
1361
+ {
1362
+ threshold: {
1363
+ required: common.withMessage(
1364
+ () => $t({
1365
+ defaultMessage: "Enter the balance to top up at.",
1366
+ description: "Error shown under the auto top-up threshold when it is left empty",
1367
+ id: "auto_topup_config.threshold.required"
1368
+ }),
1369
+ isRequired
1370
+ ),
1371
+ notNegative: common.withMessage(
1372
+ () => $t({
1373
+ defaultMessage: "The balance to top up at cannot be negative.",
1374
+ description: "Error shown under the auto top-up threshold when it is below zero",
1375
+ id: "auto_topup_config.threshold.not_negative"
1376
+ }),
1377
+ (value) => value === null || value >= 0
1378
+ )
1379
+ },
1380
+ topUpAmount: {
1381
+ required: common.withMessage(
1382
+ () => $t({
1383
+ defaultMessage: "Enter the amount to top up with.",
1384
+ description: "Error shown under the auto top-up amount when it is left empty",
1385
+ id: "auto_topup_config.amount.required"
1386
+ }),
1387
+ isRequired
1388
+ ),
1389
+ positive: common.withMessage(
1390
+ () => $t({
1391
+ defaultMessage: "Top up with more than zero.",
1392
+ description: "Error shown under the auto top-up amount when it is zero or negative",
1393
+ id: "auto_topup_config.amount.positive"
1394
+ }),
1395
+ (value) => value === null || value > 0
1396
+ ),
1397
+ atLeastMinimum: common.withMessage(
1398
+ () => {
1399
+ var _a;
1400
+ return $t(
1401
+ {
1402
+ defaultMessage: "Top up with at least {minimum}.",
1403
+ description: "Error shown under the auto top-up amount when it is below what the pricing allows",
1404
+ id: "auto_topup_config.amount.at_least_minimum"
1405
+ },
1406
+ { minimum: formatBound((_a = props.topUpBounds) == null ? void 0 : _a.minimum) }
1407
+ );
1408
+ },
1409
+ (value) => {
1410
+ var _a;
1411
+ return isAtLeastMinimum(value, (_a = props.topUpBounds) == null ? void 0 : _a.minimum);
1412
+ }
1413
+ ),
1414
+ withinMaximum: common.withMessage(
1415
+ () => {
1416
+ var _a;
1417
+ return $t(
1418
+ {
1419
+ defaultMessage: "Top up with at most {maximum}.",
1420
+ description: "Error shown under the auto top-up amount when it is above what the pricing allows",
1421
+ id: "auto_topup_config.amount.within_maximum"
1422
+ },
1423
+ { maximum: formatBound((_a = props.topUpBounds) == null ? void 0 : _a.maximum) }
1424
+ );
1425
+ },
1426
+ (value) => {
1427
+ var _a;
1428
+ return isWithinMaximum(value, (_a = props.topUpBounds) == null ? void 0 : _a.maximum);
1429
+ }
1430
+ )
1431
+ }
1432
+ },
1433
+ validationState
1434
+ );
1435
+ const hasChanges = computed(
1436
+ () => !isSameAutoTopUpRule(
1437
+ currentRule(),
1438
+ normalizeAutoTopUpRule(props.config, formContext.value)
1439
+ )
1440
+ );
1441
+ function validate() {
1442
+ validation.value.$touch();
1443
+ return validation.value.$invalid ? void 0 : currentRule();
1444
+ }
1445
+ function submit() {
1446
+ const rule2 = validate();
1447
+ if (rule2) {
1448
+ emit("save", rule2);
1449
+ }
1450
+ }
1451
+ __expose({
1452
+ submit,
1453
+ validate,
1454
+ rule,
1455
+ hasChanges,
1456
+ isInvalid: computed(() => validation.value.$invalid)
1457
+ });
1458
+ return (_ctx, _cache) => {
1459
+ return openBlock(), createBlock(_sfc_main$9, {
1460
+ class: "sv-auto-topup-config",
1461
+ "content-background": __props.contained ? "gray" : "none",
1462
+ "no-spacing": !__props.contained,
1463
+ "no-border": !__props.contained
1464
+ }, {
1465
+ default: withCtx(() => [
1466
+ !__props.alwaysEnabled ? (openBlock(), createBlock(unref(_sfc_main$p), {
1467
+ key: 0,
1468
+ modelValue: isEnabled.value,
1469
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isEnabled.value = $event),
1470
+ "no-spacing": "",
1471
+ "label-position": "before",
1472
+ class: "!flex",
1473
+ disabled: __props.disabled
1474
+ }, {
1475
+ "inline-label": withCtx(() => [
1476
+ createElementVNode("div", _hoisted_1$7, [
1477
+ createVNode(unref(_sfc_main$h), {
1478
+ tag: "span",
1479
+ variant: "body-sm"
1480
+ }, {
1481
+ default: withCtx(() => [
1482
+ createTextVNode(toDisplayString(unref($t)({
1483
+ defaultMessage: "Auto top-up",
1484
+ description: "Title of the automatic wallet top-up settings",
1485
+ id: "auto_topup_config.title"
1486
+ })), 1)
1487
+ ]),
1488
+ _: 1
1489
+ }),
1490
+ createVNode(unref(_sfc_main$h), {
1491
+ tag: "span",
1492
+ variant: "body-xs",
1493
+ color: "subtle"
1494
+ }, {
1495
+ default: withCtx(() => [
1496
+ createTextVNode(toDisplayString(unref($t)({
1497
+ defaultMessage: "Automatically top up your balance when it runs low.",
1498
+ description: "Subtitle of the automatic wallet top-up settings",
1499
+ id: "auto_topup_config.subtitle"
1500
+ })), 1)
1501
+ ]),
1502
+ _: 1
1503
+ })
1504
+ ])
1505
+ ]),
1506
+ _: 1
1507
+ }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
1508
+ createVNode(unref(_sfc_main$q), { "is-open": isEnabled.value }, {
1509
+ default: withCtx(() => [
1510
+ isEnabled.value ? (openBlock(), createElementBlock("div", {
1511
+ key: 0,
1512
+ class: normalizeClass(["grid grid-cols-1 gap-3", { "mt-4": !__props.alwaysEnabled }])
1513
+ }, [
1514
+ createVNode(_sfc_main$a, {
1515
+ modelValue: thresholdQuantity.value,
1516
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => thresholdQuantity.value = $event),
1517
+ name: "auto-top-up-threshold",
1518
+ unit: entryUnit.value,
1519
+ "model-base": entryBase.value,
1520
+ "entry-base": entryBase.value,
1521
+ currency: __props.chargeCurrency,
1522
+ "conversion-rate": __props.conversionRate,
1523
+ "show-conversion-hint": __props.showThresholdConversion,
1524
+ required: "",
1525
+ disabled: __props.disabled,
1526
+ error: unref(validation).threshold.$errors,
1527
+ label: unref($t)({
1528
+ defaultMessage: "When your balance falls below",
1529
+ description: "Label of the balance at which an automatic top-up is charged",
1530
+ id: "auto_topup_config.threshold.label"
1531
+ })
1532
+ }, null, 8, ["modelValue", "unit", "model-base", "entry-base", "currency", "conversion-rate", "show-conversion-hint", "disabled", "error", "label"]),
1533
+ createVNode(_sfc_main$a, {
1534
+ modelValue: topUpQuantity.value,
1535
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => topUpQuantity.value = $event),
1536
+ name: "auto-top-up-amount",
1537
+ unit: topUpUnit.value,
1538
+ "model-base": "AMOUNT",
1539
+ "entry-base": entryBase.value,
1540
+ currency: __props.chargeCurrency,
1541
+ "credit-unit-name": __props.creditUnitName,
1542
+ "conversion-rate": __props.conversionRate,
1543
+ bounds: __props.topUpBounds,
1544
+ "show-conversion-hint": "",
1545
+ required: "",
1546
+ disabled: __props.disabled,
1547
+ error: unref(validation).topUpAmount.$errors,
1548
+ label: unref($t)({
1549
+ defaultMessage: "Top-up with",
1550
+ description: "Label of the amount every automatic top-up adds",
1551
+ id: "auto_topup_config.amount.label"
1552
+ })
1553
+ }, null, 8, ["modelValue", "unit", "entry-base", "currency", "credit-unit-name", "conversion-rate", "bounds", "disabled", "error", "label"])
1554
+ ], 2)) : createCommentVNode("", true)
1555
+ ]),
1556
+ _: 1
1557
+ }, 8, ["is-open"])
1558
+ ]),
1559
+ _: 1
1560
+ }, 8, ["content-background", "no-spacing", "no-border"]);
1561
+ };
1562
+ }
1563
+ });
1564
+ const toTime = (createdAt) => {
1565
+ const parsed = Date.parse(createdAt ?? "");
1566
+ return Number.isFinite(parsed) ? parsed : 0;
1567
+ };
1568
+ function useDefaultPaymentMethod({
1569
+ paymentMethods,
1570
+ selectedPaymentMethodId,
1571
+ preferredPaymentMethodId
1572
+ }) {
1573
+ const sortedPaymentMethods = computed(
1574
+ () => [...paymentMethods.value ?? []].sort(
1575
+ (a, b) => toTime(b.created_at) - toTime(a.created_at)
1576
+ )
1577
+ );
1578
+ watch(
1579
+ () => [
1580
+ paymentMethods.value,
1581
+ preferredPaymentMethodId == null ? void 0 : preferredPaymentMethodId.value,
1582
+ selectedPaymentMethodId.value
1583
+ ],
1584
+ ([methods, preferredId, chosenId], previous) => {
1585
+ var _a;
1586
+ const previousMethods = previous == null ? void 0 : previous[0];
1587
+ const addedPaymentMethod = methods == null ? void 0 : methods.find(
1588
+ ({ id }) => !(previousMethods == null ? void 0 : previousMethods.some((previousMethod) => previousMethod.id === id))
1589
+ );
1590
+ if (addedPaymentMethod && (previousMethods == null ? void 0 : previousMethods.length)) {
1591
+ selectedPaymentMethodId.value = addedPaymentMethod.id;
1592
+ return;
1593
+ }
1594
+ const isStillOffered = (id) => !!id && !!(methods == null ? void 0 : methods.some((method) => method.id === id));
1595
+ if (isStillOffered(chosenId)) {
1596
+ return;
1597
+ }
1598
+ selectedPaymentMethodId.value = isStillOffered(preferredId) ? preferredId : (_a = (methods == null ? void 0 : methods.find(({ is_default }) => is_default)) ?? sortedPaymentMethods.value[0]) == null ? void 0 : _a.id;
1599
+ },
1600
+ { immediate: true }
1601
+ );
1602
+ return { sortedPaymentMethods };
1603
+ }
1604
+ function useWalletBalanceFormat() {
1605
+ const { $t, formatNumber } = useIntl();
1606
+ const formatValue = (value) => formatWalletBalanceValue($t, formatNumber, value);
1607
+ const formatOpenBalance = (balanceItem) => formatValue(balanceItem == null ? void 0 : balanceItem.wallet_balance.open_balance);
1608
+ return { formatValue, formatOpenBalance };
1609
+ }
1610
+ const _hoisted_1$6 = { class: "sv-top-up-form" };
1611
+ const _hoisted_2$1 = { class: "grid grid-cols-1 gap-4" };
1612
+ const _hoisted_3$1 = { class: "grid grid-cols-1 gap-1" };
1613
+ const _hoisted_4 = { class: "sv-top-up-form__option-details" };
1614
+ const _hoisted_5 = { key: 0 };
1615
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1616
+ __name: "TopUpModalForm",
1617
+ props: {
1618
+ topUpPricingItems: { type: null },
1619
+ paymentMethods: { type: Array },
1620
+ paymentMethodOptions: { type: Array },
1621
+ autoTopUpConfig: { type: Object }
1622
+ },
1623
+ emits: ["add-payment-method", "success", "save-auto-top-up", "failure"],
1624
+ setup(__props, { expose: __expose, emit: __emit }) {
1625
+ const props = __props;
1626
+ const emit = __emit;
1627
+ const { $t } = useIntl();
1628
+ const { formatValue } = useWalletBalanceFormat();
1629
+ const model = ref({
1630
+ pricing_plan_schedule_id: "",
1631
+ pricing_items: [],
1632
+ start_at: "",
1633
+ finalize_immediately: false,
1634
+ payment_method_id: void 0,
1635
+ preview: true
1636
+ });
1637
+ const chargeableItems = computed(() => {
1638
+ const chargeable = (props.topUpPricingItems ?? []).filter(
1639
+ (item) => item.flexiblePricing || item.fixedPricing
1640
+ );
1641
+ return [
1642
+ ...chargeable.filter(({ flexiblePricing }) => flexiblePricing),
1643
+ ...chargeable.filter(({ flexiblePricing }) => !flexiblePricing)
1644
+ ];
1645
+ });
1646
+ const findItem = (pricingItemId) => chargeableItems.value.find((item) => item.pricingItemId === pricingItemId);
1647
+ const pricingPlanScheduleId = computed(
1648
+ () => {
1649
+ var _a, _b;
1650
+ return (_b = (_a = props.topUpPricingItems) == null ? void 0 : _a.find((item) => item.pricingPlanScheduleId)) == null ? void 0 : _b.pricingPlanScheduleId;
1651
+ }
1652
+ );
1653
+ watch(
1654
+ pricingPlanScheduleId,
1655
+ (scheduleId) => {
1656
+ model.value.pricing_plan_schedule_id = scheduleId ?? "";
1657
+ },
1658
+ { immediate: true }
1659
+ );
1660
+ const getInitialAmount = (item) => {
1661
+ const { config, currency } = item.flexiblePricing ?? {};
1662
+ const minimum = config == null ? void 0 : config.minimum_amount;
1663
+ return minimum && currency ? { quantity: minimum.quantity, currency } : void 0;
1664
+ };
1665
+ const selectedPricingItemId = computed({
1666
+ get: () => {
1667
+ var _a;
1668
+ return (_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id;
1669
+ },
1670
+ set: (value) => {
1671
+ const item = findItem(typeof value === "string" ? value : void 0);
1672
+ if (!item) {
1673
+ model.value.pricing_items = [];
1674
+ return;
1675
+ }
1676
+ const initialAmount = getInitialAmount(item);
1677
+ model.value.pricing_items = [
1678
+ {
1679
+ pricing_item_id: item.pricingItemId,
1680
+ ...initialAmount && { flexible_amount: initialAmount }
1681
+ }
1682
+ ];
1683
+ }
1684
+ });
1685
+ watch(
1686
+ chargeableItems,
1687
+ (items) => {
1688
+ const chosenIsStillOffered = items.some(
1689
+ ({ pricingItemId }) => {
1690
+ var _a;
1691
+ return pricingItemId === ((_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id);
1692
+ }
1693
+ );
1694
+ if (chosenIsStillOffered) {
1695
+ return;
1696
+ }
1697
+ const preferred = items.find(({ flexiblePricing }) => flexiblePricing) ?? items[0];
1698
+ selectedPricingItemId.value = preferred == null ? void 0 : preferred.pricingItemId;
1699
+ },
1700
+ { immediate: true }
1701
+ );
1702
+ const flexibleAmount = computed({
1703
+ get: () => {
1704
+ var _a;
1705
+ return (_a = model.value.pricing_items[0]) == null ? void 0 : _a.flexible_amount;
1706
+ },
1707
+ set: (amount) => {
1708
+ var _a;
1709
+ const pricingItemId = (_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id;
1710
+ if (!pricingItemId) {
1711
+ return;
1712
+ }
1713
+ model.value.pricing_items = [
1714
+ { pricing_item_id: pricingItemId, ...amount && { flexible_amount: amount } }
1715
+ ];
1716
+ }
1717
+ });
1718
+ const getCostLabel = (optionValue) => {
1719
+ var _a;
1720
+ const fixedPricing = (_a = findItem(String(optionValue))) == null ? void 0 : _a.fixedPricing;
1721
+ return (fixedPricing == null ? void 0 : fixedPricing.value.credits) ? formatAmount(fixedPricing.amount) : void 0;
1722
+ };
1723
+ const selectedFlexiblePricing = computed(
1724
+ () => {
1725
+ var _a;
1726
+ return (_a = findItem(String(selectedPricingItemId.value))) == null ? void 0 : _a.flexiblePricing;
1727
+ }
1728
+ );
1729
+ const flexibleAmountQuantity = computed({
1730
+ get: () => {
1731
+ var _a;
1732
+ return ((_a = flexibleAmount.value) == null ? void 0 : _a.quantity) ?? "";
1733
+ },
1734
+ set: (quantity) => {
1735
+ var _a;
1736
+ const currency = (_a = selectedFlexiblePricing.value) == null ? void 0 : _a.currency;
1737
+ flexibleAmount.value = quantity && currency ? { quantity, currency } : void 0;
1738
+ }
1739
+ });
1740
+ const entryBaseFor = (pricing) => pricing.creditsConfiguration ? "CREDITS" : "AMOUNT";
1741
+ const creditUnitName = computed(() => getAutoTopUpCreditUnitName(props.topUpPricingItems));
1742
+ const entryUnitFor = (pricing) => pricing.creditsConfiguration ? creditUnitName.value ?? pricing.creditsConfiguration.unitNamePlural ?? pricing.creditsConfiguration.unitNameSingle ?? "" : pricing.currency;
1743
+ const flexiblePricingFor = (optionValue) => {
1744
+ var _a;
1745
+ const flexiblePricing = (_a = findItem(String(optionValue))) == null ? void 0 : _a.flexiblePricing;
1746
+ return flexiblePricing ? [flexiblePricing] : [];
1747
+ };
1748
+ const isFlexibleOption = (optionValue) => {
1749
+ var _a;
1750
+ return !!((_a = findItem(String(optionValue))) == null ? void 0 : _a.flexiblePricing);
1751
+ };
1752
+ const options = computed(
1753
+ () => chargeableItems.value.map((item) => {
1754
+ var _a;
1755
+ return {
1756
+ value: item.pricingItemId,
1757
+ label: item.fixedPricing ? formatValue(item.fixedPricing.value) : $t({
1758
+ defaultMessage: "Choose your own amount",
1759
+ description: "Label of the choose-your-amount option in the top-up modal",
1760
+ id: "topup_modal.flexible_option.label"
1761
+ }),
1762
+ ...((_a = item.flexiblePricing) == null ? void 0 : _a.bounds.minimum) && item.flexiblePricing.bounds.maximum && {
1763
+ description: $t(
1764
+ {
1765
+ defaultMessage: "Between {minimum} and {maximum}",
1766
+ description: "Bounds of the choose-your-amount option in the top-up modal",
1767
+ id: "topup_modal.flexible_option.bounds"
1768
+ },
1769
+ {
1770
+ minimum: formatValue(item.flexiblePricing.bounds.minimum),
1771
+ maximum: formatValue(item.flexiblePricing.bounds.maximum)
1772
+ }
1773
+ )
1774
+ }
1775
+ };
1776
+ })
1777
+ );
1778
+ const pricingItems = computed(() => {
1779
+ const chargeable = model.value.pricing_items.filter(
1780
+ (item) => {
1781
+ var _a;
1782
+ return !((_a = findItem(item.pricing_item_id)) == null ? void 0 : _a.flexiblePricing) || !!item.flexible_amount;
1783
+ }
1784
+ );
1785
+ return chargeable.length > 0 ? chargeable : void 0;
1786
+ });
1787
+ const autoTopUpEditor = computed(() => {
1788
+ const canSetUpAutoTopUp = !props.autoTopUpConfig && chargeableItems.value.some(({ flexiblePricing }) => flexiblePricing);
1789
+ return canSetUpAutoTopUp ? getAutoTopUpEditorConfig(props.topUpPricingItems) : void 0;
1790
+ });
1791
+ const autoTopUpFormRef = ref();
1792
+ const { chargeOnDemandPricingItems } = createInvoicesService();
1793
+ const logger = useLogger();
1794
+ const isCharging = ref(false);
1795
+ const canSubmit = computed(
1796
+ () => !!model.value.pricing_plan_schedule_id && !!pricingItems.value && !!model.value.payment_method_id
1797
+ );
1798
+ const validationState = reactive({
1799
+ paymentMethodId: computed(() => model.value.payment_method_id ?? null)
1800
+ });
1801
+ const validation = useValidation(
1802
+ {
1803
+ paymentMethodId: {
1804
+ required: common.withMessage(
1805
+ () => $t({
1806
+ defaultMessage: "Select a payment method to pay for this top-up.",
1807
+ description: "Error shown under the payment methods in the top-up modal when none is selected on submit",
1808
+ id: "topup_modal.payment_method_required"
1809
+ }),
1810
+ required
1811
+ )
1812
+ }
1813
+ },
1814
+ validationState
1815
+ );
1816
+ const chargedValue = computed(() => {
1817
+ const [chargedItem] = model.value.pricing_items;
1818
+ const item = findItem(chargedItem == null ? void 0 : chargedItem.pricing_item_id);
1819
+ return item ? getTopUpValue(item, chargedItem == null ? void 0 : chargedItem.flexible_amount) : void 0;
1820
+ });
1821
+ async function submit() {
1822
+ var _a, _b, _c;
1823
+ validation.value.$touch();
1824
+ const editedAutoTopUp = (_a = autoTopUpFormRef.value) == null ? void 0 : _a.validate();
1825
+ if (validation.value.$invalid || ((_b = autoTopUpFormRef.value) == null ? void 0 : _b.isInvalid) || !canSubmit.value || isCharging.value) {
1826
+ return;
1827
+ }
1828
+ isCharging.value = true;
1829
+ try {
1830
+ const invoice = await chargeOnDemandPricingItems({
1831
+ pricing_plan_schedule_id: model.value.pricing_plan_schedule_id,
1832
+ pricing_items: pricingItems.value ?? [],
1833
+ payment_method_id: model.value.payment_method_id,
1834
+ preview: false
1835
+ });
1836
+ if (editedAutoTopUp && ((_c = autoTopUpFormRef.value) == null ? void 0 : _c.hasChanges) && model.value.payment_method_id) {
1837
+ emit("save-auto-top-up", {
1838
+ rule: editedAutoTopUp,
1839
+ paymentMethodId: model.value.payment_method_id
1840
+ });
1841
+ }
1842
+ emit("success", invoice);
1843
+ } catch (error) {
1844
+ logger.error("TOP_UP_FAILED", "Failed to charge the wallet top-up", {}, error);
1845
+ emit("failure", error);
1846
+ } finally {
1847
+ isCharging.value = false;
1848
+ }
1849
+ }
1850
+ __expose({ submit, isCharging, canSubmit, chargedValue });
1851
+ const selectedPaymentMethodId = computed({
1852
+ get: () => model.value.payment_method_id ?? void 0,
1853
+ set: (paymentMethodId) => {
1854
+ model.value.payment_method_id = paymentMethodId;
1855
+ }
1856
+ });
1857
+ const { sortedPaymentMethods } = useDefaultPaymentMethod({
1858
+ paymentMethods: computed(() => props.paymentMethods),
1859
+ selectedPaymentMethodId
1860
+ });
1861
+ return (_ctx, _cache) => {
1862
+ return openBlock(), createElementBlock("form", _hoisted_1$6, [
1863
+ createElementVNode("div", _hoisted_2$1, [
1864
+ createElementVNode("div", _hoisted_3$1, [
1865
+ options.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$r), {
1866
+ key: 0,
1867
+ modelValue: selectedPricingItemId.value,
1868
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => selectedPricingItemId.value = $event),
1869
+ class: "sv-top-up-form__options",
1870
+ name: "top-up-pricing-item",
1871
+ direction: "column",
1872
+ required: "",
1873
+ disabled: isCharging.value,
1874
+ options: options.value,
1875
+ "show-radio": false,
1876
+ label: unref($t)({
1877
+ defaultMessage: "Top up amount",
1878
+ description: "Label above the list of ways to top up the wallet in the top-up modal",
1879
+ id: "topup_modal.pricing_items.label"
1880
+ })
1881
+ }, {
1882
+ label: withCtx(({ option, optionValue }) => [
1883
+ createElementVNode("span", null, toDisplayString(option.label), 1),
1884
+ getCostLabel(optionValue) ? (openBlock(), createBlock(unref(_sfc_main$h), {
1885
+ key: 0,
1886
+ tag: "span",
1887
+ variant: "body-sm",
1888
+ color: "subtle",
1889
+ weight: "normal",
1890
+ "no-spacing": "",
1891
+ class: "sv-top-up-form__option-cost"
1892
+ }, {
1893
+ default: withCtx(() => [
1894
+ createTextVNode(toDisplayString(getCostLabel(optionValue)), 1)
1895
+ ]),
1896
+ _: 2
1897
+ }, 1024)) : createCommentVNode("", true)
1898
+ ]),
1899
+ description: withCtx(({ option, optionValue }) => [
1900
+ createElementVNode("div", _hoisted_4, [
1901
+ option.description && !isFlexibleOption(optionValue) ? (openBlock(), createBlock(unref(_sfc_main$h), {
1902
+ key: 0,
1903
+ tag: "span",
1904
+ variant: "body-xs",
1905
+ color: "subtle",
1906
+ "no-spacing": ""
1907
+ }, {
1908
+ default: withCtx(() => [
1909
+ createTextVNode(toDisplayString(option.description), 1)
1910
+ ]),
1911
+ _: 2
1912
+ }, 1024)) : createCommentVNode("", true),
1913
+ flexiblePricingFor(optionValue).length > 0 ? (openBlock(), createBlock(unref(_sfc_main$q), {
1914
+ key: 1,
1915
+ "is-open": String(optionValue) === selectedPricingItemId.value,
1916
+ lazy: ""
1917
+ }, {
1918
+ default: withCtx(() => [
1919
+ (openBlock(true), createElementBlock(Fragment, null, renderList(flexiblePricingFor(optionValue), (flexiblePricing) => {
1920
+ var _a;
1921
+ return openBlock(), createElementBlock("div", {
1922
+ key: flexiblePricing.currency,
1923
+ class: "sv-top-up-form__amount grid grid-cols-1 gap-3",
1924
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
1925
+ }, ["stop"])),
1926
+ onKeydown: _cache[2] || (_cache[2] = withModifiers(() => {
1927
+ }, ["stop"]))
1928
+ }, [
1929
+ option.description ? (openBlock(), createBlock(unref(_sfc_main$h), {
1930
+ key: 0,
1931
+ tag: "span",
1932
+ variant: "body-xs",
1933
+ color: "subtle",
1934
+ "no-spacing": ""
1935
+ }, {
1936
+ default: withCtx(() => [
1937
+ createTextVNode(toDisplayString(option.description), 1)
1938
+ ]),
1939
+ _: 2
1940
+ }, 1024)) : createCommentVNode("", true),
1941
+ createVNode(_sfc_main$a, {
1942
+ modelValue: flexibleAmountQuantity.value,
1943
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => flexibleAmountQuantity.value = $event),
1944
+ name: "top-up-amount",
1945
+ "model-base": "AMOUNT",
1946
+ unit: entryUnitFor(flexiblePricing),
1947
+ "entry-base": entryBaseFor(flexiblePricing),
1948
+ currency: flexiblePricing.currency,
1949
+ "conversion-rate": (_a = flexiblePricing.creditsConfiguration) == null ? void 0 : _a.conversionRate,
1950
+ required: "",
1951
+ disabled: isCharging.value
1952
+ }, null, 8, ["modelValue", "unit", "entry-base", "currency", "conversion-rate", "disabled"])
1953
+ ], 32);
1954
+ }), 128))
1955
+ ]),
1956
+ _: 2
1957
+ }, 1032, ["is-open"])) : createCommentVNode("", true)
1958
+ ])
1959
+ ]),
1960
+ _: 1
1961
+ }, 8, ["modelValue", "disabled", "options", "label"])) : createCommentVNode("", true)
1962
+ ]),
1963
+ createElementVNode("div", null, [
1964
+ createVNode(_sfc_main$b, {
1965
+ "pricing-plan-schedule-id": pricingPlanScheduleId.value,
1966
+ "pricing-items": pricingItems.value
1967
+ }, null, 8, ["pricing-plan-schedule-id", "pricing-items"])
1968
+ ]),
1969
+ autoTopUpEditor.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
1970
+ createVNode(_sfc_main$8, mergeProps({
1971
+ ref_key: "autoTopUpFormRef",
1972
+ ref: autoTopUpFormRef,
1973
+ class: "sv-top-up-form__auto-top-up"
1974
+ }, autoTopUpEditor.value, {
1975
+ contained: "",
1976
+ "show-threshold-conversion": false,
1977
+ disabled: isCharging.value
1978
+ }), null, 16, ["disabled"])
1979
+ ])) : createCommentVNode("", true),
1980
+ createElementVNode("div", null, [
1981
+ createVNode(unref(_sfc_main$s), { spacing: "xs" })
1982
+ ]),
1983
+ createElementVNode("div", null, [
1984
+ renderSlot(_ctx.$slots, "payment-method", {}, () => [
1985
+ createVNode(_sfc_main$t, {
1986
+ modelValue: selectedPaymentMethodId.value,
1987
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => selectedPaymentMethodId.value = $event),
1988
+ class: "sv-top-up-form__payment-methods",
1989
+ "payment-methods": unref(sortedPaymentMethods),
1990
+ required: "",
1991
+ error: unref(validation).paymentMethodId.$errors,
1992
+ "payment-method-options": __props.paymentMethodOptions,
1993
+ disabled: isCharging.value,
1994
+ label: unref($t)({
1995
+ defaultMessage: "Payment method",
1996
+ description: "Label above the payment method that pays for the top-up, in the top-up modal",
1997
+ id: "topup_modal.payment_method_selector.label"
1998
+ }),
1999
+ onAddPaymentMethod: _cache[5] || (_cache[5] = ($event) => emit("add-payment-method"))
2000
+ }, null, 8, ["modelValue", "payment-methods", "error", "payment-method-options", "disabled", "label"])
2001
+ ])
2002
+ ])
2003
+ ])
2004
+ ]);
2005
+ };
2006
+ }
2007
+ });
2008
+ const _hoisted_1$5 = { class: "sv-top-up-success grid grid-cols-1 gap-4" };
2009
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2010
+ __name: "TopUpModalSuccess",
2011
+ props: {
2012
+ addedValue: { type: Object },
2013
+ invoice: { type: Object }
2014
+ },
2015
+ setup(__props) {
2016
+ const { $t } = useIntl();
2017
+ return (_ctx, _cache) => {
2018
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
2019
+ __props.invoice ? (openBlock(), createBlock(unref(_sfc_main$k), {
2020
+ key: 0,
2021
+ "content-background": "none"
2022
+ }, {
2023
+ default: withCtx(() => [
2024
+ createVNode(unref(_sfc_main$h), {
2025
+ tag: "span",
2026
+ variant: "body-sm",
2027
+ weight: "semibold",
2028
+ class: "mb-2 block"
2029
+ }, {
2030
+ default: withCtx(() => [
2031
+ createTextVNode(toDisplayString(unref($t)({
2032
+ defaultMessage: "Receipt",
2033
+ description: "Heading above the invoice a completed top-up produced",
2034
+ id: "topup_modal.success.receipt.heading"
2035
+ })), 1)
2036
+ ]),
2037
+ _: 1
2038
+ }),
2039
+ createVNode(unref(_sfc_main$n), {
2040
+ invoice: __props.invoice,
2041
+ "is-customer-facing": ""
2042
+ }, null, 8, ["invoice"])
2043
+ ]),
2044
+ _: 1
2045
+ })) : createCommentVNode("", true)
2046
+ ]);
2047
+ };
2048
+ }
2049
+ });
2050
+ function useTopUpModalLabels({
2051
+ step,
2052
+ currentBalance,
2053
+ topUpValue
2054
+ }) {
2055
+ const { $t, formatNumber } = useIntl();
2056
+ const title = computed(() => {
2057
+ if (step.value === "ADD_PAYMENT_METHOD") {
2058
+ return $t({
2059
+ defaultMessage: "Add payment method",
2060
+ description: "Title of the top-up modal while the customer is adding a payment method",
2061
+ id: "topup_modal.add_payment_method.title"
2062
+ });
2063
+ }
2064
+ if (step.value === "SUCCESS") {
2065
+ return $t({
2066
+ defaultMessage: "Top-up complete",
2067
+ description: "Title of the top-up modal once the top-up has been charged",
2068
+ id: "topup_modal.success.modal_title"
2069
+ });
2070
+ }
2071
+ return $t({
2072
+ defaultMessage: "Top up balance",
2073
+ description: "Title of the wallet top-up modal",
2074
+ id: "topup_modal.title"
2075
+ });
2076
+ });
2077
+ const subTitle = computed(() => {
2078
+ if (step.value === "ADD_PAYMENT_METHOD") {
2079
+ return $t({
2080
+ defaultMessage: "Add a new payment method for topping up your balance.",
2081
+ description: "Subtitle of the top-up modal while the customer is adding a payment method",
2082
+ id: "topup_modal.add_payment_method.subtitle"
2083
+ });
2084
+ }
2085
+ if (step.value === "SUCCESS") {
2086
+ return $t({
2087
+ defaultMessage: "Your payment went through.",
2088
+ description: "Subtitle of the top-up modal once the top-up has been charged",
2089
+ id: "topup_modal.success.modal_subtitle"
2090
+ });
2091
+ }
2092
+ return $t(
2093
+ {
2094
+ defaultMessage: "Your current balance is {balance}.",
2095
+ description: "Subtitle of the top-up modal showing the current wallet balance",
2096
+ id: "topup_modal.subtitle"
2097
+ },
2098
+ { balance: currentBalance.value }
2099
+ );
2100
+ });
2101
+ const cancelButtonText = computed(
2102
+ () => step.value === "ADD_PAYMENT_METHOD" ? $t({
2103
+ defaultMessage: "Back",
2104
+ description: "Label of the button that leaves the add payment method step in the top-up modal",
2105
+ id: "topup_modal.back_button.label"
2106
+ }) : $t({
2107
+ defaultMessage: "Cancel",
2108
+ description: "Label of the button that closes the top-up modal",
2109
+ id: "topup_modal.cancel_button.label"
2110
+ })
2111
+ );
2112
+ const confirmButtonText = computed(() => {
2113
+ if (step.value === "ADD_PAYMENT_METHOD") {
2114
+ return $t({
2115
+ defaultMessage: "Save payment method",
2116
+ description: "Label of the confirm button in the top-up modal while adding a payment method",
2117
+ id: "topup_modal.save_payment_method.label"
2118
+ });
2119
+ }
2120
+ if (step.value === "SUCCESS") {
2121
+ return $t({
2122
+ defaultMessage: "Done",
2123
+ description: "Label of the button that dismisses the top-up modal once the top-up has been charged",
2124
+ id: "topup_modal.done_button.label"
2125
+ });
2126
+ }
2127
+ if (!topUpValue.value) {
2128
+ return $t({
2129
+ defaultMessage: "Top up balance",
2130
+ description: "Label of the confirm button in the top-up modal while no amount is entered",
2131
+ id: "topup_modal.confirm_button.empty.label"
2132
+ });
2133
+ }
2134
+ return $t(
2135
+ {
2136
+ defaultMessage: "Top up balance with {value}",
2137
+ description: "Label of the confirm button in the top-up modal once an amount is entered",
2138
+ id: "topup_modal.confirm_button.label"
2139
+ },
2140
+ { value: formatWalletBalanceValue($t, formatNumber, topUpValue.value) }
2141
+ );
2142
+ });
2143
+ return { title, subTitle, cancelButtonText, confirmButtonText };
2144
+ }
2145
+ function useCustomerPaymentMethodOptions({
2146
+ isOpen,
2147
+ customer
2148
+ }) {
2149
+ const { paymentMethodOptions, get, isPending } = usePaymentMethodOptions();
2150
+ watch(
2151
+ () => [isOpen.value, customer.value],
2152
+ ([open, currentCustomer]) => {
2153
+ if (!open || !currentCustomer) {
2154
+ return;
2155
+ }
2156
+ void get({
2157
+ customerId: currentCustomer.id,
2158
+ country: getCustomerCountry(currentCustomer)
2159
+ });
2160
+ },
2161
+ { immediate: true }
2162
+ );
2163
+ const settledOptions = computed(
2164
+ () => isPending.value ? void 0 : paymentMethodOptions.value
2165
+ );
2166
+ return { paymentMethodOptions, settledOptions, isPending };
2167
+ }
2168
+ function useElementHeight(target) {
2169
+ const height = ref(0);
2170
+ const measure = (element) => {
2171
+ height.value = (element == null ? void 0 : element.offsetHeight) ?? 0;
2172
+ };
2173
+ const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver((entries) => {
2174
+ var _a;
2175
+ const element = (_a = entries[0]) == null ? void 0 : _a.target;
2176
+ measure(element instanceof HTMLElement ? element : void 0);
2177
+ });
2178
+ watch(
2179
+ target,
2180
+ (element, previousElement) => {
2181
+ if (previousElement) {
2182
+ observer == null ? void 0 : observer.unobserve(previousElement);
2183
+ }
2184
+ measure(element);
2185
+ if (element) {
2186
+ observer == null ? void 0 : observer.observe(element);
2187
+ }
2188
+ },
2189
+ // `post` so the callback runs after the render that assigns the template ref, not before.
2190
+ { immediate: true, flush: "post" }
2191
+ );
2192
+ onBeforeUnmount(() => {
2193
+ observer == null ? void 0 : observer.disconnect();
2194
+ });
2195
+ return height;
2196
+ }
2197
+ const _hoisted_1$4 = ["inert"];
2198
+ const PANE_TRANSITION_MS = 300;
2199
+ const PANE_GAP = "1rem";
2200
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2201
+ __name: "SlidingPanes",
2202
+ props: {
2203
+ panes: { type: Array },
2204
+ current: { type: String }
2205
+ },
2206
+ setup(__props) {
2207
+ const props = __props;
2208
+ const isSwitchingPanes = ref(false);
2209
+ let switchTimeout;
2210
+ watch(
2211
+ () => props.current,
2212
+ () => {
2213
+ isSwitchingPanes.value = true;
2214
+ clearTimeout(switchTimeout);
2215
+ switchTimeout = setTimeout(() => {
2216
+ isSwitchingPanes.value = false;
2217
+ }, PANE_TRANSITION_MS);
2218
+ }
2219
+ );
2220
+ onBeforeUnmount(() => {
2221
+ clearTimeout(switchTimeout);
2222
+ });
2223
+ const paneElements = ref({});
2224
+ const paneRefSetters = {};
2225
+ const setPaneElement = (pane) => paneRefSetters[pane] ?? (paneRefSetters[pane] = (element) => {
2226
+ paneElements.value[pane] = element instanceof HTMLElement ? element : void 0;
2227
+ });
2228
+ const currentPaneElement = computed(() => paneElements.value[props.current]);
2229
+ const paneHeight = useElementHeight(currentPaneElement);
2230
+ const trackOffset = computed(() => {
2231
+ const index = props.panes.indexOf(props.current);
2232
+ return index > 0 ? `translateX(calc(${-index} * (100% + ${PANE_GAP})))` : "translateX(0px)";
2233
+ });
2234
+ return (_ctx, _cache) => {
2235
+ return openBlock(), createElementBlock("div", {
2236
+ class: normalizeClass([
2237
+ "sv-sliding-panes__viewport relative -mx-2 overflow-hidden px-2",
2238
+ isSwitchingPanes.value ? "transition-[height] duration-300 ease-in-out motion-reduce:transition-none" : ""
2239
+ ]),
2240
+ style: normalizeStyle(unref(paneHeight) ? { height: `${unref(paneHeight)}px` } : void 0)
2241
+ }, [
2242
+ createElementVNode("div", {
2243
+ class: "sv-sliding-panes__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",
2244
+ style: normalizeStyle({ transform: trackOffset.value })
2245
+ }, [
2246
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.panes, (pane) => {
2247
+ return openBlock(), createElementBlock("div", {
2248
+ key: pane,
2249
+ class: "sv-sliding-panes__pane w-full shrink-0",
2250
+ inert: pane !== __props.current || void 0
2251
+ }, [
2252
+ createElementVNode("div", {
2253
+ ref_for: true,
2254
+ ref: setPaneElement(pane)
2255
+ }, [
2256
+ renderSlot(_ctx.$slots, pane)
2257
+ ], 512)
2258
+ ], 8, _hoisted_1$4);
2259
+ }), 128))
2260
+ ], 4)
2261
+ ], 6);
2262
+ };
2263
+ }
2264
+ });
2265
+ const _hoisted_1$3 = { class: "grid grid-cols-1 gap-4 pb-4" };
2266
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2267
+ __name: "WalletModalShell",
2268
+ props: {
2269
+ showModal: { type: Boolean },
2270
+ title: { type: String },
2271
+ subTitle: { type: String },
2272
+ cancelButtonText: { type: String },
2273
+ confirmButtonText: { type: String },
2274
+ isPending: { type: Boolean },
2275
+ panes: { type: Array },
2276
+ step: { type: String },
2277
+ addPaymentMethodPane: { type: String },
2278
+ customer: { type: Object },
2279
+ paymentMethodOptions: { type: Array },
2280
+ isPaymentMethodOptionsPending: { type: Boolean },
2281
+ isAddingPaymentMethod: { type: Boolean }
2282
+ },
2283
+ emits: ["confirm", "cancel", "payment-success", "payment-failed"],
2284
+ setup(__props, { expose: __expose }) {
2285
+ const props = __props;
2286
+ const paneRef = ref();
2287
+ const hostPanes = computed(() => props.panes.filter((pane) => pane !== props.addPaymentMethodPane));
2288
+ __expose({
2289
+ submit: () => {
2290
+ var _a;
2291
+ return (_a = paneRef.value) == null ? void 0 : _a.submit();
2292
+ },
2293
+ isSaving: computed(() => {
2294
+ var _a;
2295
+ return !!((_a = paneRef.value) == null ? void 0 : _a.isSaving);
2296
+ })
2297
+ });
2298
+ return (_ctx, _cache) => {
2299
+ return openBlock(), createBlock(unref(Modal), {
2300
+ "no-click-away": "",
2301
+ "show-modal": __props.showModal,
2302
+ size: "lg",
2303
+ title: __props.title,
2304
+ "sub-title": __props.subTitle,
2305
+ "cancel-button-text": __props.cancelButtonText,
2306
+ "confirm-button-text": __props.confirmButtonText,
2307
+ "is-loading": __props.isPending,
2308
+ onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("confirm")),
2309
+ onClose: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("cancel"))
2310
+ }, createSlots({
2311
+ body: withCtx(() => [
2312
+ createElementVNode("div", _hoisted_1$3, [
2313
+ createVNode(_sfc_main$5, {
2314
+ panes: __props.panes,
2315
+ current: __props.step
2316
+ }, createSlots({
2317
+ [__props.addPaymentMethodPane]: withCtx(() => [
2318
+ createVNode(_sfc_main$u, {
2319
+ ref_key: "paneRef",
2320
+ ref: paneRef,
2321
+ customer: __props.customer,
2322
+ "payment-method-options": __props.paymentMethodOptions,
2323
+ "is-loading": __props.isPaymentMethodOptionsPending,
2324
+ "is-active": __props.isAddingPaymentMethod,
2325
+ onSuccess: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("payment-success")),
2326
+ onFailure: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
2327
+ }, null, 8, ["customer", "payment-method-options", "is-loading", "is-active"])
2328
+ ]),
2329
+ _: 2
2330
+ }, [
2331
+ renderList(hostPanes.value, (pane) => {
2332
+ return {
2333
+ name: pane,
2334
+ fn: withCtx(() => [
2335
+ renderSlot(_ctx.$slots, pane)
2336
+ ])
2337
+ };
2338
+ })
2339
+ ]), 1032, ["panes", "current"])
2340
+ ])
2341
+ ]),
2342
+ _: 2
2343
+ }, [
2344
+ _ctx.$slots.footer ? {
2345
+ name: "footer",
2346
+ fn: withCtx(() => [
2347
+ renderSlot(_ctx.$slots, "footer")
2348
+ ]),
2349
+ key: "0"
2350
+ } : void 0
2351
+ ]), 1032, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-loading"]);
2352
+ };
2353
+ }
2354
+ });
2355
+ const getActiveAutoTopUpConfig = (walletBalanceItem) => {
2356
+ var _a;
2357
+ return (((_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet) == null ? void 0 : _a.auto_top_up_configs) ?? []).find(
2358
+ ({ status }) => status === "ACTIVE"
2359
+ );
2360
+ };
2361
+ const toAutoTopUpRule = (config) => config ? {
2362
+ status: config.status,
2363
+ threshold: config.threshold,
2364
+ ...config.topup_amount && { topup_amount: config.topup_amount }
2365
+ } : void 0;
2366
+ const getAutoTopUpChargeTarget = (topUpItem, topUpPricingItems = []) => {
2367
+ if ((topUpItem == null ? void 0 : topUpItem.pricing_item_id) && topUpItem.pricing_plan_schedule_id) {
2368
+ return {
2369
+ pricingItemId: topUpItem.pricing_item_id,
2370
+ pricingPlanScheduleId: topUpItem.pricing_plan_schedule_id
2371
+ };
2372
+ }
2373
+ const flexible = topUpPricingItems.find(
2374
+ ({ flexiblePricing, pricingPlanScheduleId }) => flexiblePricing && pricingPlanScheduleId
2375
+ );
2376
+ return (flexible == null ? void 0 : flexible.pricingPlanScheduleId) ? {
2377
+ pricingItemId: flexible.pricingItemId,
2378
+ pricingPlanScheduleId: flexible.pricingPlanScheduleId
2379
+ } : void 0;
2380
+ };
2381
+ const toCreateAutoTopUpConfigPayload = ({
2382
+ rule,
2383
+ walletBalanceItem,
2384
+ chargeTarget,
2385
+ paymentMethodId
2386
+ }) => {
2387
+ var _a, _b;
2388
+ const hasThreshold = !!(((_a = rule == null ? void 0 : rule.threshold) == null ? void 0 : _a.amount) ?? ((_b = rule == null ? void 0 : rule.threshold) == null ? void 0 : _b.credits));
2389
+ if (!rule || !hasThreshold || !(walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_id) || !chargeTarget || !paymentMethodId) {
2390
+ return void 0;
2391
+ }
2392
+ return {
2393
+ wallet_id: walletBalanceItem.wallet_id,
2394
+ status: rule.status,
2395
+ threshold: rule.threshold,
2396
+ pricing_plan_schedule_id: chargeTarget.pricingPlanScheduleId,
2397
+ pricing_item_id: chargeTarget.pricingItemId,
2398
+ payment_method_id: paymentMethodId,
2399
+ ...rule.topup_amount && { topup_amount: rule.topup_amount }
2400
+ };
2401
+ };
2402
+ function useAddPaymentMethodStep({
2403
+ step,
2404
+ name,
2405
+ returnTo
2406
+ }) {
2407
+ const paneRef = ref();
2408
+ return {
2409
+ paneRef,
2410
+ isActive: computed(() => step.value === name),
2411
+ isSaving: computed(() => {
2412
+ var _a;
2413
+ return !!((_a = paneRef.value) == null ? void 0 : _a.isSaving);
2414
+ }),
2415
+ open: () => {
2416
+ step.value = name;
2417
+ },
2418
+ leave: () => {
2419
+ step.value = returnTo;
2420
+ },
2421
+ submit: () => {
2422
+ var _a;
2423
+ return (_a = paneRef.value) == null ? void 0 : _a.submit();
2424
+ }
2425
+ };
2426
+ }
2427
+ function createAutoTopUpConfigsService() {
2428
+ const request = createRequestService();
2429
+ const config = useConfig();
2430
+ const BASE_URL = "/portal/auto-top-up-configs";
2431
+ function getAutoTopUpConfigs(filters) {
2432
+ return request({
2433
+ url: `${config.apiUrls.config}${BASE_URL}`,
2434
+ query: { ...filters },
2435
+ isCollection: true
2436
+ });
2437
+ }
2438
+ function getAutoTopUpConfig(configId) {
2439
+ return request({
2440
+ url: `${config.apiUrls.config}${BASE_URL}/${configId}`
2441
+ });
2442
+ }
2443
+ function createAutoTopUpConfig(payload) {
2444
+ return request({
2445
+ url: `${config.apiUrls.config}${BASE_URL}`,
2446
+ options: { method: "POST" },
2447
+ data: payload
2448
+ });
2449
+ }
2450
+ function deactivateAutoTopUpConfig(configId) {
2451
+ return request({
2452
+ url: `${config.apiUrls.config}${BASE_URL}/${configId}/deactivate`,
2453
+ options: { method: "POST" }
2454
+ });
2455
+ }
2456
+ return {
2457
+ getAutoTopUpConfigs,
2458
+ getAutoTopUpConfig,
2459
+ createAutoTopUpConfig,
2460
+ deactivateAutoTopUpConfig
2461
+ };
2462
+ }
2463
+ function useSaveAutoTopUpConfig() {
2464
+ const { createAutoTopUpConfig } = createAutoTopUpConfigsService();
2465
+ const logger = useLogger();
2466
+ const isSaving = ref(false);
2467
+ const save = async (payload) => {
2468
+ if (!payload || isSaving.value) {
2469
+ return { saved: false };
2470
+ }
2471
+ isSaving.value = true;
2472
+ try {
2473
+ await createAutoTopUpConfig(payload);
2474
+ return { saved: true };
2475
+ } catch (error) {
2476
+ logger.error(
2477
+ "AUTO_TOP_UP_SAVE_FAILED",
2478
+ "Failed to save the automatic top-up rule",
2479
+ {},
2480
+ error
2481
+ );
2482
+ return { saved: false, error };
2483
+ } finally {
2484
+ isSaving.value = false;
2485
+ }
2486
+ };
2487
+ return { save, isSaving };
2488
+ }
2489
+ const _hoisted_1$2 = {
2490
+ key: 0,
2491
+ class: "mb-4"
2492
+ };
2493
+ const _hoisted_2 = { class: "sr-only" };
2494
+ const _hoisted_3 = { class: "flex flex-col gap-2" };
2495
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2496
+ __name: "TopUpModal",
2497
+ props: {
2498
+ showModal: { type: Boolean },
2499
+ selectedBalanceItem: { type: Object },
2500
+ paymentMethods: { type: Array },
2501
+ customer: { type: Object },
2502
+ subscriptions: { type: Array }
2503
+ },
2504
+ emits: ["confirm", "close", "auto-top-up-saved", "payment-success", "payment-failed"],
2505
+ setup(__props, { emit: __emit }) {
2506
+ const props = __props;
2507
+ const emit = __emit;
2508
+ const { $t } = useIntl();
2509
+ const { formatOpenBalance } = useWalletBalanceFormat();
2510
+ const savedAutoTopUpRule = computed(
2511
+ () => toAutoTopUpRule(getActiveAutoTopUpConfig(props.selectedBalanceItem))
2512
+ );
2513
+ const currentBalance = computed(() => formatOpenBalance(props.selectedBalanceItem));
2514
+ const topUpSubscriptions = computed(
2515
+ () => getTopUpSubscriptions(props.selectedBalanceItem, props.subscriptions ?? [])
2516
+ );
2517
+ const selectedSubscriptionId = ref();
2518
+ watch(
2519
+ topUpSubscriptions,
2520
+ (available) => {
2521
+ var _a;
2522
+ const chosenIsStillOffered = available.some(
2523
+ ({ id }) => id === selectedSubscriptionId.value
2524
+ );
2525
+ if (!chosenIsStillOffered) {
2526
+ selectedSubscriptionId.value = (_a = available[0]) == null ? void 0 : _a.id;
2527
+ }
2528
+ },
2529
+ { immediate: true }
2530
+ );
2531
+ const hasSubscriptionChoice = computed(() => topUpSubscriptions.value.length > 1);
2532
+ const subscriptionOptions = computed(
2533
+ () => topUpSubscriptions.value.map(({ id, name }) => ({ value: id, label: name }))
2534
+ );
2535
+ const summaryById = computed(
2536
+ () => Object.fromEntries(
2537
+ topUpSubscriptions.value.flatMap(({ id, enabledPricingIds }) => {
2538
+ const subscription = (props.subscriptions ?? []).find(({ id: it }) => it === id);
2539
+ return subscription ? [[id, { subscription, enabledPricingIds }]] : [];
2540
+ })
2541
+ )
2542
+ );
2543
+ const balanceItemForSubscription = computed(() => {
2544
+ var _a;
2545
+ if (!props.selectedBalanceItem || !((_a = props.subscriptions) == null ? void 0 : _a.length)) {
2546
+ return props.selectedBalanceItem;
2547
+ }
2548
+ const selected = topUpSubscriptions.value.find(({ id }) => id === selectedSubscriptionId.value);
2549
+ if (!selected) {
2550
+ return { ...props.selectedBalanceItem, charge_on_demand_pricing_items: [] };
2551
+ }
2552
+ return withTopUpPricingItemsForSchedules(props.selectedBalanceItem, selected.scheduleIds);
2553
+ });
2554
+ const topUpPricingItems = computed(() => getTopUpPricingItems(balanceItemForSubscription.value));
2555
+ const {
2556
+ paymentMethodOptions,
2557
+ settledOptions,
2558
+ isPending: isPaymentMethodOptionsPending
2559
+ } = useCustomerPaymentMethodOptions({
2560
+ isOpen: computed(() => props.showModal),
2561
+ customer: computed(() => props.customer)
2562
+ });
2563
+ const step = ref("TOP_UP");
2564
+ const hasStoredPaymentMethods = computed(() => (props.paymentMethods ?? []).length > 0);
2565
+ const hasNoPaymentMethodOptions = computed(
2566
+ () => !isPaymentMethodOptionsPending.value && (paymentMethodOptions.value ?? []).length === 0
2567
+ );
2568
+ const isTopUpUnavailable = computed(
2569
+ () => step.value === "TOP_UP" && !hasStoredPaymentMethods.value && hasNoPaymentMethodOptions.value
2570
+ );
2571
+ const chargedInvoice = ref();
2572
+ const chargedValue = ref();
2573
+ const handlePaymentSuccess = () => {
2574
+ leaveAddPaymentMethod();
2575
+ emit("payment-success");
2576
+ };
2577
+ const {
2578
+ paneRef: addPaymentMethodRef,
2579
+ isActive: isAddingPaymentMethod,
2580
+ isSaving: isSavingPaymentMethod,
2581
+ open: openAddPaymentMethod,
2582
+ leave: leaveAddPaymentMethod,
2583
+ submit: submitPaymentMethod
2584
+ } = useAddPaymentMethodStep({ step, name: "ADD_PAYMENT_METHOD", returnTo: "TOP_UP" });
2585
+ const { save: saveRule } = useSaveAutoTopUpConfig();
2586
+ const topUpFormRef = ref();
2587
+ const topUpValue = computed(() => {
2588
+ var _a;
2589
+ return (_a = topUpFormRef.value) == null ? void 0 : _a.chargedValue;
2590
+ });
2591
+ const isPending = computed(() => {
2592
+ var _a;
2593
+ return isSavingPaymentMethod.value || !!((_a = topUpFormRef.value) == null ? void 0 : _a.isCharging);
2594
+ });
2595
+ const { title, subTitle, cancelButtonText, confirmButtonText } = useTopUpModalLabels({
2596
+ step,
2597
+ currentBalance,
2598
+ topUpValue
2599
+ });
2600
+ const handleConfirm = () => {
2601
+ var _a;
2602
+ if (isAddingPaymentMethod.value) {
2603
+ submitPaymentMethod();
2604
+ return;
2605
+ }
2606
+ void ((_a = topUpFormRef.value) == null ? void 0 : _a.submit());
2607
+ };
2608
+ const handleSaveAutoTopUp = async ({
2609
+ rule,
2610
+ paymentMethodId
2611
+ }) => {
2612
+ const { saved } = await saveRule(
2613
+ toCreateAutoTopUpConfigPayload({
2614
+ rule,
2615
+ walletBalanceItem: props.selectedBalanceItem,
2616
+ chargeTarget: getAutoTopUpChargeTarget(void 0, topUpPricingItems.value),
2617
+ paymentMethodId
2618
+ })
2619
+ );
2620
+ if (saved) {
2621
+ emit("auto-top-up-saved");
2622
+ }
2623
+ };
2624
+ const handleTopUpSuccess = (invoice) => {
2625
+ var _a;
2626
+ chargedInvoice.value = invoice;
2627
+ chargedValue.value = (_a = topUpFormRef.value) == null ? void 0 : _a.chargedValue;
2628
+ step.value = "SUCCESS";
2629
+ };
2630
+ const handleDone = () => {
2631
+ emit("confirm");
2632
+ emit("close");
2633
+ };
2634
+ const handleCancel = () => {
2635
+ if (isPending.value) {
2636
+ return;
2637
+ }
2638
+ if (isAddingPaymentMethod.value) {
2639
+ leaveAddPaymentMethod();
2640
+ return;
2641
+ }
2642
+ if (step.value === "SUCCESS") {
2643
+ handleDone();
2644
+ return;
2645
+ }
2646
+ emit("close");
2647
+ };
2648
+ const topUpFormKey = ref(0);
2649
+ watch(
2650
+ () => props.showModal,
2651
+ (showModal) => {
2652
+ if (!showModal) {
2653
+ return;
2654
+ }
2655
+ step.value = "TOP_UP";
2656
+ chargedInvoice.value = void 0;
2657
+ chargedValue.value = void 0;
2658
+ topUpFormKey.value += 1;
2659
+ }
2660
+ );
2661
+ return (_ctx, _cache) => {
2662
+ return openBlock(), createBlock(_sfc_main$4, {
2663
+ ref_key: "addPaymentMethodRef",
2664
+ ref: addPaymentMethodRef,
2665
+ "show-modal": __props.showModal,
2666
+ title: unref(title),
2667
+ "sub-title": unref(subTitle),
2668
+ "cancel-button-text": unref(cancelButtonText),
2669
+ "confirm-button-text": unref(confirmButtonText),
2670
+ "is-pending": isPending.value,
2671
+ panes: unref(TOP_UP_MODAL_STEPS),
2672
+ step: step.value,
2673
+ "add-payment-method-pane": "ADD_PAYMENT_METHOD",
2674
+ customer: __props.customer,
2675
+ "payment-method-options": unref(paymentMethodOptions),
2676
+ "is-payment-method-options-pending": unref(isPaymentMethodOptionsPending),
2677
+ "is-adding-payment-method": unref(isAddingPaymentMethod),
2678
+ onConfirm: handleConfirm,
2679
+ onCancel: handleCancel,
2680
+ onPaymentSuccess: handlePaymentSuccess,
2681
+ onPaymentFailed: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
2682
+ }, createSlots({
2683
+ TOP_UP: withCtx(() => [
2684
+ hasSubscriptionChoice.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
2685
+ createVNode(unref(_sfc_main$r), {
2686
+ modelValue: selectedSubscriptionId.value,
2687
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedSubscriptionId.value = $event),
2688
+ class: "sv-topup-modal__subscription",
2689
+ name: "top-up-subscription",
2690
+ direction: "column",
2691
+ required: "",
2692
+ options: subscriptionOptions.value,
2693
+ "show-radio": false,
2694
+ label: unref($t)({
2695
+ defaultMessage: "Subscription to top up",
2696
+ description: "Label above the list of subscriptions a top-up can be charged against, in the top-up modal",
2697
+ id: "topup_modal.subscriptions.label"
2698
+ })
2699
+ }, {
2700
+ prefix: withCtx(({ optionValue }) => [
2701
+ summaryById.value[String(optionValue)] ? (openBlock(), createBlock(_sfc_main$v, {
2702
+ key: 0,
2703
+ class: "sv-topup-modal__subscription-option grow",
2704
+ "no-spacing": "",
2705
+ subscription: summaryById.value[String(optionValue)].subscription,
2706
+ "enabled-pricing-ids": summaryById.value[String(optionValue)].enabledPricingIds
2707
+ }, null, 8, ["subscription", "enabled-pricing-ids"])) : createCommentVNode("", true)
2708
+ ]),
2709
+ label: withCtx(({ option }) => [
2710
+ createElementVNode("span", _hoisted_2, toDisplayString(option.label), 1)
2711
+ ]),
2712
+ _: 1
2713
+ }, 8, ["modelValue", "options", "label"])
2714
+ ])) : createCommentVNode("", true),
2715
+ (openBlock(), createBlock(_sfc_main$7, {
2716
+ key: topUpFormKey.value,
2717
+ ref_key: "topUpFormRef",
2718
+ ref: topUpFormRef,
2719
+ "top-up-pricing-items": topUpPricingItems.value,
2720
+ "payment-methods": __props.paymentMethods,
2721
+ "auto-top-up-config": savedAutoTopUpRule.value,
2722
+ "payment-method-options": unref(settledOptions),
2723
+ onAddPaymentMethod: unref(openAddPaymentMethod),
2724
+ onSuccess: handleTopUpSuccess,
2725
+ onSaveAutoTopUp: handleSaveAutoTopUp
2726
+ }, null, 8, ["top-up-pricing-items", "payment-methods", "auto-top-up-config", "payment-method-options", "onAddPaymentMethod"]))
2727
+ ]),
2728
+ SUCCESS: withCtx(() => [
2729
+ chargedInvoice.value ? (openBlock(), createBlock(_sfc_main$6, {
2730
+ key: 0,
2731
+ "added-value": chargedValue.value,
2732
+ invoice: chargedInvoice.value
2733
+ }, null, 8, ["added-value", "invoice"])) : createCommentVNode("", true)
2734
+ ]),
2735
+ _: 2
2736
+ }, [
2737
+ step.value === "SUCCESS" || isTopUpUnavailable.value ? {
2738
+ name: "footer",
2739
+ fn: withCtx(() => [
2740
+ createElementVNode("div", _hoisted_3, [
2741
+ step.value === "SUCCESS" ? (openBlock(), createBlock(unref(_sfc_main$i), {
2742
+ key: 0,
2743
+ size: "lg",
2744
+ "data-testid": "done",
2745
+ onClick: handleDone
2746
+ }, {
2747
+ default: withCtx(() => [
2748
+ createTextVNode(toDisplayString(unref(confirmButtonText)), 1)
2749
+ ]),
2750
+ _: 1
2751
+ })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2752
+ createVNode(unref(_sfc_main$i), {
2753
+ size: "lg",
2754
+ disabled: "",
2755
+ "data-testid": "confirm"
2756
+ }, {
2757
+ default: withCtx(() => [
2758
+ createTextVNode(toDisplayString(unref(confirmButtonText)), 1)
2759
+ ]),
2760
+ _: 1
2761
+ }),
2762
+ createVNode(unref(_sfc_main$i), {
2763
+ size: "lg",
2764
+ intent: "subtle",
2765
+ "data-testid": "cancel",
2766
+ onClick: handleCancel
2767
+ }, {
2768
+ default: withCtx(() => [
2769
+ createTextVNode(toDisplayString(unref(cancelButtonText)), 1)
2770
+ ]),
2771
+ _: 1
2772
+ })
2773
+ ], 64))
2774
+ ])
2775
+ ]),
2776
+ key: "0"
2777
+ } : void 0
2778
+ ]), 1032, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-pending", "panes", "step", "customer", "payment-method-options", "is-payment-method-options-pending", "is-adding-payment-method"]);
2779
+ };
2780
+ }
2781
+ });
2782
+ const AUTO_TOP_UP_MODAL_STEPS = ["AUTO_TOP_UP", "ADD_PAYMENT_METHOD"];
2783
+ const _hoisted_1$1 = { class: "grid grid-cols-1 gap-4" };
2784
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2785
+ __name: "AutoTopUpModal",
2786
+ props: {
2787
+ showModal: { type: Boolean },
2788
+ walletBalanceItem: { type: Object },
2789
+ topUpItem: { type: Object },
2790
+ paymentMethods: { type: Array },
2791
+ customer: { type: Object }
2792
+ },
2793
+ emits: ["saved", "close", "payment-success", "payment-failed"],
2794
+ setup(__props, { emit: __emit }) {
2795
+ const props = __props;
2796
+ const emit = __emit;
2797
+ const { $t } = useIntl();
2798
+ const { formatOpenBalance } = useWalletBalanceFormat();
2799
+ const step = ref("AUTO_TOP_UP");
2800
+ const currentBalance = computed(() => formatOpenBalance(props.walletBalanceItem));
2801
+ const topUpPricingItems = computed(() => getTopUpPricingItems(props.walletBalanceItem));
2802
+ const autoTopUpEditor = computed(() => getAutoTopUpEditorConfig(topUpPricingItems.value));
2803
+ const savedConfig = computed(() => getActiveAutoTopUpConfig(props.walletBalanceItem));
2804
+ const savedRule = computed(() => toAutoTopUpRule(savedConfig.value));
2805
+ const chargeTarget = computed(
2806
+ () => getAutoTopUpChargeTarget(props.topUpItem, topUpPricingItems.value)
2807
+ );
2808
+ const autoTopUpFormRef = ref();
2809
+ const previewPricingItems = computed(() => {
2810
+ var _a, _b;
2811
+ const amount = (_b = (_a = autoTopUpFormRef.value) == null ? void 0 : _a.rule) == null ? void 0 : _b.topup_amount;
2812
+ return (amount == null ? void 0 : amount.quantity) && chargeTarget.value ? [{ pricing_item_id: chargeTarget.value.pricingItemId, flexible_amount: amount }] : void 0;
2813
+ });
2814
+ const previewScheduleId = computed(() => {
2815
+ var _a;
2816
+ return (_a = chargeTarget.value) == null ? void 0 : _a.pricingPlanScheduleId;
2817
+ });
2818
+ const selectedPaymentMethodId = ref();
2819
+ const { sortedPaymentMethods } = useDefaultPaymentMethod({
2820
+ paymentMethods: computed(() => props.paymentMethods),
2821
+ selectedPaymentMethodId,
2822
+ preferredPaymentMethodId: computed(() => {
2823
+ var _a;
2824
+ return (_a = savedConfig.value) == null ? void 0 : _a.payment_method_id;
2825
+ })
2826
+ });
2827
+ const {
2828
+ paymentMethodOptions,
2829
+ settledOptions,
2830
+ isPending: isPaymentMethodOptionsPending
2831
+ } = useCustomerPaymentMethodOptions({
2832
+ isOpen: computed(() => props.showModal),
2833
+ customer: computed(() => props.customer)
2834
+ });
2835
+ const {
2836
+ paneRef: addPaymentMethodRef,
2837
+ isActive: isAddingPaymentMethod,
2838
+ isSaving: isSavingPaymentMethod,
2839
+ open: openAddPaymentMethod,
2840
+ leave: leaveAddPaymentMethod,
2841
+ submit: submitPaymentMethod
2842
+ } = useAddPaymentMethodStep({ step, name: "ADD_PAYMENT_METHOD", returnTo: "AUTO_TOP_UP" });
2843
+ const { save: saveRule, isSaving: isSavingRule } = useSaveAutoTopUpConfig();
2844
+ const isPending = computed(() => isSavingPaymentMethod.value || isSavingRule.value);
2845
+ const validationState = reactive({
2846
+ paymentMethodId: computed(() => selectedPaymentMethodId.value ?? null)
2847
+ });
2848
+ const validation = useValidation(
2849
+ {
2850
+ paymentMethodId: {
2851
+ required: common.withMessage(
2852
+ () => $t({
2853
+ defaultMessage: "Select a payment method to pay for automatic top-ups.",
2854
+ description: "Error shown in the auto top-up modal when no payment method is selected",
2855
+ id: "auto_topup_modal.payment_method.required"
2856
+ }),
2857
+ required
2858
+ )
2859
+ }
2860
+ },
2861
+ validationState
2862
+ );
2863
+ const title = computed(
2864
+ () => step.value === "ADD_PAYMENT_METHOD" ? $t({
2865
+ defaultMessage: "Add payment method",
2866
+ description: "Title of the auto top-up modal while the customer is adding a payment method",
2867
+ id: "auto_topup_modal.add_payment_method.title"
2868
+ }) : $t({
2869
+ defaultMessage: "Automatic top-up",
2870
+ description: "Title of the automatic wallet top-up modal",
2871
+ id: "auto_topup_modal.title"
2872
+ })
2873
+ );
2874
+ const subTitle = computed(
2875
+ () => step.value === "ADD_PAYMENT_METHOD" ? $t({
2876
+ defaultMessage: "This method pays for every automatic top-up.",
2877
+ description: "Subtitle of the auto top-up modal while the customer is adding a payment method",
2878
+ id: "auto_topup_modal.add_payment_method.subtitle"
2879
+ }) : $t(
2880
+ {
2881
+ defaultMessage: "Your current balance is {balance}. Enable auto top so you can stay productive",
2882
+ description: "Subtitle of the automatic wallet top-up modal, naming the balance",
2883
+ id: "auto_topup_modal.subtitle"
2884
+ },
2885
+ { balance: currentBalance.value }
2886
+ )
2887
+ );
2888
+ const cancelButtonText = computed(
2889
+ () => step.value === "ADD_PAYMENT_METHOD" ? $t({
2890
+ defaultMessage: "Back",
2891
+ description: "Button returning from adding a payment method to the auto top-up rule",
2892
+ id: "auto_topup_modal.add_payment_method.cancel"
2893
+ }) : $t({
2894
+ defaultMessage: "Cancel",
2895
+ description: "Button dismissing the auto top-up modal",
2896
+ id: "auto_topup_modal.cancel"
2897
+ })
2898
+ );
2899
+ const confirmButtonText = computed(
2900
+ () => step.value === "ADD_PAYMENT_METHOD" ? $t({
2901
+ defaultMessage: "Add payment method",
2902
+ description: "Button storing the payment method being added in the auto top-up modal",
2903
+ id: "auto_topup_modal.add_payment_method.confirm"
2904
+ }) : $t({
2905
+ defaultMessage: "Save",
2906
+ description: "Button saving the automatic top-up rule",
2907
+ id: "auto_topup_modal.confirm"
2908
+ })
2909
+ );
2910
+ async function save() {
2911
+ var _a;
2912
+ validation.value.$touch();
2913
+ if (isPending.value) {
2914
+ return;
2915
+ }
2916
+ const { saved, error } = await saveRule(
2917
+ toCreateAutoTopUpConfigPayload({
2918
+ rule: (_a = autoTopUpFormRef.value) == null ? void 0 : _a.validate(),
2919
+ walletBalanceItem: props.walletBalanceItem,
2920
+ chargeTarget: chargeTarget.value,
2921
+ paymentMethodId: selectedPaymentMethodId.value
2922
+ })
2923
+ );
2924
+ if (saved) {
2925
+ emit("saved");
2926
+ emit("close");
2927
+ return;
2928
+ }
2929
+ if (error) {
2930
+ emit("payment-failed", error);
2931
+ }
2932
+ }
2933
+ const handleConfirm = () => {
2934
+ if (isAddingPaymentMethod.value) {
2935
+ submitPaymentMethod();
2936
+ return;
2937
+ }
2938
+ void save();
2939
+ };
2940
+ const handlePaymentSuccess = () => {
2941
+ leaveAddPaymentMethod();
2942
+ emit("payment-success");
2943
+ };
2944
+ const handleCancel = () => {
2945
+ if (isPending.value) {
2946
+ return;
2947
+ }
2948
+ if (isAddingPaymentMethod.value) {
2949
+ leaveAddPaymentMethod();
2950
+ return;
2951
+ }
2952
+ emit("close");
2953
+ };
2954
+ const formKey = ref(0);
2955
+ watch(
2956
+ () => props.showModal,
2957
+ (showModal) => {
2958
+ if (!showModal) {
2959
+ return;
2960
+ }
2961
+ step.value = "AUTO_TOP_UP";
2962
+ selectedPaymentMethodId.value = void 0;
2963
+ formKey.value += 1;
2964
+ }
2965
+ );
2966
+ return (_ctx, _cache) => {
2967
+ return openBlock(), createBlock(_sfc_main$4, {
2968
+ ref_key: "addPaymentMethodRef",
2969
+ ref: addPaymentMethodRef,
2970
+ "show-modal": __props.showModal,
2971
+ title: title.value,
2972
+ "sub-title": subTitle.value,
2973
+ "cancel-button-text": cancelButtonText.value,
2974
+ "confirm-button-text": confirmButtonText.value,
2975
+ "is-pending": isPending.value,
2976
+ panes: unref(AUTO_TOP_UP_MODAL_STEPS),
2977
+ step: step.value,
2978
+ "add-payment-method-pane": "ADD_PAYMENT_METHOD",
2979
+ customer: __props.customer,
2980
+ "payment-method-options": unref(paymentMethodOptions),
2981
+ "is-payment-method-options-pending": unref(isPaymentMethodOptionsPending),
2982
+ "is-adding-payment-method": unref(isAddingPaymentMethod),
2983
+ onConfirm: handleConfirm,
2984
+ onCancel: handleCancel,
2985
+ onPaymentSuccess: handlePaymentSuccess,
2986
+ onPaymentFailed: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
2987
+ }, {
2988
+ AUTO_TOP_UP: withCtx(() => [
2989
+ createElementVNode("div", _hoisted_1$1, [
2990
+ autoTopUpEditor.value ? (openBlock(), createBlock(_sfc_main$8, mergeProps({
2991
+ key: formKey.value,
2992
+ ref_key: "autoTopUpFormRef",
2993
+ ref: autoTopUpFormRef,
2994
+ class: "sv-auto-topup-modal__rule"
2995
+ }, autoTopUpEditor.value, {
2996
+ config: savedRule.value,
2997
+ "always-enabled": "",
2998
+ disabled: isPending.value
2999
+ }), null, 16, ["config", "disabled"])) : createCommentVNode("", true),
3000
+ createVNode(_sfc_main$b, {
3001
+ "pricing-plan-schedule-id": previewScheduleId.value,
3002
+ "pricing-items": previewPricingItems.value
3003
+ }, null, 8, ["pricing-plan-schedule-id", "pricing-items"]),
3004
+ createVNode(_sfc_main$t, {
3005
+ modelValue: selectedPaymentMethodId.value,
3006
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedPaymentMethodId.value = $event),
3007
+ class: "sv-auto-topup-modal__payment-method",
3008
+ "payment-methods": unref(sortedPaymentMethods),
3009
+ "payment-method-options": unref(settledOptions),
3010
+ disabled: isPending.value,
3011
+ error: unref(validation).paymentMethodId.$errors,
3012
+ label: unref($t)({
3013
+ defaultMessage: "Pay automatic top-ups with",
3014
+ description: "Label above the payment method an automatic top-up is charged to",
3015
+ id: "auto_topup_modal.payment_method.label"
3016
+ }),
3017
+ onAddPaymentMethod: unref(openAddPaymentMethod)
3018
+ }, null, 8, ["modelValue", "payment-methods", "payment-method-options", "disabled", "error", "label", "onAddPaymentMethod"])
3019
+ ])
3020
+ ]),
3021
+ _: 1
3022
+ }, 8, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-pending", "panes", "step", "customer", "payment-method-options", "is-payment-method-options-pending", "is-adding-payment-method"]);
3023
+ };
3024
+ }
3025
+ });
3026
+ const _hoisted_1 = { class: "sv-auto-topup-cancellation-modal sv-auto-topup-cancellation-modal__body flex flex-col gap-3" };
3027
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3028
+ __name: "AutoTopUpCancellationModal",
3029
+ props: {
3030
+ showModal: { type: Boolean },
3031
+ config: { type: Object }
3032
+ },
3033
+ emits: ["confirmed", "close"],
3034
+ setup(__props, { emit: __emit }) {
3035
+ const props = __props;
3036
+ const emit = __emit;
3037
+ const { $t } = useIntl();
3038
+ const logger = useLogger();
3039
+ const { formatValue } = useWalletBalanceFormat();
3040
+ const { deactivateAutoTopUpConfig } = createAutoTopUpConfigsService();
3041
+ const isSubmitting = ref(false);
3042
+ const hasFailed = ref(false);
3043
+ watch(
3044
+ () => props.showModal,
3045
+ (showModal) => {
3046
+ if (showModal) {
3047
+ hasFailed.value = false;
3048
+ }
3049
+ }
3050
+ );
3051
+ const explanation = computed(() => {
3052
+ var _a, _b;
3053
+ const threshold = (_a = props.config) == null ? void 0 : _a.threshold;
3054
+ const topUpAmount = (_b = props.config) == null ? void 0 : _b.topup_amount;
3055
+ if (!(threshold == null ? void 0 : threshold.amount) && !(threshold == null ? void 0 : threshold.credits)) {
3056
+ return $t({
3057
+ defaultMessage: "Your balance will no longer be topped up automatically. You can still top up whenever you want to.",
3058
+ description: "Explanation in the modal that turns a wallet automatic top-up off",
3059
+ id: "auto_topup_cancellation_modal.explanation"
3060
+ });
3061
+ }
3062
+ if (!topUpAmount) {
3063
+ return $t(
3064
+ {
3065
+ defaultMessage: "Your balance will no longer be topped up automatically when it falls below {threshold}. You can still top up whenever you want to.",
3066
+ description: "Explanation in the modal that turns a wallet automatic top-up off, naming the threshold",
3067
+ id: "auto_topup_cancellation_modal.explanation_with_threshold"
3068
+ },
3069
+ { threshold: formatValue(threshold) }
3070
+ );
3071
+ }
3072
+ return $t(
3073
+ {
3074
+ 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.",
3075
+ description: "Explanation in the modal that turns a wallet automatic top-up off, naming what it charged and when",
3076
+ id: "auto_topup_cancellation_modal.explanation_with_amount"
3077
+ },
3078
+ { amount: formatValue({ amount: topUpAmount }), threshold: formatValue(threshold) }
3079
+ );
3080
+ });
3081
+ const handleConfirm = async () => {
3082
+ var _a;
3083
+ const configId = (_a = props.config) == null ? void 0 : _a.id;
3084
+ if (!configId || isSubmitting.value) {
3085
+ return;
3086
+ }
3087
+ isSubmitting.value = true;
3088
+ hasFailed.value = false;
3089
+ try {
3090
+ await deactivateAutoTopUpConfig(configId);
3091
+ emit("confirmed");
3092
+ emit("close");
3093
+ } catch (error) {
3094
+ logger.error(
3095
+ "AUTO_TOP_UP_CANCELLATION_FAILED",
3096
+ "Failed to turn off a wallet's automatic top-up",
3097
+ {},
3098
+ error
3099
+ );
3100
+ hasFailed.value = true;
3101
+ } finally {
3102
+ isSubmitting.value = false;
3103
+ }
3104
+ };
3105
+ const handleClose = () => {
3106
+ if (isSubmitting.value) {
3107
+ return;
3108
+ }
3109
+ emit("close");
3110
+ };
3111
+ return (_ctx, _cache) => {
3112
+ return openBlock(), createBlock(unref(Modal), {
3113
+ size: "sm",
3114
+ "show-modal": __props.showModal,
3115
+ "is-loading": isSubmitting.value,
3116
+ "no-click-away": isSubmitting.value,
3117
+ "no-backdrop-close": isSubmitting.value,
3118
+ title: unref($t)({
3119
+ defaultMessage: "Turn off automatic top-up",
3120
+ description: "Title of the modal that turns a wallet automatic top-up off",
3121
+ id: "auto_topup_cancellation_modal.title"
3122
+ }),
3123
+ "confirm-button-text": unref($t)({
3124
+ defaultMessage: "Yes, turn it off",
3125
+ description: "Button confirming that a wallet automatic top-up is turned off",
3126
+ id: "auto_topup_cancellation_modal.confirm"
3127
+ }),
3128
+ "cancel-button-text": unref($t)({
3129
+ defaultMessage: "Cancel",
3130
+ description: "Button dismissing the modal that turns a wallet automatic top-up off",
3131
+ id: "auto_topup_cancellation_modal.cancel"
3132
+ }),
3133
+ onConfirm: handleConfirm,
3134
+ onClose: handleClose
3135
+ }, {
3136
+ body: withCtx(() => [
3137
+ createElementVNode("div", _hoisted_1, [
3138
+ createVNode(unref(_sfc_main$h), {
3139
+ variant: "body-sm",
3140
+ color: "subtle",
3141
+ tag: "p",
3142
+ class: "sv-auto-topup-cancellation-modal__explanation"
3143
+ }, {
3144
+ default: withCtx(() => [
3145
+ createTextVNode(toDisplayString(explanation.value), 1)
3146
+ ]),
3147
+ _: 1
3148
+ }),
3149
+ hasFailed.value ? (openBlock(), createBlock(unref(_sfc_main$w), {
3150
+ key: 0,
3151
+ class: "sv-auto-topup-cancellation-modal__error sv-error",
3152
+ title: unref($t)({
3153
+ defaultMessage: "Could not turn off the automatic top-up. Please try again later.",
3154
+ description: "Error shown when turning a wallet automatic top-up off failed",
3155
+ id: "auto_topup_cancellation_modal.failed"
3156
+ })
3157
+ }, null, 8, ["title"])) : createCommentVNode("", true)
3158
+ ])
3159
+ ]),
3160
+ _: 1
3161
+ }, 8, ["show-modal", "is-loading", "no-click-away", "no-backdrop-close", "title", "confirm-button-text", "cancel-button-text"]);
3162
+ };
3163
+ }
3164
+ });
3165
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3166
+ ...{ inheritAttrs: false },
3167
+ __name: "CustomerWalletBalances",
3168
+ props: {
3169
+ hasError: { type: Boolean },
3170
+ isLoading: { type: Boolean },
3171
+ walletBalances: { type: Array },
3172
+ showTopUpButton: { type: Boolean },
3173
+ customer: { type: Object },
3174
+ paymentMethods: { type: Array },
3175
+ subscriptions: { type: Array }
3176
+ },
3177
+ emits: ["top-up-charged", "auto-top-up-saved", "auto-top-up-cancelled", "payment-method-stored", "payment-failed"],
3178
+ setup(__props, { emit: __emit }) {
3179
+ const props = __props;
3180
+ const emit = __emit;
3181
+ const { $t } = useIntl();
3182
+ const selectedTopUpItem = ref();
3183
+ const selectedBalanceItem = computed(
3184
+ () => getWalletBalanceForTopUpItem(props.walletBalances, selectedTopUpItem.value)
3185
+ );
3186
+ const showTopUpModal = computed(() => !!selectedBalanceItem.value);
3187
+ const selectedAutoTopUpItem = ref();
3188
+ const showAutoTopUpModal = computed(() => !!selectedAutoTopUpItem.value);
3189
+ const autoTopUpWallet = computed(
3190
+ () => getWalletBalanceForTopUpItem(props.walletBalances, selectedAutoTopUpItem.value)
3191
+ );
3192
+ const cancellingAutoTopUpConfig = ref();
3193
+ const showAutoTopUpCancellation = computed(() => !!cancellingAutoTopUpConfig.value);
3194
+ return (_ctx, _cache) => {
3195
+ return openBlock(), createElementBlock(Fragment, null, [
3196
+ __props.isLoading ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
3197
+ key: 0,
3198
+ variant: "section"
3199
+ }, _ctx.$attrs, {
3200
+ class: "sv-wallet-balances sv-root sv-component sv-loading min-h-48",
3201
+ "data-testid": "customer-wallet-balances-skeleton"
3202
+ }), null, 16)) : __props.hasError ? (openBlock(), createBlock(unref(_sfc_main$w), mergeProps({ key: 1 }, _ctx.$attrs, {
3203
+ class: "sv-wallet-balances sv-root sv-component sv-error",
3204
+ title: unref($t)({
3205
+ defaultMessage: "Could not load wallet balances",
3206
+ description: "Error shown when wallet balances fail to load",
3207
+ id: "wallet_balance.load_failed"
3208
+ })
3209
+ }), null, 16, ["title"])) : __props.walletBalances.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({ key: 2 }, _ctx.$attrs, {
3210
+ class: "sv-wallet-balances sv-root sv-component",
3211
+ "customer-wallet-balances": __props.walletBalances,
3212
+ "show-auto-top-up": "",
3213
+ "show-manual-top-up": "",
3214
+ title: unref($t)(
3215
+ {
3216
+ defaultMessage: "{count, plural, one {Wallet} other {Wallets}}",
3217
+ description: "Title for the wallets block on the customer overview page",
3218
+ id: "customer_overview.wallet_balances_block.title"
3219
+ },
3220
+ { count: String(__props.walletBalances.length) }
3221
+ ),
3222
+ onTopUp: _cache[0] || (_cache[0] = ($event) => selectedTopUpItem.value = $event),
3223
+ onAutoTopUp: _cache[1] || (_cache[1] = ($event) => selectedAutoTopUpItem.value = $event),
3224
+ onCancelAutoTopUp: _cache[2] || (_cache[2] = ($event) => cancellingAutoTopUpConfig.value = $event)
3225
+ }), null, 16, ["customer-wallet-balances", "title"])) : createCommentVNode("", true),
3226
+ __props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$3, {
3227
+ key: 3,
3228
+ "show-modal": showTopUpModal.value,
3229
+ "selected-balance-item": selectedBalanceItem.value,
3230
+ "payment-methods": __props.paymentMethods,
3231
+ customer: __props.customer,
3232
+ subscriptions: __props.subscriptions,
3233
+ onClose: _cache[3] || (_cache[3] = ($event) => selectedTopUpItem.value = void 0),
3234
+ onConfirm: _cache[4] || (_cache[4] = ($event) => emit("top-up-charged")),
3235
+ onPaymentSuccess: _cache[5] || (_cache[5] = ($event) => emit("payment-method-stored")),
3236
+ onPaymentFailed: _cache[6] || (_cache[6] = (error) => emit("payment-failed", error))
3237
+ }, null, 8, ["show-modal", "selected-balance-item", "payment-methods", "customer", "subscriptions"])) : createCommentVNode("", true),
3238
+ __props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$2, {
3239
+ key: 4,
3240
+ "show-modal": showAutoTopUpModal.value,
3241
+ "wallet-balance-item": autoTopUpWallet.value,
3242
+ "top-up-item": selectedAutoTopUpItem.value,
3243
+ "payment-methods": __props.paymentMethods,
3244
+ customer: __props.customer,
3245
+ onClose: _cache[7] || (_cache[7] = ($event) => selectedAutoTopUpItem.value = void 0),
3246
+ onSaved: _cache[8] || (_cache[8] = ($event) => emit("auto-top-up-saved")),
3247
+ onPaymentSuccess: _cache[9] || (_cache[9] = ($event) => emit("payment-method-stored")),
3248
+ onPaymentFailed: _cache[10] || (_cache[10] = (error) => emit("payment-failed", error))
3249
+ }, null, 8, ["show-modal", "wallet-balance-item", "top-up-item", "payment-methods", "customer"])) : createCommentVNode("", true),
3250
+ __props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$1, {
3251
+ key: 5,
3252
+ "show-modal": showAutoTopUpCancellation.value,
3253
+ config: cancellingAutoTopUpConfig.value,
3254
+ onClose: _cache[11] || (_cache[11] = ($event) => cancellingAutoTopUpConfig.value = void 0),
3255
+ onConfirmed: _cache[12] || (_cache[12] = ($event) => emit("auto-top-up-cancelled"))
3256
+ }, null, 8, ["show-modal", "config"])) : createCommentVNode("", true)
3257
+ ], 64);
3258
+ };
3259
+ }
3260
+ });
3261
+ export {
3262
+ _sfc_main as _,
3263
+ useCustomerWalletBalances as u
3264
+ };