@solvimon/solvimon-web 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (196) hide show
  1. package/README.md +196 -44
  2. package/dist/ApiStatus-CyNDp_op.mjs +9 -0
  3. package/dist/ApiStatus-oqvUEWJx.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-CX8vlY2Z.mjs} +9 -6
  5. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-DGisvmez.js +1 -0
  6. package/dist/ContentWithAsideLayout-B5B8Kwaw.js +1 -0
  7. package/dist/{ContentWithAsideLayout-BC-C5Gjt.mjs → ContentWithAsideLayout-DhfUkZZg.mjs} +10 -16
  8. package/dist/{useCustomerPaymentMethodOptions-Fe_dLxfv.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bus-5gC3.mjs} +29 -37
  9. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CkRsyMlJ.js +1 -0
  10. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Bc2hkpTb.mjs} +20 -9
  11. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0vVUHuY.js +1 -0
  12. package/dist/PaymentHistoryBlock-BiiFJkpT.js +1 -0
  13. package/dist/PaymentHistoryBlock-D_B099M7.mjs +4 -0
  14. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CaMDtHrL.mjs} +19 -12
  15. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DWTEfLrE.js +1 -0
  16. package/dist/PaymentIntegrationForm-D1ZaHCTm.js +1 -0
  17. package/dist/PaymentIntegrationForm-Dmmhqqn1.mjs +4 -0
  18. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CSPZRvMV.js +1 -0
  19. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Do2KIVKH.mjs +962 -0
  20. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-BChVMzCj.mjs +50 -0
  21. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-Br3bEUlP.js +1 -0
  22. package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs → Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs} +24 -8
  23. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js +1 -0
  24. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-AHw3iTfi.js +1 -0
  25. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BkzLj8n2.mjs} +42 -36
  26. package/dist/adyen-51SvcyqV.mjs +4 -0
  27. package/dist/adyen-Bwewy3HC.mjs +172 -0
  28. package/dist/adyen-DZsyEXkw.js +1 -0
  29. package/dist/adyen-R6aSZ0Yf.js +1 -0
  30. package/dist/component-BOqPDAVk.js +1 -0
  31. package/dist/component-Djrf1L-Z.mjs +889 -0
  32. package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -1
  33. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  34. package/dist/components/BillingInformation/BillingInformation.es.js +99 -5
  35. package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -1
  36. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  37. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +582 -5
  38. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -1
  39. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  40. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +126 -5
  41. package/dist/components/Invoice/Invoice.ce.d.ts +1 -1
  42. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  43. package/dist/components/Invoice/Invoice.es.js +538 -5
  44. package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -1
  45. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  46. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +127 -5
  47. package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -1
  48. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  49. package/dist/components/InvoicesList/InvoicesList.es.js +106 -5
  50. package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -1
  51. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  52. package/dist/components/PaymentHistory/PaymentHistory.es.js +131 -5
  53. package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -1
  54. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  55. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +217 -5
  56. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -1
  57. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  58. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +154 -5
  59. package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -1
  60. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  61. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +132 -5
  62. package/dist/components/WalletBalances/WalletBalances.ce.d.ts +3 -0
  63. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -0
  64. package/dist/components/WalletBalances/WalletBalances.es.js +120 -0
  65. package/dist/core/configuration.d.ts +2 -1
  66. package/dist/core/index.cjs.js +1 -1
  67. package/dist/core/index.d.ts +1 -0
  68. package/dist/core/index.es.js +1 -1
  69. package/dist/core/registry.d.ts +1 -1
  70. package/dist/core/types.d.ts +10 -2
  71. package/dist/customer-B31QzznT.mjs +32 -0
  72. package/dist/customer-hDxW1Dbp.js +1 -0
  73. package/dist/en-US-CgPY97Vq.js +1 -0
  74. package/dist/en-US-N3CUCsVy.mjs +179 -0
  75. package/dist/index-DIFK3mcJ.js +6 -0
  76. package/dist/index-DyvRdSR7.mjs +9673 -0
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.d.ts +3 -0
  79. package/dist/index.es.js +43 -34
  80. package/dist/{invoices-C31Wz1Bu.mjs → invoices-DIYPN2j_.mjs} +2 -1
  81. package/dist/invoices-DzkA1jDc.js +1 -0
  82. package/dist/nl-NL-B8U9b85I.mjs +197 -0
  83. package/dist/nl-NL-qMRaTRrM.js +1 -0
  84. package/dist/{paymentMethods-CrU4G_2Y.mjs → paymentMethods-67b3UlTZ.mjs} +2 -1
  85. package/dist/paymentMethods-C_sdTkSF.js +1 -0
  86. package/dist/{payments-C3LPk9k9.js → payments-DkHhTHto.js} +1 -1
  87. package/dist/{payments-NtWI8KlU.mjs → payments-Dq6R37Fz.mjs} +1 -1
  88. package/dist/registry-BkViv4tv.js +1 -0
  89. package/dist/registry-Df_26rJy.mjs +144 -0
  90. package/dist/screens/Checkout/Checkout.ce.d.ts +1 -1
  91. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  92. package/dist/screens/Checkout/Checkout.es.js +4935 -5
  93. package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -1
  94. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  95. package/dist/screens/CustomerOverview/CustomerOverview.es.js +154 -5
  96. package/dist/screens/PayInvoice/PayInvoice.ce.d.ts +3 -0
  97. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -0
  98. package/dist/screens/PayInvoice/PayInvoice.es.js +458 -0
  99. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +3 -0
  100. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -0
  101. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +1066 -0
  102. package/dist/solvimon-web.css +1 -1
  103. package/dist/{subscriptions-3R7aMoky.mjs → subscriptions-ClGIr_aS.mjs} +2 -1
  104. package/dist/subscriptions-jelITJcX.js +1 -0
  105. package/dist/{useActionDispatchProvider-CBo_Hwu5.mjs → useActionDispatchProvider-BC57-Ufn.mjs} +1 -1
  106. package/dist/useActionDispatchProvider-rw9kWeE0.js +1 -0
  107. package/dist/useCustomer-Ba9WRtuT.mjs +25 -0
  108. package/dist/useCustomer-CUcaeQn_.js +1 -0
  109. package/dist/{useIncrementalLoading-fHCizCSo.mjs → useIncrementalLoading-Cnzh2mAz.mjs} +11 -10
  110. package/dist/useIncrementalLoading-DoTTXM2Y.js +1 -0
  111. package/dist/{useInvoiceData-dyvoDwFF.mjs → useInvoiceData-BJwwDur7.mjs} +6 -12
  112. package/dist/useInvoiceData-D2jkdmlA.js +1 -0
  113. package/dist/{useInvoicesList-rDvRzMqe.mjs → useInvoicesList-CFzAxyae.mjs} +34 -30
  114. package/dist/useInvoicesList-CaBCGs4h.js +1 -0
  115. package/dist/{useLoadInitialData-Dm48tlSO.mjs → useLoadInitialData-5sgImpzc.mjs} +5 -0
  116. package/dist/useLoadInitialData-DjwRHcAH.js +1 -0
  117. package/dist/usePaymentMethodOptions-C2k4npCQ.mjs +26 -0
  118. package/dist/usePaymentMethodOptions-DYO6xr3-.js +1 -0
  119. package/dist/{usePaymentMethods-Bq5fWl1Q.mjs → usePaymentMethods-CRWbH48K.mjs} +2 -2
  120. package/dist/{usePaymentMethods-Dbimodf0.js → usePaymentMethods-ryN_YohI.js} +1 -1
  121. package/dist/usePayments-Cw5PPEJa.mjs +36 -0
  122. package/dist/usePayments-DWXPGFvp.js +1 -0
  123. package/dist/usePortal-CxX4nrE4.js +1 -0
  124. package/dist/usePortal-cmE08vYs.mjs +12 -0
  125. package/dist/useService-Bb9r_sOQ.js +1 -0
  126. package/dist/useService-BsSEI8DZ.mjs +53 -0
  127. package/dist/useViewport-Bu0cyeSi.mjs +38 -0
  128. package/dist/useViewport-CKRY1CKR.js +1 -0
  129. package/dist/useWalletBalanceItems-CkDqmk36.mjs +109 -0
  130. package/dist/useWalletBalanceItems-CpZ1NWPr.js +1 -0
  131. package/dist/useWatchDebounced-2ZLnfgvG.js +1 -0
  132. package/dist/useWatchDebounced-D1xuIX6_.mjs +12 -0
  133. package/dist/vendor-ui-5pJF5KBP.js +1 -0
  134. package/dist/vendor-ui-C0K3osvz.mjs +27645 -0
  135. package/package.json +47 -20
  136. package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +0 -99
  137. package/dist/BillingInformation.entry.ce-DkrfEvK_.js +0 -1
  138. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js +0 -1
  139. package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +0 -1
  140. package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +0 -579
  141. package/dist/Checkout.entry.ce-Bif6vR1K.mjs +0 -5185
  142. package/dist/Checkout.entry.ce-CkQnLAn4.js +0 -1
  143. package/dist/ContentWithAsideLayout-CIVSoqFr.js +0 -1
  144. package/dist/CustomerOverview.entry.ce-C__omsVl.js +0 -1
  145. package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +0 -231
  146. package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +0 -135
  147. package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +0 -1
  148. package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +0 -583
  149. package/dist/Invoice.entry.ce-Cgr43ome.js +0 -1
  150. package/dist/InvoiceDetails.entry.ce-Cnpz8CLJ.mjs +0 -130
  151. package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +0 -1
  152. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js +0 -1
  153. package/dist/InvoicesList.entry.ce-38iOW5qh.js +0 -1
  154. package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +0 -105
  155. package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +0 -1
  156. package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +0 -134
  157. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js +0 -1
  158. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs +0 -6568
  159. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +0 -1
  160. package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +0 -238
  161. package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +0 -1
  162. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +0 -1
  163. package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +0 -1
  164. package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +0 -153
  165. package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +0 -1
  166. package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +0 -135
  167. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js +0 -1
  168. package/dist/_Uint8Array-DHE03FZr.mjs +0 -507
  169. package/dist/_Uint8Array-DxISR7XF.js +0 -1
  170. package/dist/auto-B_36W1Fc.js +0 -6
  171. package/dist/auto-BfMZdgp-.mjs +0 -14207
  172. package/dist/cloneDeep-Hs8Pp07F.js +0 -1
  173. package/dist/cloneDeep-sm9cY-u2.mjs +0 -212
  174. package/dist/component-BkmcE85U.mjs +0 -58654
  175. package/dist/component-Df5eNqYX.js +0 -1
  176. package/dist/index-2jo9BSPM.js +0 -1
  177. package/dist/index-BFZ0dPh9.mjs +0 -179
  178. package/dist/index-CWSXne1Q.js +0 -1
  179. package/dist/index-D3v7hAtc.mjs +0 -253
  180. package/dist/invoices-8M_3ur_U.js +0 -1
  181. package/dist/paymentMethods-CzUqDlvc.js +0 -1
  182. package/dist/registry-By94DXE2.js +0 -1
  183. package/dist/registry-shRKDl3K.mjs +0 -127
  184. package/dist/sprite-i5T7eZnk-C55G-dBo.js +0 -1
  185. package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +0 -4
  186. package/dist/subscriptions-CqK7t-fF.js +0 -1
  187. package/dist/useActionDispatchProvider-DsIljrhi.js +0 -1
  188. package/dist/useCustomer-BRY0tuBH.mjs +0 -45
  189. package/dist/useCustomer-Dp8sGHI0.js +0 -1
  190. package/dist/useCustomerPaymentMethodOptions-DYpMDnJR.js +0 -1
  191. package/dist/useIncrementalLoading-D8oKNxX7.js +0 -1
  192. package/dist/useInvoiceData-DImEH1ca.js +0 -1
  193. package/dist/useInvoicesList-BZQ9Y0qN.js +0 -1
  194. package/dist/useLoadInitialData-BRg7IWqW.js +0 -1
  195. package/dist/useService-Dz13Nxbi.mjs +0 -272
  196. package/dist/useService-bNNi4GB8.js +0 -1
@@ -1,579 +0,0 @@
1
- import { ref, computed, defineComponent, watch, openBlock, createElementBlock, withModifiers, createVNode, unref, withCtx, createTextVNode, toDisplayString, createElementVNode, createBlock, createCommentVNode, Fragment, onMounted, renderSlot, normalizeProps, guardReactiveProps } from "vue";
2
- import { F as useValidation, G as objectDiff, H as isOrganization, I as isIndividual, b as useIntl, _ as _sfc_main$2$1, J as _sfc_main$2a, K as _sfc_main$1$, L as _sfc_main$20, E as _sfc_main$16, m as _sfc_main$2H, M as getApiError, o as _sfc_main$4, p as defineCustomElement, n as getComponentName } from "./component-BkmcE85U.mjs";
3
- import { e as email, r as required } from "./index-CzL1ZcGi.mjs";
4
- import { c as cloneDeep } from "./cloneDeep-sm9cY-u2.mjs";
5
- import { u as useCustomer } from "./useCustomer-BRY0tuBH.mjs";
6
- const useForm = ({
7
- initialState,
8
- validationRules = {},
9
- nullifyEmptyValues = false,
10
- mode = "shallow"
11
- }) => {
12
- const initialFormState = ref(cloneDeep(initialState));
13
- const form = ref(cloneDeep(initialState));
14
- const validation = useValidation(validationRules, form);
15
- const changes = computed(
16
- () => objectDiff({ from: initialFormState.value, to: form.value, mode, nullifyEmptyValues })
17
- );
18
- const hasChanges = computed(() => Object.entries(changes.value).length > 0);
19
- const updateInitialState = (state) => {
20
- form.value = cloneDeep(state);
21
- initialFormState.value = cloneDeep(state);
22
- };
23
- const reset = () => {
24
- form.value = cloneDeep(initialState);
25
- validation.value.$reset();
26
- };
27
- return {
28
- form,
29
- validation,
30
- changes,
31
- hasChanges,
32
- reset,
33
- updateInitialState,
34
- initialState: initialFormState
35
- };
36
- };
37
- const DEFAULT_FORM_STATE = {
38
- type: "INDIVIDUAL",
39
- email: "",
40
- country: "",
41
- addressLine1: "",
42
- postalCode: "",
43
- city: "",
44
- state: ""
45
- };
46
- function useBillingInformationForm({
47
- initialState = {},
48
- onSubmit
49
- }) {
50
- const {
51
- form,
52
- validation,
53
- changes,
54
- hasChanges,
55
- updateInitialState: updateFormInitialState,
56
- initialState: currentInitialState
57
- } = useForm({
58
- initialState: {
59
- ...DEFAULT_FORM_STATE,
60
- ...initialState
61
- },
62
- validationRules: {
63
- email: { required, email }
64
- },
65
- nullifyEmptyValues: true,
66
- mode: "deep"
67
- });
68
- const updateInitialState = (customer) => {
69
- updateFormInitialState(mapCustomerToFormState(customer));
70
- };
71
- const submit = (customerId, data = form.value) => {
72
- return onSubmit({
73
- customerId,
74
- payload: mapFormStateToCustomerPayload(data)
75
- });
76
- };
77
- return {
78
- form,
79
- isOrganization,
80
- validation,
81
- changes,
82
- hasChanges,
83
- updateInitialState,
84
- submit,
85
- initialState: currentInitialState
86
- };
87
- }
88
- const mapCustomerToFormState = (customer) => {
89
- var _a, _b;
90
- if (isIndividual(customer)) {
91
- const address2 = customer.individual.residential_address;
92
- return {
93
- type: "INDIVIDUAL",
94
- email: customer.email ?? "",
95
- country: (address2 == null ? void 0 : address2.country) ?? "",
96
- addressLine1: (address2 == null ? void 0 : address2.line1) ?? "",
97
- addressLine2: (address2 == null ? void 0 : address2.line2) ?? "",
98
- postalCode: (address2 == null ? void 0 : address2.postal_code) ?? "",
99
- city: (address2 == null ? void 0 : address2.city) ?? "",
100
- state: (address2 == null ? void 0 : address2.state) ?? "",
101
- firstName: ((_a = customer.individual.name) == null ? void 0 : _a.first_name) ?? "",
102
- lastName: ((_b = customer.individual.name) == null ? void 0 : _b.last_name) ?? ""
103
- };
104
- }
105
- const address = customer.organization.registered_address;
106
- return {
107
- type: "ORGANIZATION",
108
- email: customer.email ?? "",
109
- country: (address == null ? void 0 : address.country) ?? "",
110
- addressLine1: (address == null ? void 0 : address.line1) ?? "",
111
- addressLine2: (address == null ? void 0 : address.line2) ?? "",
112
- postalCode: (address == null ? void 0 : address.postal_code) ?? "",
113
- city: (address == null ? void 0 : address.city) ?? "",
114
- state: (address == null ? void 0 : address.state) ?? "",
115
- companyLegalName: customer.organization.legal_name ?? "",
116
- companyVatNumber: customer.organization.tax_id ?? ""
117
- };
118
- };
119
- const mapFormStateToCustomerPayload = (data) => data.type === "ORGANIZATION" ? {
120
- type: "ORGANIZATION",
121
- email: data.email,
122
- organization: {
123
- legal_name: data.companyLegalName ?? "",
124
- tax_id: data.companyVatNumber ?? "",
125
- registered_address: {
126
- line1: data.addressLine1,
127
- line2: data.addressLine2 ?? "",
128
- postal_code: data.postalCode,
129
- city: data.city,
130
- country: data.country,
131
- state: data.state ?? ""
132
- }
133
- }
134
- } : {
135
- type: "INDIVIDUAL",
136
- email: data.email,
137
- individual: {
138
- name: {
139
- first_name: data.firstName ?? "",
140
- last_name: data.lastName ?? ""
141
- },
142
- residential_address: {
143
- line1: data.addressLine1,
144
- line2: data.addressLine2 ?? "",
145
- postal_code: data.postalCode,
146
- city: data.city,
147
- country: data.country,
148
- state: data.state ?? ""
149
- }
150
- }
151
- };
152
- const _hoisted_1 = { class: "grid grid-cols-1 gap-4" };
153
- const _hoisted_2 = { class: "flex grow flex-col" };
154
- const _hoisted_3 = { class: "mt-6 flex items-center justify-between gap-4" };
155
- const _hoisted_4 = { class: "flex flex-col gap-2" };
156
- const _hoisted_5 = {
157
- key: 0,
158
- class: "grid grid-cols-2 gap-2"
159
- };
160
- const _hoisted_6 = { class: "grid grid-cols-3 gap-2" };
161
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
162
- __name: "BillingInformationForm",
163
- props: {
164
- customer: { type: Object },
165
- isLoading: { type: Boolean },
166
- apiError: { type: null },
167
- updateCustomer: { type: Function }
168
- },
169
- setup(__props) {
170
- const props = __props;
171
- const { $t } = useIntl();
172
- const { validation, form, updateInitialState, submit, hasChanges } = useBillingInformationForm({
173
- onSubmit: ({ customerId, payload }) => props.updateCustomer({ customerId, payload })
174
- });
175
- const hasHydratedFromCustomer = ref(false);
176
- const isCompanyPurchase = computed(() => form.value.type === "ORGANIZATION");
177
- const showCompanyPurchaseToggle = computed(() => !hasHydratedFromCustomer.value);
178
- const companyPurchaseModel = computed({
179
- get: () => isCompanyPurchase.value,
180
- set: (value) => form.value.type = value ? "ORGANIZATION" : "INDIVIDUAL"
181
- });
182
- const handleSubmit = async () => {
183
- var _a;
184
- await validation.value.$validate();
185
- const isValid = !validation.value.$invalid;
186
- if (!isValid) return;
187
- if (!((_a = props.customer) == null ? void 0 : _a.id)) return;
188
- await submit(props.customer.id);
189
- };
190
- watch(
191
- () => props.customer,
192
- (customer) => {
193
- if (!customer || hasHydratedFromCustomer.value) {
194
- return;
195
- }
196
- updateInitialState(customer);
197
- hasHydratedFromCustomer.value = true;
198
- },
199
- { immediate: true }
200
- );
201
- return (_ctx, _cache) => {
202
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
203
- return openBlock(), createElementBlock("form", {
204
- onSubmit: withModifiers(handleSubmit, ["prevent"])
205
- }, [
206
- createVNode(unref(_sfc_main$2$1), {
207
- variant: "heading-3",
208
- tag: "h2"
209
- }, {
210
- default: withCtx(() => [
211
- createTextVNode(toDisplayString(unref($t)({
212
- defaultMessage: "Customer information",
213
- id: "checkout.contact_information_block.title",
214
- description: "The title of the contact information block in the checkout form"
215
- })), 1)
216
- ]),
217
- _: 1
218
- }),
219
- createElementVNode("div", _hoisted_1, [
220
- createVNode(unref(_sfc_main$2a), {
221
- modelValue: unref(form).email,
222
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(form).email = $event),
223
- required: "",
224
- type: "email",
225
- label: unref($t)({
226
- defaultMessage: "Email address",
227
- id: "checkout.email_address.label",
228
- description: "The email address of the customer in the checkout form"
229
- }),
230
- placeholder: unref($t)({
231
- defaultMessage: "Email address...",
232
- id: "checkout.email_address.placeholder",
233
- description: "The email address of the customer in the checkout form"
234
- }),
235
- error: ((_a = unref(validation).email) == null ? void 0 : _a.$errors) || ((_b = __props.apiError) == null ? void 0 : _b.email)
236
- }, null, 8, ["modelValue", "label", "placeholder", "error"]),
237
- createVNode(unref(_sfc_main$1$), {
238
- "single-model-value": unref(form).country,
239
- "onUpdate:singleModelValue": _cache[1] || (_cache[1] = ($event) => unref(form).country = $event),
240
- label: unref($t)({
241
- defaultMessage: "Country",
242
- id: "checkout.country.label",
243
- description: "The country of the customer in the checkout form"
244
- }),
245
- error: (_c = __props.apiError) == null ? void 0 : _c.country
246
- }, null, 8, ["single-model-value", "label", "error"]),
247
- showCompanyPurchaseToggle.value ? (openBlock(), createBlock(unref(_sfc_main$20), {
248
- key: 0,
249
- modelValue: companyPurchaseModel.value,
250
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => companyPurchaseModel.value = $event),
251
- "label-position": "before"
252
- }, {
253
- "inline-label": withCtx(() => [
254
- createElementVNode("div", _hoisted_2, [
255
- createVNode(unref(_sfc_main$2$1), { tag: "span" }, {
256
- default: withCtx(() => [
257
- createTextVNode(toDisplayString(unref($t)({
258
- defaultMessage: "Company purchase",
259
- id: "checkout.company_purchase_toggle.title",
260
- description: "The title of the company purchase toggle in the checkout"
261
- })), 1)
262
- ]),
263
- _: 1
264
- }),
265
- createVNode(unref(_sfc_main$2$1), {
266
- tag: "span",
267
- variant: "body-xs",
268
- shade: "lighter"
269
- }, {
270
- default: withCtx(() => [
271
- createTextVNode(toDisplayString(unref($t)({
272
- defaultMessage: "I am purchasing on behalf of a company",
273
- id: "checkout.company_purchase_toggle.sub_title",
274
- description: "The subtitle of the company purchase toggle in the checkout"
275
- })), 1)
276
- ]),
277
- _: 1
278
- })
279
- ])
280
- ]),
281
- _: 1
282
- }, 8, ["modelValue"])) : createCommentVNode("", true),
283
- isCompanyPurchase.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
284
- createVNode(unref(_sfc_main$2a), {
285
- modelValue: unref(form).companyVatNumber,
286
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(form).companyVatNumber = $event),
287
- name: "vat_number",
288
- label: unref($t)({
289
- defaultMessage: "VAT number",
290
- id: "checkout.vat_number.label",
291
- description: "The label for the vat number in the checkout form"
292
- }),
293
- placeholder: unref($t)({
294
- defaultMessage: "VAT number...",
295
- id: "checkout.vat_number.placeholder",
296
- description: "The label for the vat number in the checkout form"
297
- }),
298
- error: (_d = __props.apiError) == null ? void 0 : _d.vat_number
299
- }, null, 8, ["modelValue", "label", "placeholder", "error"]),
300
- createVNode(unref(_sfc_main$2a), {
301
- modelValue: unref(form).companyLegalName,
302
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(form).companyLegalName = $event),
303
- required: "",
304
- name: "legal_name",
305
- label: unref($t)({
306
- defaultMessage: "Legal entity name",
307
- id: "checkout.legal_name.label",
308
- description: "The legal name of the organization customer in the checkout form"
309
- }),
310
- placeholder: unref($t)({
311
- defaultMessage: "Legal entity name...",
312
- id: "checkout.legal_name.placeholder",
313
- description: "The legal name of the organization customer in the checkout form"
314
- }),
315
- error: (_e = __props.apiError) == null ? void 0 : _e.legal_name
316
- }, null, 8, ["modelValue", "label", "placeholder", "error"])
317
- ], 64)) : createCommentVNode("", true)
318
- ]),
319
- createElementVNode("div", _hoisted_3, [
320
- createVNode(unref(_sfc_main$2$1), {
321
- variant: "heading-3",
322
- tag: "h2"
323
- }, {
324
- default: withCtx(() => [
325
- createTextVNode(toDisplayString(unref($t)({
326
- defaultMessage: "Billing details",
327
- id: "checkout.billing_information_block.title",
328
- description: "The title of the billing information block in the checkout form"
329
- })), 1)
330
- ]),
331
- _: 1
332
- })
333
- ]),
334
- createElementVNode("div", _hoisted_4, [
335
- !isCompanyPurchase.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
336
- createVNode(unref(_sfc_main$2a), {
337
- modelValue: unref(form).firstName,
338
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(form).firstName = $event),
339
- name: "first_name",
340
- label: unref($t)({
341
- defaultMessage: "First name",
342
- id: "checkout.first_name.label",
343
- description: "The first name of the customer in the checkout form"
344
- }),
345
- placeholder: unref($t)({
346
- defaultMessage: "First name...",
347
- id: "checkout.first_name.placeholder",
348
- description: "The first name of the customer in the checkout form"
349
- }),
350
- error: (_f = __props.apiError) == null ? void 0 : _f.first_name
351
- }, null, 8, ["modelValue", "label", "placeholder", "error"]),
352
- createVNode(unref(_sfc_main$2a), {
353
- modelValue: unref(form).lastName,
354
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(form).lastName = $event),
355
- name: "last_name",
356
- label: unref($t)({
357
- defaultMessage: "Last name",
358
- id: "checkout.last_name.label",
359
- description: "The last name of the customer in the checkout form"
360
- }),
361
- placeholder: unref($t)({
362
- defaultMessage: "Last name...",
363
- id: "checkout.last_name.placeholder",
364
- description: "The last name of the customer in the checkout form"
365
- }),
366
- error: (_g = __props.apiError) == null ? void 0 : _g.last_name
367
- }, null, 8, ["modelValue", "label", "placeholder", "error"])
368
- ])) : createCommentVNode("", true),
369
- createVNode(unref(_sfc_main$2a), {
370
- modelValue: unref(form).addressLine1,
371
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => unref(form).addressLine1 = $event),
372
- name: "address_line_1",
373
- label: unref($t)({
374
- defaultMessage: "Billing address",
375
- id: "checkout.address.title",
376
- description: "Address line 1 of the customer address in the checkout form"
377
- }),
378
- placeholder: unref($t)({
379
- defaultMessage: "Address line 1...",
380
- id: "checkout.address.line1.placeholder",
381
- description: "Address line 1 of the customer address in the checkout form"
382
- }),
383
- error: (_h = __props.apiError) == null ? void 0 : _h.address_line_1
384
- }, null, 8, ["modelValue", "label", "placeholder", "error"]),
385
- createVNode(unref(_sfc_main$2a), {
386
- modelValue: unref(form).addressLine2,
387
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(form).addressLine2 = $event),
388
- name: "address_line_2",
389
- placeholder: unref($t)({
390
- defaultMessage: "Address line 2...",
391
- id: "checkout.address.line2.placeholder",
392
- description: "Address line 2 of the customer address in the checkout form"
393
- }),
394
- error: (_i = __props.apiError) == null ? void 0 : _i.address_line_2
395
- }, null, 8, ["modelValue", "placeholder", "error"]),
396
- createElementVNode("div", _hoisted_6, [
397
- createVNode(unref(_sfc_main$2a), {
398
- modelValue: unref(form).postalCode,
399
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(form).postalCode = $event),
400
- name: "postal_code",
401
- placeholder: unref($t)({
402
- defaultMessage: "Postal code...",
403
- id: "checkout.address.portal_code.placeholder",
404
- description: "Postal code of the customer address in the checkout form"
405
- }),
406
- error: (_j = __props.apiError) == null ? void 0 : _j.postal_code
407
- }, null, 8, ["modelValue", "placeholder", "error"]),
408
- createVNode(unref(_sfc_main$2a), {
409
- modelValue: unref(form).city,
410
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(form).city = $event),
411
- name: "city",
412
- placeholder: unref($t)({
413
- defaultMessage: "City...",
414
- id: "checkout.address.city.placeholder",
415
- description: "City of the customer address in the checkout form"
416
- }),
417
- error: (_k = __props.apiError) == null ? void 0 : _k.city
418
- }, null, 8, ["modelValue", "placeholder", "error"]),
419
- createVNode(unref(_sfc_main$2a), {
420
- modelValue: unref(form).state,
421
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => unref(form).state = $event),
422
- name: "state",
423
- placeholder: unref($t)({
424
- defaultMessage: "State...",
425
- id: "checkout.address.state.placeholder",
426
- description: "State of the customer address in the checkout form"
427
- }),
428
- error: (_l = __props.apiError) == null ? void 0 : _l.state
429
- }, null, 8, ["modelValue", "placeholder", "error"])
430
- ])
431
- ]),
432
- ((_m = __props.apiError) == null ? void 0 : _m._generic) ? (openBlock(), createBlock(unref(_sfc_main$16), {
433
- key: 0,
434
- class: "mt-4",
435
- title: __props.apiError._generic
436
- }, null, 8, ["title"])) : createCommentVNode("", true),
437
- createVNode(unref(_sfc_main$2H), {
438
- type: "submit",
439
- color: "primary",
440
- disabled: !unref(hasChanges),
441
- loading: __props.isLoading,
442
- class: "mt-4"
443
- }, {
444
- default: withCtx(() => [
445
- createTextVNode(toDisplayString(unref($t)({
446
- defaultMessage: "Save changes",
447
- id: "billing_information_form.submit_button.label",
448
- description: "The label for the submit button of the billing information form"
449
- })), 1)
450
- ]),
451
- _: 1
452
- }, 8, ["disabled", "loading"])
453
- ], 32);
454
- };
455
- }
456
- });
457
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
458
- __name: "BillingInformationForm",
459
- props: {
460
- customer: { type: Object },
461
- apiError: { type: null },
462
- updateCustomer: { type: Function },
463
- isLoading: { type: Boolean }
464
- },
465
- setup(__props) {
466
- return (_ctx, _cache) => {
467
- return openBlock(), createBlock(_sfc_main$3, {
468
- customer: __props.customer,
469
- "update-customer": __props.updateCustomer,
470
- "is-loading": __props.isLoading,
471
- "api-error": __props.apiError
472
- }, null, 8, ["customer", "update-customer", "is-loading", "api-error"]);
473
- };
474
- }
475
- });
476
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
477
- __name: "BillingInformationForm.entry.view",
478
- props: {
479
- environment: { type: String },
480
- locale: { type: String },
481
- dateLocale: { type: String },
482
- messages: { type: Object },
483
- showTimezones: { type: Boolean },
484
- primaryColor: { type: String },
485
- secondaryColor: { type: String },
486
- isShadowRoot: { type: Boolean },
487
- experimentalFeatures: { type: Array },
488
- logLevel: { type: String },
489
- onLog: { type: Function },
490
- allowedPortalTypes: { type: Array },
491
- portalObject: { type: Object },
492
- customElementName: { type: String },
493
- branding: { type: Object }
494
- },
495
- setup(__props) {
496
- const props = __props;
497
- const customerId = props.portalObject.customer_id;
498
- const { customer, get, update } = useCustomer({ customerId });
499
- onMounted(async () => {
500
- await get.execute();
501
- });
502
- return (_ctx, _cache) => {
503
- return renderSlot(_ctx.$slots, "default", {
504
- customer: unref(customer),
505
- isLoading: unref(get).isPending.value || unref(update).isPending.value,
506
- updateCustomer: unref(update),
507
- apiError: unref(getApiError)(unref(update).error)
508
- });
509
- };
510
- }
511
- });
512
- const _sfc_main = /* @__PURE__ */ defineComponent({
513
- __name: "BillingInformationForm.entry",
514
- props: {
515
- environment: { type: String },
516
- locale: { type: String },
517
- dateLocale: { type: String },
518
- messages: { type: Object },
519
- showTimezones: { type: Boolean },
520
- primaryColor: { type: String },
521
- secondaryColor: { type: String },
522
- isShadowRoot: { type: Boolean },
523
- experimentalFeatures: { type: Array },
524
- logLevel: { type: String },
525
- onLog: { type: Function },
526
- allowedPortalTypes: { type: Array },
527
- portalObject: { type: Object },
528
- customElementName: { type: String },
529
- branding: { type: Object }
530
- },
531
- emits: ["error"],
532
- setup(__props) {
533
- return (_ctx, _cache) => {
534
- var _a, _b, _c, _d;
535
- return openBlock(), createBlock(unref(_sfc_main$4), {
536
- "custom-element-name": unref(COMPONENT_NAME),
537
- environment: __props.environment,
538
- locale: __props.locale,
539
- "portal-object": __props.portalObject,
540
- "allowed-portal-types": ["CUSTOMER"],
541
- "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
542
- "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
543
- "experimental-features": __props.experimentalFeatures,
544
- "log-level": __props.logLevel,
545
- "on-log": __props.onLog,
546
- onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
547
- }, {
548
- default: withCtx(() => [
549
- createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
550
- default: withCtx(({ customer, updateCustomer, isLoading, apiError }) => [
551
- customer ? (openBlock(), createBlock(_sfc_main$2, {
552
- key: 0,
553
- customer,
554
- "is-loading": isLoading,
555
- "update-customer": ({ payload }) => updateCustomer.execute(payload),
556
- "api-error": apiError
557
- }, null, 8, ["customer", "is-loading", "update-customer", "api-error"])) : createCommentVNode("", true)
558
- ]),
559
- _: 1
560
- }, 16)
561
- ]),
562
- _: 1
563
- }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log"]);
564
- };
565
- }
566
- });
567
- const SolvimonBillingInformationForm = defineCustomElement(_sfc_main);
568
- const COMPONENT_NAME = getComponentName("billing-information-form");
569
- const defineSolvimonBillingInformationForm = () => {
570
- if (!customElements.get(COMPONENT_NAME)) {
571
- customElements.define(COMPONENT_NAME, SolvimonBillingInformationForm);
572
- }
573
- };
574
- export {
575
- COMPONENT_NAME as C,
576
- SolvimonBillingInformationForm as S,
577
- _sfc_main as _,
578
- defineSolvimonBillingInformationForm as d
579
- };