@solvimon/solvimon-web 0.1.0-alpha.17 → 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.
- package/README.md +28 -26
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BrPsTuoW.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BuQ8bzar.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CuWrBcoK.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-wxP5IaGt.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-05NKI2A0.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-17v07F58.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
- package/dist/{PaymentHistoryBlock-BitwS9Re.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
- package/dist/{PaymentHistoryBlock-ZtmPXXwI.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3ZUDUdw.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-BZTzCUiu.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
- package/dist/{PaymentIntegrationForm-BK2aLPCo.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
- package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
- package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
- package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
- package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
- package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
- package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-CIQ0vsko.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +2 -2
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js → PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js} +1 -1
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DVeB_mqK.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +76 -30
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
- package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D1TcP9PR.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +2 -2
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
- package/dist/{SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs → SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs} +1 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
- package/dist/{EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs → SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs} +16 -63
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-BDqX6OaE.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +5 -5
- package/dist/adyen-BMDZQBUG.js +1 -0
- package/dist/{url-BjZ1Pg0l.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
- package/dist/component--Y7Igv5i.mjs +1022 -0
- package/dist/component-DIy1hvJM.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +4 -4
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +7 -7
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +4 -4
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
- package/dist/components/WalletBalances/WalletBalances.es.js +21 -7
- package/dist/core/action-request.types.d.ts +1 -13
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/{customer-DAgdegIW.mjs → customer-DovIxTG1.mjs} +1 -1
- package/dist/{customer-AfRcAZ5P.js → customer-brfznoHY.js} +1 -1
- package/dist/en-US-BvOHPudj.js +1 -0
- package/dist/{en-US-DSzSbgL5.mjs → en-US-CXDO3qhq.mjs} +53 -0
- package/dist/index-BMWWP8xj.js +1 -0
- package/dist/index-Do7kzLpg.mjs +265 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-BHgajZHq.js → invoices-Cf3dSYSj.js} +1 -1
- package/dist/{invoices-BXDgW8ch.mjs → invoices-Dk-z04lg.mjs} +2 -2
- package/dist/{nl-NL-Li7RW89R.mjs → nl-NL-BgL_PuBn.mjs} +55 -1
- package/dist/nl-NL-COGUFg60.js +1 -0
- package/dist/{paymentMethods-xzFD2L30.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
- package/dist/paymentMethods-DVDC_WfL.js +1 -0
- package/dist/{payments-DMvmB5vg.js → payments-DVZFO5yb.js} +1 -1
- package/dist/{payments-DV6csRej.mjs → payments-TnRjtlOw.mjs} +1 -1
- package/dist/{pricing-BEjY_5wb.js → pricing-CuYndX6t.js} +1 -1
- package/dist/{pricing-B1uImUm4.mjs → pricing-GwLCiSzs.mjs} +1 -1
- package/dist/{pricingPlanSchedule-C_cqUyTk.mjs → pricingPlanSchedule-CXG3CQ61.mjs} +3 -1
- package/dist/{registry-CyENvS6l.mjs → registry-Ck0Gb6rj.mjs} +1 -1
- package/dist/{registry-CeMxLjwU.js → registry-Cra6yoB4.js} +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +37 -36
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +32 -56
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +28 -12
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -1
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +436 -89
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -1
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +28 -37
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscription-B4dBAY9C.mjs → subscription-C41lG-rH.mjs} +1 -1
- package/dist/subscriptions-BFCKVHnP.js +1 -0
- package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
- package/dist/{useActionDispatchProvider-zB_GKeUR.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
- package/dist/{useActionDispatchProvider-bqR_FeM4.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
- package/dist/{useCustomer-bO4D6e4Z.js → useCustomer-C1XTqmrQ.js} +1 -1
- package/dist/{useCustomer-VfeQ6rG2.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
- package/dist/{useIncrementalLoading-C59FXHzp.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
- package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
- package/dist/{useInvoiceData-CxxkBTGY.js → useInvoiceData-BrxMo4Zt.js} +1 -1
- package/dist/{useInvoiceData-Dhg-hx8C.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
- package/dist/{useInvoicesList-DBz7T7sM.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
- package/dist/{useInvoicesList-BXZ9uV9i.js → useInvoicesList-DmisMQzy.js} +1 -1
- package/dist/{useLoadInitialData-BhpIg7OF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
- package/dist/{useLoadInitialData-BqiAFNFi.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
- package/dist/{usePaymentMethodOptions-PcMjtMSF.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
- package/dist/{usePaymentMethodOptions-DszFvgKX.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
- package/dist/{usePaymentMethods-Bb1Xbads.js → usePaymentMethods-CAFMvSOr.js} +1 -1
- package/dist/{usePaymentMethods-B5AbGWsn.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
- package/dist/{usePayments-is5c66Z6.js → usePayments-BieVBaz-.js} +1 -1
- package/dist/{usePayments-DgoZoBZh.mjs → usePayments-D88XSZfS.mjs} +10 -4
- package/dist/{usePortal-DWLtNqBB.mjs → usePortal-0NDlbFr9.mjs} +1 -1
- package/dist/{usePortal-C4qWsJeq.js → usePortal-B954nyEB.js} +1 -1
- package/dist/{useService-DKm3QtT4.js → useService-BiljI7XA.js} +1 -1
- package/dist/{useService-BZqFkz7p.mjs → useService-CqfJi5ST.mjs} +1 -1
- package/dist/{useSubscription-CEZJw6wZ.mjs → useSubscription-9rJpFNUF.mjs} +9 -3
- package/dist/{useSubscription-DuUNc1_l.js → useSubscription-k3limdu_.js} +1 -1
- package/dist/vendor-ui-Dfh3_g4q.js +1 -0
- package/dist/{vendor-ui-BoGKOJ36.mjs → vendor-ui-ItGf7wJV.mjs} +1912 -1800
- package/package.json +12 -5
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-1Op9GjGZ.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C66beqgf.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs +0 -77
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BbuEBiY3.js +0 -1
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-dwIv_xxf.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CMGK71zZ.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-B_yDNGK8.mjs +0 -1537
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-GN3WAr10.js +0 -1
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-BQIN3zuf.mjs +0 -156
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js +0 -1
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-OvGGejpX.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BKz2QQn9.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CyAFjCh7.js +0 -1
- package/dist/component-CUJ_G2Nw.mjs +0 -962
- package/dist/component-CiKxWtdx.js +0 -1
- package/dist/en-US-QzQnGXP1.js +0 -1
- package/dist/index-CzL1ZcGi.mjs +0 -85
- package/dist/index-DRdBmZ2-.js +0 -1
- package/dist/nl-NL-C4rr-1tr.js +0 -1
- package/dist/paymentMethods-BMcc-eTl.js +0 -1
- package/dist/subscriptions-CrNDM9qa.mjs +0 -79
- package/dist/subscriptions-DC-mxa17.js +0 -1
- package/dist/url-D8GJi5rF.js +0 -1
- package/dist/useIncrementalLoading-BgWuwoMo.js +0 -1
- package/dist/useTopUpModal-DNyWrHDv.mjs +0 -1012
- package/dist/useTopUpModal-DeF-cfCK.js +0 -1
- package/dist/vendor-ui-BuRqLx74.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("vue"),t=require("./vendor-ui-BuRqLx74.js"),i=require("./invoices-BHgajZHq.js"),n=require("./useWatchDebounced-C_YxgoQ6.js"),o=require("./component-CiKxWtdx.js"),a=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),l=require("./PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js"),u=require("./url-D8GJi5rF.js"),r=require("./usePaymentMethodOptions-DszFvgKX.js"),d=require("./PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js"),c=["TOP_UP","ADD_PAYMENT_METHOD","SUCCESS"],s=e=>((null==e?void 0:e.charge_on_demand_pricing_items)??[]).flatMap(i=>{var n,o;if(!(e=>"object"==typeof e&&null!==e&&"pricing_item"in e)(i))return[];const a=i.pricing_item_id??(null==(n=i.pricing_item)?void 0:n.id);return a?((null==(o=i.pricing_item)?void 0:o.configs)??[]).map(n=>{const o=function(e,i){var n,o,a,l,u,r,d;if(!e.on_demand||!t.isFlexiblePricing(e))return;const c=null==(o=null==(n=e.details)?void 0:n.bands)?void 0:o[0],s=(null==(a=null==c?void 0:c.minimum_amount)?void 0:a.currency)??(null==(l=null==c?void 0:c.maximum_amount)?void 0:l.currency)??(null==(r=null==(u=null==i?void 0:i.wallet_balance.balance)?void 0:u.amount)?void 0:r.currency);if(!s)return;const p=m(i),_=p?v(e,i):void 0,h=null==(d=null==p?void 0:p.credit_type)?void 0:d.unit_name,b=e=>{if(!e)return;const t=p&&_?g(e.quantity,_.rate):void 0;return void 0!==t&&p?f(t,p):{amount:e}};return{config:{...(null==c?void 0:c.minimum_amount)&&{minimum_amount:c.minimum_amount},...(null==c?void 0:c.maximum_amount)&&{maximum_amount:c.maximum_amount}},currency:s,..._&&{creditsConfiguration:{conversionRate:_.rate,...(null==h?void 0:h.singular)&&{unitNameSingle:h.singular},...(null==h?void 0:h.plural)&&{unitNamePlural:h.plural}}},bounds:{...b(null==c?void 0:c.minimum_amount)&&{minimum:b(null==c?void 0:c.minimum_amount)},...b(null==c?void 0:c.maximum_amount)&&{maximum:b(null==c?void 0:c.maximum_amount)}}}}(n,e),l=function(e,i){var n,o,a;if(!e.on_demand||!t.hasOneOfPricingTypes(e,["FIXED"]))return;const l=null==(a=null==(o=null==(n=e.details)?void 0:n.bands)?void 0:o[0])?void 0:a.fixed_amount;if(!l)return;const u=m(i),r=u?_(e,i):void 0;return{amount:l,value:r&&u?f(r.quantity,u):{amount:l}}}(n,e);return{pricingItemId:a,...i.pricing_plan_schedule_id&&{pricingPlanScheduleId:i.pricing_plan_schedule_id},config:n,...o&&{flexiblePricing:o},...l&&{fixedPricing:l}}}):[]});const m=e=>{var t;return null==(t=null==e?void 0:e.wallet_balance.balance)?void 0:t.credits},p=(e,t)=>{const i=null==t?void 0:t.wallet_type_id;return(e.wallet_grants??[]).filter(({wallet_type_id:e})=>!i||e===i)},v=(e,t)=>{var i,n;return null==(n=null==(i=p(e,t).find(({credits_grant:e})=>null==e?void 0:e.conversion))?void 0:i.credits_grant)?void 0:n.conversion},_=(e,t)=>{var i,n;return null==(n=null==(i=p(e,t).find(({credits_grant:e})=>null==e?void 0:e.credits))?void 0:i.credits_grant)?void 0:n.credits},f=(e,t)=>({credits:{...t,quantity:e}}),g=(e,t)=>{const i=Number(e),n=Number(t);return Number.isFinite(i)&&Number.isFinite(n)?String(i*n):void 0};const h={class:"sv-top-up-form"},b={class:"grid grid-cols-1 gap-4"},y={class:"grid grid-cols-1 gap-1"},P={class:"sv-top-up-form__option-details"},x=e.defineComponent({__name:"TopUpModalForm",props:{topUpPricingItems:{type:null},paymentMethods:{type:Array}},emits:["add-payment-method","success","failure"],setup(u,{expose:r,emit:d}){const c=u,s=d,{$t:m,formatNumber:p}=t.useIntl(),v=e.ref({pricing_plan_schedule_id:"",pricing_items:[],start_at:"",finalize_immediately:!1,payment_method_id:void 0,preview:!0}),_=e.computed(()=>(c.topUpPricingItems??[]).filter(e=>e.flexiblePricing||e.fixedPricing)),x=e=>_.value.find(t=>t.pricingItemId===e),w=e.computed(()=>{var e,t;return null==(t=null==(e=c.topUpPricingItems)?void 0:e.find(e=>e.pricingPlanScheduleId))?void 0:t.pricingPlanScheduleId});e.watch(w,e=>{v.value.pricing_plan_schedule_id=e??""},{immediate:!0});const M=e.computed({get:()=>{var e;return null==(e=v.value.pricing_items[0])?void 0:e.pricing_item_id},set:e=>{const t=x("string"==typeof e?e:void 0);if(!t)return void(v.value.pricing_items=[]);const i=(e=>{const{config:t,currency:i}=e.flexiblePricing??{},n=null==t?void 0:t.minimum_amount;return n&&i?{quantity:n.quantity,currency:i}:void 0})(t);v.value.pricing_items=[{pricing_item_id:t.pricingItemId,...i&&{flexible_amount:i}}]}});e.watch(_,e=>{var t;e.some(({pricingItemId:e})=>{var t;return e===(null==(t=v.value.pricing_items[0])?void 0:t.pricing_item_id)})||(M.value=null==(t=e.find(({flexiblePricing:e})=>e))?void 0:t.pricingItemId)},{immediate:!0});const k=e.computed({get:()=>{var e;return null==(e=v.value.pricing_items[0])?void 0:e.flexible_amount},set:e=>{var t;const i=null==(t=v.value.pricing_items[0])?void 0:t.pricing_item_id;i&&(v.value.pricing_items=[{pricing_item_id:i,...e&&{flexible_amount:e}}])}}),E=e=>t.formatWalletBalanceValue(m,p,e),N=e=>{var i;const n=null==(i=x(String(e)))?void 0:i.fixedPricing;return(null==n?void 0:n.value.credits)?t.formatAmount(n.amount):void 0},V=e=>{var t;const i=null==(t=x(String(e)))?void 0:t.flexiblePricing;return i?[i]:[]},C=e=>{var t;return!!(null==(t=x(String(e)))?void 0:t.flexiblePricing)},S=e.computed(()=>_.value.map(e=>{var t;return{value:e.pricingItemId,label:e.fixedPricing?E(e.fixedPricing.value):m({defaultMessage:"Choose your own amount",description:"Label of the choose-your-amount option in the top-up modal",id:"topup_modal.flexible_option.label"}),...(null==(t=e.flexiblePricing)?void 0:t.bounds.minimum)&&e.flexiblePricing.bounds.maximum&&{description:m({defaultMessage:"Between {minimum} and {maximum}",description:"Bounds of the choose-your-amount option in the top-up modal",id:"topup_modal.flexible_option.bounds"},{minimum:E(e.flexiblePricing.bounds.minimum),maximum:E(e.flexiblePricing.bounds.maximum)})}}})),T=e.computed(()=>{const e=v.value.pricing_items.filter(e=>{var t;return!(null==(t=x(e.pricing_item_id))?void 0:t.flexiblePricing)||!!e.flexible_amount});return e.length>0?e:void 0}),{invoicePreview:B}=function({pricingPlanScheduleId:t,pricingItems:a}){const{previewChargeOnDemandPricingItems:l}=i.createInvoicesService(),u=o.useLogger(),r=e.ref(),d=e.ref(!1);let c=0;const s=async()=>{const e=t.value,i=++c;if(!e||!a.value)return a.value&&!e&&u.warn("INVOICE_PREVIEW_SKIPPED","Skipped the top-up invoice preview: no schedule to charge it on",{missing:["pricingPlanScheduleId"]}),r.value=void 0,void(d.value=!1);d.value=!0;try{const t=await l({pricingPlanScheduleId:e,pricingItems:a.value});i===c&&(r.value=t)}catch(n){i===c&&(r.value=void 0),u.error("INVOICE_PREVIEW_FAILED","Failed to load top-up invoice preview",{},n)}finally{i===c&&(d.value=!1)}};return n.useWatchDebounced(a,()=>{s()},{debounce:400,deep:!0}),s(),{invoicePreview:r,isPreviewPending:d,loadPreview:s}}({pricingPlanScheduleId:w,pricingItems:T}),{chargeOnDemandPricingItems:D}=i.createInvoicesService(),I=o.useLogger(),O=e.ref(!1),A=e.computed(()=>!!v.value.pricing_plan_schedule_id&&!!T.value),U=e.computed(()=>{const[e]=v.value.pricing_items,t=x(null==e?void 0:e.pricing_item_id);return t?((e,t)=>{var i;if(e.fixedPricing)return e.fixedPricing.value;if(!e.flexiblePricing||!t)return;const{bounds:n,creditsConfiguration:o}=e.flexiblePricing,a=null==(i=n.minimum??n.maximum)?void 0:i.credits,l=o?g(t.quantity,o.conversionRate):void 0;return a&&void 0!==l?f(l,a):{amount:t}})(t,null==e?void 0:e.flexible_amount):void 0});r({submit:async function(){if(A.value&&!O.value){O.value=!0;try{const e=await D({pricing_plan_schedule_id:v.value.pricing_plan_schedule_id,pricing_items:T.value??[],payment_method_id:v.value.payment_method_id,preview:!1});s("success",e)}catch(e){I.error("TOP_UP_FAILED","Failed to charge the wallet top-up",{},e),s("failure",e)}finally{O.value=!1}}},isCharging:O,canSubmit:A,chargedValue:U});const q=e.computed({get:()=>v.value.payment_method_id??void 0,set:e=>{v.value.payment_method_id=e}}),$=e=>{const t=Date.parse(e??"");return Number.isFinite(t)?t:0},F=e.computed(()=>[...c.paymentMethods??[]].sort((e,t)=>$(t.created_at)-$(e.created_at)));return e.watch(()=>c.paymentMethods,(e,t)=>{var i;const n=null==e?void 0:e.find(({id:e})=>!(null==t?void 0:t.some(t=>t.id===e)));if(n&&(null==t?void 0:t.length))return void(q.value=n.id);(null==e?void 0:e.some(({id:e})=>e===v.value.payment_method_id))||(q.value=null==(i=(null==e?void 0:e.find(({is_default:e})=>e))??F.value[0])?void 0:i.id)},{immediate:!0}),(i,n)=>(e.openBlock(),e.createElementBlock("form",h,[e.createElementVNode("div",b,[e.createElementVNode("div",y,[S.value.length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$7),{key:0,modelValue:M.value,"onUpdate:modelValue":n[3]||(n[3]=e=>M.value=e),class:"sv-top-up-form__options",name:"top-up-pricing-item",direction:"column",required:"",disabled:O.value,options:S.value,"show-radio":!1,label:e.unref(m)({defaultMessage:"Top up amount",description:"Label above the list of ways to top up the wallet in the top-up modal",id:"topup_modal.pricing_items.label"})},{label:e.withCtx(({option:i,optionValue:n})=>[e.createElementVNode("span",null,e.toDisplayString(i.label),1),N(n)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-sm",shade:"lighter",weight:"normal","no-spacing":"",class:"sv-top-up-form__option-cost"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(N(n)),1)]),_:2},1024)):e.createCommentVNode("",!0)]),description:e.withCtx(({option:i,optionValue:o})=>[e.createElementVNode("div",P,[i.description&&!C(o)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.description),1)]),_:2},1024)):e.createCommentVNode("",!0),V(o).length>0?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{key:1,"is-open":String(o)===M.value,lazy:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V(o),o=>(e.openBlock(),e.createElementBlock("div",{key:o.currency,class:"sv-top-up-form__amount grid grid-cols-1 gap-3",onClick:n[1]||(n[1]=e.withModifiers(()=>{},["stop"])),onKeydown:n[2]||(n[2]=e.withModifiers(()=>{},["stop"]))},[i.description?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,tag:"span",variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.description),1)]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$28),{modelValue:k.value,"onUpdate:modelValue":n[0]||(n[0]=e=>k.value=e),config:o.config,currency:o.currency,"credits-configuration":o.creditsConfiguration,required:"",disabled:O.value,"show-range-hint":!1},null,8,["modelValue","config","currency","credits-configuration","disabled"])],32))),128))]),_:2},1032,["is-open"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue","disabled","options","label"])):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createBlock(a._sfc_main,{key:1,class:"h-[152px]","data-testid":"top-up-invoice-preview-skeleton"},{default:e.withCtx(()=>[e.unref(B)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{invoice:e.unref(B),"is-customer-facing":""},null,8,["invoice"])]),_:1})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$30),{spacing:"xs"})]),e.createElementVNode("div",null,[e.createVNode(l._sfc_main,{modelValue:q.value,"onUpdate:modelValue":n[4]||(n[4]=e=>q.value=e),class:"sv-top-up-form__payment-methods","payment-methods":F.value,required:"",disabled:O.value,label:e.unref(m)({defaultMessage:"Payment method",description:"Label above the payment method that pays for the top-up, in the top-up modal",id:"topup_modal.payment_method_selector.label"}),onAddPaymentMethod:n[5]||(n[5]=e=>s("add-payment-method"))},null,8,["modelValue","payment-methods","disabled","label"])])])]))}}),w={class:"sv-top-up-success grid grid-cols-1 gap-4"},M={key:0,class:"sv-top-up-success__added"},k=e.defineComponent({__name:"TopUpModalSuccess",props:{addedValue:{type:Object},invoice:{type:Object}},setup(i){const n=i,{$t:o,formatNumber:a}=t.useIntl(),l=e.computed(()=>o({defaultMessage:"Top-up successful",description:"Title of the top-up modal once the top-up has been charged",id:"topup_modal.success.title"})),r=e.computed(()=>n.addedValue?o({defaultMessage:"Your balance was topped up with {value}. Please be aware that it can take some time to reflect this change in your wallet.",description:"Confirmation of what a completed top-up added to the wallet balance",id:"topup_modal.success.added"},{value:t.formatWalletBalanceValue(o,a,n.addedValue)}):void 0);return(n,a)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(u._sfc_main,{status:"success",title:l.value},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("span",M,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)]),_:1},8,["title"]),i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,"content-background":"none"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold",class:"mb-2 block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Receipt",description:"Heading above the invoice a completed top-up produced",id:"topup_modal.success.receipt.heading"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$29),{invoice:i.invoice,"is-customer-facing":""},null,8,["invoice"])]),_:1})):e.createCommentVNode("",!0)]))}});function E(t){const i=e.ref(0),n=e=>{i.value=(null==e?void 0:e.offsetHeight)??0},o="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(e=>{var t;const i=null==(t=e[0])?void 0:t.target;n(i instanceof HTMLElement?i:void 0)});return e.watch(t,(e,t)=>{t&&(null==o||o.unobserve(t)),n(e),e&&(null==o||o.observe(e))},{immediate:!0,flush:"post"}),e.onBeforeUnmount(()=>{null==o||o.disconnect()}),i}const N={class:"grid grid-cols-1 gap-4 pb-4"},V=["inert"],C=["inert"],S=["inert"],T={class:"flex flex-col gap-2"},B=e.defineComponent({__name:"TopUpModal",props:{showModal:{type:Boolean},selectedBalanceItem:{type:Object},paymentMethods:{type:Array},customer:{type:Object}},emits:["confirm","close","payment-success","payment-failed"],setup(i,{emit:n}){const o=i,a=n,{$t:l,formatNumber:u}=t.useIntl(),m=e.computed(()=>{var e;return t.formatWalletBalanceValue(l,u,null==(e=o.selectedBalanceItem)?void 0:e.wallet_balance.open_balance)}),p=e.computed(()=>s(o.selectedBalanceItem)),{paymentMethodOptions:v,get:_,isPending:f}=r.usePaymentMethodOptions();e.watch(()=>[o.showModal,o.customer],([e,i])=>{e&&i&&_({customerId:i.id,country:t.getCustomerCountry(i)})},{immediate:!0});const g=e.ref("TOP_UP"),h=e.ref(),b=e.ref(),y=()=>{g.value="TOP_UP",a("payment-success")},P=e.computed(()=>({variant:"TOKENIZE"})),w=e.ref(!1),M=e.ref(!1);let B;e.watch(g,e=>{w.value=w.value||"ADD_PAYMENT_METHOD"===e,M.value=!0,clearTimeout(B),B=setTimeout(()=>{M.value=!1},300)}),e.onBeforeUnmount(()=>{clearTimeout(B)});const D=e.ref(),I=e.ref(),O=e.ref(),A={TOP_UP:E(D),ADD_PAYMENT_METHOD:E(I),SUCCESS:E(O)},U=e.computed(()=>A[g.value].value),q=e.computed(()=>{const e=c.indexOf(g.value);return 0===e?"translateX(0px)":`translateX(calc(${-e} * (100% + 1rem)))`}),$=e.ref(),F=e.computed(()=>{var e;return"ADD_PAYMENT_METHOD"===g.value&&!!(null==(e=$.value)?void 0:e.isPaymentPending)}),H=e.ref(),L=e.computed(()=>{var e;return null==(e=H.value)?void 0:e.chargedValue}),Y=e.computed(()=>{var e;return F.value||!!(null==(e=H.value)?void 0:e.isCharging)}),{title:j,subTitle:R,cancelButtonText:z,confirmButtonText:W}=function({step:i,currentBalance:n,topUpValue:o}){const{$t:a,formatNumber:l}=t.useIntl();return{title:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({defaultMessage:"Add payment method",description:"Title of the top-up modal while the customer is adding a payment method",id:"topup_modal.add_payment_method.title"}):"SUCCESS"===i.value?a({defaultMessage:"Top-up complete",description:"Title of the top-up modal once the top-up has been charged",id:"topup_modal.success.modal_title"}):a({defaultMessage:"Top up balance",description:"Title of the wallet top-up modal",id:"topup_modal.title"})),subTitle:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({defaultMessage:"Add a new payment method for topping up your balance.",description:"Subtitle of the top-up modal while the customer is adding a payment method",id:"topup_modal.add_payment_method.subtitle"}):"SUCCESS"===i.value?a({defaultMessage:"Your payment went through.",description:"Subtitle of the top-up modal once the top-up has been charged",id:"topup_modal.success.modal_subtitle"}):a({defaultMessage:"Your current balance is {balance}.",description:"Subtitle of the top-up modal showing the current wallet balance",id:"topup_modal.subtitle"},{balance:n.value})),cancelButtonText:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({defaultMessage:"Back",description:"Label of the button that leaves the add payment method step in the top-up modal",id:"topup_modal.back_button.label"}):a({defaultMessage:"Cancel",description:"Label of the button that closes the top-up modal",id:"topup_modal.cancel_button.label"})),confirmButtonText:e.computed(()=>"ADD_PAYMENT_METHOD"===i.value?a({defaultMessage:"Save payment method",description:"Label of the confirm button in the top-up modal while adding a payment method",id:"topup_modal.save_payment_method.label"}):"SUCCESS"===i.value?a({defaultMessage:"Done",description:"Label of the button that dismisses the top-up modal once the top-up has been charged",id:"topup_modal.done_button.label"}):o.value?a({defaultMessage:"Top up balance with {value}",description:"Label of the confirm button in the top-up modal once an amount is entered",id:"topup_modal.confirm_button.label"},{value:t.formatWalletBalanceValue(a,l,o.value)}):a({defaultMessage:"Top up balance",description:"Label of the confirm button in the top-up modal while no amount is entered",id:"topup_modal.confirm_button.empty.label"}))}}({step:g,currentBalance:m,topUpValue:L}),K=()=>{var e,t;"ADD_PAYMENT_METHOD"!==g.value?null==(t=H.value)||t.submit():null==(e=$.value)||e.submit()},X=e=>{var t;h.value=e,b.value=null==(t=H.value)?void 0:t.chargedValue,g.value="SUCCESS"},Z=()=>{a("confirm"),a("close")},G=()=>{Y.value||("ADD_PAYMENT_METHOD"!==g.value?"SUCCESS"!==g.value?a("close"):Z():g.value="TOP_UP")},J=e.ref(0);return e.watch(()=>o.showModal,e=>{e&&(g.value="TOP_UP",h.value=void 0,b.value=void 0,J.value+=1)}),(n,o)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{"no-click-away":"","show-modal":i.showModal,size:"lg",title:e.unref(j),"sub-title":e.unref(R),"cancel-button-text":e.unref(z),"confirm-button-text":e.unref(W),"is-loading":Y.value,onConfirm:K,onClose:G},e.createSlots({body:e.withCtx(()=>[e.createElementVNode("div",N,[e.createElementVNode("div",{class:e.normalizeClass(["sv-topup-modal__viewport relative -mx-2 overflow-hidden px-2",M.value?"transition-[height] duration-300 ease-in-out motion-reduce:transition-none":""]),style:e.normalizeStyle(U.value?{height:`${U.value}px`}:void 0)},[e.createElementVNode("div",{class:"sv-topup-modal__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",style:e.normalizeStyle({transform:q.value})},[e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"TOP_UP"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"topUpPaneRef",ref:D},[(e.openBlock(),e.createBlock(x,{key:J.value,ref_key:"topUpFormRef",ref:H,"top-up-pricing-items":p.value,"payment-methods":i.paymentMethods,onAddPaymentMethod:o[0]||(o[0]=e=>g.value="ADD_PAYMENT_METHOD"),onSuccess:X},null,8,["top-up-pricing-items","payment-methods"]))],512)],8,V),e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"ADD_PAYMENT_METHOD"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"addPaneRef",ref:I},[i.customer&&w.value?(e.openBlock(),e.createBlock(d._sfc_main,{key:0,ref_key:"paymentMethodFormRef",ref:$,"hide-submit-button":"",customer:i.customer,"payment-method-options":e.unref(v),"is-loading":e.unref(f),configuration:P.value,onSuccess:y,onFailure:o[1]||(o[1]=e=>n.$emit("payment-failed",e))},null,8,["customer","payment-method-options","is-loading","configuration"])):e.createCommentVNode("",!0)],512)],8,C),e.createElementVNode("div",{class:"sv-topup-modal__pane w-full shrink-0",inert:"SUCCESS"!==g.value||void 0},[e.createElementVNode("div",{ref_key:"successPaneRef",ref:O},[h.value?(e.openBlock(),e.createBlock(k,{key:0,"added-value":b.value,invoice:h.value},null,8,["added-value","invoice"])):e.createCommentVNode("",!0)],512)],8,S)],4)],6)])]),_:2},["SUCCESS"===g.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",T,[e.createVNode(e.unref(t._sfc_main$1),{size:"lg","data-testid":"done",onClick:Z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(W)),1)]),_:1})])]),key:"0"}:void 0]),1032,["show-modal","title","sub-title","cancel-button-text","confirm-button-text","is-loading"]))}});exports._sfc_main=B,exports.useTopUpModal=function(t){return{showModal:e.computed(()=>!!t.value)}};
|