@solvimon/solvimon-web 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +80 -0
  2. package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +99 -0
  3. package/dist/BillingInformation.entry.ce-DkrfEvK_.js +1 -0
  4. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs +56 -0
  5. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js +1 -0
  6. package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +1 -0
  7. package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +579 -0
  8. package/dist/Checkout.entry.ce-Bif6vR1K.mjs +5185 -0
  9. package/dist/Checkout.entry.ce-CkQnLAn4.js +1 -0
  10. package/dist/ContentWithAsideLayout-BC-C5Gjt.mjs +42 -0
  11. package/dist/ContentWithAsideLayout-CIVSoqFr.js +1 -0
  12. package/dist/CustomerOverview.entry.ce-C__omsVl.js +1 -0
  13. package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +231 -0
  14. package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +135 -0
  15. package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +1 -0
  16. package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +583 -0
  17. package/dist/Invoice.entry.ce-Cgr43ome.js +1 -0
  18. package/dist/InvoiceDetails.entry.ce-Cnpz8CLJ.mjs +130 -0
  19. package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +1 -0
  20. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs +85 -0
  21. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js +1 -0
  22. package/dist/InvoicesList.entry.ce-38iOW5qh.js +1 -0
  23. package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +105 -0
  24. package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +1 -0
  25. package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +134 -0
  26. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js +1 -0
  27. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs +90 -0
  28. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs +6568 -0
  29. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +1 -0
  30. package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +238 -0
  31. package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +1 -0
  32. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs +62 -0
  33. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +1 -0
  34. package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +1 -0
  35. package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +153 -0
  36. package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +1 -0
  37. package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +135 -0
  38. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs +373 -0
  39. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js +1 -0
  40. package/dist/_Uint8Array-DHE03FZr.mjs +507 -0
  41. package/dist/_Uint8Array-DxISR7XF.js +1 -0
  42. package/dist/auto-B_36W1Fc.js +6 -0
  43. package/dist/auto-BfMZdgp-.mjs +14207 -0
  44. package/dist/cloneDeep-Hs8Pp07F.js +1 -0
  45. package/dist/cloneDeep-sm9cY-u2.mjs +212 -0
  46. package/dist/component-BkmcE85U.mjs +58654 -0
  47. package/dist/component-Df5eNqYX.js +1 -0
  48. package/dist/components/BillingInformation/BillingInformation.ce.d.ts +3 -0
  49. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -0
  50. package/dist/components/BillingInformation/BillingInformation.es.js +7 -0
  51. package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +3 -0
  52. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -0
  53. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +7 -0
  54. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +3 -0
  55. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -0
  56. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +7 -0
  57. package/dist/components/Invoice/Invoice.ce.d.ts +3 -0
  58. package/dist/components/Invoice/Invoice.cjs.js +1 -0
  59. package/dist/components/Invoice/Invoice.es.js +7 -0
  60. package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +3 -0
  61. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -0
  62. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +7 -0
  63. package/dist/components/InvoicesList/InvoicesList.ce.d.ts +3 -0
  64. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -0
  65. package/dist/components/InvoicesList/InvoicesList.es.js +7 -0
  66. package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +3 -0
  67. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -0
  68. package/dist/components/PaymentHistory/PaymentHistory.es.js +7 -0
  69. package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +3 -0
  70. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -0
  71. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +7 -0
  72. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +3 -0
  73. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -0
  74. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -0
  75. package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +3 -0
  76. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -0
  77. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +7 -0
  78. package/dist/core/action-request.types.d.ts +58 -0
  79. package/dist/core/configuration.d.ts +2 -0
  80. package/dist/core/index.cjs.js +1 -0
  81. package/dist/core/index.d.ts +10 -0
  82. package/dist/core/index.es.js +6 -0
  83. package/dist/core/registry.ce.d.ts +2 -0
  84. package/dist/core/registry.d.ts +6 -0
  85. package/dist/core/types.d.ts +107 -0
  86. package/dist/index-2jo9BSPM.js +1 -0
  87. package/dist/index-BFZ0dPh9.mjs +179 -0
  88. package/dist/index-CWSXne1Q.js +1 -0
  89. package/dist/index-CzL1ZcGi.mjs +85 -0
  90. package/dist/index-D3v7hAtc.mjs +253 -0
  91. package/dist/index-DRdBmZ2-.js +1 -0
  92. package/dist/index.cjs.js +1 -0
  93. package/dist/index.d.ts +13 -0
  94. package/dist/index.es.js +39 -0
  95. package/dist/invoices-8M_3ur_U.js +1 -0
  96. package/dist/invoices-C31Wz1Bu.mjs +84 -0
  97. package/dist/paymentMethods-CrU4G_2Y.mjs +65 -0
  98. package/dist/paymentMethods-CzUqDlvc.js +1 -0
  99. package/dist/payments-C3LPk9k9.js +1 -0
  100. package/dist/payments-NtWI8KlU.mjs +47 -0
  101. package/dist/registry-By94DXE2.js +1 -0
  102. package/dist/registry-shRKDl3K.mjs +127 -0
  103. package/dist/screens/Checkout/Checkout.ce.d.ts +3 -0
  104. package/dist/screens/Checkout/Checkout.cjs.js +1 -0
  105. package/dist/screens/Checkout/Checkout.es.js +7 -0
  106. package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +3 -0
  107. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -0
  108. package/dist/screens/CustomerOverview/CustomerOverview.es.js +7 -0
  109. package/dist/solvimon-web.css +1 -0
  110. package/dist/sprite-i5T7eZnk-C55G-dBo.js +1 -0
  111. package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +4 -0
  112. package/dist/subscriptions-3R7aMoky.mjs +74 -0
  113. package/dist/subscriptions-CqK7t-fF.js +1 -0
  114. package/dist/useActionDispatchProvider-CBo_Hwu5.mjs +12 -0
  115. package/dist/useActionDispatchProvider-DsIljrhi.js +1 -0
  116. package/dist/useCustomer-BRY0tuBH.mjs +45 -0
  117. package/dist/useCustomer-Dp8sGHI0.js +1 -0
  118. package/dist/useCustomerPaymentMethodOptions-DYpMDnJR.js +1 -0
  119. package/dist/useCustomerPaymentMethodOptions-Fe_dLxfv.mjs +168 -0
  120. package/dist/useIncrementalLoading-D8oKNxX7.js +1 -0
  121. package/dist/useIncrementalLoading-fHCizCSo.mjs +69 -0
  122. package/dist/useInvoiceData-DImEH1ca.js +1 -0
  123. package/dist/useInvoiceData-dyvoDwFF.mjs +51 -0
  124. package/dist/useInvoicesList-BZQ9Y0qN.js +1 -0
  125. package/dist/useInvoicesList-rDvRzMqe.mjs +294 -0
  126. package/dist/useLoadInitialData-BRg7IWqW.js +1 -0
  127. package/dist/useLoadInitialData-Dm48tlSO.mjs +13 -0
  128. package/dist/usePaymentMethods-Bq5fWl1Q.mjs +16 -0
  129. package/dist/usePaymentMethods-Dbimodf0.js +1 -0
  130. package/dist/useService-Dz13Nxbi.mjs +272 -0
  131. package/dist/useService-bNNi4GB8.js +1 -0
  132. package/package.json +174 -0
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @solvimon/sdk
2
+
3
+ ## Getting started
4
+
5
+ ```bash
6
+ npm install @solvimon/sdk
7
+ ```
8
+
9
+ Solvimon's SDK exports web components, that are framework agnostic. Each component requires at least:
10
+
11
+ | Property | Description |
12
+ | ------------- | -------------------------------------------- |
13
+ | `token` | Fetched from our API |
14
+ | `environment` | Specifies the environment (`TEST` or `LIVE`) |
15
+
16
+ It supports two ways of importing:
17
+
18
+ ### `defineSolvimonAddPaymentMethodForm`
19
+
20
+ ```tsx
21
+ import { defineSolvimonAddPaymentMethodForm } from '@solvimon/sdk/solvimon-add-payment-method-form';
22
+
23
+ defineSolvimonAddPaymentMethodForm();
24
+
25
+ export default function Home() {
26
+ return (
27
+ <solvimon-add-payment-method-form
28
+ token="<my-token-retrieved-from-solvimon-api>"
29
+ environment="LIVE"
30
+ />
31
+ );
32
+ }
33
+ ```
34
+
35
+ ### Register yourself (beneficial in Vue setup for typed components)
36
+
37
+ ```vue
38
+ <script setup lang="ts">
39
+ import { SolvimonAddPaymentMethodForm } from '@solvimon/sdk/solvimon-add-payment-method-form';
40
+
41
+ if (customElements.get('solvimon-add-payment-method-form')) {
42
+ customElements.define('solvimon-add-payment-method-form', SolvimonAddPaymentMethodForm);
43
+ }
44
+ </script>
45
+
46
+ <template>
47
+ <solvimon-add-payment-method-form
48
+ token="<my-token-retrieved-from-solvimon-api>"
49
+ environment="LIVE"
50
+ />
51
+ </template>
52
+ ```
53
+
54
+ ### Isomorphic (server side rendered) usage
55
+
56
+ Our component define functions might cause issues when run in isomorphic setups. To solve this, you might want to consider only loading our SDK client side only:
57
+
58
+ ```tsx
59
+ import { useEffect } from 'react';
60
+
61
+ export default function Home() {
62
+ useEffect(() => {
63
+ async function loadSolvimonSdkComponent() {
64
+ const { defineSolvimonAddPaymentMethodForm } = await import(
65
+ '@solvimon/sdk/solvimon-add-payment-method-form'
66
+ );
67
+ defineSolvimonAddPaymentMethodForm();
68
+ }
69
+
70
+ loadSolvimonSdkComponent();
71
+ }, []);
72
+
73
+ return (
74
+ <solvimon-add-payment-method-form
75
+ token="<my-token-retrieved-from-solvimon-api>"
76
+ environment="LIVE"
77
+ />
78
+ );
79
+ }
80
+ ```
@@ -0,0 +1,99 @@
1
+ import { defineComponent, renderSlot, unref, openBlock, createBlock, withCtx, createVNode, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
2
+ import { _ as _sfc_main$3 } from "./BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs";
3
+ import { u as useCustomer } from "./useCustomer-BRY0tuBH.mjs";
4
+ import { o as _sfc_main$2, p as defineCustomElement, n as getComponentName } from "./component-BkmcE85U.mjs";
5
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6
+ __name: "BillingInformation.entry.view",
7
+ props: {
8
+ environment: { type: String },
9
+ locale: { type: String },
10
+ dateLocale: { type: String },
11
+ messages: { type: Object },
12
+ showTimezones: { type: Boolean },
13
+ primaryColor: { type: String },
14
+ secondaryColor: { type: String },
15
+ isShadowRoot: { type: Boolean },
16
+ experimentalFeatures: { type: Array },
17
+ logLevel: { type: String },
18
+ onLog: { type: Function },
19
+ allowedPortalTypes: { type: Array },
20
+ portalObject: { type: Object },
21
+ customElementName: { type: String },
22
+ branding: { type: Object },
23
+ configuration: { type: Object }
24
+ },
25
+ setup(__props) {
26
+ const props = __props;
27
+ const customerId = props.portalObject.customer_id;
28
+ const customer = useCustomer({ customerId });
29
+ return (_ctx, _cache) => {
30
+ return renderSlot(_ctx.$slots, "default", { customer: unref(customer) });
31
+ };
32
+ }
33
+ });
34
+ const _sfc_main = /* @__PURE__ */ defineComponent({
35
+ __name: "BillingInformation.entry",
36
+ props: {
37
+ environment: { type: String },
38
+ locale: { type: String },
39
+ dateLocale: { type: String },
40
+ messages: { type: Object },
41
+ showTimezones: { type: Boolean },
42
+ primaryColor: { type: String },
43
+ secondaryColor: { type: String },
44
+ isShadowRoot: { type: Boolean },
45
+ experimentalFeatures: { type: Array },
46
+ logLevel: { type: String },
47
+ onLog: { type: Function },
48
+ allowedPortalTypes: { type: Array },
49
+ portalObject: { type: Object },
50
+ customElementName: { type: String },
51
+ branding: { type: Object },
52
+ configuration: { type: Object }
53
+ },
54
+ setup(__props) {
55
+ return (_ctx, _cache) => {
56
+ var _a, _b, _c, _d;
57
+ return openBlock(), createBlock(unref(_sfc_main$2), {
58
+ "custom-element-name": unref(COMPONENT_NAME),
59
+ environment: __props.environment,
60
+ locale: __props.locale,
61
+ "portal-object": __props.portalObject,
62
+ "allowed-portal-types": ["CUSTOMER"],
63
+ "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
64
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
65
+ "experimental-features": __props.experimentalFeatures,
66
+ "log-level": __props.logLevel,
67
+ "on-log": __props.onLog,
68
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
69
+ }, {
70
+ default: withCtx(() => [
71
+ createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
72
+ default: withCtx(({ customer }) => [
73
+ customer.customer.value ? (openBlock(), createBlock(_sfc_main$3, {
74
+ key: 0,
75
+ "is-loading": customer.get.isPending.value,
76
+ customer: customer.customer.value
77
+ }, null, 8, ["is-loading", "customer"])) : createCommentVNode("", true)
78
+ ]),
79
+ _: 1
80
+ }, 16)
81
+ ]),
82
+ _: 1
83
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log"]);
84
+ };
85
+ }
86
+ });
87
+ const SolvimonBillingInformation = defineCustomElement(_sfc_main);
88
+ const COMPONENT_NAME = getComponentName("billing-information");
89
+ const defineSolvimonBillingInformation = () => {
90
+ if (!customElements.get(COMPONENT_NAME)) {
91
+ customElements.define(COMPONENT_NAME, SolvimonBillingInformation);
92
+ }
93
+ };
94
+ export {
95
+ COMPONENT_NAME as C,
96
+ SolvimonBillingInformation as S,
97
+ _sfc_main as _,
98
+ defineSolvimonBillingInformation as d
99
+ };
@@ -0,0 +1 @@
1
+ const e=require("vue"),o=require("./BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js"),t=require("./useCustomer-Dp8sGHI0.js"),n=require("./component-Df5eNqYX.js"),r=e.defineComponent({__name:"BillingInformation.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(o){const n=o.portalObject.customer_id,r=t.useCustomer({customerId:n});return(o,t)=>e.renderSlot(o.$slots,"default",{customer:e.unref(r)})}}),l=e.defineComponent({__name:"BillingInformation.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=>(l,i)=>{var p,s,m,c;return e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),{"custom-element-name":e.unref(a),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(p=t.branding)?void 0:p.colors)?void 0:s.primary,"secondary-color":null==(c=null==(m=t.branding)?void 0:m.colors)?void 0:c.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,onError:i[0]||(i[0]=e=>l.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(r,e.normalizeProps(e.guardReactiveProps(l.$props)),{default:e.withCtx(({customer:t})=>[t.customer.value?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,"is-loading":t.get.isPending.value,customer:t.customer.value},null,8,["is-loading","customer"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),i=n.defineCustomElement(l),a=n.getComponentName("billing-information");exports.COMPONENT_NAME=a,exports.SolvimonBillingInformation=i,exports._sfc_main=l,exports.defineSolvimonBillingInformation=()=>{customElements.get(a)||customElements.define(a,i)};
@@ -0,0 +1,56 @@
1
+ import { defineComponent, openBlock, createBlock, unref, createSlots, withCtx, createVNode, createTextVNode, toDisplayString } from "vue";
2
+ import { b as useIntl, k as _sfc_main$14, l as _sfc_main$z, m as _sfc_main$2H } from "./component-BkmcE85U.mjs";
3
+ import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CBo_Hwu5.mjs";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "BillingInformation",
6
+ props: {
7
+ customer: { type: Object },
8
+ isLoading: { type: Boolean },
9
+ configuration: { default: () => ({
10
+ showEditButton: true
11
+ }), type: Object }
12
+ },
13
+ emits: ["edit-billing-information"],
14
+ setup(__props) {
15
+ const { $t } = useIntl();
16
+ const { dispatchAction } = useActionDispatchProvider();
17
+ return (_ctx, _cache) => {
18
+ return __props.isLoading ? (openBlock(), createBlock(unref(_sfc_main$14), {
19
+ key: 0,
20
+ variant: "section",
21
+ class: "min-h-[100px]",
22
+ "data-testid": "billing-information-skeleton"
23
+ })) : (openBlock(), createBlock(unref(_sfc_main$z), {
24
+ key: 1,
25
+ customer: __props.customer,
26
+ "fallback-to-reference": false
27
+ }, createSlots({ _: 2 }, [
28
+ __props.configuration.showEditButton ? {
29
+ name: "settings",
30
+ fn: withCtx(() => [
31
+ createVNode(unref(_sfc_main$2H), {
32
+ size: "sm",
33
+ variant: "ghost",
34
+ color: "gray",
35
+ "icon-prefix": "edit",
36
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(dispatchAction)({ action: "edit-billing-information" }))
37
+ }, {
38
+ default: withCtx(() => [
39
+ createTextVNode(toDisplayString(unref($t)({
40
+ defaultMessage: "Edit",
41
+ id: "customer_overview.billing_information_block.view_all_payment_methods_link_label",
42
+ description: "The link text that links to the overview page of the customer billing information"
43
+ })), 1)
44
+ ]),
45
+ _: 1
46
+ })
47
+ ]),
48
+ key: "0"
49
+ } : void 0
50
+ ]), 1032, ["customer"]));
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ _sfc_main as _
56
+ };
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./component-Df5eNqYX.js"),i=require("./useActionDispatchProvider-DsIljrhi.js"),o=e.defineComponent({__name:"BillingInformation",props:{customer:{type:Object},isLoading:{type:Boolean},configuration:{default:()=>({showEditButton:!0}),type:Object}},emits:["edit-billing-information"],setup(o){const{$t:n}=t.useIntl(),{dispatchAction:r}=i.useActionDispatchProvider();return(i,a)=>o.isLoading?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$14),{key:0,variant:"section",class:"min-h-[100px]","data-testid":"billing-information-skeleton"})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$z),{key:1,customer:o.customer,"fallback-to-reference":!1},e.createSlots({_:2},[o.configuration.showEditButton?{name:"settings",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2H),{size:"sm",variant:"ghost",color:"gray","icon-prefix":"edit",onClick:a[0]||(a[0]=t=>e.unref(r)({action:"edit-billing-information"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Edit",id:"customer_overview.billing_information_block.view_all_payment_methods_link_label",description:"The link text that links to the overview page of the customer billing information"})),1)]),_:1})]),key:"0"}:void 0]),1032,["customer"]))}});exports._sfc_main=o;
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./component-Df5eNqYX.js"),a=require("./index-DRdBmZ2-.js"),o=require("./cloneDeep-Hs8Pp07F.js"),r=require("./useCustomer-Dp8sGHI0.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.ref(o.cloneDeep(a)),d=e.ref(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;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 r=e.organization.registered_address;return{type:"ORGANIZATION",email:e.email??"",country:(null==r?void 0:r.country)??"",addressLine1:(null==r?void 0:r.line1)??"",addressLine2:(null==r?void 0:r.line2)??"",postalCode:(null==r?void 0:r.postal_code)??"",city:(null==r?void 0:r.city)??"",state:(null==r?void 0:r.state)??"",companyLegalName:e.organization.legal_name??"",companyVatNumber:e.organization.tax_id??""}},d=e=>"ORGANIZATION"===e.type?{type:"ORGANIZATION",email:e.email,organization:{legal_name:e.companyLegalName??"",tax_id:e.companyVatNumber??"",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,x,T,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).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==(x=a.apiError)?void 0:x.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==(T=a.apiError)?void 0:T.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._sfc_main=_,exports.defineSolvimonBillingInformationForm=()=>{customElements.get(b)||customElements.define(b,v)};