@solvimon/solvimon-web 0.1.0-alpha.6 → 0.1.0-alpha.8
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/dist/ApiStatus-CyNDp_op.mjs +9 -0
- package/dist/ApiStatus-oqvUEWJx.js +1 -0
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-C-C0i6i6.js +1 -0
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-DZ1XkSJ3.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-CT0Tjsnw.mjs} +4 -4
- package/dist/{ContentWithAsideLayout-D_T137tN.mjs → ContentWithAsideLayout-BTdixy3L.mjs} +2 -11
- package/dist/ContentWithAsideLayout-oAYVrLvL.js +1 -0
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-DK6tiecN.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CK73bYUe.mjs} +11 -11
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CLU7Yiyx.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-B_WLgBur.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-BWXmZmGZ.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Dt_Vb7Wz.mjs} +2 -2
- package/dist/PaymentHistoryBlock-DHM-3fh-.js +1 -0
- package/dist/PaymentHistoryBlock-YzJ6bxKr.mjs +4 -0
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-BSn_Zy0Y.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-D6Cr2Uga.mjs} +5 -5
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DFw8lrDv.js +1 -0
- package/dist/PaymentIntegrationForm-Cl5ua8v8.js +1 -0
- package/dist/PaymentIntegrationForm-ID4QnvA3.mjs +4 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CVWPT3Ni.mjs +910 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DifRn1ok.js +1 -0
- package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-CKNMt-JH.js +1 -0
- package/dist/{PricingGroupContent.vue_vue_type_script_setup_true_lang-X7-dfeZP.mjs → PricingGroupContent.vue_vue_type_script_setup_true_lang-CzS32ZUt.mjs} +5 -30
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-AxYjVFUM.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BIxGqr9U.mjs} +20 -20
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CpEqDnO3.js +1 -0
- package/dist/adyen-51SvcyqV.mjs +4 -0
- package/dist/adyen-DZsyEXkw.js +1 -0
- package/dist/adyenLoader-CEH4A2b2.js +1 -0
- package/dist/adyenLoader-gsbzSjYV.mjs +177 -0
- package/dist/component-C2Gc-wsE.js +1 -0
- package/dist/component-CM9g6tbD.mjs +804 -0
- package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -1
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +14 -14
- package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +28 -32
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +3 -7
- package/dist/components/Invoice/Invoice.ce.d.ts +1 -1
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +42 -75
- package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -7
- package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -1
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +2 -6
- package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -7
- package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +10 -34
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -10
- package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +4 -8
- package/dist/components/WalletBalances/WalletBalances.ce.d.ts +1 -1
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
- package/dist/components/WalletBalances/WalletBalances.es.js +3 -7
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/core/types.d.ts +2 -0
- package/dist/customer-C_Hz_npf.js +1 -0
- package/dist/customer-TIi7iZFw.mjs +32 -0
- package/dist/en-US-CBoPxQwX.mjs +199 -0
- package/dist/en-US-DJq-9dD8.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4 -1
- package/dist/{invoices-C7BHqB0g.mjs → invoices-BuVOuTOm.mjs} +2 -1
- package/dist/invoices-DbvwXAsm.js +1 -0
- package/dist/nl-NL-BB7KbK-h.mjs +181 -0
- package/dist/nl-NL-CtU1Lg2F.js +1 -0
- package/dist/paymentMethods-B4AYGf0K.js +1 -0
- package/dist/{paymentMethods-BA7Kt8ti.mjs → paymentMethods-Di32oJ39.mjs} +2 -1
- package/dist/{payments-NTHUh5je.mjs → payments-C5fD1PXB.mjs} +1 -1
- package/dist/{payments-B8W0W6wZ.js → payments-DeutKq9x.js} +1 -1
- package/dist/{registry-DgRnFEVF.mjs → registry-BLwMl1bK.mjs} +6 -5
- package/dist/registry-CMSmkLcy.js +1 -0
- package/dist/screens/Checkout/Checkout.ce.d.ts +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +589 -857
- package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +13 -14
- package/dist/screens/PayInvoice/PayInvoice.ce.d.ts +3 -0
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -0
- package/dist/screens/PayInvoice/PayInvoice.es.js +456 -0
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +1 -1
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -1
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +81 -57
- package/dist/solvimon-web.css +1 -1
- package/dist/source-DKDKBlUm.mjs +179 -0
- package/dist/source-dkMNFWDc.js +1 -0
- package/dist/{subscriptions-BEoXaAHw.mjs → subscriptions-mOgjjzUi.mjs} +2 -1
- package/dist/subscriptions-wdMADcQZ.js +1 -0
- package/dist/{useActionDispatchProvider-zSXRlc2S.mjs → useActionDispatchProvider-B4gszz0Q.mjs} +1 -1
- package/dist/{useActionDispatchProvider-DmTJ_bqE.js → useActionDispatchProvider-DfS2P0bd.js} +1 -1
- package/dist/useCustomer-DanZzn-l.js +1 -0
- package/dist/useCustomer-cbhDyWJL.mjs +25 -0
- package/dist/useIncrementalLoading-DFe5Yh8M.js +1 -0
- package/dist/{useIncrementalLoading-Bgs0mqyb.mjs → useIncrementalLoading-RRicokf1.mjs} +3 -4
- package/dist/useInvoiceData-CxxHa5R2.js +1 -0
- package/dist/{useInvoiceData-B6P2VShe.mjs → useInvoiceData-fS6G_244.mjs} +6 -12
- package/dist/{useInvoicesList-23Ra-23Z.mjs → useInvoicesList-BQQxcPdz.mjs} +22 -22
- package/dist/useInvoicesList-CtJqmblZ.js +1 -0
- package/dist/usePaymentMethodOptions-2MloZ9bY.mjs +26 -0
- package/dist/usePaymentMethodOptions-D01YWW3G.js +1 -0
- package/dist/{usePaymentMethods-BK4unvj2.js → usePaymentMethods-Cm9WdSW0.js} +1 -1
- package/dist/{usePaymentMethods-B8Nft16c.mjs → usePaymentMethods-DZvfWSlx.mjs} +2 -2
- package/dist/usePayments-B13S_yai.js +1 -0
- package/dist/usePayments-D4uGKBsV.mjs +36 -0
- package/dist/usePortal-DJDJNLbo.mjs +12 -0
- package/dist/usePortal-DWJEVkTj.js +1 -0
- package/dist/useService-9fCKPTmu.js +1 -0
- package/dist/useService-BuWWE5ND.mjs +68 -0
- package/dist/useViewport-Bu0cyeSi.mjs +38 -0
- package/dist/useViewport-CKRY1CKR.js +1 -0
- package/dist/{useWalletBalanceItems-DreHuOra.mjs → useWalletBalanceItems-B53Gkjro.mjs} +8 -7
- package/dist/useWalletBalanceItems-BMaVT4TW.js +1 -0
- package/dist/useWatchDebounced-2ZLnfgvG.js +1 -0
- package/dist/useWatchDebounced-D1xuIX6_.mjs +12 -0
- package/dist/vendor-ui-BwxuPDg8.mjs +28598 -0
- package/dist/vendor-ui-Ce_Yp7xA.js +1 -0
- package/package.json +30 -17
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-eRGZRjmq.js +0 -1
- package/dist/ContentWithAsideLayout-BZJPhvLh.js +0 -1
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BvmKLc2H.js +0 -1
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DNWspHtC.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Cx4c8E4i.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Ct26TY0a.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-WRXecMCj.mjs +0 -6568
- package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-KnhKv07X.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-D9_G7CyE.js +0 -1
- package/dist/_Uint8Array-DHE03FZr.mjs +0 -507
- package/dist/_Uint8Array-DxISR7XF.js +0 -1
- package/dist/cloneDeep-DranHQkY.js +0 -1
- package/dist/cloneDeep-sm9cY-u2.mjs +0 -212
- package/dist/component-DI3AxwdD.mjs +0 -58733
- package/dist/component-yWF07boR.js +0 -1
- package/dist/index-2jo9BSPM.js +0 -1
- package/dist/index-BFZ0dPh9.mjs +0 -179
- package/dist/index-CWSXne1Q.js +0 -1
- package/dist/index-D3v7hAtc.mjs +0 -253
- package/dist/invoices-CjBHfDXp.js +0 -1
- package/dist/paymentMethods-A-5SBmy1.js +0 -1
- package/dist/registry-SwmYGFn7.js +0 -1
- package/dist/sprite-DZD704h3-CCc3Mz1x.js +0 -1
- package/dist/sprite-DZD704h3-DZD704h3.mjs +0 -4
- package/dist/subscriptions-DSi93KpN.js +0 -1
- package/dist/useCustomer-DkrBNt5f.mjs +0 -45
- package/dist/useCustomer-fK-w7ifj.js +0 -1
- package/dist/useIncrementalLoading-BK6N8sYW.js +0 -1
- package/dist/useInvoiceData-CS7hLTea.js +0 -1
- package/dist/useInvoicesList-CIFGVsDj.js +0 -1
- package/dist/useService-B4qv5N2D.mjs +0 -281
- package/dist/useService-D-CUtlp3.js +0 -1
- package/dist/useWalletBalanceItems-NlFk6jPD.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SolvimonBillingInformation: import('
|
|
1
|
+
export declare const SolvimonBillingInformation: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
|
|
2
2
|
export declare const COMPONENT_NAME: string;
|
|
3
3
|
export declare const defineSolvimonBillingInformation: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../BillingInformation.vue_vue_type_script_setup_true_lang-C-C0i6i6.js"),o=require("../../useCustomer-DanZzn-l.js"),r=require("../../useLoadInitialData-BRg7IWqW.js"),n=require("../../component-C2Gc-wsE.js"),l=e.defineComponent({__name:"BillingInformation.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},branding:{type:Object},configuration:{type:Object}},setup(t){const n=t.portalObject.customer_id,l=o.useCustomer({customerId:n}),{isLoading:i}=r.useLoadInitialData(l.get.execute());return(t,o)=>e.renderSlot(t.$slots,"default",{customer:e.unref(l),isLoading:e.unref(i)})}}),i=e.defineComponent({__name:"BillingInformation.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},branding:{type:Object},configuration:{type:Object}},setup:o=>(r,i)=>{var a,s,c,m;return e.openBlock(),e.createBlock(e.unref(n._sfc_main),{"custom-element-name":e.unref(p),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==(m=null==(c=o.branding)?void 0:c.colors)?void 0:m.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,onError:i[0]||(i[0]=e=>r.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(l,e.normalizeProps(e.guardReactiveProps(r.$props)),{default:e.withCtx(({customer:o,isLoading:r})=>[e.createVNode(t._sfc_main,{"is-loading":r,customer:o.customer.value},null,8,["is-loading","customer"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),a=n.defineCustomElement(i),p=n.getComponentName("billing-information");exports.COMPONENT_NAME=p,exports.SolvimonBillingInformation=a,exports.defineSolvimonBillingInformation=()=>{customElements.get(p)||customElements.define(p,a)};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, renderSlot, unref, openBlock, createBlock, withCtx, createVNode, normalizeProps, guardReactiveProps
|
|
2
|
-
import { _ as _sfc_main$3 } from "../../BillingInformation.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { u as useCustomer } from "../../useCustomer-
|
|
4
|
-
import {
|
|
1
|
+
import { defineComponent, renderSlot, unref, openBlock, createBlock, withCtx, createVNode, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { _ as _sfc_main$3 } from "../../BillingInformation.vue_vue_type_script_setup_true_lang-CT0Tjsnw.mjs";
|
|
3
|
+
import { u as useCustomer } from "../../useCustomer-cbhDyWJL.mjs";
|
|
4
|
+
import { u as useLoadInitialData } from "../../useLoadInitialData-Dm48tlSO.mjs";
|
|
5
|
+
import { _ as _sfc_main$2, d as defineCustomElement, g as getComponentName } from "../../component-CM9g6tbD.mjs";
|
|
5
6
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6
7
|
__name: "BillingInformation.entry.view",
|
|
7
8
|
props: {
|
|
@@ -9,7 +10,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
9
10
|
locale: { type: String },
|
|
10
11
|
dateLocale: { type: String },
|
|
11
12
|
messages: { type: Object },
|
|
12
|
-
showTimezones: { type: Boolean },
|
|
13
13
|
primaryColor: { type: String },
|
|
14
14
|
secondaryColor: { type: String },
|
|
15
15
|
isShadowRoot: { type: Boolean },
|
|
@@ -18,7 +18,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
onLog: { type: Function },
|
|
19
19
|
allowedPortalTypes: { type: Array },
|
|
20
20
|
portalObject: { type: Object },
|
|
21
|
-
customElementName: { type: String },
|
|
22
21
|
branding: { type: Object },
|
|
23
22
|
configuration: { type: Object }
|
|
24
23
|
},
|
|
@@ -26,8 +25,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
26
25
|
const props = __props;
|
|
27
26
|
const customerId = props.portalObject.customer_id;
|
|
28
27
|
const customer = useCustomer({ customerId });
|
|
28
|
+
const { isLoading } = useLoadInitialData(customer.get.execute());
|
|
29
29
|
return (_ctx, _cache) => {
|
|
30
|
-
return renderSlot(_ctx.$slots, "default", {
|
|
30
|
+
return renderSlot(_ctx.$slots, "default", {
|
|
31
|
+
customer: unref(customer),
|
|
32
|
+
isLoading: unref(isLoading)
|
|
33
|
+
});
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
});
|
|
@@ -38,7 +41,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
41
|
locale: { type: String },
|
|
39
42
|
dateLocale: { type: String },
|
|
40
43
|
messages: { type: Object },
|
|
41
|
-
showTimezones: { type: Boolean },
|
|
42
44
|
primaryColor: { type: String },
|
|
43
45
|
secondaryColor: { type: String },
|
|
44
46
|
isShadowRoot: { type: Boolean },
|
|
@@ -47,7 +49,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
49
|
onLog: { type: Function },
|
|
48
50
|
allowedPortalTypes: { type: Array },
|
|
49
51
|
portalObject: { type: Object },
|
|
50
|
-
customElementName: { type: String },
|
|
51
52
|
branding: { type: Object },
|
|
52
53
|
configuration: { type: Object }
|
|
53
54
|
},
|
|
@@ -69,12 +70,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
70
|
}, {
|
|
70
71
|
default: withCtx(() => [
|
|
71
72
|
createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
|
|
72
|
-
default: withCtx(({ customer }) => [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"is-loading": customer.get.isPending.value,
|
|
73
|
+
default: withCtx(({ customer, isLoading }) => [
|
|
74
|
+
createVNode(_sfc_main$3, {
|
|
75
|
+
"is-loading": isLoading,
|
|
76
76
|
customer: customer.customer.value
|
|
77
|
-
}, null, 8, ["is-loading", "customer"])
|
|
77
|
+
}, null, 8, ["is-loading", "customer"])
|
|
78
78
|
]),
|
|
79
79
|
_: 1
|
|
80
80
|
}, 16)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SolvimonBillingInformationForm: import('
|
|
1
|
+
export declare const SolvimonBillingInformationForm: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
|
|
2
2
|
export declare const COMPONENT_NAME: string;
|
|
3
3
|
export declare const defineSolvimonBillingInformationForm: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-yWF07boR.js"),a=require("../../index-DRdBmZ2-.js"),o=require("../../cloneDeep-DranHQkY.js"),r=require("../../useCustomer-fK-w7ifj.js"),l={type:"INDIVIDUAL",email:"",country:"",addressLine1:"",postalCode:"",city:"",state:""};function n({initialState:r={},onSubmit:n}){const{form:s,validation:u,changes:c,hasChanges:m,updateInitialState:p,initialState:f}=(({initialState:a,validationRules:r,nullifyEmptyValues:l=!1,mode:n="shallow"})=>{const i=e.shallowRef(o.cloneDeep(a)),d=e.shallowRef(o.cloneDeep(a)),s=t.useValidation(r??{},d),u=e.computed(()=>t.objectDiff({from:i.value,to:d.value,mode:n,nullifyEmptyValues:l})),c=e.computed(()=>Object.entries(u.value).length>0);return{form:d,validation:s,changes:u,hasChanges:c,reset:()=>{d.value=o.cloneDeep(a),s.value.$reset()},updateInitialState:e=>{d.value=o.cloneDeep(e),i.value=o.cloneDeep(e)},initialState:i}})({initialState:{...l,...r},validationRules:{email:{required:a.required,email:a.email}},nullifyEmptyValues:!0,mode:"deep"});return{form:s,isOrganization:t.isOrganization,validation:u,changes:c,hasChanges:m,updateInitialState:e=>{p(i(e))},submit:(e,t=s.value)=>n({customerId:e,payload:d(t)}),initialState:f}}const i=e=>{var a,o,r,l;if(t.isIndividual(e)){const t=e.individual.residential_address;return{type:"INDIVIDUAL",email:e.email??"",country:(null==t?void 0:t.country)??"",addressLine1:(null==t?void 0:t.line1)??"",addressLine2:(null==t?void 0:t.line2)??"",postalCode:(null==t?void 0:t.postal_code)??"",city:(null==t?void 0:t.city)??"",state:(null==t?void 0:t.state)??"",firstName:(null==(a=e.individual.name)?void 0:a.first_name)??"",lastName:(null==(o=e.individual.name)?void 0:o.last_name)??""}}const n=e.organization.registered_address;return{type:"ORGANIZATION",email:e.email??"",country:(null==n?void 0:n.country)??"",addressLine1:(null==n?void 0:n.line1)??"",addressLine2:(null==n?void 0:n.line2)??"",postalCode:(null==n?void 0:n.postal_code)??"",city:(null==n?void 0:n.city)??"",state:(null==n?void 0:n.state)??"",companyLegalName:e.organization.legal_name??"",companyVatNumber:(null==(l=null==(r=e.organization.tax_ids)?void 0:r[0])?void 0:l.id)??""}},d=e=>"ORGANIZATION"===e.type?{type:"ORGANIZATION",email:e.email,organization:{legal_name:e.companyLegalName??"",tax_ids:e.companyVatNumber?[{id:e.companyVatNumber,type:"GENERIC_TAX_ID"}]:void 0,registered_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}}:{type:"INDIVIDUAL",email:e.email,individual:{name:{first_name:e.firstName??"",last_name:e.lastName??""},residential_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}},s={class:"grid grid-cols-1 gap-4"},u={class:"flex grow flex-col"},c={class:"mt-6 flex items-center justify-between gap-4"},m={class:"flex flex-col gap-2"},p={key:0,class:"grid grid-cols-2 gap-2"},f={class:"grid grid-cols-3 gap-2"},h=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},isLoading:{type:Boolean},apiError:{type:null},updateCustomer:{type:Function}},setup(a){const o=a,{$t:r}=t.useIntl(),{validation:l,form:i,updateInitialState:d,submit:h,hasChanges:g}=n({onSubmit:({customerId:e,payload:t})=>o.updateCustomer({customerId:e,payload:t})}),y=e.ref(!1),_=e.computed(()=>"ORGANIZATION"===i.value.type),v=e.computed(()=>!y.value),b=e.computed({get:()=>_.value,set:e=>i.value.type=e?"ORGANIZATION":"INDIVIDUAL"}),V=async()=>{var e;await l.value.$validate();!l.value.$invalid&&(null==(e=o.customer)?void 0:e.id)&&await h(o.customer.id)};return e.watch(()=>o.customer,e=>{e&&!y.value&&(d(e),y.value=!0)},{immediate:!0}),(o,n)=>{var d,h,y,N,k,C,E,S,I,L,T,x,B;return e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(V,["prevent"])},[e.createVNode(e.unref(t._sfc_main$2),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})),1)]),_:1}),e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).email,"onUpdate:modelValue":n[0]||(n[0]=t=>e.unref(i).email=t),required:"",type:"email",label:e.unref(r)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"}),error:(null==(d=e.unref(l).value.email)?void 0:d.$errors)||(null==(h=a.apiError)?void 0:h.email)},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$1$),{"single-model-value":e.unref(i).country,"onUpdate:singleModelValue":n[1]||(n[1]=t=>e.unref(i).country=t),label:e.unref(r)({defaultMessage:"Country",id:"checkout.country.label",description:"The country of the customer in the checkout form"}),error:null==(y=a.apiError)?void 0:y.country},null,8,["single-model-value","label","error"]),v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$20),{key:0,modelValue:b.value,"onUpdate:modelValue":n[2]||(n[2]=e=>b.value=e),"label-position":"before"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",u,[e.createVNode(e.unref(t._sfc_main$2),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).companyVatNumber,"onUpdate:modelValue":n[3]||(n[3]=t=>e.unref(i).companyVatNumber=t),name:"vat_number",label:e.unref(r)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:null==(N=a.apiError)?void 0:N.vat_number},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).companyLegalName,"onUpdate:modelValue":n[4]||(n[4]=t=>e.unref(i).companyLegalName=t),required:"",name:"legal_name",label:e.unref(r)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"}),error:null==(k=a.apiError)?void 0:k.legal_name},null,8,["modelValue","label","placeholder","error"])],64)):e.createCommentVNode("",!0)]),e.createElementVNode("div",c,[e.createVNode(e.unref(t._sfc_main$2),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Billing details",id:"checkout.billing_information_block.title",description:"The title of the billing information block in the checkout form"})),1)]),_:1})]),e.createElementVNode("div",m,[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",p,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).firstName,"onUpdate:modelValue":n[5]||(n[5]=t=>e.unref(i).firstName=t),name:"first_name",label:e.unref(r)({defaultMessage:"First name",id:"checkout.first_name.label",description:"The first name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"First name...",id:"checkout.first_name.placeholder",description:"The first name of the customer in the checkout form"}),error:null==(C=a.apiError)?void 0:C.first_name},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).lastName,"onUpdate:modelValue":n[6]||(n[6]=t=>e.unref(i).lastName=t),name:"last_name",label:e.unref(r)({defaultMessage:"Last name",id:"checkout.last_name.label",description:"The last name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Last name...",id:"checkout.last_name.placeholder",description:"The last name of the customer in the checkout form"}),error:null==(E=a.apiError)?void 0:E.last_name},null,8,["modelValue","label","placeholder","error"])])),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).addressLine1,"onUpdate:modelValue":n[7]||(n[7]=t=>e.unref(i).addressLine1=t),name:"address_line_1",label:e.unref(r)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"}),error:null==(S=a.apiError)?void 0:S.address_line_1},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).addressLine2,"onUpdate:modelValue":n[8]||(n[8]=t=>e.unref(i).addressLine2=t),name:"address_line_2",placeholder:e.unref(r)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"}),error:null==(I=a.apiError)?void 0:I.address_line_2},null,8,["modelValue","placeholder","error"]),e.createElementVNode("div",f,[e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).postalCode,"onUpdate:modelValue":n[9]||(n[9]=t=>e.unref(i).postalCode=t),name:"postal_code",placeholder:e.unref(r)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"}),error:null==(L=a.apiError)?void 0:L.postal_code},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).city,"onUpdate:modelValue":n[10]||(n[10]=t=>e.unref(i).city=t),name:"city",placeholder:e.unref(r)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"}),error:null==(T=a.apiError)?void 0:T.city},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$2a),{modelValue:e.unref(i).state,"onUpdate:modelValue":n[11]||(n[11]=t=>e.unref(i).state=t),name:"state",placeholder:e.unref(r)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"}),error:null==(x=a.apiError)?void 0:x.state},null,8,["modelValue","placeholder","error"])])]),(null==(B=a.apiError)?void 0:B._generic)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),{key:0,class:"mt-4",title:a.apiError._generic},null,8,["title"])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$2H),{type:"submit",color:"primary",disabled:!e.unref(g),loading:a.isLoading,class:"mt-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Save changes",id:"billing_information_form.submit_button.label",description:"The label for the submit button of the billing information form"})),1)]),_:1},8,["disabled","loading"])],32)}}}),g=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},apiError:{type:null},updateCustomer:{type:Function},isLoading:{type:Boolean}},setup:t=>(a,o)=>(e.openBlock(),e.createBlock(h,{customer:t.customer,"update-customer":t.updateCustomer,"is-loading":t.isLoading,"api-error":t.apiError},null,8,["customer","update-customer","is-loading","api-error"]))}),y=e.defineComponent({__name:"BillingInformationForm.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object}},setup(a){const o=a.portalObject.customer_id,{customer:l,get:n,update:i}=r.useCustomer({customerId:o});return e.onMounted(async()=>{await n.execute()}),(a,o)=>e.renderSlot(a.$slots,"default",{customer:e.unref(l),isLoading:e.unref(n).isPending.value||e.unref(i).isPending.value,updateCustomer:e.unref(i),apiError:e.unref(t.getApiError)(e.unref(i).error)})}}),_=e.defineComponent({__name:"BillingInformationForm.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object}},emits:["error"],setup:a=>(o,r)=>{var l,n,i,d;return e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"custom-element-name":e.unref(b),environment:a.environment,locale:a.locale,"portal-object":a.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(n=null==(l=a.branding)?void 0:l.colors)?void 0:n.primary,"secondary-color":null==(d=null==(i=a.branding)?void 0:i.colors)?void 0:d.secondary,"experimental-features":a.experimentalFeatures,"log-level":a.logLevel,"on-log":a.onLog,onError:r[0]||(r[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({customer:t,updateCustomer:a,isLoading:o,apiError:r})=>[t?(e.openBlock(),e.createBlock(g,{key:0,customer:t,"is-loading":o,"update-customer":({payload:e})=>a.execute(e),"api-error":r},null,8,["customer","is-loading","update-customer","api-error"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),v=t.defineCustomElement(_),b=t.getComponentName("billing-information-form");exports.COMPONENT_NAME=b,exports.SolvimonBillingInformationForm=v,exports.defineSolvimonBillingInformationForm=()=>{customElements.get(b)||customElements.define(b,v)};
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-Ce_Yp7xA.js"),a=require("../../index-DRdBmZ2-.js"),o=require("../../useCustomer-DanZzn-l.js"),r=require("../../component-C2Gc-wsE.js"),l={type:"INDIVIDUAL",email:"",country:"",addressLine1:"",postalCode:"",city:"",state:""};function n({initialState:o={},onSubmit:r}){const{form:n,validation:s,changes:u,hasChanges:c,updateInitialState:m,initialState:p}=(({initialState:a,validationRules:o,nullifyEmptyValues:r=!1,mode:l="shallow"})=>{const n=e.shallowRef(structuredClone(a)),i=e.shallowRef(structuredClone(a)),d=t.useValidation(o??{},i),s=e.computed(()=>t.objectDiff({from:n.value,to:i.value,mode:l,nullifyEmptyValues:r})),u=e.computed(()=>Object.entries(s.value).length>0);return{form:i,validation:d,changes:s,hasChanges:u,reset:()=>{i.value=structuredClone(a),d.value.$reset()},updateInitialState:e=>{i.value=structuredClone(e),n.value=structuredClone(e)},initialState:n}})({initialState:{...l,...o},validationRules:{email:{required:a.required,email:a.email}},nullifyEmptyValues:!0,mode:"deep"});return{form:n,isOrganization:t.isOrganization,validation:s,changes:u,hasChanges:c,updateInitialState:e=>{m(i(e))},submit:(e,t=n.value)=>r({customerId:e,payload:d(t)}),initialState:p}}const i=e=>{var a,o,r,l;if(t.isIndividual(e)){const t=e.individual.residential_address;return{type:"INDIVIDUAL",email:e.email??"",country:(null==t?void 0:t.country)??"",addressLine1:(null==t?void 0:t.line1)??"",addressLine2:(null==t?void 0:t.line2)??"",postalCode:(null==t?void 0:t.postal_code)??"",city:(null==t?void 0:t.city)??"",state:(null==t?void 0:t.state)??"",firstName:(null==(a=e.individual.name)?void 0:a.first_name)??"",lastName:(null==(o=e.individual.name)?void 0:o.last_name)??""}}const n=e.organization.registered_address;return{type:"ORGANIZATION",email:e.email??"",country:(null==n?void 0:n.country)??"",addressLine1:(null==n?void 0:n.line1)??"",addressLine2:(null==n?void 0:n.line2)??"",postalCode:(null==n?void 0:n.postal_code)??"",city:(null==n?void 0:n.city)??"",state:(null==n?void 0:n.state)??"",companyLegalName:e.organization.legal_name??"",companyVatNumber:(null==(l=null==(r=e.organization.tax_ids)?void 0:r[0])?void 0:l.id)??""}},d=e=>"ORGANIZATION"===e.type?{type:"ORGANIZATION",email:e.email,organization:{legal_name:e.companyLegalName??"",tax_ids:e.companyVatNumber?[{id:e.companyVatNumber,type:"GENERIC_TAX_ID"}]:void 0,registered_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}}:{type:"INDIVIDUAL",email:e.email,individual:{name:{first_name:e.firstName??"",last_name:e.lastName??""},residential_address:{line1:e.addressLine1,line2:e.addressLine2??"",postal_code:e.postalCode,city:e.city,country:e.country,state:e.state??""}}},s={class:"grid grid-cols-1 gap-4"},u={class:"flex grow flex-col"},c={class:"mt-6 flex items-center justify-between gap-4"},m={class:"flex flex-col gap-2"},p={key:0,class:"grid grid-cols-2 gap-2"},f={class:"grid grid-cols-3 gap-2"},h=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},isLoading:{type:Boolean},apiError:{type:null},updateCustomer:{type:Function}},setup(a){const o=a,{$t:r}=t.useIntl(),{validation:l,form:i,updateInitialState:d,submit:h,hasChanges:g}=n({onSubmit:({customerId:e,payload:t})=>o.updateCustomer({customerId:e,payload:t})}),y=e.ref(!1),_=e.computed(()=>"ORGANIZATION"===i.value.type),v=e.computed(()=>!y.value),b=e.computed({get:()=>_.value,set:e=>i.value.type=e?"ORGANIZATION":"INDIVIDUAL"}),V=async()=>{var e;await l.value.$validate();!l.value.$invalid&&(null==(e=o.customer)?void 0:e.id)&&await h(o.customer.id)};return e.watch(()=>o.customer,e=>{e&&!y.value&&(d(e),y.value=!0)},{immediate:!0}),(o,n)=>{var d,h,y,N,k,C,E,I,S,L,T,x,M;return e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(V,["prevent"])},[e.createVNode(e.unref(t._sfc_main),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})),1)]),_:1}),e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).email,"onUpdate:modelValue":n[0]||(n[0]=t=>e.unref(i).email=t),required:"",type:"email",label:e.unref(r)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"}),error:(null==(d=e.unref(l).email)?void 0:d.$errors)||(null==(h=a.apiError)?void 0:h.email)},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$22),{"single-model-value":e.unref(i).country,"onUpdate:singleModelValue":n[1]||(n[1]=t=>e.unref(i).country=t),label:e.unref(r)({defaultMessage:"Country",id:"checkout.country.label",description:"The country of the customer in the checkout form"}),error:null==(y=a.apiError)?void 0:y.country},null,8,["single-model-value","label","error"]),v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$23),{key:0,modelValue:b.value,"onUpdate:modelValue":n[2]||(n[2]=e=>b.value=e),"label-position":"before"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",u,[e.createVNode(e.unref(t._sfc_main),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).companyVatNumber,"onUpdate:modelValue":n[3]||(n[3]=t=>e.unref(i).companyVatNumber=t),name:"vat_number",label:e.unref(r)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:null==(N=a.apiError)?void 0:N.vat_number},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).companyLegalName,"onUpdate:modelValue":n[4]||(n[4]=t=>e.unref(i).companyLegalName=t),required:"",name:"legal_name",label:e.unref(r)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"}),error:null==(k=a.apiError)?void 0:k.legal_name},null,8,["modelValue","label","placeholder","error"])],64)):e.createCommentVNode("",!0)]),e.createElementVNode("div",c,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Billing details",id:"checkout.billing_information_block.title",description:"The title of the billing information block in the checkout form"})),1)]),_:1})]),e.createElementVNode("div",m,[_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",p,[e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).firstName,"onUpdate:modelValue":n[5]||(n[5]=t=>e.unref(i).firstName=t),name:"first_name",label:e.unref(r)({defaultMessage:"First name",id:"checkout.first_name.label",description:"The first name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"First name...",id:"checkout.first_name.placeholder",description:"The first name of the customer in the checkout form"}),error:null==(C=a.apiError)?void 0:C.first_name},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).lastName,"onUpdate:modelValue":n[6]||(n[6]=t=>e.unref(i).lastName=t),name:"last_name",label:e.unref(r)({defaultMessage:"Last name",id:"checkout.last_name.label",description:"The last name of the customer in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Last name...",id:"checkout.last_name.placeholder",description:"The last name of the customer in the checkout form"}),error:null==(E=a.apiError)?void 0:E.last_name},null,8,["modelValue","label","placeholder","error"])])),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).addressLine1,"onUpdate:modelValue":n[7]||(n[7]=t=>e.unref(i).addressLine1=t),name:"address_line_1",label:e.unref(r)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(r)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"}),error:null==(I=a.apiError)?void 0:I.address_line_1},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).addressLine2,"onUpdate:modelValue":n[8]||(n[8]=t=>e.unref(i).addressLine2=t),name:"address_line_2",placeholder:e.unref(r)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"}),error:null==(S=a.apiError)?void 0:S.address_line_2},null,8,["modelValue","placeholder","error"]),e.createElementVNode("div",f,[e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).postalCode,"onUpdate:modelValue":n[9]||(n[9]=t=>e.unref(i).postalCode=t),name:"postal_code",placeholder:e.unref(r)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"}),error:null==(L=a.apiError)?void 0:L.postal_code},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).city,"onUpdate:modelValue":n[10]||(n[10]=t=>e.unref(i).city=t),name:"city",placeholder:e.unref(r)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"}),error:null==(T=a.apiError)?void 0:T.city},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{modelValue:e.unref(i).state,"onUpdate:modelValue":n[11]||(n[11]=t=>e.unref(i).state=t),name:"state",placeholder:e.unref(r)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"}),error:null==(x=a.apiError)?void 0:x.state},null,8,["modelValue","placeholder","error"])])]),(null==(M=a.apiError)?void 0:M._generic)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$15),{key:0,class:"mt-4",title:a.apiError._generic},null,8,["title"])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$3),{type:"submit",color:"primary",disabled:!e.unref(g),loading:a.isLoading,class:"mt-4"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Save changes",id:"billing_information_form.submit_button.label",description:"The label for the submit button of the billing information form"})),1)]),_:1},8,["disabled","loading"])],32)}}}),g=e.defineComponent({__name:"BillingInformationForm",props:{customer:{type:Object},apiError:{type:null},updateCustomer:{type:Function},isLoading:{type:Boolean}},setup:t=>(a,o)=>(e.openBlock(),e.createBlock(h,{customer:t.customer,"update-customer":t.updateCustomer,"is-loading":t.isLoading,"api-error":t.apiError},null,8,["customer","update-customer","is-loading","api-error"]))}),y=e.defineComponent({__name:"BillingInformationForm.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},branding:{type:Object}},setup(a){const r=a.portalObject.customer_id,{customer:l,get:n,update:i}=o.useCustomer({customerId:r});return e.onMounted(async()=>{await n.execute()}),(a,o)=>e.renderSlot(a.$slots,"default",{customer:e.unref(l),isLoading:e.unref(n).isPending.value||e.unref(i).isPending.value,updateCustomer:e.unref(i),apiError:e.unref(t.getApiError)(e.unref(i).error)})}}),_=e.defineComponent({__name:"BillingInformationForm.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},branding:{type:Object}},emits:["error"],setup:t=>(a,o)=>{var l,n,i,d;return e.openBlock(),e.createBlock(e.unref(r._sfc_main),{"custom-element-name":e.unref(b),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(n=null==(l=t.branding)?void 0:l.colors)?void 0:n.primary,"secondary-color":null==(d=null==(i=t.branding)?void 0:i.colors)?void 0:d.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,onError:o[0]||(o[0]=e=>a.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(y,e.normalizeProps(e.guardReactiveProps(a.$props)),{default:e.withCtx(({customer:t,updateCustomer:a,isLoading:o,apiError:r})=>[t?(e.openBlock(),e.createBlock(g,{key:0,customer:t,"is-loading":o,"update-customer":({payload:e})=>a.execute(e),"api-error":r},null,8,["customer","is-loading","update-customer","api-error"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),v=r.defineCustomElement(_),b=r.getComponentName("billing-information-form");exports.COMPONENT_NAME=b,exports.SolvimonBillingInformationForm=v,exports.defineSolvimonBillingInformationForm=()=>{customElements.get(b)||customElements.define(b,v)};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { shallowRef, computed, defineComponent, ref, watch, openBlock, createElementBlock, withModifiers, createVNode, unref, withCtx, createTextVNode, toDisplayString, createElementVNode, createBlock, createCommentVNode, Fragment, onMounted, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { H as useValidation, J as objectDiff, K as isOrganization, L as isIndividual, u as useIntl, _ as _sfc_main$4, M as _sfc_main$5, N as _sfc_main$6, O as _sfc_main$7, A as _sfc_main$8, e as _sfc_main$9, P as getApiError } from "../../vendor-ui-BwxuPDg8.mjs";
|
|
3
3
|
import { e as email, r as required } from "../../index-CzL1ZcGi.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { u as useCustomer } from "../../useCustomer-cbhDyWJL.mjs";
|
|
5
|
+
import { _ as _sfc_main$a, d as defineCustomElement, g as getComponentName } from "../../component-CM9g6tbD.mjs";
|
|
6
6
|
const useForm = ({
|
|
7
7
|
initialState,
|
|
8
8
|
validationRules,
|
|
9
9
|
nullifyEmptyValues = false,
|
|
10
10
|
mode = "shallow"
|
|
11
11
|
}) => {
|
|
12
|
-
const initialFormState = shallowRef(
|
|
13
|
-
const form = shallowRef(
|
|
12
|
+
const initialFormState = shallowRef(structuredClone(initialState));
|
|
13
|
+
const form = shallowRef(structuredClone(initialState));
|
|
14
14
|
const validation = useValidation(validationRules ?? {}, form);
|
|
15
15
|
const changes = computed(
|
|
16
16
|
() => objectDiff({ from: initialFormState.value, to: form.value, mode, nullifyEmptyValues })
|
|
17
17
|
);
|
|
18
18
|
const hasChanges = computed(() => Object.entries(changes.value).length > 0);
|
|
19
19
|
const updateInitialState = (state) => {
|
|
20
|
-
form.value =
|
|
21
|
-
initialFormState.value =
|
|
20
|
+
form.value = structuredClone(state);
|
|
21
|
+
initialFormState.value = structuredClone(state);
|
|
22
22
|
};
|
|
23
23
|
const reset = () => {
|
|
24
|
-
form.value =
|
|
24
|
+
form.value = structuredClone(initialState);
|
|
25
25
|
validation.value.$reset();
|
|
26
26
|
};
|
|
27
27
|
return {
|
|
@@ -209,7 +209,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
209
209
|
return openBlock(), createElementBlock("form", {
|
|
210
210
|
onSubmit: withModifiers(handleSubmit, ["prevent"])
|
|
211
211
|
}, [
|
|
212
|
-
createVNode(unref(_sfc_main$
|
|
212
|
+
createVNode(unref(_sfc_main$4), {
|
|
213
213
|
variant: "heading-3",
|
|
214
214
|
tag: "h2"
|
|
215
215
|
}, {
|
|
@@ -223,7 +223,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
223
223
|
_: 1
|
|
224
224
|
}),
|
|
225
225
|
createElementVNode("div", _hoisted_1, [
|
|
226
|
-
createVNode(unref(_sfc_main$
|
|
226
|
+
createVNode(unref(_sfc_main$5), {
|
|
227
227
|
modelValue: unref(form).email,
|
|
228
228
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(form).email = $event),
|
|
229
229
|
required: "",
|
|
@@ -238,9 +238,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
238
238
|
id: "checkout.email_address.placeholder",
|
|
239
239
|
description: "The email address of the customer in the checkout form"
|
|
240
240
|
}),
|
|
241
|
-
error: ((_a = unref(validation).
|
|
241
|
+
error: ((_a = unref(validation).email) == null ? void 0 : _a.$errors) || ((_b = __props.apiError) == null ? void 0 : _b.email)
|
|
242
242
|
}, null, 8, ["modelValue", "label", "placeholder", "error"]),
|
|
243
|
-
createVNode(unref(_sfc_main$
|
|
243
|
+
createVNode(unref(_sfc_main$6), {
|
|
244
244
|
"single-model-value": unref(form).country,
|
|
245
245
|
"onUpdate:singleModelValue": _cache[1] || (_cache[1] = ($event) => unref(form).country = $event),
|
|
246
246
|
label: unref($t)({
|
|
@@ -250,7 +250,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
250
250
|
}),
|
|
251
251
|
error: (_c = __props.apiError) == null ? void 0 : _c.country
|
|
252
252
|
}, null, 8, ["single-model-value", "label", "error"]),
|
|
253
|
-
showCompanyPurchaseToggle.value ? (openBlock(), createBlock(unref(_sfc_main$
|
|
253
|
+
showCompanyPurchaseToggle.value ? (openBlock(), createBlock(unref(_sfc_main$7), {
|
|
254
254
|
key: 0,
|
|
255
255
|
modelValue: companyPurchaseModel.value,
|
|
256
256
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => companyPurchaseModel.value = $event),
|
|
@@ -258,7 +258,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
258
258
|
}, {
|
|
259
259
|
"inline-label": withCtx(() => [
|
|
260
260
|
createElementVNode("div", _hoisted_2, [
|
|
261
|
-
createVNode(unref(_sfc_main$
|
|
261
|
+
createVNode(unref(_sfc_main$4), { tag: "span" }, {
|
|
262
262
|
default: withCtx(() => [
|
|
263
263
|
createTextVNode(toDisplayString(unref($t)({
|
|
264
264
|
defaultMessage: "Company purchase",
|
|
@@ -268,7 +268,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
268
268
|
]),
|
|
269
269
|
_: 1
|
|
270
270
|
}),
|
|
271
|
-
createVNode(unref(_sfc_main$
|
|
271
|
+
createVNode(unref(_sfc_main$4), {
|
|
272
272
|
tag: "span",
|
|
273
273
|
variant: "body-xs",
|
|
274
274
|
shade: "lighter"
|
|
@@ -287,7 +287,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
287
287
|
_: 1
|
|
288
288
|
}, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
289
289
|
isCompanyPurchase.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
290
|
-
createVNode(unref(_sfc_main$
|
|
290
|
+
createVNode(unref(_sfc_main$5), {
|
|
291
291
|
modelValue: unref(form).companyVatNumber,
|
|
292
292
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(form).companyVatNumber = $event),
|
|
293
293
|
name: "vat_number",
|
|
@@ -303,7 +303,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
303
303
|
}),
|
|
304
304
|
error: (_d = __props.apiError) == null ? void 0 : _d.vat_number
|
|
305
305
|
}, null, 8, ["modelValue", "label", "placeholder", "error"]),
|
|
306
|
-
createVNode(unref(_sfc_main$
|
|
306
|
+
createVNode(unref(_sfc_main$5), {
|
|
307
307
|
modelValue: unref(form).companyLegalName,
|
|
308
308
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(form).companyLegalName = $event),
|
|
309
309
|
required: "",
|
|
@@ -323,7 +323,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
323
323
|
], 64)) : createCommentVNode("", true)
|
|
324
324
|
]),
|
|
325
325
|
createElementVNode("div", _hoisted_3, [
|
|
326
|
-
createVNode(unref(_sfc_main$
|
|
326
|
+
createVNode(unref(_sfc_main$4), {
|
|
327
327
|
variant: "heading-3",
|
|
328
328
|
tag: "h2"
|
|
329
329
|
}, {
|
|
@@ -339,7 +339,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
339
339
|
]),
|
|
340
340
|
createElementVNode("div", _hoisted_4, [
|
|
341
341
|
!isCompanyPurchase.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
342
|
-
createVNode(unref(_sfc_main$
|
|
342
|
+
createVNode(unref(_sfc_main$5), {
|
|
343
343
|
modelValue: unref(form).firstName,
|
|
344
344
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(form).firstName = $event),
|
|
345
345
|
name: "first_name",
|
|
@@ -355,7 +355,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
355
355
|
}),
|
|
356
356
|
error: (_f = __props.apiError) == null ? void 0 : _f.first_name
|
|
357
357
|
}, null, 8, ["modelValue", "label", "placeholder", "error"]),
|
|
358
|
-
createVNode(unref(_sfc_main$
|
|
358
|
+
createVNode(unref(_sfc_main$5), {
|
|
359
359
|
modelValue: unref(form).lastName,
|
|
360
360
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(form).lastName = $event),
|
|
361
361
|
name: "last_name",
|
|
@@ -372,7 +372,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
372
372
|
error: (_g = __props.apiError) == null ? void 0 : _g.last_name
|
|
373
373
|
}, null, 8, ["modelValue", "label", "placeholder", "error"])
|
|
374
374
|
])) : createCommentVNode("", true),
|
|
375
|
-
createVNode(unref(_sfc_main$
|
|
375
|
+
createVNode(unref(_sfc_main$5), {
|
|
376
376
|
modelValue: unref(form).addressLine1,
|
|
377
377
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => unref(form).addressLine1 = $event),
|
|
378
378
|
name: "address_line_1",
|
|
@@ -388,7 +388,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
388
388
|
}),
|
|
389
389
|
error: (_h = __props.apiError) == null ? void 0 : _h.address_line_1
|
|
390
390
|
}, null, 8, ["modelValue", "label", "placeholder", "error"]),
|
|
391
|
-
createVNode(unref(_sfc_main$
|
|
391
|
+
createVNode(unref(_sfc_main$5), {
|
|
392
392
|
modelValue: unref(form).addressLine2,
|
|
393
393
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(form).addressLine2 = $event),
|
|
394
394
|
name: "address_line_2",
|
|
@@ -400,7 +400,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
400
400
|
error: (_i = __props.apiError) == null ? void 0 : _i.address_line_2
|
|
401
401
|
}, null, 8, ["modelValue", "placeholder", "error"]),
|
|
402
402
|
createElementVNode("div", _hoisted_6, [
|
|
403
|
-
createVNode(unref(_sfc_main$
|
|
403
|
+
createVNode(unref(_sfc_main$5), {
|
|
404
404
|
modelValue: unref(form).postalCode,
|
|
405
405
|
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(form).postalCode = $event),
|
|
406
406
|
name: "postal_code",
|
|
@@ -411,7 +411,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
411
411
|
}),
|
|
412
412
|
error: (_j = __props.apiError) == null ? void 0 : _j.postal_code
|
|
413
413
|
}, null, 8, ["modelValue", "placeholder", "error"]),
|
|
414
|
-
createVNode(unref(_sfc_main$
|
|
414
|
+
createVNode(unref(_sfc_main$5), {
|
|
415
415
|
modelValue: unref(form).city,
|
|
416
416
|
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(form).city = $event),
|
|
417
417
|
name: "city",
|
|
@@ -422,7 +422,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
422
422
|
}),
|
|
423
423
|
error: (_k = __props.apiError) == null ? void 0 : _k.city
|
|
424
424
|
}, null, 8, ["modelValue", "placeholder", "error"]),
|
|
425
|
-
createVNode(unref(_sfc_main$
|
|
425
|
+
createVNode(unref(_sfc_main$5), {
|
|
426
426
|
modelValue: unref(form).state,
|
|
427
427
|
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => unref(form).state = $event),
|
|
428
428
|
name: "state",
|
|
@@ -435,12 +435,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
435
435
|
}, null, 8, ["modelValue", "placeholder", "error"])
|
|
436
436
|
])
|
|
437
437
|
]),
|
|
438
|
-
((_m = __props.apiError) == null ? void 0 : _m._generic) ? (openBlock(), createBlock(unref(_sfc_main$
|
|
438
|
+
((_m = __props.apiError) == null ? void 0 : _m._generic) ? (openBlock(), createBlock(unref(_sfc_main$8), {
|
|
439
439
|
key: 0,
|
|
440
440
|
class: "mt-4",
|
|
441
441
|
title: __props.apiError._generic
|
|
442
442
|
}, null, 8, ["title"])) : createCommentVNode("", true),
|
|
443
|
-
createVNode(unref(_sfc_main$
|
|
443
|
+
createVNode(unref(_sfc_main$9), {
|
|
444
444
|
type: "submit",
|
|
445
445
|
color: "primary",
|
|
446
446
|
disabled: !unref(hasChanges),
|
|
@@ -486,7 +486,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
486
486
|
locale: { type: String },
|
|
487
487
|
dateLocale: { type: String },
|
|
488
488
|
messages: { type: Object },
|
|
489
|
-
showTimezones: { type: Boolean },
|
|
490
489
|
primaryColor: { type: String },
|
|
491
490
|
secondaryColor: { type: String },
|
|
492
491
|
isShadowRoot: { type: Boolean },
|
|
@@ -495,7 +494,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
495
494
|
onLog: { type: Function },
|
|
496
495
|
allowedPortalTypes: { type: Array },
|
|
497
496
|
portalObject: { type: Object },
|
|
498
|
-
customElementName: { type: String },
|
|
499
497
|
branding: { type: Object }
|
|
500
498
|
},
|
|
501
499
|
setup(__props) {
|
|
@@ -522,7 +520,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
522
520
|
locale: { type: String },
|
|
523
521
|
dateLocale: { type: String },
|
|
524
522
|
messages: { type: Object },
|
|
525
|
-
showTimezones: { type: Boolean },
|
|
526
523
|
primaryColor: { type: String },
|
|
527
524
|
secondaryColor: { type: String },
|
|
528
525
|
isShadowRoot: { type: Boolean },
|
|
@@ -531,14 +528,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
531
528
|
onLog: { type: Function },
|
|
532
529
|
allowedPortalTypes: { type: Array },
|
|
533
530
|
portalObject: { type: Object },
|
|
534
|
-
customElementName: { type: String },
|
|
535
531
|
branding: { type: Object }
|
|
536
532
|
},
|
|
537
533
|
emits: ["error"],
|
|
538
534
|
setup(__props) {
|
|
539
535
|
return (_ctx, _cache) => {
|
|
540
536
|
var _a, _b, _c, _d;
|
|
541
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
537
|
+
return openBlock(), createBlock(unref(_sfc_main$a), {
|
|
542
538
|
"custom-element-name": unref(COMPONENT_NAME),
|
|
543
539
|
environment: __props.environment,
|
|
544
540
|
locale: __props.locale,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SolvimonCustomerPaymentMethods: import('
|
|
1
|
+
export declare const SolvimonCustomerPaymentMethods: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
|
|
2
2
|
export declare const COMPONENT_NAME: string;
|
|
3
3
|
export declare const defineSolvimonCustomerPaymentMethods: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CLU7Yiyx.js"),t=require("../../component-C2Gc-wsE.js"),r=require("../../useLoadInitialData-BRg7IWqW.js"),n=require("../../usePaymentMethods-Cm9WdSW0.js"),l=e.defineComponent({__name:"CustomerPaymentMethods.entry.view",props:{portalObject:{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},branding:{type:Object},configuration:{type:Object}},setup(o){var l;const a=o,i=a.portalObject.customer_id,p=n.usePaymentMethods({customerId:i,pageSize:(null==(l=a.configuration)?void 0:l.maxItems)||3}),{isLoading:m}=r.useLoadInitialData(p.fetchInitial());return(r,n)=>{var l,a,i,c;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(s),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(a=null==(l=o.branding)?void 0:l.colors)?void 0:a.primary,"secondary-color":null==(c=null==(i=o.branding)?void 0:i.colors)?void 0:c.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,onError:n[0]||(n[0]=e=>r.$emit("error",e))},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{paymentMethods:e.unref(p).items.value,isLoading:e.unref(m)})]),_:3},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}}),a=e.defineComponent({__name:"CustomerPaymentMethods.entry",props:{portalObject:{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},branding:{type:Object},configuration:{type:Object}},setup:r=>(n,a)=>{var i,p,m,c;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(s),environment:r.environment,locale:r.locale,"portal-object":r.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(p=null==(i=r.branding)?void 0:i.colors)?void 0:p.primary,"secondary-color":null==(c=null==(m=r.branding)?void 0:m.colors)?void 0:c.secondary,"experimental-features":r.experimentalFeatures,"log-level":r.logLevel,"on-log":r.onLog,onError:a[0]||(a[0]=e=>n.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(l,e.normalizeProps(e.guardReactiveProps(n.$props)),{default:e.withCtx(({paymentMethods:t,isLoading:n})=>[e.createVNode(o._sfc_main,{configuration:r.configuration,"payment-methods":t,"is-loading":n},null,8,["configuration","payment-methods","is-loading"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),i=t.defineCustomElement(a),s=t.getComponentName("customer-payment-methods");exports.COMPONENT_NAME=s,exports.SolvimonCustomerPaymentMethods=i,exports.defineSolvimonCustomerPaymentMethods=()=>{customElements.get(s)||customElements.define(s,i)};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref, withCtx, renderSlot, createVNode, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import { _ as _sfc_main$3 } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import {
|
|
2
|
+
import { _ as _sfc_main$3 } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CK73bYUe.mjs";
|
|
3
|
+
import { _ as _sfc_main$2, d as defineCustomElement, g as getComponentName } from "../../component-CM9g6tbD.mjs";
|
|
4
4
|
import { u as useLoadInitialData } from "../../useLoadInitialData-Dm48tlSO.mjs";
|
|
5
|
-
import { u as usePaymentMethods } from "../../usePaymentMethods-
|
|
5
|
+
import { u as usePaymentMethods } from "../../usePaymentMethods-DZvfWSlx.mjs";
|
|
6
6
|
const DEFAULT_MAX_ITEMS = 3;
|
|
7
7
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
8
8
|
__name: "CustomerPaymentMethods.entry.view",
|
|
@@ -12,7 +12,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
locale: { type: String },
|
|
13
13
|
dateLocale: { type: String },
|
|
14
14
|
messages: { type: Object },
|
|
15
|
-
showTimezones: { type: Boolean },
|
|
16
15
|
primaryColor: { type: String },
|
|
17
16
|
secondaryColor: { type: String },
|
|
18
17
|
isShadowRoot: { type: Boolean },
|
|
@@ -20,7 +19,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
20
19
|
logLevel: { type: String },
|
|
21
20
|
onLog: { type: Function },
|
|
22
21
|
allowedPortalTypes: { type: Array },
|
|
23
|
-
customElementName: { type: String },
|
|
24
22
|
branding: { type: Object },
|
|
25
23
|
configuration: { type: Object }
|
|
26
24
|
},
|
|
@@ -67,7 +65,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
67
65
|
locale: { type: String },
|
|
68
66
|
dateLocale: { type: String },
|
|
69
67
|
messages: { type: Object },
|
|
70
|
-
showTimezones: { type: Boolean },
|
|
71
68
|
primaryColor: { type: String },
|
|
72
69
|
secondaryColor: { type: String },
|
|
73
70
|
isShadowRoot: { type: Boolean },
|
|
@@ -75,7 +72,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
75
72
|
logLevel: { type: String },
|
|
76
73
|
onLog: { type: Function },
|
|
77
74
|
allowedPortalTypes: { type: Array },
|
|
78
|
-
customElementName: { type: String },
|
|
79
75
|
branding: { type: Object },
|
|
80
76
|
configuration: { type: Object }
|
|
81
77
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SolvimonInvoice: import('
|
|
1
|
+
export declare const SolvimonInvoice: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
|
|
2
2
|
export declare const COMPONENT_NAME: string;
|
|
3
3
|
export declare const defineSolvimonInvoice: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../useLoadInitialData-BRg7IWqW.js"),o=require("../../invoices-CjBHfDXp.js"),n=require("../../useService-D-CUtlp3.js"),i=require("../../payments-B8W0W6wZ.js"),a=require("../../component-yWF07boR.js"),r=require("../../index-CWSXne1Q.js"),l=require("../../InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DNWspHtC.js"),c=require("../../PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Cx4c8E4i.js");const s=e.defineComponent({__name:"Invoice.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object},configuration:{type:Object}},setup(a){const r=a,l=function({invoiceId:e}){const{getInvoice:t,getInvoicePdf:i}=o.createInvoicesService(),{data:a,execute:r,apiStatus:l,error:c,isPending:s}=n.useService({service:()=>t(e)});return{invoice:a,downloadInvoicePdf:i,apiStatus:l,error:c,get:r,isPending:s}}({invoiceId:r.configuration.invoiceId}),c=function(){const{getPayments:e}=i.createPaymentsService(),{data:t,execute:o,error:a,apiStatus:r,isPending:l}=n.useService({service:e,isCollection:!0});return{payments:t,get:o,error:a,apiStatus:r,isPending:l}}(),{isLoading:s}=t.useLoadInitialData(l.get(),c.get(r.configuration.invoiceId));return(t,o)=>e.renderSlot(t.$slots,"default",{invoice:e.unref(l).invoice.value,invoiceDownloadService:e.unref(l).downloadInvoicePdf,payments:e.unref(c),isLoading:e.unref(s)})}}),d={key:0,class:"mt-8"},u={class:"flex flex-col gap-6"},p=["onClick","onKeyup"],m={class:"ml-1 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full bg-blue-100 text-2xs font-bold text-blue-600"},f={key:0},v={class:"p-0"},g={class:"-mx-9 bg-gray-50 px-9 py-3 text-xs"},y=e.defineComponent({__name:"InvoiceCreditsBreakdown",props:{invoice:{type:Object}},setup(t){const o=t,{formatDate:n,$t:i,formatMessage:r,formatNumber:l}=a.useIntl(),{getIsOpen:c,toggle:s}=a.useToggleList(),y=e.computed(()=>Object.fromEntries((o.invoice.credit_types??[]).map(e=>[e.id,e]))),_=e=>r({defaultMessage:"Service period - {startAt} - {endAt}",id:"kFCxC4",description:"Heading shown above wallet balance details for an invoice period"},{startAt:n({date:e.start_at,format:"date",offsetType:"offsetted",timezone:o.invoice.customer.timezone}),endAt:n({date:e.end_at,format:"date",offsetType:"offsetted",timezone:o.invoice.customer.timezone})}),w=e=>{var t;return(null==e?void 0:e.credit_type_id)?(null==(t=y.value[e.credit_type_id])?void 0:t.name)??e.credit_type_id:r({defaultMessage:"Credits",id:"K2fM1n",description:"Fallback label for wallet balance credit types when no name is available"})},b=e=>e?l(Number(e)):r({defaultMessage:"-",id:"dHb0fN",description:"Placeholder shown when a wallet balance quantity is missing"}),x=e.computed(()=>(({invoice:e,getPeriodTitle:t,getCreditTypeLabel:o,formatQuantity:n})=>[...e.periods??[],...e.closed_periods??[]].map(e=>{var i,a,r,l;const c=new Map,s=new Map;for(const t of e.groups??[])for(const d of t.lines??[]){const u=null==(i=null==d?void 0:d.details)?void 0:i.wallet_balance_details;if(!u)continue;const p=u.used_wallet_credits??u.left_wallet_credits??u.available_wallet_credits,m=o(p),f={id:`${e.period_order}-${t.group_order}-${d.line_order}`,label:m,used:n(null==(a=u.used_wallet_credits)?void 0:a.quantity),left:n(null==(r=u.left_wallet_credits)?void 0:r.quantity),available:n(null==(l=u.available_wallet_credits)?void 0:l.quantity)},v=`${f.label}-${f.used}-${f.left}-${f.available}`,g=s.get(m)??new Set;if(g.has(v))continue;g.add(v),s.set(m,g);const y=c.get(m)??{id:`${e.period_order}-${m}`,label:m,amount:f.available,rows:[]};y.rows.push(f),c.set(m,y)}return{id:`${e.period_order}-${e.start_at}`,title:t(e),rows:[...c.values()]}}).filter(e=>e.rows.length>0))({invoice:o.invoice,getPeriodTitle:_,getCreditTypeLabel:w,formatQuantity:b}));return(t,o)=>x.value.length>0?(e.openBlock(),e.createElementBlock("section",d,[e.createElementVNode("div",u,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,t=>(e.openBlock(),e.createElementBlock("section",{key:t.id},[e.createVNode(e.unref(a._sfc_main$2q),{class:"mt-4"},{default:e.withCtx(()=>[e.createVNode(e.unref(a._sfc_main$2),{tag:"h3",variant:"caps-heading"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:2},1024)]),_:2},1024),e.createVNode(e.unref(a.InvoiceTable),{class:"mt-3"},{default:e.withCtx(()=>[e.createElementVNode("tr",null,[e.createVNode(e.unref(a._sfc_main$t),{left:"",class:"text-gray-600"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Wallet balance",id:"j2d7b2",description:"Section header for invoice wallet balance details"})),1)]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rows,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},[e.createElementVNode("tr",{class:"cursor-pointer border-t",tabindex:"0",onClick:o=>e.unref(s)(t.id),onKeyup:[e.withKeys(o=>e.unref(s)(t.id),["enter"]),e.withKeys(o=>e.unref(s)(t.id),["space"])]},[e.createVNode(e.unref(a._sfc_main$u),{class:"p-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(a._sfc_main$4),{icon:"keyboard_arrow_down",size:"md",class:e.normalizeClass(["absolute -translate-x-7 text-slate-400",{"-rotate-90":!e.unref(c)(t.id)}])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(t.label)+" ",1),e.createElementVNode("span",m,e.toDisplayString(t.rows.length),1)]),_:2},1024)],40,p),e.unref(c)(t.id)?(e.openBlock(),e.createElementBlock("tr",f,[e.createElementVNode("td",v,[e.createElementVNode("div",g,[e.createVNode(e.unref(a.InvoiceTable),null,{default:e.withCtx(()=>[e.createElementVNode("tr",null,[e.createVNode(e.unref(a._sfc_main$t),{left:"",class:"w-2/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Credit breakdown",id:"65I4e4",description:"Column header for wallet balance credit type details"})),1)]),_:1}),e.createVNode(e.unref(a._sfc_main$t),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Balance",id:"4UjRe6",description:"Column header for the available wallet balance amount"})),1)]),_:1}),e.createVNode(e.unref(a._sfc_main$t),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Used",id:"rUy4Lk",description:"Column header for the used wallet credit amount"})),1)]),_:1}),e.createVNode(e.unref(a._sfc_main$t),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Remaining",id:"C8F4/r",description:"Column header for the remaining wallet credit amount"})),1)]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rows,t=>(e.openBlock(),e.createElementBlock("tr",{key:t.id,class:"border-t"},[e.createVNode(e.unref(a._sfc_main$u),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:2},1024),e.createVNode(e.unref(a._sfc_main$u),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.available),1)]),_:2},1024),e.createVNode(e.unref(a._sfc_main$u),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.used),1)]),_:2},1024),e.createVNode(e.unref(a._sfc_main$u),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.left),1)]),_:2},1024)]))),128))]),_:2},1024)])])])):e.createCommentVNode("",!0)],64))),128))]),_:2},1024)]))),128))])])):e.createCommentVNode("",!0)}}),_=e.defineComponent({__name:"InvoiceBlock",props:{invoice:{type:Object}},setup(t){const{$t:o}=a.useIntl(),{width:n}=r.useWindowSize(),i=e.computed(()=>n.value<=768);return(n,r)=>(e.openBlock(),e.createBlock(e.unref(a._sfc_main$1g),{title:e.unref(o)({defaultMessage:"Invoice",description:"Title for the invoice block on the invoice details page",id:"sdk.invoice_details.invoice.title"}),class:"grow"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"p-6 pt-2":!i.value})},[i.value?(e.openBlock(),e.createBlock(e.unref(a._sfc_main$1J),{key:0,variant:"default","has-icon":"",class:"justify-center bg-gray-50 border-gray-100 text-gray-800 font-semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Download the PDF for a full breakdown",description:"Download the PDF for a full breakdown",id:"sdk.invoice_details.invoice.download_pdf"})),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(a._sfc_main$e),{invoice:t.invoice,"is-expandable":!i.value},{logo:e.withCtx(()=>[e.renderSlot(n.$slots,"logo")]),_:3},8,["invoice","is-expandable"]),e.createVNode(y,{invoice:t.invoice},null,8,["invoice"])],2)]),_:3},8,["title"]))}}),w={class:"flex flex-col gap-3 lg:flex-row lg:gap-6"},b={class:"flex shrink-0 flex-col gap-8 lg:w-72 lg:gap-6"},x=e.defineComponent({__name:"Invoice",props:{isLoading:{type:Boolean},invoice:{type:Object},payments:{type:Array},invoiceDownloadService:{type:Function},configuration:{type:Object}},setup(t){const{$t:o}=a.useIntl();return(n,i)=>{var r,s;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(a._sfc_main$w),{class:"mb-6","payment-attempts":t.payments??[],invoice:t.invoice,"download-service":()=>t.invoiceDownloadService(t.invoice.id),"show-download-button":t.configuration.enableDownloadButton,variant:"external"},null,8,["payment-attempts","invoice","download-service","show-download-button"]),e.createElementVNode("div",w,[t.invoice?(e.openBlock(),e.createBlock(_,{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0),e.createElementVNode("div",b,[e.createVNode(l._sfc_main,{invoice:t.invoice},null,8,["invoice"]),(null==(r=t.configuration)?void 0:r.enablePaymentAttempts)&&(null==(s=t.payments)?void 0:s.length)?(e.openBlock(),e.createBlock(c._sfc_main,{key:0,"payment-attempts":t.payments,customer:t.invoice.customer},null,8,["payment-attempts","customer"])):e.createCommentVNode("",!0),t.configuration.enableCustomerBillingInformation?(e.openBlock(),e.createBlock(e.unref(a._sfc_main$z),{key:1,customer:t.invoice.customer,title:e.unref(o)({defaultMessage:"Your billing information",description:"Title for the billing information on the detailed invoice view",id:"sdk.invoice_details.customer_billing_information.title"})},null,8,["customer","title"])):e.createCommentVNode("",!0)])])],64)}}}),h=e.defineComponent({__name:"Invoice.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},showTimezones:{type:Boolean},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},customElementName:{type:String},branding:{type:Object},configuration:{type:Object}},setup(t){var o;const n=t;if(!(null==(o=n.configuration)?void 0:o.invoiceId))throw new Error("Missing invoice id");const i=e.computed(()=>({...n,configuration:{enableCustomerBillingInformation:!0,enableDownloadButton:!0,enablePaymentAttempts:!0,...n.configuration}}));return(o,n)=>{var r,l,c,d;return e.openBlock(),e.createBlock(e.unref(a._sfc_main$1),{"custom-element-name":e.unref(C),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(l=null==(r=t.branding)?void 0:r.colors)?void 0:l.primary,"secondary-color":null==(d=null==(c=t.branding)?void 0:c.colors)?void 0:d.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,onError:n[0]||(n[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(s,e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(({invoice:o,payments:n,isLoading:i,invoiceDownloadService:a})=>[o?(e.openBlock(),e.createBlock(x,{key:0,"is-loading":i,invoice:o,"invoice-download-service":a,payments:n.payments.value,configuration:t.configuration},null,8,["is-loading","invoice","invoice-download-service","payments","configuration"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}}),k=a.defineCustomElement(h),C=a.getComponentName("invoice");exports.COMPONENT_NAME=C,exports.SolvimonInvoice=k,exports.defineSolvimonInvoice=()=>{customElements.get(C)||customElements.define(C,k)};
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../useLoadInitialData-BRg7IWqW.js"),o=require("../../usePayments-B13S_yai.js"),n=require("../../component-C2Gc-wsE.js"),i=require("../../vendor-ui-Ce_Yp7xA.js"),a=require("../../useViewport-CKRY1CKR.js"),l=require("../../InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-B_WLgBur.js"),r=e.defineComponent({__name:"Invoice.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},branding:{type:Object},configuration:{type:Object}},setup(n){const i=n,a=o.useInvoice({invoiceId:i.configuration.invoiceId}),l=o.usePayments(),{isLoading:r}=t.useLoadInitialData(a.get(),l.get(i.configuration.invoiceId));return(t,o)=>e.renderSlot(t.$slots,"default",{invoice:e.unref(a).invoice.value,invoiceDownloadService:e.unref(a).downloadInvoicePdf,payments:e.unref(l),isLoading:e.unref(r)})}}),c={key:0,class:"mt-8"},s={class:"flex flex-col gap-6"},d=["onClick","onKeyup"],u={class:"ml-1 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full bg-blue-100 text-2xs font-bold text-blue-600"},p={key:0},m={class:"p-0"},f={class:"-mx-9 bg-gray-50 px-9 py-3 text-xs"},v=e.defineComponent({__name:"InvoiceCreditsBreakdown",props:{invoice:{type:Object}},setup(t){const o=t,{formatDate:n,$t:a,formatMessage:l,formatNumber:r}=i.useIntl(),{getIsOpen:v,toggle:g}=i.useToggleList(),y=e.computed(()=>Object.fromEntries((o.invoice.credit_types??[]).map(e=>[e.id,e]))),_=e=>l({defaultMessage:"Service period - {startAt} - {endAt}",id:"wallet_balance.service_period_heading",description:"Heading shown above wallet balance details for an invoice period"},{startAt:n({date:e.start_at,format:"date",offsetType:"offsetted",timezone:o.invoice.customer.timezone}),endAt:n({date:e.end_at,format:"date",offsetType:"offsetted",timezone:o.invoice.customer.timezone})}),b=e=>{var t;return(null==e?void 0:e.credit_type_id)?(null==(t=y.value[e.credit_type_id])?void 0:t.name)??e.credit_type_id:l({defaultMessage:"Credits",id:"wallet_balance.credit_type_fallback_label",description:"Fallback label for wallet balance credit types when no name is available"})},w=e=>e?r(Number(e)):l({defaultMessage:"-",id:"empty_value_placeholder",description:"Placeholder shown when a wallet balance quantity is missing"}),h=e.computed(()=>(({invoice:e,getPeriodTitle:t,getCreditTypeLabel:o,formatQuantity:n})=>[...e.periods??[],...e.closed_periods??[]].map(e=>{var i,a,l,r;const c=new Map,s=new Map;for(const t of e.groups??[])for(const d of t.lines??[]){const u=null==(i=null==d?void 0:d.details)?void 0:i.wallet_balance_details;if(!u)continue;const p=u.used_wallet_credits??u.left_wallet_credits??u.available_wallet_credits,m=o(p),f={id:`${e.period_order}-${t.group_order}-${d.line_order}`,label:m,used:n(null==(a=u.used_wallet_credits)?void 0:a.quantity),left:n(null==(l=u.left_wallet_credits)?void 0:l.quantity),available:n(null==(r=u.available_wallet_credits)?void 0:r.quantity)},v=`${f.label}-${f.used}-${f.left}-${f.available}`,g=s.get(m)??new Set;if(g.has(v))continue;g.add(v),s.set(m,g);const y=c.get(m)??{id:`${e.period_order}-${m}`,label:m,amount:f.available,rows:[]};y.rows.push(f),c.set(m,y)}return{id:`${e.period_order}-${e.start_at}`,title:t(e),rows:[...c.values()]}}).filter(e=>e.rows.length>0))({invoice:o.invoice,getPeriodTitle:_,getCreditTypeLabel:b,formatQuantity:w}));return(t,o)=>h.value.length>0?(e.openBlock(),e.createElementBlock("section",c,[e.createElementVNode("div",s,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createElementBlock("section",{key:t.id},[e.createVNode(e.unref(i._sfc_main$17),{class:"mt-4"},{default:e.withCtx(()=>[e.createVNode(e.unref(i._sfc_main),{tag:"h3",variant:"caps-heading"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:2},1024)]),_:2},1024),e.createVNode(e.unref(i.InvoiceTable),{class:"mt-3"},{default:e.withCtx(()=>[e.createElementVNode("tr",null,[e.createVNode(e.unref(i._sfc_main$18),{left:"",class:"text-gray-600"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Wallet balance",id:"wallet_balance.details.header",description:"Section header for invoice wallet balance details"})),1)]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rows,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},[e.createElementVNode("tr",{class:"cursor-pointer border-t",tabindex:"0",onClick:o=>e.unref(g)(t.id),onKeyup:[e.withKeys(o=>e.unref(g)(t.id),["enter"]),e.withKeys(o=>e.unref(g)(t.id),["space"])]},[e.createVNode(e.unref(i._sfc_main$19),{class:"p-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(i._sfc_main$11),{icon:"keyboard_arrow_down",size:"md",class:e.normalizeClass(["absolute -translate-x-7 text-slate-400",{"-rotate-90":!e.unref(v)(t.id)}])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(t.label)+" ",1),e.createElementVNode("span",u,e.toDisplayString(t.rows.length),1)]),_:2},1024)],40,d),e.unref(v)(t.id)?(e.openBlock(),e.createElementBlock("tr",p,[e.createElementVNode("td",m,[e.createElementVNode("div",f,[e.createVNode(e.unref(i.InvoiceTable),null,{default:e.withCtx(()=>[e.createElementVNode("tr",null,[e.createVNode(e.unref(i._sfc_main$18),{left:"",class:"w-2/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Credit breakdown",id:"invoice_credits.credit_breakdown.table_header",description:"Column header for wallet balance credit type details"})),1)]),_:1}),e.createVNode(e.unref(i._sfc_main$18),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Balance",id:"invoice_credits.balance.table_header",description:"Column header for the available wallet balance amount"})),1)]),_:1}),e.createVNode(e.unref(i._sfc_main$18),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Used",id:"invoice_credits.used.table_header",description:"Column header for the used wallet credit amount"})),1)]),_:1}),e.createVNode(e.unref(i._sfc_main$18),{right:"",class:"w-1/5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Remaining",id:"invoice_credits.remaining.table_header",description:"Column header for the remaining wallet credit amount"})),1)]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rows,t=>(e.openBlock(),e.createElementBlock("tr",{key:t.id,class:"border-t"},[e.createVNode(e.unref(i._sfc_main$19),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:2},1024),e.createVNode(e.unref(i._sfc_main$19),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.available),1)]),_:2},1024),e.createVNode(e.unref(i._sfc_main$19),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.used),1)]),_:2},1024),e.createVNode(e.unref(i._sfc_main$19),{number:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.left),1)]),_:2},1024)]))),128))]),_:2},1024)])])])):e.createCommentVNode("",!0)],64))),128))]),_:2},1024)]))),128))])])):e.createCommentVNode("",!0)}}),g=e.defineComponent({__name:"InvoiceBlock",props:{invoice:{type:Object}},setup(t){const{$t:o}=i.useIntl(),{isMobileViewport:n}=a.useViewport();return(a,l)=>(e.openBlock(),e.createBlock(e.unref(i._sfc_main$1),{title:e.unref(o)({defaultMessage:"Invoice",description:"Title for the invoice block on the invoice details page",id:"sdk.invoice_details.invoice.title"}),class:"grow"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"p-6 pt-2":!e.unref(n)})},[e.unref(n)?(e.openBlock(),e.createBlock(e.unref(i._sfc_main$20),{key:0,variant:"default","has-icon":"",class:"justify-center border-gray-100 bg-gray-50 font-semibold text-gray-800"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Download the PDF for a full breakdown",description:"Download the PDF for a full breakdown",id:"sdk.invoice_details.invoice.download_pdf"})),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(i._sfc_main$12),{invoice:t.invoice,"is-expandable":!e.unref(n)},{logo:e.withCtx(()=>[e.renderSlot(a.$slots,"logo")]),_:3},8,["invoice","is-expandable"]),e.createVNode(v,{invoice:t.invoice},null,8,["invoice"])],2)]),_:3},8,["title"]))}}),y={class:"flex flex-col gap-3 lg:flex-row lg:gap-6"},_={class:"flex shrink-0 flex-col gap-8 lg:w-72 lg:gap-6"},b=e.defineComponent({__name:"Invoice",props:{isLoading:{type:Boolean},invoice:{type:Object},payments:{type:Array},invoiceDownloadService:{type:Function},configuration:{type:Object}},setup(t){const o=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("../../PaymentHistoryBlock-DHM-3fh-.js"))),{$t:n}=i.useIntl();return(a,r)=>{var c,s;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(i._sfc_main$13),{class:"mb-6","payment-attempts":t.payments??[],invoice:t.invoice,"download-service":()=>t.invoiceDownloadService(t.invoice.id),"show-download-button":t.configuration.enableDownloadButton,variant:"external"},null,8,["payment-attempts","invoice","download-service","show-download-button"]),e.createElementVNode("div",y,[t.invoice?(e.openBlock(),e.createBlock(g,{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0),e.createElementVNode("div",_,[e.createVNode(l._sfc_main,{invoice:t.invoice},null,8,["invoice"]),(null==(c=t.configuration)?void 0:c.enablePaymentAttempts)&&(null==(s=t.payments)?void 0:s.length)?(e.openBlock(),e.createBlock(e.unref(o),{key:0,"payment-attempts":t.payments,customer:t.invoice.customer},null,8,["payment-attempts","customer"])):e.createCommentVNode("",!0),t.configuration.enableCustomerBillingInformation?(e.openBlock(),e.createBlock(e.unref(i._sfc_main$2),{key:1,customer:t.invoice.customer,title:e.unref(n)({defaultMessage:"Your billing information",description:"Title for the billing information on the detailed invoice view",id:"sdk.invoice_details.customer_billing_information.title"})},null,8,["customer","title"])):e.createCommentVNode("",!0)])])],64)}}}),w=e.defineComponent({__name:"Invoice.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},branding:{type:Object},configuration:{type:Object}},setup(t){var o;const i=t;if(!(null==(o=i.configuration)?void 0:o.invoiceId))throw new Error("Missing invoice id");const a=e.computed(()=>({...i,configuration:{enableCustomerBillingInformation:!0,enableDownloadButton:!0,enablePaymentAttempts:!0,...i.configuration}}));return(o,i)=>{var l,c,s,d;return e.openBlock(),e.createBlock(e.unref(n._sfc_main),{"custom-element-name":e.unref(x),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(c=null==(l=t.branding)?void 0:l.colors)?void 0:c.primary,"secondary-color":null==(d=null==(s=t.branding)?void 0:s.colors)?void 0:d.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,onError:i[0]||(i[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(r,e.normalizeProps(e.guardReactiveProps(a.value)),{default:e.withCtx(({invoice:o,payments:n,isLoading:i,invoiceDownloadService:a})=>[o?(e.openBlock(),e.createBlock(b,{key:0,"is-loading":i,invoice:o,"invoice-download-service":a,payments:n.payments.value,configuration:t.configuration},null,8,["is-loading","invoice","invoice-download-service","payments","configuration"])):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=n.defineCustomElement(w),x=n.getComponentName("invoice");exports.COMPONENT_NAME=x,exports.SolvimonInvoice=h,exports.defineSolvimonInvoice=()=>{customElements.get(x)||customElements.define(x,h)};
|