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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +33 -31
  2. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
  3. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
  5. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
  6. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
  7. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
  8. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
  9. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
  10. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
  11. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
  12. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
  13. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
  14. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
  15. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
  16. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
  17. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
  18. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
  19. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
  20. package/dist/{PaymentHistoryBlock-BKMttUyk.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
  21. package/dist/{PaymentHistoryBlock-BGbTy4Se.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
  22. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
  23. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
  24. package/dist/{PaymentIntegrationForm-D4QupHWl.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
  25. package/dist/{PaymentIntegrationForm-CypW6fZY.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
  26. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
  27. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
  28. package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
  29. package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
  30. package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
  31. package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
  32. package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
  33. package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
  34. package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +25 -14
  35. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js +1 -0
  36. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +77 -31
  37. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
  38. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +115 -68
  39. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
  40. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs +37 -0
  41. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
  42. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
  43. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs +100 -0
  44. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
  45. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +22 -119
  46. package/dist/adyen-BMDZQBUG.js +1 -0
  47. package/dist/{url-1Lbg5Yni.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
  48. package/dist/component--Y7Igv5i.mjs +1022 -0
  49. package/dist/component-DIy1hvJM.js +1 -0
  50. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  51. package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
  52. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  53. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +4 -4
  54. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  55. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
  56. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  57. package/dist/components/Invoice/Invoice.es.js +7 -7
  58. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  59. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
  60. package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
  61. package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
  62. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  63. package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
  64. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  65. package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
  66. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  67. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
  68. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  69. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -58
  70. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  71. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
  72. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
  73. package/dist/components/WalletBalances/WalletBalances.es.js +25 -9
  74. package/dist/core/action-request.types.d.ts +3 -15
  75. package/dist/core/index.cjs.js +1 -1
  76. package/dist/core/index.es.js +1 -1
  77. package/dist/core/types.d.ts +4 -2
  78. package/dist/{customer-Bv_fqXzO.mjs → customer-DovIxTG1.mjs} +1 -1
  79. package/dist/{customer-_W8gIX5m.js → customer-brfznoHY.js} +1 -1
  80. package/dist/en-US-BvOHPudj.js +1 -0
  81. package/dist/{en-US-DAgOSlgv.mjs → en-US-CXDO3qhq.mjs} +121 -36
  82. package/dist/index-BMWWP8xj.js +1 -0
  83. package/dist/index-Do7kzLpg.mjs +265 -0
  84. package/dist/index.cjs.js +1 -1
  85. package/dist/index.d.ts +2 -1
  86. package/dist/index.es.js +7 -4
  87. package/dist/invoices-Cf3dSYSj.js +1 -0
  88. package/dist/{invoices-BGb0AwVF.mjs → invoices-Dk-z04lg.mjs} +32 -16
  89. package/dist/{nl-NL-DCsmrA8A.mjs → nl-NL-BgL_PuBn.mjs} +126 -40
  90. package/dist/nl-NL-COGUFg60.js +1 -0
  91. package/dist/{paymentMethods-DvqlWe96.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
  92. package/dist/paymentMethods-DVDC_WfL.js +1 -0
  93. package/dist/{payments-DMDDI3MK.js → payments-DVZFO5yb.js} +1 -1
  94. package/dist/{payments-CpzTVrQM.mjs → payments-TnRjtlOw.mjs} +1 -1
  95. package/dist/pricing-CuYndX6t.js +1 -0
  96. package/dist/pricing-GwLCiSzs.mjs +19 -0
  97. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  98. package/dist/pricingPlanSchedule-CXG3CQ61.mjs +146 -0
  99. package/dist/{registry-B-If1W_u.mjs → registry-Ck0Gb6rj.mjs} +7 -4
  100. package/dist/registry-Cra6yoB4.js +1 -0
  101. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  102. package/dist/screens/Checkout/Checkout.es.js +429 -689
  103. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  104. package/dist/screens/CustomerOverview/CustomerOverview.es.js +61 -39
  105. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  106. package/dist/screens/PayInvoice/PayInvoice.es.js +30 -13
  107. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
  108. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
  109. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +3 -0
  110. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -0
  111. package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +889 -0
  112. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +3 -0
  113. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -0
  114. package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +716 -0
  115. package/dist/solvimon-web.css +1 -1
  116. package/dist/subscription-C41lG-rH.mjs +89 -0
  117. package/dist/subscription-b0OPx8Du.js +1 -0
  118. package/dist/subscriptions-BFCKVHnP.js +1 -0
  119. package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
  120. package/dist/{useActionDispatchProvider-Dz8-e4gZ.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
  121. package/dist/{useActionDispatchProvider-BHTknMoH.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
  122. package/dist/{useCustomer-Z24KchWC.js → useCustomer-C1XTqmrQ.js} +1 -1
  123. package/dist/{useCustomer-VVJi8z2w.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
  124. package/dist/{useIncrementalLoading-DmOT2MXH.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
  125. package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
  126. package/dist/{useInvoiceData-Bl87gzIS.js → useInvoiceData-BrxMo4Zt.js} +1 -1
  127. package/dist/{useInvoiceData-Di5pLPM0.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
  128. package/dist/{useInvoicesList-z19cteaD.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
  129. package/dist/useInvoicesList-DmisMQzy.js +1 -0
  130. package/dist/{useLoadInitialData-CkpryfjF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
  131. package/dist/{useLoadInitialData-CTqfiMTN.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
  132. package/dist/{usePaymentMethodOptions-BoGHJjng.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
  133. package/dist/{usePaymentMethodOptions-BsCZnCQW.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
  134. package/dist/{usePaymentMethods-AC-4rrR9.js → usePaymentMethods-CAFMvSOr.js} +1 -1
  135. package/dist/{usePaymentMethods-ocHmNoP7.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
  136. package/dist/{usePayments-CgXZeWrU.js → usePayments-BieVBaz-.js} +1 -1
  137. package/dist/{usePayments-D85eB5l4.mjs → usePayments-D88XSZfS.mjs} +10 -4
  138. package/dist/{usePortal-B1O1zgdV.mjs → usePortal-0NDlbFr9.mjs} +1 -1
  139. package/dist/{usePortal-DVD7PcWI.js → usePortal-B954nyEB.js} +1 -1
  140. package/dist/{useService-CHrkefKd.js → useService-BiljI7XA.js} +1 -1
  141. package/dist/{useService-DF57xuDd.mjs → useService-CqfJi5ST.mjs} +1 -1
  142. package/dist/useSubscription-9rJpFNUF.mjs +29 -0
  143. package/dist/useSubscription-k3limdu_.js +1 -0
  144. package/dist/vendor-ui-Dfh3_g4q.js +1 -0
  145. package/dist/{vendor-ui-B8IlviSs.mjs → vendor-ui-ItGf7wJV.mjs} +8006 -6329
  146. package/package.json +23 -9
  147. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js +0 -1
  148. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js +0 -1
  149. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js +0 -1
  150. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +0 -1
  151. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs +0 -1537
  152. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js +0 -1
  153. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js +0 -1
  154. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +0 -1
  155. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js +0 -1
  156. package/dist/component-Bg2JVC_O.mjs +0 -933
  157. package/dist/component-Bs8oszfD.js +0 -1
  158. package/dist/en-US-C0gIE4Q1.js +0 -1
  159. package/dist/index-CzL1ZcGi.mjs +0 -85
  160. package/dist/index-DRdBmZ2-.js +0 -1
  161. package/dist/invoices-D-OKipCg.js +0 -1
  162. package/dist/nl-NL-Br7muSHK.js +0 -1
  163. package/dist/paymentMethods-DIbB759g.js +0 -1
  164. package/dist/registry-uG2isab0.js +0 -1
  165. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  166. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  167. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1102
  168. package/dist/subscriptions-BPYyv09M.mjs +0 -75
  169. package/dist/subscriptions-CC61I6Nj.js +0 -1
  170. package/dist/url-B6-3PkW2.js +0 -1
  171. package/dist/useIncrementalLoading-CuSndpP2.js +0 -1
  172. package/dist/useInvoicesList-CFk-_oVK.js +0 -1
  173. package/dist/useWalletBalanceItems-BL-R5foK.js +0 -1
  174. package/dist/useWalletBalanceItems-COQDLfoZ.mjs +0 -109
  175. package/dist/vendor-ui-C3Tq-qY_.js +0 -1
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../ApiStatus-oqvUEWJx.js"),o=require("../../ContentWithAsideLayout-DHpnJfGA.js"),r=require("../../useInvoicesList-CFk-_oVK.js"),s=require("../../usePortal-DVD7PcWI.js"),n=require("../../SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js"),a=require("../../useCustomer-Z24KchWC.js"),i=require("../../usePaymentMethods-AC-4rrR9.js"),u=require("../../BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js"),l=require("../../useLoadInitialData-CTqfiMTN.js"),c=require("../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js"),m=require("../../paymentMethods-DIbB759g.js"),d=require("../../useService-CHrkefKd.js"),v=require("../../useWalletBalanceItems-BL-R5foK.js"),p=require("../../component-Bs8oszfD.js");const y=e.defineComponent({__name:"CustomerOverview",props:{configuration:{type:Object}},setup(p){var y;const f=null==(y=s.usePortal().value)?void 0:y.customer_id,_=a.useCustomer({customerId:f}),g=r.useInvoicesList({customerId:f,batchSize:5}),h=n.useSubscriptionsList({customerId:f,batchSize:2}),b=i.usePaymentMethods({customerId:f}),j=function({customerId:e,amount:t}){const{getPaymentMethodOptions:o}=m.createPaymentMethodsService(),{data:r,execute:s,error:n,apiStatus:a,isPending:i}=d.useService({initialValue:[],service:async()=>(await o({customerId:e,amount:t})).flatMap(e=>e.options??[])});return{error:n,apiStatus:a,items:r,fetch:s,isPending:i}}({customerId:f}),C=v.useCustomerWalletBalances({customerId:f}),S=v.useWalletBalanceItems(C.walletBalances),{isLoading:w}=l.useLoadInitialData(_.get.execute(),g.fetchInitial(),h.fetchInitial(),b.fetchAll(),j.fetch(),C.fetch());return(s,a)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),{class:"sv-customer-overview sv-root sv-screen"},{header:e.withCtx(()=>[e.unref(_).customer.value?(e.openBlock(),e.createBlock(n._sfc_main,{key:0,class:"sv-customer-overview__subscriptions",customer:e.unref(_).customer.value,subscriptions:e.unref(h).items.value,"payment-methods":e.unref(b).items.value,"is-loading":e.unref(w),onLoadMore:e.unref(h).fetchMore},null,8,["customer","subscriptions","payment-methods","is-loading","onLoadMore"])):e.createCommentVNode("",!0)]),content:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"sv-customer-overview__invoices",invoices:e.unref(g).items.value,"has-more-items":e.unref(g).hasNextBatch.value,"is-loading":e.unref(w),onLoadMore:e.unref(g).fetchMore},null,8,["invoices","has-more-items","is-loading","onLoadMore"])]),aside:e.withCtx(()=>[e.createVNode(v._sfc_main,{class:"sv-customer-overview__wallet-balances","has-error":e.unref(C).apiStatus.value===e.unref(t.ApiStatus).Failed,"is-loading":e.unref(w),"wallet-balances":e.unref(S)},null,8,["has-error","is-loading","wallet-balances"]),e.createVNode(c._sfc_main,{class:"sv-customer-overview__payment-methods","is-loading":e.unref(w),"payment-methods":e.unref(b).items.value},null,8,["is-loading","payment-methods"]),e.unref(_).customer.value?(e.openBlock(),e.createBlock(u._sfc_main,{key:0,class:"sv-customer-overview__billing-information","is-loading":e.unref(w),customer:e.unref(_).customer.value},null,8,["is-loading","customer"])):e.createCommentVNode("",!0)]),_:1}))}}),f=e.defineComponent({__name:"CustomerOverview.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:t=>(o,r)=>{var s,n,a,i;return e.openBlock(),e.createBlock(p._sfc_main,{"custom-element-name":e.unref(g),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(n=null==(s=t.branding)?void 0:s.colors)?void 0:n.primary,"secondary-color":null==(i=null==(a=t.branding)?void 0:a.colors)?void 0:i.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,"css-overrides":t.cssOverrides,onError:r[0]||(r[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}),_=p.defineCustomElement(f),g=p.getComponentName("customer-overview");exports.COMPONENT_NAME=g,exports.SolvimonCustomerOverview=_,exports.defineSolvimonCustomerOverview=()=>{customElements.get(g)||customElements.define(g,_)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../ApiStatus-oqvUEWJx.js"),o=require("../../ContentWithAsideLayout-DHpnJfGA.js"),r=require("../../useInvoicesList-DmisMQzy.js"),s=require("../../usePortal-B954nyEB.js"),n=require("../../component-DIy1hvJM.js"),a=require("../../SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js"),i=require("../../useCustomer-C1XTqmrQ.js"),l=require("../../usePaymentMethods-CAFMvSOr.js"),u=require("../../BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js"),c=require("../../useLoadInitialData-_BjCD0Jc.js"),m=require("../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js"),p=require("../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js"),d=require("../../pricingPlanSchedule-B9HFiXy-.js"),v=e.defineComponent({__name:"CustomerOverview",props:{configuration:{type:Object}},setup(v){var _;const y=s.usePortal(),g=n.useLogger(),f=null==(_=y.value)?void 0:_.customer_id,h=i.useCustomer({customerId:f}),b=r.useInvoicesList({customerId:f,batchSize:5}),C=a.useSubscriptionsList({customerId:f}),w=l.usePaymentMethods({customerId:f}),S=p.useCustomerWalletBalances({customerId:f}),j=e.computed(()=>{var e;return(null==(e=S.walletBalances.value)?void 0:e.wallet_balances)??[]}),O=e.computed(()=>C.items.value.slice(0,2)),{isLoading:L}=c.useLoadInitialData(h.get.execute(),b.fetchInitial(),C.fetchAll(),w.fetchAll(),S.fetch()),A=()=>{w.fetchAll()},N=()=>{S.fetch()},q=e.computed(()=>d.getActiveDefaultScheduleId(C.items.value));return e.watch([q,()=>C.items.value],([e,t])=>{e||0===t.length||g.warn("ACTIVE_SCHEDULE_NOT_FOUND","No schedule is currently being billed",{schedules:t.flatMap(({pricing_plan_schedule_infos:e})=>(e??[]).map(({id:e,type:t,start_at:o,end_at:r,...s})=>{var n;return{id:e,type:(null==(n=s.pricing_plan_schedule)?void 0:n.type)??t,start_at:o,end_at:r}}))})}),(s,n)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),{class:"sv-customer-overview sv-root sv-screen"},{header:e.withCtx(()=>[e.unref(h).customer.value?(e.openBlock(),e.createBlock(a._sfc_main,{key:0,class:"sv-customer-overview__subscriptions",customer:e.unref(h).customer.value,subscriptions:O.value,"payment-methods":e.unref(w).items.value,"is-loading":e.unref(L)},null,8,["customer","subscriptions","payment-methods","is-loading"])):e.createCommentVNode("",!0)]),content:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"sv-customer-overview__invoices",invoices:e.unref(b).items.value,"has-more-items":e.unref(b).hasNextBatch.value,"is-loading":e.unref(L),onLoadMore:e.unref(b).fetchMore},null,8,["invoices","has-more-items","is-loading","onLoadMore"])]),aside:e.withCtx(()=>[e.createVNode(p._sfc_main,{class:"sv-customer-overview__wallet-balances","has-error":e.unref(S).apiStatus.value===e.unref(t.ApiStatus).Failed,"is-loading":e.unref(L),"wallet-balances":j.value,"show-top-up-button":"",customer:e.unref(h).customer.value,"payment-methods":e.unref(w).items.value,subscriptions:e.unref(C).items.value,onTopUpCharged:N,onAutoTopUpSaved:N,onAutoTopUpCancelled:N,onPaymentMethodStored:A},null,8,["has-error","is-loading","wallet-balances","customer","payment-methods","subscriptions"]),e.createVNode(m._sfc_main,{class:"sv-customer-overview__payment-methods","is-loading":e.unref(L),"payment-methods":e.unref(w).items.value},null,8,["is-loading","payment-methods"]),e.unref(h).customer.value?(e.openBlock(),e.createBlock(u._sfc_main,{key:0,class:"sv-customer-overview__billing-information","is-loading":e.unref(L),customer:e.unref(h).customer.value},null,8,["is-loading","customer"])):e.createCommentVNode("",!0)]),_:1}))}}),_=e.defineComponent({__name:"CustomerOverview.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:t=>(o,r)=>{var s,a,i,l;return e.openBlock(),e.createBlock(n._sfc_main,{"custom-element-name":e.unref(g),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(a=null==(s=t.branding)?void 0:s.colors)?void 0:a.primary,"secondary-color":null==(l=null==(i=t.branding)?void 0:i.colors)?void 0:l.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,"css-overrides":t.cssOverrides,onError:r[0]||(r[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(v)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}),y=n.defineCustomElement(_),g=n.getComponentName("customer-overview");exports.COMPONENT_NAME=g,exports.SolvimonCustomerOverview=y,exports.defineSolvimonCustomerOverview=()=>{customElements.get(g)||customElements.define(g,y)};
@@ -1,33 +1,18 @@
1
- import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createCommentVNode } from "vue";
1
+ import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createCommentVNode } from "vue";
2
2
  import { A as ApiStatus } from "../../ApiStatus-CyNDp_op.mjs";
3
3
  import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
4
- import { u as useInvoicesList, _ as _sfc_main$5 } from "../../useInvoicesList-z19cteaD.mjs";
5
- import { u as usePortal } from "../../usePortal-B1O1zgdV.mjs";
6
- import { u as useSubscriptionsList, _ as _sfc_main$6 } from "../../SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs";
7
- import { u as useCustomer } from "../../useCustomer-VVJi8z2w.mjs";
8
- import { u as usePaymentMethods } from "../../usePaymentMethods-ocHmNoP7.mjs";
9
- import { _ as _sfc_main$4 } from "../../BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs";
10
- import { u as useLoadInitialData } from "../../useLoadInitialData-CkpryfjF.mjs";
11
- import { _ as _sfc_main$3 } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs";
12
- import { c as createPaymentMethodsService } from "../../paymentMethods-DvqlWe96.mjs";
13
- import { u as useService } from "../../useService-DF57xuDd.mjs";
14
- import { u as useCustomerWalletBalances, a as useWalletBalanceItems, _ as _sfc_main$2 } from "../../useWalletBalanceItems-COQDLfoZ.mjs";
15
- import { _ as _sfc_main$7, d as defineCustomElement, g as getComponentName } from "../../component-Bg2JVC_O.mjs";
16
- function useCustomerPaymentMethodOptions({
17
- customerId,
18
- amount
19
- }) {
20
- const { getPaymentMethodOptions } = createPaymentMethodsService();
21
- const initialValue = [];
22
- const { data, execute, error, apiStatus, isPending } = useService({
23
- initialValue,
24
- service: async () => {
25
- const response = await getPaymentMethodOptions({ customerId, amount });
26
- return response.flatMap((entry) => entry.options ?? []);
27
- }
28
- });
29
- return { error, apiStatus, items: data, fetch: execute, isPending };
30
- }
4
+ import { u as useInvoicesList, _ as _sfc_main$5 } from "../../useInvoicesList-DMsZn1tE.mjs";
5
+ import { u as usePortal } from "../../usePortal-0NDlbFr9.mjs";
6
+ import { a as useLogger, _ as _sfc_main$7, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
7
+ import { u as useSubscriptionsList, _ as _sfc_main$6 } from "../../SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs";
8
+ import { u as useCustomer } from "../../useCustomer-Cw8LXT6S.mjs";
9
+ import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
10
+ import { _ as _sfc_main$4 } from "../../BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs";
11
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
12
+ import { _ as _sfc_main$3 } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs";
13
+ import { u as useCustomerWalletBalances, _ as _sfc_main$2 } from "../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs";
14
+ import { a as getActiveDefaultScheduleId } from "../../pricingPlanSchedule-CXG3CQ61.mjs";
15
+ const SUBSCRIPTIONS_SHOWN = 2;
31
16
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
32
17
  __name: "CustomerOverview",
33
18
  props: {
@@ -36,22 +21,52 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
36
21
  setup(__props) {
37
22
  var _a;
38
23
  const portal = usePortal();
24
+ const logger = useLogger();
39
25
  const customerId = (_a = portal.value) == null ? void 0 : _a.customer_id;
40
26
  const customer = useCustomer({ customerId });
41
27
  const invoices = useInvoicesList({ customerId, batchSize: 5 });
42
- const subscriptions = useSubscriptionsList({ customerId, batchSize: 2 });
28
+ const subscriptions = useSubscriptionsList({ customerId });
43
29
  const paymentMethods = usePaymentMethods({ customerId });
44
- const customerPaymentMethodOptions = useCustomerPaymentMethodOptions({ customerId });
45
30
  const customerWalletBalances = useCustomerWalletBalances({ customerId });
46
- const walletBalanceItems = useWalletBalanceItems(customerWalletBalances.walletBalances);
31
+ const walletBalanceItems = computed(
32
+ () => {
33
+ var _a2;
34
+ return ((_a2 = customerWalletBalances.walletBalances.value) == null ? void 0 : _a2.wallet_balances) ?? [];
35
+ }
36
+ );
37
+ const shownSubscriptions = computed(() => subscriptions.items.value.slice(0, SUBSCRIPTIONS_SHOWN));
47
38
  const { isLoading } = useLoadInitialData(
48
39
  customer.get.execute(),
49
40
  invoices.fetchInitial(),
50
- subscriptions.fetchInitial(),
41
+ subscriptions.fetchAll(),
51
42
  paymentMethods.fetchAll(),
52
- customerPaymentMethodOptions.fetch(),
53
43
  customerWalletBalances.fetch()
54
44
  );
45
+ const handlePaymentMethodStored = () => {
46
+ void paymentMethods.fetchAll();
47
+ };
48
+ const handleWalletBalancesChanged = () => {
49
+ void customerWalletBalances.fetch();
50
+ };
51
+ const activeScheduleId = computed(() => getActiveDefaultScheduleId(subscriptions.items.value));
52
+ watch([activeScheduleId, () => subscriptions.items.value], ([scheduleId, activeSubscriptions]) => {
53
+ if (scheduleId || activeSubscriptions.length === 0) {
54
+ return;
55
+ }
56
+ logger.warn("ACTIVE_SCHEDULE_NOT_FOUND", "No schedule is currently being billed", {
57
+ schedules: activeSubscriptions.flatMap(
58
+ ({ pricing_plan_schedule_infos }) => (pricing_plan_schedule_infos ?? []).map(({ id, type, start_at, end_at, ...info }) => {
59
+ var _a2;
60
+ return {
61
+ id,
62
+ type: ((_a2 = info.pricing_plan_schedule) == null ? void 0 : _a2.type) ?? type,
63
+ start_at,
64
+ end_at
65
+ };
66
+ })
67
+ )
68
+ });
69
+ });
55
70
  return (_ctx, _cache) => {
56
71
  return openBlock(), createBlock(unref(ContentWithAsideLayout), { class: "sv-customer-overview sv-root sv-screen" }, {
57
72
  header: withCtx(() => [
@@ -59,11 +74,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
59
74
  key: 0,
60
75
  class: "sv-customer-overview__subscriptions",
61
76
  customer: unref(customer).customer.value,
62
- subscriptions: unref(subscriptions).items.value,
77
+ subscriptions: shownSubscriptions.value,
63
78
  "payment-methods": unref(paymentMethods).items.value,
64
- "is-loading": unref(isLoading),
65
- onLoadMore: unref(subscriptions).fetchMore
66
- }, null, 8, ["customer", "subscriptions", "payment-methods", "is-loading", "onLoadMore"])) : createCommentVNode("", true)
79
+ "is-loading": unref(isLoading)
80
+ }, null, 8, ["customer", "subscriptions", "payment-methods", "is-loading"])) : createCommentVNode("", true)
67
81
  ]),
68
82
  content: withCtx(() => [
69
83
  createVNode(_sfc_main$5, {
@@ -79,8 +93,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
79
93
  class: "sv-customer-overview__wallet-balances",
80
94
  "has-error": unref(customerWalletBalances).apiStatus.value === unref(ApiStatus).Failed,
81
95
  "is-loading": unref(isLoading),
82
- "wallet-balances": unref(walletBalanceItems)
83
- }, null, 8, ["has-error", "is-loading", "wallet-balances"]),
96
+ "wallet-balances": walletBalanceItems.value,
97
+ "show-top-up-button": "",
98
+ customer: unref(customer).customer.value,
99
+ "payment-methods": unref(paymentMethods).items.value,
100
+ subscriptions: unref(subscriptions).items.value,
101
+ onTopUpCharged: handleWalletBalancesChanged,
102
+ onAutoTopUpSaved: handleWalletBalancesChanged,
103
+ onAutoTopUpCancelled: handleWalletBalancesChanged,
104
+ onPaymentMethodStored: handlePaymentMethodStored
105
+ }, null, 8, ["has-error", "is-loading", "wallet-balances", "customer", "payment-methods", "subscriptions"]),
84
106
  createVNode(_sfc_main$3, {
85
107
  class: "sv-customer-overview__payment-methods",
86
108
  "is-loading": unref(isLoading),
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-Bs8oszfD.js"),n=require("../../vendor-ui-C3Tq-qY_.js"),o=require("../../ContentWithAsideLayout-DHpnJfGA.js"),a=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js"),r=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),i=require("../../url-B6-3PkW2.js"),c=require("../../useLoadInitialData-CTqfiMTN.js"),l=require("../../usePayments-CgXZeWrU.js"),s=require("../../usePaymentMethodOptions-BsCZnCQW.js"),u=require("../../usePaymentMethods-AC-4rrR9.js"),p=e.defineComponent({__name:"PayButton",props:{amount:{type:Object},paymentMethod:{type:Object},type:{type:String},variant:{type:String},color:{type:String},size:{type:String},pill:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},iconPrefix:{type:null},iconSuffix:{type:null},tag:{type:String}},emits:["click"],setup(t){const o=t,{$t:a}=n.useIntl(),r=e.computed(()=>({color:o.color??"primary",disabled:o.disabled,iconPrefix:o.iconPrefix,iconSuffix:o.iconSuffix,loading:o.loading,pill:o.pill,size:o.size??"lg",square:o.square,tag:o.tag,type:o.type,variant:o.variant})),i=e.computed(()=>{var t,n,a;switch(null==(t=o.paymentMethod)?void 0:t.paymentMethodType){case"scheme":return"Credit Card";case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";case"ideal":return"iDeal";case"klarna":return"Klarna";case"bcmc":return"BCMC";case"sepadirectdebit":return"SEPA";case"twint":return"Twint";case"swish":return"Swish";case"vipps":return"Vipps";case"mbway":return"MBway";case"alipay":return"AliPay";case"wechatpayWeb":return"WeChatPay";case"afterpay_default":return"Afterpay";case"affirm":return"Affirm";case"ach":return"ACH";case"blik":return"Blik";case"cashapp":return"Cash App Pay";case"amazonpay":return"Amazon Pay";case"venmo":return"Venmo";case"clicktopay":return"Click to Pay";case"upi":return"UPI";case"revolutpay":return"Revolut Pay";case"ratepay":return"Ratepay";case"walley":return"Walley";case"alma":return"Alma";case"facilypay_3x":case"facilypay_4x":return"Oney";case"samsungpay":return"Samsung Pay";case"bizum":return"Bizum";case"pix":return"Pix";case"multibanco":return"Multibanco";case"openbanking_UK":return"Open Banking";default:return(null==(n=o.paymentMethod)?void 0:n.paymentMethodType)?e.capitalize(null==(a=o.paymentMethod)?void 0:a.paymentMethodType):""}}),c=e.computed(()=>o.amount&&o.paymentMethod?a({defaultMessage:"Pay {amount} with {type}",id:"pay_button.label.amount_and_payment_method",description:"The label for the pay button when both the amount and the payment method are known"},{amount:n.formatAmount(o.amount),type:i.value}):o.amount?a({defaultMessage:"Pay {amount}",id:"pay_button.label.amount_only",description:"The label for the pay button when only the amount is known"},{amount:n.formatAmount(o.amount),type:i.value}):a({defaultMessage:"Pay",id:"pay_button.label.default",description:"The default label for the pay button when no amount and payment method are known"}));return(t,o)=>(e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),e.mergeProps(r.value,{class:"w-full",onClick:o[0]||(o[0]=e=>t.$emit("click",e))}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1},16))}}),d={key:0},m=e.defineComponent({__name:"PayInvoice",props:{invoice:{type:Object},paymentMethodOptions:{type:Array},paymentAttempts:{default:()=>[],type:Array},countryCode:{type:String},amount:{type:Object},downloadService:{type:Function},configuration:{type:Object},isLoading:{type:Boolean},error:{type:null}},setup(t){const{$t:c}=n.useIntl(),l=t,s=e.ref(),u=e.ref(),m=e.ref(!1);function y(){if(!u.value)throw new Error("payment integration form not found");m.value=!0,u.value.submit()}const v=()=>{l.configuration.onPaymentSuccess&&l.configuration.onPaymentSuccess()},f=()=>{m.value=!1};return(l,g)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>[t.invoice&&t.downloadService?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$2),{key:0,invoice:t.invoice,"payment-attempts":t.paymentAttempts,"download-service":()=>t.downloadService(t.invoice.id)},null,8,["invoice","payment-attempts","download-service"])):e.createCommentVNode("",!0)]),_:1})]),content:e.withCtx(()=>{var o,l;return[t.isLoading?(e.openBlock(),e.createBlock(r._sfc_main,{key:0,variant:"section",class:"min-h-[300px]"})):e.createCommentVNode("",!0),(null==(o=t.invoice)?void 0:o.paid)?(e.openBlock(),e.createBlock(i._sfc_main,{key:1,status:"success",title:e.unref(c)({id:"pay_invoice.paid.title",defaultMessage:"Thank you for your payment!",description:"Title shown when the invoice has already been paid"}),class:"mt-8"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$3),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$14),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(n.formatAmount)(t.invoice.tax_summary.total_amount)),1)]),_:1})]),_:1},8,["title"])):t.error?(e.openBlock(),e.createBlock(i._sfc_main,{key:2,status:"error",title:e.unref(c)({id:"pay_invoice.error.title",defaultMessage:"Something went wrong",description:"Title shown when the invoice payment fails to load"})},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$3),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({id:"pay_invoice.error.description",defaultMessage:"Please try again or contact support.",description:"Body text shown when the invoice payment fails to load"})),1)]),_:1})]),_:1},8,["title"])):!t.isLoading&&t.countryCode&&t.amount&&t.invoice?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[(null==(l=t.paymentMethodOptions)?void 0:l.length)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main),{key:0,title:e.unref(c)({id:"pay_invoice.payment_methods.title",defaultMessage:"Payment methods",description:"Section title for the payment method selector on the pay invoice screen"}),"content-background":"none","no-border":"","no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":m.value})},[e.createVNode(a._sfc_main,{ref_key:"paymentIntegrationFormRef",ref:u,amount:t.amount,"country-code":t.countryCode,context:{type:"INVOICE",related_resource_ids:[{type:"INVOICE",id:t.invoice.id}]},"customer-id":t.invoice.customer.id,"force-store-payment-method":"","invoice-id":t.invoice.id,"payment-method-options":t.paymentMethodOptions,variant:"AUTHORIZE",onPaymentSuccess:v,onPaymentFailed:f,onSelect:g[0]||(g[0]=e=>s.value=e)},null,8,["amount","country-code","context","customer-id","invoice-id","payment-method-options"])],2)]),_:1},8,["title"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]}),aside:e.withCtx(()=>[e.createVNode(r._sfc_main,{variant:"section",class:"min-h-[200px]"},{default:e.withCtx(()=>[t.invoice?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$15),{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0)]),_:1}),t.invoice?(e.openBlock(),e.createElementBlock("div",d,[e.createVNode(p,{disabled:!s.value||m.value,loading:m.value,amount:t.amount,"payment-method":s.value,onClick:y},null,8,["disabled","loading","amount","payment-method"])])):e.createCommentVNode("",!0)]),_:1}))}}),y=e.defineComponent({__name:"PayInvoice.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,{invoice:a,get:r,downloadInvoicePdf:i}=l.useInvoice({invoiceId:o.configuration.invoiceId}),{payments:p,get:d}=l.usePayments(),{fetchInitial:m}=u.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:y,get:v}=s.usePaymentMethodOptions(),{isLoading:f}=c.useLoadInitialData((async()=>{const e=await r();await v({customerId:e.customer.id,amount:e.open_invoice_amount})})(),m(),d(o.configuration.invoiceId)),g=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.customer)?n.getCustomerCountry(a.value.customer):void 0});return(t,n)=>{var o;return e.renderSlot(t.$slots,"default",{invoice:e.unref(a),isLoading:e.unref(f),amount:null==(o=e.unref(a))?void 0:o.open_invoice_amount,countryCode:g.value,paymentMethodOptions:e.unref(y),paymentAttempts:e.unref(p),downloadService:e.unref(i)})}}}),v=e.defineComponent({__name:"PayInvoice.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:n=>(o,a)=>{var r,i,c,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(g),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(i=null==(r=n.branding)?void 0:r.colors)?void 0:i.primary,"secondary-color":null==(l=null==(c=n.branding)?void 0:c.colors)?void 0:l.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,onError:a[0]||(a[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:t,isLoading:o,amount:a,countryCode:r,paymentMethodOptions:i,paymentAttempts:c,downloadService:l})=>[e.createVNode(m,{"is-loading":o,invoice:t,amount:a,"country-code":r,"payment-method-options":i,configuration:n.configuration,"payment-attempts":c??[],"download-service":l},null,8,["is-loading","invoice","amount","country-code","payment-method-options","configuration","payment-attempts","download-service"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),f=t.defineCustomElement(v),g=t.getComponentName("pay-invoice");exports.COMPONENT_NAME=g,exports.SolvimonPayInvoice=f,exports.defineSolvimonPayInvoice=()=>{customElements.get(g)||customElements.define(g,f)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-DIy1hvJM.js"),n=require("../../vendor-ui-Dfh3_g4q.js"),o=require("../../ContentWithAsideLayout-DHpnJfGA.js"),a=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js"),r=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),i=require("../../PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js"),c=require("../../useLoadInitialData-_BjCD0Jc.js"),l=require("../../usePayments-BieVBaz-.js"),s=require("../../usePaymentMethodOptions-xeSTmaVo.js"),u=require("../../usePaymentMethods-CAFMvSOr.js"),p=e.defineComponent({__name:"PayButton",props:{amount:{type:Object},paymentMethod:{type:Object},type:{type:String},variant:{type:String},color:{type:String},size:{type:String},pill:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},iconPrefix:{type:null},iconSuffix:{type:null},tag:{type:String},preventDoubleClick:{type:Boolean}},emits:["click"],setup(t){const o=t,{$t:a}=n.useIntl(),r=e.computed(()=>({color:o.color??"primary",disabled:o.disabled,iconPrefix:o.iconPrefix,iconSuffix:o.iconSuffix,loading:o.loading,pill:o.pill,size:o.size??"lg",square:o.square,tag:o.tag,type:o.type,variant:o.variant})),i=e.computed(()=>{var t,n,a;switch(null==(t=o.paymentMethod)?void 0:t.paymentMethodType){case"scheme":return"Credit Card";case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";case"ideal":return"iDeal";case"klarna":return"Klarna";case"bcmc":return"BCMC";case"sepadirectdebit":return"SEPA";case"twint":return"Twint";case"swish":return"Swish";case"vipps":return"Vipps";case"mbway":return"MBway";case"alipay":return"AliPay";case"wechatpayWeb":return"WeChatPay";case"afterpay_default":return"Afterpay";case"affirm":return"Affirm";case"ach":return"ACH";case"blik":return"Blik";case"cashapp":return"Cash App Pay";case"amazonpay":return"Amazon Pay";case"venmo":return"Venmo";case"clicktopay":return"Click to Pay";case"upi":return"UPI";case"revolutpay":return"Revolut Pay";case"ratepay":return"Ratepay";case"walley":return"Walley";case"alma":return"Alma";case"facilypay_3x":case"facilypay_4x":return"Oney";case"samsungpay":return"Samsung Pay";case"bizum":return"Bizum";case"pix":return"Pix";case"multibanco":return"Multibanco";case"openbanking_UK":return"Open Banking";default:return(null==(n=o.paymentMethod)?void 0:n.paymentMethodType)?e.capitalize(null==(a=o.paymentMethod)?void 0:a.paymentMethodType):""}}),c=e.computed(()=>o.amount&&o.paymentMethod?a({defaultMessage:"Pay {amount} with {type}",id:"pay_button.label.amount_and_payment_method",description:"The label for the pay button when both the amount and the payment method are known"},{amount:n.formatAmount(o.amount),type:i.value}):o.amount?a({defaultMessage:"Pay {amount}",id:"pay_button.label.amount_only",description:"The label for the pay button when only the amount is known"},{amount:n.formatAmount(o.amount),type:i.value}):a({defaultMessage:"Pay",id:"pay_button.label.default",description:"The default label for the pay button when no amount and payment method are known"}));return(t,o)=>(e.openBlock(),e.createBlock(e.unref(n._sfc_main$6),e.mergeProps(r.value,{class:"w-full",onClick:o[0]||(o[0]=e=>t.$emit("click",e))}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1},16))}}),d={key:0},m=e.defineComponent({__name:"PayInvoice",props:{invoice:{type:Object},paymentMethodOptions:{type:Array},paymentAttempts:{default:()=>[],type:Array},countryCode:{type:String},amount:{type:Object},downloadService:{type:Function},configuration:{type:Object},isLoading:{type:Boolean},error:{type:null}},setup(t){const{$t:c}=n.useIntl(),l=t,s=e.ref(),u=e.ref(),m=e.ref(!1);function y(){if(!u.value)throw new Error("payment integration form not found");m.value=!0,u.value.submit()}const v=()=>{l.configuration.onPaymentSuccess&&l.configuration.onPaymentSuccess()},f=()=>{m.value=!1};return(l,g)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>[t.invoice&&t.downloadService?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$4),{key:0,invoice:t.invoice,"payment-attempts":t.paymentAttempts,"download-service":()=>t.downloadService(t.invoice.id)},null,8,["invoice","payment-attempts","download-service"])):e.createCommentVNode("",!0)]),_:1})]),content:e.withCtx(()=>{var o,l;return[t.isLoading?(e.openBlock(),e.createBlock(r._sfc_main,{key:0,variant:"section",class:"min-h-[300px]"})):e.createCommentVNode("",!0),(null==(o=t.invoice)?void 0:o.paid)?(e.openBlock(),e.createBlock(i._sfc_main,{key:1,status:"success",title:e.unref(c)({id:"pay_invoice.paid.title",defaultMessage:"Thank you for your payment!",description:"Title shown when the invoice has already been paid"}),class:"mt-8"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$1),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$3),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(n.formatAmount)(t.invoice.tax_summary.total_amount)),1)]),_:1})]),_:1},8,["title"])):t.error?(e.openBlock(),e.createBlock(i._sfc_main,{key:2,status:"error",title:e.unref(c)({id:"pay_invoice.error.title",defaultMessage:"Something went wrong",description:"Title shown when the invoice payment fails to load"})},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$1),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({id:"pay_invoice.error.description",defaultMessage:"Please try again or contact support.",description:"Body text shown when the invoice payment fails to load"})),1)]),_:1})]),_:1},8,["title"])):!t.isLoading&&t.countryCode&&t.amount&&t.invoice?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[(null==(l=t.paymentMethodOptions)?void 0:l.length)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$2),{key:0,title:e.unref(c)({id:"pay_invoice.payment_methods.title",defaultMessage:"Payment methods",description:"Section title for the payment method selector on the pay invoice screen"}),"content-background":"none","no-border":"","no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":m.value})},[e.createVNode(a._sfc_main,{ref_key:"paymentIntegrationFormRef",ref:u,amount:t.amount,"country-code":t.countryCode,context:{type:"INVOICE",related_resource_ids:[{type:"INVOICE",id:t.invoice.id}]},"customer-id":t.invoice.customer.id,"force-store-payment-method":"","invoice-id":t.invoice.id,"payment-method-options":t.paymentMethodOptions,variant:"AUTHORIZE",onPaymentSuccess:v,onPaymentFailed:f,onSelect:g[0]||(g[0]=e=>s.value=e)},null,8,["amount","country-code","context","customer-id","invoice-id","payment-method-options"])],2)]),_:1},8,["title"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]}),aside:e.withCtx(()=>[e.createVNode(r._sfc_main,{variant:"section",class:"min-h-[200px]"},{default:e.withCtx(()=>[t.invoice?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$17),{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0)]),_:1}),t.invoice?(e.openBlock(),e.createElementBlock("div",d,[e.createVNode(p,{disabled:!s.value||m.value,loading:m.value,amount:t.amount,"payment-method":s.value,onClick:y},null,8,["disabled","loading","amount","payment-method"])])):e.createCommentVNode("",!0)]),_:1}))}}),y=e.defineComponent({__name:"PayInvoice.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,{invoice:a,get:r,downloadInvoicePdf:i}=l.useInvoice({invoiceId:o.configuration.invoiceId}),{payments:p,get:d}=l.usePayments(),{fetchInitial:m}=u.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:y,get:v}=s.usePaymentMethodOptions(),{isLoading:f}=c.useLoadInitialData((async()=>{const e=await r();await v({customerId:e.customer.id,amount:e.open_invoice_amount})})(),m(),d(o.configuration.invoiceId)),g=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.customer)?n.getCustomerCountry(a.value.customer):void 0});return(t,n)=>{var o;return e.renderSlot(t.$slots,"default",{invoice:e.unref(a),isLoading:e.unref(f),amount:null==(o=e.unref(a))?void 0:o.open_invoice_amount,countryCode:g.value,paymentMethodOptions:e.unref(y),paymentAttempts:e.unref(p),downloadService:e.unref(i)})}}}),v=e.defineComponent({__name:"PayInvoice.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:n=>(o,a)=>{var r,i,c,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(g),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(i=null==(r=n.branding)?void 0:r.colors)?void 0:i.primary,"secondary-color":null==(l=null==(c=n.branding)?void 0:c.colors)?void 0:l.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,onError:a[0]||(a[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:t,isLoading:o,amount:a,countryCode:r,paymentMethodOptions:i,paymentAttempts:c,downloadService:l})=>[e.createVNode(m,{"is-loading":o,invoice:t,amount:a,"country-code":r,"payment-method-options":i,configuration:n.configuration,"payment-attempts":c??[],"download-service":l},null,8,["is-loading","invoice","amount","country-code","payment-method-options","configuration","payment-attempts","download-service"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),f=t.defineCustomElement(v),g=t.getComponentName("pay-invoice");exports.COMPONENT_NAME=g,exports.SolvimonPayInvoice=f,exports.defineSolvimonPayInvoice=()=>{customElements.get(g)||customElements.define(g,f)};
@@ -1,14 +1,14 @@
1
1
  import { defineComponent, computed, capitalize, openBlock, createBlock, unref, mergeProps, withCtx, createTextVNode, toDisplayString, ref, createVNode, createCommentVNode, createElementBlock, Fragment, createElementVNode, normalizeClass, renderSlot, normalizeProps, guardReactiveProps } from "vue";
2
- import { _ as _sfc_main$d, d as defineCustomElement, g as getComponentName } from "../../component-Bg2JVC_O.mjs";
3
- import { u as useIntl, B as formatAmount, c as _sfc_main$4, C as _sfc_main$6, e as _sfc_main$8, A as _sfc_main$9, _ as _sfc_main$a, d as _sfc_main$c, g as getCustomerCountry } from "../../vendor-ui-B8IlviSs.mjs";
2
+ import { _ as _sfc_main$d, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
3
+ import { u as useIntl, E as formatAmount, k as _sfc_main$4, F as _sfc_main$6, a as _sfc_main$8, c as _sfc_main$9, b as _sfc_main$a, e as _sfc_main$c, o as getCustomerCountry } from "../../vendor-ui-ItGf7wJV.mjs";
4
4
  import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
5
- import { _ as _sfc_main$b } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs";
5
+ import { _ as _sfc_main$b } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs";
6
6
  import { _ as _sfc_main$5 } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
7
- import { _ as _sfc_main$7 } from "../../url-1Lbg5Yni.mjs";
8
- import { u as useLoadInitialData } from "../../useLoadInitialData-CkpryfjF.mjs";
9
- import { u as useInvoice, a as usePayments } from "../../usePayments-D85eB5l4.mjs";
10
- import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-BoGHJjng.mjs";
11
- import { u as usePaymentMethods } from "../../usePaymentMethods-ocHmNoP7.mjs";
7
+ import { _ as _sfc_main$7 } from "../../PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs";
8
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
9
+ import { u as useInvoice, a as usePayments } from "../../usePayments-D88XSZfS.mjs";
10
+ import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-CWfGvW0U.mjs";
11
+ import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
12
12
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
13
13
  __name: "PayButton",
14
14
  props: {
@@ -24,7 +24,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24
24
  disabled: { type: Boolean },
25
25
  iconPrefix: { type: null },
26
26
  iconSuffix: { type: null },
27
- tag: { type: String }
27
+ tag: { type: String },
28
+ preventDoubleClick: { type: Boolean }
28
29
  },
29
30
  emits: ["click"],
30
31
  setup(__props) {
@@ -224,7 +225,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
224
225
  ((_a = __props.invoice) == null ? void 0 : _a.paid) ? (openBlock(), createBlock(_sfc_main$7, {
225
226
  key: 1,
226
227
  status: "success",
227
- title: unref($t)({ id: "pay_invoice.paid.title", defaultMessage: "Thank you for your payment!", description: "Title shown when the invoice has already been paid" }),
228
+ title: unref($t)({
229
+ id: "pay_invoice.paid.title",
230
+ defaultMessage: "Thank you for your payment!",
231
+ description: "Title shown when the invoice has already been paid"
232
+ }),
228
233
  class: "mt-8"
229
234
  }, {
230
235
  default: withCtx(() => [
@@ -243,7 +248,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
243
248
  }, 8, ["title"])) : __props.error ? (openBlock(), createBlock(_sfc_main$7, {
244
249
  key: 2,
245
250
  status: "error",
246
- title: unref($t)({ id: "pay_invoice.error.title", defaultMessage: "Something went wrong", description: "Title shown when the invoice payment fails to load" })
251
+ title: unref($t)({
252
+ id: "pay_invoice.error.title",
253
+ defaultMessage: "Something went wrong",
254
+ description: "Title shown when the invoice payment fails to load"
255
+ })
247
256
  }, {
248
257
  default: withCtx(() => [
249
258
  createVNode(unref(_sfc_main$8), {
@@ -251,7 +260,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
251
260
  class: "mt-1"
252
261
  }, {
253
262
  default: withCtx(() => [
254
- createTextVNode(toDisplayString(unref($t)({ id: "pay_invoice.error.description", defaultMessage: "Please try again or contact support.", description: "Body text shown when the invoice payment fails to load" })), 1)
263
+ createTextVNode(toDisplayString(unref($t)({
264
+ id: "pay_invoice.error.description",
265
+ defaultMessage: "Please try again or contact support.",
266
+ description: "Body text shown when the invoice payment fails to load"
267
+ })), 1)
255
268
  ]),
256
269
  _: 1
257
270
  })
@@ -260,7 +273,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
260
273
  }, 8, ["title"])) : !__props.isLoading && __props.countryCode && __props.amount && __props.invoice ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
261
274
  ((_b = __props.paymentMethodOptions) == null ? void 0 : _b.length) ? (openBlock(), createBlock(unref(_sfc_main$a), {
262
275
  key: 0,
263
- title: unref($t)({ id: "pay_invoice.payment_methods.title", defaultMessage: "Payment methods", description: "Section title for the payment method selector on the pay invoice screen" }),
276
+ title: unref($t)({
277
+ id: "pay_invoice.payment_methods.title",
278
+ defaultMessage: "Payment methods",
279
+ description: "Section title for the payment method selector on the pay invoice screen"
280
+ }),
264
281
  "content-background": "none",
265
282
  "no-border": "",
266
283
  "no-spacing": ""
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-Bs8oszfD.js"),o=require("../../vendor-ui-C3Tq-qY_.js"),n=require("../../ContentWithAsideLayout-DHpnJfGA.js"),r=require("../../PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js"),a=require("../../PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js"),s=require("../../useCustomer-Z24KchWC.js"),i=require("../../usePaymentMethods-AC-4rrR9.js"),l=require("../../usePaymentMethodOptions-BsCZnCQW.js"),m=require("../../useLoadInitialData-CTqfiMTN.js"),p={class:"grid gap-4 sm:grid-cols-1 md:grid-cols-2"},d={key:0},c=e.defineComponent({__name:"ScreenTitle",props:{title:{type:String},description:{type:String}},setup:t=>(n,r)=>(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("div",null,[e.createVNode(e.unref(o._sfc_main$3),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1}),t.description?(e.openBlock(),e.createBlock(e.unref(o._sfc_main$3),{key:0,variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.description),1)]),_:1})):e.createCommentVNode("",!0)]),n.$slots.right?(e.openBlock(),e.createElementBlock("div",d,[e.renderSlot(n.$slots,"right")])):e.createCommentVNode("",!0)]))}),u=e.defineComponent({__name:"PaymentMethodsManagement",props:{customer:{type:Object},paymentMethods:{type:Array},paymentMethodOptions:{type:Array},isLoading:{type:Boolean},error:{type:null}},emits:["set-default"],setup(t,{emit:s}){const i=s,{$t:l}=o.useIntl(),m=e.ref(!1);return(s,p)=>(e.openBlock(),e.createBlock(e.unref(n.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(c,{title:e.unref(l)({defaultMessage:"Payment methods",id:"screens.payment_method_management.title",description:"The title for the payment method management screen "}),description:e.unref(l)({defaultMessage:"Add a new payment method or set a default payment method for your payments.",id:"screens.payment_method_management.description",description:"The descriptive text for the payment method management screen"})},null,8,["title","description"])]),content:e.withCtx(()=>[e.createVNode(e.unref(o._sfc_main),{"no-border":"","no-spacing":"","content-background":"none",title:"Your payment methods"},{default:e.withCtx(()=>[e.createVNode(r._sfc_main,{"payment-methods":t.paymentMethods,onSetDefault:p[0]||(p[0]=e=>i("set-default"))},null,8,["payment-methods"])]),_:1}),m.value?(e.openBlock(),e.createBlock(a._sfc_main,{key:0,customer:t.customer,"payment-method-options":t.paymentMethodOptions},null,8,["customer","payment-method-options"])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createBlock(e.unref(o._sfc_main$1),{key:1,color:"gray",variant:"outline",onClick:p[1]||(p[1]=e=>m.value=!1)},{default:e.withCtx(()=>[...p[3]||(p[3]=[e.createTextVNode("Cancel",-1)])]),_:1})):(e.openBlock(),e.createBlock(e.unref(o._sfc_main$1),{key:2,color:"gray",variant:"outline",onClick:p[2]||(p[2]=e=>m.value=!0)},{default:e.withCtx(()=>[...p[4]||(p[4]=[e.createTextVNode("Add payment method",-1)])]),_:1}))]),_:1}))}}),y=e.defineComponent({__name:"PaymentMethodsManagement.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup(t){const o=t,n=o.portalObject.customer_id,{customer:r,get:a}=s.useCustomer({customerId:n}),{items:p,fetchInitial:d}=i.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:c,get:u}=l.usePaymentMethodOptions(),{isLoading:y}=m.useLoadInitialData(a.execute(),d(),u({customerId:o.portalObject.customer_id}));return(t,o)=>e.renderSlot(t.$slots,"default",{customer:e.unref(r),paymentMethods:e.unref(p),paymentMethodOptions:e.unref(c),isLoading:e.unref(y),refreshPaymentMethods:e.unref(d)})}}),g=e.defineComponent({__name:"PaymentMethodsManagement.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup:o=>(n,r)=>{var a,s,i,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(f),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(a=o.branding)?void 0:a.colors)?void 0:s.primary,"secondary-color":null==(l=null==(i=o.branding)?void 0:i.colors)?void 0:l.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,onError:r[0]||(r[0]=e=>n.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(n.$props)),{default:e.withCtx(({customer:t,paymentMethods:o,paymentMethodOptions:n,isLoading:r,refreshPaymentMethods:a})=>[t?(e.openBlock(),e.createBlock(u,{key:0,"is-loading":r,"payment-methods":o,"payment-method-options":n,customer:t,onSetDefault:a},null,8,["is-loading","payment-methods","payment-method-options","customer","onSetDefault"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),h=t.defineCustomElement(g),f=t.getComponentName("payment-methods-management");exports.COMPONENT_NAME=f,exports.SolvimonPaymentMethodsManagement=h,exports.defineSolvimonPaymentMethodsManagement=()=>{customElements.get(f)||customElements.define(f,h)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-DIy1hvJM.js"),o=require("../../vendor-ui-Dfh3_g4q.js"),n=require("../../ContentWithAsideLayout-DHpnJfGA.js"),r=require("../../PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js"),a=require("../../PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js"),s=require("../../useCustomer-C1XTqmrQ.js"),i=require("../../usePaymentMethods-CAFMvSOr.js"),l=require("../../usePaymentMethodOptions-xeSTmaVo.js"),m=require("../../useLoadInitialData-_BjCD0Jc.js"),p={class:"grid gap-4 sm:grid-cols-1 md:grid-cols-2"},d={key:0},c=e.defineComponent({__name:"ScreenTitle",props:{title:{type:String},description:{type:String}},setup:t=>(n,r)=>(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("div",null,[e.createVNode(e.unref(o._sfc_main$1),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1}),t.description?(e.openBlock(),e.createBlock(e.unref(o._sfc_main$1),{key:0,variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.description),1)]),_:1})):e.createCommentVNode("",!0)]),n.$slots.right?(e.openBlock(),e.createElementBlock("div",d,[e.renderSlot(n.$slots,"right")])):e.createCommentVNode("",!0)]))}),u=e.defineComponent({__name:"PaymentMethodsManagement",props:{customer:{type:Object},paymentMethods:{type:Array},paymentMethodOptions:{type:Array},isLoading:{type:Boolean},error:{type:null}},emits:["set-default","delete"],setup(t,{emit:s}){const i=s,{$t:l}=o.useIntl(),m=e.ref(!1);return(s,p)=>(e.openBlock(),e.createBlock(e.unref(n.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(c,{title:e.unref(l)({defaultMessage:"Payment methods",id:"screens.payment_method_management.title",description:"The title for the payment method management screen "}),description:e.unref(l)({defaultMessage:"Add a new payment method or set a default payment method for your payments.",id:"screens.payment_method_management.description",description:"The descriptive text for the payment method management screen"})},null,8,["title","description"])]),content:e.withCtx(()=>[e.createVNode(e.unref(o._sfc_main$2),{"no-border":"","no-spacing":"","content-background":"none",title:"Your payment methods"},{default:e.withCtx(()=>[e.createVNode(r._sfc_main,{"payment-methods":t.paymentMethods,onSetDefault:p[0]||(p[0]=e=>i("set-default")),onDelete:p[1]||(p[1]=e=>i("delete"))},null,8,["payment-methods"])]),_:1}),m.value?(e.openBlock(),e.createBlock(a._sfc_main,{key:0,customer:t.customer,"payment-method-options":t.paymentMethodOptions},null,8,["customer","payment-method-options"])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createBlock(e.unref(o._sfc_main$6),{key:1,color:"gray",variant:"outline",onClick:p[2]||(p[2]=e=>m.value=!1)},{default:e.withCtx(()=>[...p[4]||(p[4]=[e.createTextVNode("Cancel",-1)])]),_:1})):(e.openBlock(),e.createBlock(e.unref(o._sfc_main$6),{key:2,color:"gray",variant:"outline",onClick:p[3]||(p[3]=e=>m.value=!0)},{default:e.withCtx(()=>[...p[5]||(p[5]=[e.createTextVNode("Add payment method",-1)])]),_:1}))]),_:1}))}}),y=e.defineComponent({__name:"PaymentMethodsManagement.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup(t){const o=t,n=o.portalObject.customer_id,{customer:r,get:a}=s.useCustomer({customerId:n}),{items:p,fetchInitial:d}=i.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:c,get:u}=l.usePaymentMethodOptions(),{isLoading:y}=m.useLoadInitialData(a.execute(),d(),u({customerId:o.portalObject.customer_id}));return(t,o)=>e.renderSlot(t.$slots,"default",{customer:e.unref(r),paymentMethods:e.unref(p),paymentMethodOptions:e.unref(c),isLoading:e.unref(y),refreshPaymentMethods:e.unref(d)})}}),g=e.defineComponent({__name:"PaymentMethodsManagement.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup:o=>(n,r)=>{var a,s,i,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(f),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(a=o.branding)?void 0:a.colors)?void 0:s.primary,"secondary-color":null==(l=null==(i=o.branding)?void 0:i.colors)?void 0:l.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,onError:r[0]||(r[0]=e=>n.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(n.$props)),{default:e.withCtx(({customer:t,paymentMethods:o,paymentMethodOptions:n,isLoading:r,refreshPaymentMethods:a})=>[t?(e.openBlock(),e.createBlock(u,{key:0,"is-loading":r,"payment-methods":o,"payment-method-options":n,customer:t,onSetDefault:a,onDelete:a},null,8,["is-loading","payment-methods","payment-method-options","customer","onSetDefault","onDelete"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),h=t.defineCustomElement(g),f=t.getComponentName("payment-methods-management");exports.COMPONENT_NAME=f,exports.SolvimonPaymentMethodsManagement=h,exports.defineSolvimonPaymentMethodsManagement=()=>{customElements.get(f)||customElements.define(f,h)};
@@ -1,13 +1,13 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, createTextVNode, toDisplayString, createBlock, createCommentVNode, renderSlot, ref, normalizeProps, guardReactiveProps } from "vue";
2
- import { _ as _sfc_main$9, d as defineCustomElement, g as getComponentName } from "../../component-Bg2JVC_O.mjs";
3
- import { e as _sfc_main$4, u as useIntl, _ as _sfc_main$5, c as _sfc_main$8 } from "../../vendor-ui-B8IlviSs.mjs";
2
+ import { _ as _sfc_main$9, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
3
+ import { a as _sfc_main$4, u as useIntl, b as _sfc_main$5, k as _sfc_main$8 } from "../../vendor-ui-ItGf7wJV.mjs";
4
4
  import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
5
- import { _ as _sfc_main$6 } from "../../PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs";
6
- import { _ as _sfc_main$7 } from "../../PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs";
7
- import { u as useCustomer } from "../../useCustomer-VVJi8z2w.mjs";
8
- import { u as usePaymentMethods } from "../../usePaymentMethods-ocHmNoP7.mjs";
9
- import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-BoGHJjng.mjs";
10
- import { u as useLoadInitialData } from "../../useLoadInitialData-CkpryfjF.mjs";
5
+ import { _ as _sfc_main$6 } from "../../PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs";
6
+ import { _ as _sfc_main$7 } from "../../PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs";
7
+ import { u as useCustomer } from "../../useCustomer-Cw8LXT6S.mjs";
8
+ import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
9
+ import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-CWfGvW0U.mjs";
10
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
11
11
  const _hoisted_1 = { class: "grid gap-4 sm:grid-cols-1 md:grid-cols-2" };
12
12
  const _hoisted_2 = { key: 0 };
13
13
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
@@ -53,7 +53,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
53
53
  isLoading: { type: Boolean },
54
54
  error: { type: null }
55
55
  },
56
- emits: ["set-default"],
56
+ emits: ["set-default", "delete"],
57
57
  setup(__props, { emit: __emit }) {
58
58
  const emit = __emit;
59
59
  const { $t } = useIntl();
@@ -84,7 +84,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
84
84
  default: withCtx(() => [
85
85
  createVNode(_sfc_main$6, {
86
86
  "payment-methods": __props.paymentMethods,
87
- onSetDefault: _cache[0] || (_cache[0] = ($event) => emit("set-default"))
87
+ onSetDefault: _cache[0] || (_cache[0] = ($event) => emit("set-default")),
88
+ onDelete: _cache[1] || (_cache[1] = ($event) => emit("delete"))
88
89
  }, null, 8, ["payment-methods"])
89
90
  ]),
90
91
  _: 1
@@ -98,9 +99,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
98
99
  key: 1,
99
100
  color: "gray",
100
101
  variant: "outline",
101
- onClick: _cache[1] || (_cache[1] = ($event) => showPaymentMethodForm.value = false)
102
+ onClick: _cache[2] || (_cache[2] = ($event) => showPaymentMethodForm.value = false)
102
103
  }, {
103
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
104
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
104
105
  createTextVNode("Cancel", -1)
105
106
  ])]),
106
107
  _: 1
@@ -108,9 +109,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
108
109
  key: 2,
109
110
  color: "gray",
110
111
  variant: "outline",
111
- onClick: _cache[2] || (_cache[2] = ($event) => showPaymentMethodForm.value = true)
112
+ onClick: _cache[3] || (_cache[3] = ($event) => showPaymentMethodForm.value = true)
112
113
  }, {
113
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
114
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [
114
115
  createTextVNode("Add payment method", -1)
115
116
  ])]),
116
117
  _: 1
@@ -199,15 +200,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
199
200
  }, {
200
201
  default: withCtx(() => [
201
202
  createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
202
- default: withCtx(({ customer, paymentMethods, paymentMethodOptions, isLoading, refreshPaymentMethods }) => [
203
+ default: withCtx(({
204
+ customer,
205
+ paymentMethods,
206
+ paymentMethodOptions,
207
+ isLoading,
208
+ refreshPaymentMethods
209
+ }) => [
203
210
  customer ? (openBlock(), createBlock(_sfc_main$2, {
204
211
  key: 0,
205
212
  "is-loading": isLoading,
206
213
  "payment-methods": paymentMethods,
207
214
  "payment-method-options": paymentMethodOptions,
208
215
  customer,
209
- onSetDefault: refreshPaymentMethods
210
- }, null, 8, ["is-loading", "payment-methods", "payment-method-options", "customer", "onSetDefault"])) : createCommentVNode("", true)
216
+ onSetDefault: refreshPaymentMethods,
217
+ onDelete: refreshPaymentMethods
218
+ }, null, 8, ["is-loading", "payment-methods", "payment-method-options", "customer", "onSetDefault", "onDelete"])) : createCommentVNode("", true)
211
219
  ]),
212
220
  _: 1
213
221
  }, 16)
@@ -217,7 +225,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
217
225
  };
218
226
  }
219
227
  });
220
- const SolvimonPaymentMethodsManagement = defineCustomElement(_sfc_main);
228
+ const SolvimonPaymentMethodsManagement = defineCustomElement(
229
+ _sfc_main
230
+ );
221
231
  const COMPONENT_NAME = getComponentName("payment-methods-management");
222
232
  const defineSolvimonPaymentMethodsManagement = () => {
223
233
  if (!customElements.get(COMPONENT_NAME)) {
@@ -0,0 +1,3 @@
1
+ export declare const SolvimonSubscriptionDetails: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
2
+ export declare const COMPONENT_NAME: string;
3
+ export declare const defineSolvimonSubscriptionDetails: () => void;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-DIy1hvJM.js"),n=require("../../vendor-ui-Dfh3_g4q.js"),a=require("../../ContentWithAsideLayout-DHpnJfGA.js"),i=require("../../useActionDispatchProvider-aJOy3kr1.js"),o=require("../../subscription-b0OPx8Du.js"),s=require("../../SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js"),r=require("../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js"),l=require("../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js"),c=require("../../EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js"),u=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),d=require("../../pricing-CuYndX6t.js"),p=require("../../subscriptions-BFCKVHnP.js"),m=require("../../SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js"),b=require("../../paymentMethods-DVDC_WfL.js"),g=require("../../ApiStatus-oqvUEWJx.js"),_=require("../../useSubscription-k3limdu_.js"),f=require("../../useCustomer-C1XTqmrQ.js"),v=require("../../usePaymentMethods-CAFMvSOr.js"),h=require("../../useLoadInitialData-_BjCD0Jc.js");function y(e){var t,n,a,i,o,s,r;const l=null==(a=null==(n=null==(t=e.items)?void 0:t[0])?void 0:n.configs)?void 0:a[0],c=null==(o=null==(i=null==l?void 0:l.details)?void 0:i.bands)?void 0:o[0];return{amount:(null==c?void 0:c.amount)??(null==c?void 0:c.fixed_amount),billingPeriod:(null==(s=null==l?void 0:l.details)?void 0:s.pricing_period)??(null==(r=null==l?void 0:l.details)?void 0:r.billing_period)}}const w={class:"sv-enabled-pricings-list__item-body flex items-center gap-4"},C={class:"sv-enabled-pricings-list__item-content grow"},x=e.defineComponent({__name:"EnabledPricingsListItem",props:{entry:{type:Object}},emits:["upgrade"],setup(t){const a=t,{$t:i}=n.useIntl(),o=e.computed(()=>{const{amount:e,billingPeriod:t}=a.entry;if(e)return t?i({defaultMessage:"{amount} per {period}",id:"enabled_pricings_list.item.price",description:'The recurring price of an enabled pricing, e.g. "€ 100,00 per month"'},{amount:n.formatAmount(e),period:n.formatBillingPeriod(t,{short:!0,hideValueForExactPeriods:!0})}):n.formatAmount(e)});return(a,s)=>(e.openBlock(),e.createBlock(e.unref(n._sfc_main$2),{class:"sv-enabled-pricings-list__item"},{default:e.withCtx(()=>[e.createElementVNode("div",w,[e.createElementVNode("div",C,[e.createVNode(e.unref(n._sfc_main$1),{tag:"span",variant:"body-xs",shade:"lighter",class:"sv-enabled-pricings-list__item-group"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.entry.groupName),1)]),_:1}),e.createVNode(e.unref(n._sfc_main$1),{tag:"h3",variant:"heading-3","no-spacing":"",class:"sv-enabled-pricings-list__item-name"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.entry.name),1)]),_:1}),o.value?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),{key:0,tag:"span",variant:"body-sm",shade:"lighter",class:"sv-enabled-pricings-list__item-price"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value),1)]),_:1})):e.createCommentVNode("",!0)]),e.createVNode(e.unref(n._sfc_main$6),{variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-enabled-pricings-list__item-upgrade shrink-0",type:"button",size:"xs",onClick:s[0]||(s[0]=e=>a.$emit("upgrade",t.entry))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Upgrade",id:"enabled_pricings_list.item.upgrade_button.label",description:"Label for the button that changes which pricing is enabled for a group"})),1)]),_:1})])]),_:1}))}}),S={class:"sv-enabled-pricings-list__items grid grid-cols-1 gap-2"},k=e.defineComponent({__name:"EnabledPricingsList",props:{pricingPlanSchedule:{type:Object}},emits:["upgrade"],setup(t){const a=t,{$t:i}=n.useIntl(),o=e.computed(()=>function(e){var t,n,a;const i=new Set(((null==(t=e.pricing_plan_schedule)?void 0:t.enabled_pricings)??[]).map(({pricing_id:e})=>e));return 0===i.size?[]:((null==(a=null==(n=e.pricing_plan_version)?void 0:n.pricing_categories)?void 0:a.flatMap(e=>e.pricing_groups??[]))??[]).flatMap(e=>(e.pricings??[]).filter(e=>i.has(e.id)).map(t=>({pricingId:t.id,pricingGroupId:e.id,groupName:e.name,name:d.getNameFromPricing(t)||e.name,...y(t)})))}(a.pricingPlanSchedule));return(t,a)=>o.value.length>0?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$2),{key:0,class:"sv-enabled-pricings-list","content-background":"none","no-border":"","no-spacing":"",title:e.unref(i)({defaultMessage:"Upgrades",id:"enabled_pricings_list.title",description:"Title for the block listing the pricings enabled on a subscription"})},{default:e.withCtx(()=>[e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,n=>(e.openBlock(),e.createBlock(x,{key:n.pricingId,entry:n,onUpgrade:a[0]||(a[0]=e=>t.$emit("upgrade",e))},null,8,["entry"]))),128))])]),_:1},8,["title"])):e.createCommentVNode("",!0)}});const B={class:"sv-subscription-cancellation-modal sv-subscription-cancellation-modal__body flex flex-col gap-3"},M={key:0,class:"sv-subscription-cancellation-modal__meta flex flex-wrap items-center gap-x-6 gap-y-2 px-3 pb-2"},N={key:0,class:"sv-subscription-cancellation-modal__renews flex gap-1"},V=e.defineComponent({__name:"SubscriptionCancellationModal",props:{showModal:{type:Boolean},variant:{type:null},subscription:{type:Object},avatar:{type:String}},emits:["confirmed","close"],setup(a,{emit:i}){const s=a,r=i,{$t:l,formatDate:c}=n.useIntl(),u=t.useLogger(),{setSubscriptionCancellation:d}=p.createSubscriptionsService(),g=e.computed(()=>s.variant),_=e.computed(()=>{var e;const t=(null==(e=s.subscription)?void 0:e.inactive_periods)??[],n=t.find(({type:e})=>"CANCEL"===e)??t[0];if(n)return c({date:n.start_at,format:"date",offsetType:"local"})}),f=e.computed(()=>{var e,t;const n=null==(t=null==(e=s.subscription)?void 0:e.next_invoice)?void 0:t.invoice_date;if(n)return c({date:n,format:"date",offsetType:"local"})}),v=f,h=e.computed(()=>{var e,t;return((null==(t=null==(e=o.getMostRecentScheduleInfo(s.subscription))?void 0:e.pricing_plan_schedule)?void 0:t.enabled_pricings)??[]).map(({pricing_id:e})=>e).filter(e=>Boolean(e))}),{title:y,explanation:w,confirmButtonText:C,cancelButtonText:x,errorMessage:S}=function({variant:t,renewableUntil:a,billingPeriodEndsAt:i}){const{$t:o}=n.useIntl(),s=e.computed(()=>"RENEW"===t.value);return{title:e.computed(()=>s.value?o({defaultMessage:"Renew subscription",description:"Title of the renew subscription confirmation modal",id:"subscription_cancellation_modal.renew.title"}):o({defaultMessage:"Cancel subscription",description:"Title of the cancel subscription confirmation modal",id:"subscription_cancellation_modal.cancel.title"})),explanation:e.computed(()=>s.value?a.value?o({defaultMessage:"You can renew your subscription until {date}. After this period you can only create a new subscription.",description:"Explanation of the deadline for undoing a cancellation, shown in the renew subscription modal",id:"subscription_cancellation_modal.renew.explanation_with_date"},{date:a.value}):o({defaultMessage:"Your subscription will continue as before, and billing will resume on its usual schedule.",description:"Explanation of what happens when a cancellation is undone, shown in the renew subscription modal when no end date is known",id:"subscription_cancellation_modal.renew.explanation"}):i.value?o({defaultMessage:"Your subscription will be canceled, but you’ll continue to have access until {date}.",description:"Explanation of what happens when a running subscription is cancelled, naming the date access ends, shown in the cancel subscription modal",id:"subscription_cancellation_modal.cancel.explanation_with_date"},{date:i.value}):o({defaultMessage:"Your subscription will be canceled, but you’ll continue to have access until the end of the billing period.",description:"Explanation of what happens when a running subscription is cancelled, shown in the cancel subscription modal",id:"subscription_cancellation_modal.cancel.explanation"})),confirmButtonText:e.computed(()=>s.value?o({defaultMessage:"Renew subscription",description:"Label of the confirm button in the renew subscription modal",id:"subscription_cancellation_modal.renew.confirm_button.label"}):o({defaultMessage:"Cancel subscription",description:"Label of the confirm button in the cancel subscription modal",id:"subscription_cancellation_modal.cancel.confirm_button.label"})),cancelButtonText:e.computed(()=>o({defaultMessage:"Cancel",description:"Label of the button that dismisses the cancellation modal",id:"subscription_cancellation_modal.cancel_button.label"})),errorMessage:e.computed(()=>s.value?o({defaultMessage:"We could not renew your subscription. Please try again.",description:"Error shown when undoing a cancellation fails",id:"subscription_cancellation_modal.renew.error"}):o({defaultMessage:"We could not cancel your subscription. Please try again.",description:"Error shown when cancelling a subscription fails",id:"subscription_cancellation_modal.cancel.error"}))}}({variant:g,renewableUntil:_,billingPeriodEndsAt:f}),{paymentMethod:k,get:V}=function(){const{getPaymentMethods:t}=b.createPaymentMethodsService(),a=e.shallowRef();return{paymentMethod:a,get:async({customerId:e,paymentMethodId:i})=>{const o=await n.getPaginatedFullList(async a=>{const i=await t({customerId:e,pagination:{page:a,pageSize:50}});if(!n.isApiSuccessCollectionResponse(i))throw new Error("Could not load the customer’s payment methods.");return i});return a.value=o.data.find(({id:e})=>e===i),a.value}}}();e.watch([()=>s.showModal,()=>{var e;return null==(e=s.subscription)?void 0:e.payment_method_id},()=>{var e;return null==(e=s.subscription)?void 0:e.customer_id}],([e,t,n])=>{var a;e&&t&&n&&t!==(null==(a=k.value)?void 0:a.id)&&V({customerId:n,paymentMethodId:t}).catch(()=>{})},{immediate:!0});const E=e.ref(!1),T=e.ref(!1);e.watch(()=>s.showModal,e=>{e&&(T.value=!1)});const j=async()=>{if(s.subscription&&s.variant&&!E.value){E.value=!0,T.value=!1;try{await d({id:s.subscription.id,variant:s.variant}),r("confirmed"),r("close")}catch(e){u.error("SUBSCRIPTION_CANCELLATION_FAILED","Failed to change the cancellation state of a subscription",{variant:s.variant},e),T.value=!0}finally{E.value=!1}}},A=()=>{E.value||r("close")};return(t,i)=>(e.openBlock(),e.createBlock(e.unref(n.Modal),{size:"md","show-modal":a.showModal,title:e.unref(y),"confirm-button-text":e.unref(C),"cancel-button-text":e.unref(x),"is-loading":E.value,"no-click-away":E.value,"no-backdrop-close":E.value,onConfirm:j,onClose:A},{body:e.withCtx(()=>[e.createElementVNode("div",B,[e.createVNode(e.unref(n._sfc_main$1),{variant:"body-sm",shade:"lighter",tag:"p",class:"sv-subscription-cancellation-modal__explanation"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(w)),1)]),_:1}),a.subscription?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$2),{key:0,"no-spacing":"",class:"sv-subscription-cancellation-modal__subscription"},{default:e.withCtx(()=>[e.createVNode(m._sfc_main,{subscription:a.subscription,avatar:a.avatar,"enabled-pricing-ids":h.value},null,8,["subscription","avatar","enabled-pricing-ids"]),e.unref(v)||e.unref(k)?(e.openBlock(),e.createElementBlock("div",M,[e.unref(v)?(e.openBlock(),e.createElementBlock("div",N,[e.createVNode(e.unref(n._sfc_main$1),{tag:"span",variant:"body-xs",shade:"light",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Renews",description:"Label before the date the subscription renews, shown in the cancel subscription modal",id:"subscription_cancellation_modal.renews_label"})),1)]),_:1}),e.createVNode(e.unref(n._sfc_main$1),{tag:"span",variant:"body-xs",shade:"light"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)),1)]),_:1})])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$8),{key:1,variant:"condensed",class:"sv-subscription-cancellation-modal__payment-method","payment-method":e.unref(k)},null,8,["payment-method"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$16),{key:1,class:"sv-subscription-cancellation-modal__error sv-error",title:e.unref(S)},null,8,["title"])):e.createCommentVNode("",!0)])]),_:1},8,["show-modal","title","confirm-button-text","cancel-button-text","is-loading","no-click-away","no-backdrop-close"]))}}),E={class:"sv-subscription-details__header flex flex-col gap-2 md:flex-row md:items-center"},T=e.defineComponent({__name:"SubscriptionDetails",props:{subscription:{type:Object},schedulesData:{type:Array},customer:{type:Object},paymentMethods:{type:Array},walletBalances:{default:()=>[],type:Array},hasWalletBalancesError:{type:Boolean},avatar:{type:String},isLoading:{type:Boolean},error:{type:null}},emits:["top-up-charged","auto-top-up-saved","auto-top-up-cancelled","payment-method-stored","subscription-changed"],setup(t,{emit:d}){const p=t,m=d,{$t:b}=n.useIntl(),{isCancellable:g,isRenewable:_,pendingVariant:f,cancel:v,renew:h,dismiss:y,manage:w}=function({subscription:t}){const{dispatchAction:n}=i.useActionDispatchProvider(),a=e.computed(()=>{if(!t.value)return!1;const e=t.value.inactive_periods;return!e||0===e.length}),o=e.computed(()=>{var e;const n=null==(e=t.value)?void 0:e.inactive_periods;return Array.isArray(n)&&n.length>0}),s=e.ref();return{isCancellable:a,isRenewable:o,pendingVariant:s,cancel:()=>{t.value&&(s.value="CANCEL")},renew:()=>{t.value&&(s.value="RENEW")},dismiss:()=>{s.value=void 0},manage:()=>{t.value&&n({action:"manage-subscription",data:{subscriptionId:t.value.id}})}}}({subscription:e.toRef(p,"subscription")}),C=e.ref();e.watch(f,e=>{e&&(C.value=void 0)});const x=()=>{C.value=f.value,m("subscription-changed")},S=e.computed(()=>{if(C.value)return"RENEW"===C.value?b({defaultMessage:"Your subscription has been renewed.",id:"subscription_details.renew_success",description:"Confirmation shown after a cancellation has been undone"}):b({defaultMessage:"Your subscription has been cancelled. You keep access until the end of the billing period.",id:"subscription_details.cancel_success",description:"Confirmation shown after a subscription has been cancelled"})}),B=e.computed(()=>o.getMostRecentScheduleInfo(p.subscription)),M=e.computed(()=>(p.paymentMethods??[]).find(({id:e})=>{var t;return e===(null==(t=p.subscription)?void 0:t.payment_method_id)})),N=e.computed(()=>p.subscription?[p.subscription]:[]),T=e.computed(()=>o.getSubscriptionName({subscription:p.subscription,fallback:b({defaultMessage:"Subscription details",id:"subscription_details.title",description:"Title for the subscription details page"})}));return(i,o)=>(e.openBlock(),e.createBlock(e.unref(a.ContentWithAsideLayout),{class:"sv-subscription-details sv-root sv-screen"},{header:e.withCtx(()=>[e.createElementVNode("div",E,[e.createVNode(e.unref(n._sfc_main$1),{variant:"heading-2",tag:"h1",class:"sv-subscription-details__title grow"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(T.value),1)]),_:1}),e.unref(_)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$6),{key:0,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscription-details__renew w-full md:w-auto",type:"button",onClick:e.unref(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)({defaultMessage:"Renew subscription",id:"subscription_details.renew_button.label",description:"Label for the renew subscription button on the subscription details page"})),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$6),{key:1,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscription-details__cancel w-full md:w-auto",type:"button",onClick:e.unref(v)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)({defaultMessage:"Cancel subscription",id:"subscription_details.cancel_button.label",description:"Label for the cancel subscription button on the subscription details page"})),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)])]),content:e.withCtx(()=>[S.value?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$30),{key:0,class:"sv-subscription-details__cancellation-success",type:"success",title:S.value},null,8,["title"])):e.createCommentVNode("",!0),t.error?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$16),{key:1,class:"sv-subscription-details__error sv-error",title:e.unref(b)({defaultMessage:"Unable to load this subscription. Please try again later.",id:"subscription_details.load_error",description:"Error message shown when the subscription cannot be loaded on the subscription details page"})},null,8,["title"])):t.isLoading?(e.openBlock(),e.createBlock(u._sfc_main,{key:2,variant:"section",class:"min-h-[220px]"})):t.subscription?(e.openBlock(),e.createBlock(s._sfc_main,{key:3,class:"sv-subscription-details__schedules","schedules-data":t.schedulesData??[],configuration:{subscriptionId:t.subscription.id},"is-loading":t.isLoading},null,8,["schedules-data","configuration","is-loading"])):(e.openBlock(),e.createBlock(c._sfc_main,{key:4,class:"sv-subscription-details__empty-state",icon:"receipt_long"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)({defaultMessage:"Subscription not found",id:"subscription_details.empty_state.title",description:"Title shown when the requested subscription does not exist"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)({defaultMessage:"This subscription is no longer available.",id:"subscription_details.empty_state.message",description:"Message shown when the requested subscription does not exist"})),1)]),_:1}))]),aside:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"sv-subscription-details__wallet-balances","has-error":Boolean(t.hasWalletBalancesError),"is-loading":t.isLoading,"wallet-balances":t.walletBalances,"show-top-up-button":"",customer:t.customer,"payment-methods":t.paymentMethods,subscriptions:N.value,onTopUpCharged:o[0]||(o[0]=e=>i.$emit("top-up-charged")),onAutoTopUpSaved:o[1]||(o[1]=e=>i.$emit("auto-top-up-saved")),onAutoTopUpCancelled:o[2]||(o[2]=e=>i.$emit("auto-top-up-cancelled")),onPaymentMethodStored:o[3]||(o[3]=e=>i.$emit("payment-method-stored"))},null,8,["has-error","is-loading","wallet-balances","customer","payment-methods","subscriptions"]),B.value?(e.openBlock(),e.createBlock(k,{key:0,class:"sv-subscription-details__upgrades","pricing-plan-schedule":B.value,onUpgrade:e.unref(w)},null,8,["pricing-plan-schedule","onUpgrade"])):e.createCommentVNode("",!0),M.value?(e.openBlock(),e.createBlock(l._sfc_main,{key:1,class:"sv-subscription-details__payment-method","is-loading":t.isLoading,"payment-methods":[M.value],configuration:{showViewAllButton:!1,showAddButton:!1}},null,8,["is-loading","payment-methods"])):e.createCommentVNode("",!0),e.createVNode(V,{"show-modal":Boolean(e.unref(f)),variant:e.unref(f),subscription:t.subscription,avatar:t.avatar,onConfirmed:x,onClose:e.unref(y)},null,8,["show-modal","variant","subscription","avatar","onClose"])]),_:1}))}}),j=e.defineComponent({__name:"SubscriptionDetails.entry.view",props:{configuration:{type:Object},environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup(t){const n=t,a=n.portalObject.customer_id,{subscription:i,withPlanData:o,get:s,error:l}=_.useSubscription({subscriptionId:n.configuration.subscriptionId}),{customer:c,get:u}=f.useCustomer({customerId:a}),{items:d,fetchAll:p}=v.usePaymentMethods({customerId:a}),{walletBalances:m,apiStatus:b,fetch:y}=r.useCustomerWalletBalances({customerId:a}),{isLoading:w}=h.useLoadInitialData(s(),u.execute(),p(),y()),C=e.computed(()=>i.value?o(i.value):[]),x=e.computed(()=>{var e;return(null==(e=m.value)?void 0:e.wallet_balances)??[]}),S=e.computed(()=>b.value===g.ApiStatus.Failed);return(t,n)=>e.renderSlot(t.$slots,"default",{subscription:e.unref(i),schedulesData:C.value,customer:e.unref(c),paymentMethods:e.unref(d),walletBalances:x.value,hasWalletBalancesError:S.value,isLoading:e.unref(w),error:e.unref(l),refreshWalletBalances:e.unref(y),refreshPaymentMethods:e.unref(p),refreshSubscription:e.unref(s)})}}),A=e.defineComponent({__name:"SubscriptionDetails.entry",props:{configuration:{type:Object},environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object}},setup:n=>(a,i)=>{var o,s,r,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(P),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(o=n.branding)?void 0:o.colors)?void 0:s.primary,"secondary-color":null==(l=null==(r=n.branding)?void 0:r.colors)?void 0:l.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,"css-overrides":n.cssOverrides,onError:i[0]||(i[0]=e=>a.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(j,e.normalizeProps(e.guardReactiveProps(a.$props)),{default:e.withCtx(({subscription:t,schedulesData:a,customer:i,paymentMethods:o,walletBalances:s,hasWalletBalancesError:r,isLoading:l,error:c,refreshWalletBalances:u,refreshPaymentMethods:d,refreshSubscription:p})=>[e.createVNode(T,{subscription:t,"schedules-data":a,customer:i,avatar:n.configuration.avatar,"payment-methods":o,"wallet-balances":s,"has-wallet-balances-error":r,"is-loading":l,error:c,onTopUpCharged:u,onAutoTopUpSaved:u,onAutoTopUpCancelled:u,onPaymentMethodStored:d,onSubscriptionChanged:p},null,8,["subscription","schedules-data","customer","avatar","payment-methods","wallet-balances","has-wallet-balances-error","is-loading","error","onTopUpCharged","onAutoTopUpSaved","onAutoTopUpCancelled","onPaymentMethodStored","onSubscriptionChanged"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}),L=t.defineCustomElement(A),P=t.getComponentName("subscription-details");exports.COMPONENT_NAME=P,exports.SolvimonSubscriptionDetails=L,exports.defineSolvimonSubscriptionDetails=()=>{customElements.get(P)||customElements.define(P,L)};