@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
@@ -0,0 +1,583 @@
1
+ import { defineComponent, renderSlot, unref, computed, openBlock, createElementBlock, createElementVNode, Fragment, renderList, createVNode, withCtx, createTextVNode, toDisplayString, withKeys, normalizeClass, createCommentVNode, createBlock, normalizeProps, guardReactiveProps } from "vue";
2
+ import { u as useLoadInitialData } from "./useLoadInitialData-Dm48tlSO.mjs";
3
+ import { c as createInvoicesService } from "./invoices-C31Wz1Bu.mjs";
4
+ import { u as useService } from "./useService-Dz13Nxbi.mjs";
5
+ import { c as createPaymentsService } from "./payments-NtWI8KlU.mjs";
6
+ import { b as useIntl, N as useToggleList, O as _sfc_main$2q, _ as _sfc_main$2$1, Q as InvoiceTable, R as _sfc_main$t, S as _sfc_main$u, U as _sfc_main$4$1, d as _sfc_main$1g, V as _sfc_main$1J, W as _sfc_main$e, X as _sfc_main$w, l as _sfc_main$z, o as _sfc_main$8, p as defineCustomElement, n as getComponentName } from "./component-BkmcE85U.mjs";
7
+ import { u as useWindowSize } from "./index-D3v7hAtc.mjs";
8
+ import { _ as _sfc_main$6 } from "./InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs";
9
+ import { _ as _sfc_main$7 } from "./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs";
10
+ function useInvoice({ invoiceId }) {
11
+ const { getInvoice, getInvoicePdf: downloadInvoicePdf } = createInvoicesService();
12
+ const service = () => getInvoice(invoiceId);
13
+ const {
14
+ data,
15
+ execute: get,
16
+ apiStatus,
17
+ error,
18
+ isPending
19
+ } = useService({
20
+ service
21
+ });
22
+ return {
23
+ invoice: data,
24
+ downloadInvoicePdf,
25
+ apiStatus,
26
+ error,
27
+ get,
28
+ isPending
29
+ };
30
+ }
31
+ function usePayments() {
32
+ const { getPayments } = createPaymentsService();
33
+ const { data, execute: get, error, apiStatus, isPending } = useService({
34
+ service: getPayments,
35
+ isCollection: true
36
+ });
37
+ return { payments: data, get, error, apiStatus, isPending };
38
+ }
39
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
40
+ __name: "Invoice.entry.view",
41
+ props: {
42
+ environment: { type: String },
43
+ locale: { type: String },
44
+ dateLocale: { type: String },
45
+ messages: { type: Object },
46
+ showTimezones: { type: Boolean },
47
+ primaryColor: { type: String },
48
+ secondaryColor: { type: String },
49
+ isShadowRoot: { type: Boolean },
50
+ experimentalFeatures: { type: Array },
51
+ logLevel: { type: String },
52
+ onLog: { type: Function },
53
+ allowedPortalTypes: { type: Array },
54
+ portalObject: { type: Object },
55
+ customElementName: { type: String },
56
+ branding: { type: Object },
57
+ configuration: { type: Object }
58
+ },
59
+ setup(__props) {
60
+ const props = __props;
61
+ const invoice = useInvoice({ invoiceId: props.configuration.invoiceId });
62
+ const payments = usePayments();
63
+ const { isLoading } = useLoadInitialData(
64
+ invoice.get(),
65
+ payments.get(props.configuration.invoiceId)
66
+ );
67
+ return (_ctx, _cache) => {
68
+ return renderSlot(_ctx.$slots, "default", {
69
+ invoice: unref(invoice).invoice.value,
70
+ invoiceDownloadService: unref(invoice).downloadInvoicePdf,
71
+ payments: unref(payments),
72
+ isLoading: unref(isLoading)
73
+ });
74
+ };
75
+ }
76
+ });
77
+ const buildInvoiceCreditsBreakdown = ({
78
+ invoice,
79
+ getPeriodTitle,
80
+ getCreditTypeLabel,
81
+ formatQuantity
82
+ }) => {
83
+ const periods = [...invoice.periods ?? [], ...invoice.closed_periods ?? []];
84
+ return periods.map((period) => {
85
+ var _a, _b, _c, _d;
86
+ const walletRowsByLabel = /* @__PURE__ */ new Map();
87
+ const rowKeysByLabel = /* @__PURE__ */ new Map();
88
+ for (const group of period.groups ?? []) {
89
+ for (const line of group.lines ?? []) {
90
+ const walletBalanceDetails = (_a = line == null ? void 0 : line.details) == null ? void 0 : _a.wallet_balance_details;
91
+ if (!walletBalanceDetails) {
92
+ continue;
93
+ }
94
+ const primaryCredit = walletBalanceDetails.used_wallet_credits ?? walletBalanceDetails.left_wallet_credits ?? walletBalanceDetails.available_wallet_credits;
95
+ const label = getCreditTypeLabel(primaryCredit);
96
+ const row = {
97
+ id: `${period.period_order}-${group.group_order}-${line.line_order}`,
98
+ label,
99
+ used: formatQuantity((_b = walletBalanceDetails.used_wallet_credits) == null ? void 0 : _b.quantity),
100
+ left: formatQuantity((_c = walletBalanceDetails.left_wallet_credits) == null ? void 0 : _c.quantity),
101
+ available: formatQuantity(
102
+ (_d = walletBalanceDetails.available_wallet_credits) == null ? void 0 : _d.quantity
103
+ )
104
+ };
105
+ const rowKey = `${row.label}-${row.used}-${row.left}-${row.available}`;
106
+ const rowKeys = rowKeysByLabel.get(label) ?? /* @__PURE__ */ new Set();
107
+ if (rowKeys.has(rowKey)) {
108
+ continue;
109
+ }
110
+ rowKeys.add(rowKey);
111
+ rowKeysByLabel.set(label, rowKeys);
112
+ const walletRow = walletRowsByLabel.get(label) ?? {
113
+ id: `${period.period_order}-${label}`,
114
+ label,
115
+ amount: row.available,
116
+ rows: []
117
+ };
118
+ walletRow.rows.push(row);
119
+ walletRowsByLabel.set(label, walletRow);
120
+ }
121
+ }
122
+ return {
123
+ id: `${period.period_order}-${period.start_at}`,
124
+ title: getPeriodTitle(period),
125
+ rows: [...walletRowsByLabel.values()]
126
+ };
127
+ }).filter((period) => period.rows.length > 0);
128
+ };
129
+ const _hoisted_1$1 = {
130
+ key: 0,
131
+ class: "mt-8"
132
+ };
133
+ const _hoisted_2$1 = { class: "flex flex-col gap-6" };
134
+ const _hoisted_3 = ["onClick", "onKeyup"];
135
+ const _hoisted_4 = { 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" };
136
+ const _hoisted_5 = { key: 0 };
137
+ const _hoisted_6 = { class: "p-0" };
138
+ const _hoisted_7 = { class: "-mx-9 bg-gray-50 px-9 py-3 text-xs" };
139
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
140
+ __name: "InvoiceCreditsBreakdown",
141
+ props: {
142
+ invoice: { type: Object }
143
+ },
144
+ setup(__props) {
145
+ const props = __props;
146
+ const { formatDate, $t, formatMessage, formatNumber } = useIntl();
147
+ const { getIsOpen, toggle } = useToggleList();
148
+ const creditTypesById = computed(
149
+ () => Object.fromEntries(
150
+ (props.invoice.credit_types ?? []).map((creditType) => [
151
+ creditType.id,
152
+ creditType
153
+ ])
154
+ )
155
+ );
156
+ const getPeriodTitle = (period) => formatMessage(
157
+ {
158
+ defaultMessage: "Service period - {startAt} - {endAt}",
159
+ id: "kFCxC4",
160
+ description: "Heading shown above wallet balance details for an invoice period"
161
+ },
162
+ {
163
+ startAt: formatDate({
164
+ date: period.start_at,
165
+ format: "date",
166
+ offsetType: "offsetted",
167
+ timezone: props.invoice.customer.timezone
168
+ }),
169
+ endAt: formatDate({
170
+ date: period.end_at,
171
+ format: "date",
172
+ offsetType: "offsetted",
173
+ timezone: props.invoice.customer.timezone
174
+ })
175
+ }
176
+ );
177
+ const getCreditTypeLabel = (credits) => {
178
+ var _a;
179
+ if (!(credits == null ? void 0 : credits.credit_type_id)) {
180
+ return formatMessage({
181
+ defaultMessage: "Credits",
182
+ id: "K2fM1n",
183
+ description: "Fallback label for wallet balance credit types when no name is available"
184
+ });
185
+ }
186
+ return ((_a = creditTypesById.value[credits.credit_type_id]) == null ? void 0 : _a.name) ?? credits.credit_type_id;
187
+ };
188
+ const formatQuantity = (quantity) => quantity ? formatNumber(Number(quantity)) : formatMessage({
189
+ defaultMessage: "-",
190
+ id: "dHb0fN",
191
+ description: "Placeholder shown when a wallet balance quantity is missing"
192
+ });
193
+ const periodsWithCredits = computed(
194
+ () => buildInvoiceCreditsBreakdown({
195
+ invoice: props.invoice,
196
+ getPeriodTitle,
197
+ getCreditTypeLabel,
198
+ formatQuantity
199
+ })
200
+ );
201
+ return (_ctx, _cache) => {
202
+ return periodsWithCredits.value.length > 0 ? (openBlock(), createElementBlock("section", _hoisted_1$1, [
203
+ createElementVNode("div", _hoisted_2$1, [
204
+ (openBlock(true), createElementBlock(Fragment, null, renderList(periodsWithCredits.value, (period) => {
205
+ return openBlock(), createElementBlock("section", {
206
+ key: period.id
207
+ }, [
208
+ createVNode(unref(_sfc_main$2q), { class: "mt-4" }, {
209
+ default: withCtx(() => [
210
+ createVNode(unref(_sfc_main$2$1), {
211
+ tag: "h3",
212
+ variant: "caps-heading"
213
+ }, {
214
+ default: withCtx(() => [
215
+ createTextVNode(toDisplayString(period.title), 1)
216
+ ]),
217
+ _: 2
218
+ }, 1024)
219
+ ]),
220
+ _: 2
221
+ }, 1024),
222
+ createVNode(unref(InvoiceTable), { class: "mt-3" }, {
223
+ default: withCtx(() => [
224
+ createElementVNode("tr", null, [
225
+ createVNode(unref(_sfc_main$t), {
226
+ left: "",
227
+ class: "text-gray-600"
228
+ }, {
229
+ default: withCtx(() => [
230
+ createTextVNode(toDisplayString(unref($t)({
231
+ defaultMessage: "Wallet balance",
232
+ id: "j2d7b2",
233
+ description: "Section header for invoice wallet balance details"
234
+ })), 1)
235
+ ]),
236
+ _: 1
237
+ })
238
+ ]),
239
+ (openBlock(true), createElementBlock(Fragment, null, renderList(period.rows, (row) => {
240
+ return openBlock(), createElementBlock(Fragment, {
241
+ key: row.id
242
+ }, [
243
+ createElementVNode("tr", {
244
+ class: "cursor-pointer border-t",
245
+ tabindex: "0",
246
+ onClick: ($event) => unref(toggle)(row.id),
247
+ onKeyup: [
248
+ withKeys(($event) => unref(toggle)(row.id), ["enter"]),
249
+ withKeys(($event) => unref(toggle)(row.id), ["space"])
250
+ ]
251
+ }, [
252
+ createVNode(unref(_sfc_main$u), { class: "p-0" }, {
253
+ default: withCtx(() => [
254
+ createVNode(unref(_sfc_main$4$1), {
255
+ icon: "keyboard_arrow_down",
256
+ size: "md",
257
+ class: normalizeClass(["absolute -translate-x-7 text-slate-400", { "-rotate-90": !unref(getIsOpen)(row.id) }])
258
+ }, null, 8, ["class"]),
259
+ createTextVNode(" " + toDisplayString(row.label) + " ", 1),
260
+ createElementVNode("span", _hoisted_4, toDisplayString(row.rows.length), 1)
261
+ ]),
262
+ _: 2
263
+ }, 1024)
264
+ ], 40, _hoisted_3),
265
+ unref(getIsOpen)(row.id) ? (openBlock(), createElementBlock("tr", _hoisted_5, [
266
+ createElementVNode("td", _hoisted_6, [
267
+ createElementVNode("div", _hoisted_7, [
268
+ createVNode(unref(InvoiceTable), null, {
269
+ default: withCtx(() => [
270
+ createElementVNode("tr", null, [
271
+ createVNode(unref(_sfc_main$t), {
272
+ left: "",
273
+ class: "w-2/5"
274
+ }, {
275
+ default: withCtx(() => [
276
+ createTextVNode(toDisplayString(unref($t)({
277
+ defaultMessage: "Credit breakdown",
278
+ id: "65I4e4",
279
+ description: "Column header for wallet balance credit type details"
280
+ })), 1)
281
+ ]),
282
+ _: 1
283
+ }),
284
+ createVNode(unref(_sfc_main$t), {
285
+ right: "",
286
+ class: "w-1/5"
287
+ }, {
288
+ default: withCtx(() => [
289
+ createTextVNode(toDisplayString(unref($t)({
290
+ defaultMessage: "Balance",
291
+ id: "4UjRe6",
292
+ description: "Column header for the available wallet balance amount"
293
+ })), 1)
294
+ ]),
295
+ _: 1
296
+ }),
297
+ createVNode(unref(_sfc_main$t), {
298
+ right: "",
299
+ class: "w-1/5"
300
+ }, {
301
+ default: withCtx(() => [
302
+ createTextVNode(toDisplayString(unref($t)({
303
+ defaultMessage: "Used",
304
+ id: "rUy4Lk",
305
+ description: "Column header for the used wallet credit amount"
306
+ })), 1)
307
+ ]),
308
+ _: 1
309
+ }),
310
+ createVNode(unref(_sfc_main$t), {
311
+ right: "",
312
+ class: "w-1/5"
313
+ }, {
314
+ default: withCtx(() => [
315
+ createTextVNode(toDisplayString(unref($t)({
316
+ defaultMessage: "Remaining",
317
+ id: "C8F4/r",
318
+ description: "Column header for the remaining wallet credit amount"
319
+ })), 1)
320
+ ]),
321
+ _: 1
322
+ })
323
+ ]),
324
+ (openBlock(true), createElementBlock(Fragment, null, renderList(row.rows, (breakdownRow) => {
325
+ return openBlock(), createElementBlock("tr", {
326
+ key: breakdownRow.id,
327
+ class: "border-t"
328
+ }, [
329
+ createVNode(unref(_sfc_main$u), null, {
330
+ default: withCtx(() => [
331
+ createTextVNode(toDisplayString(breakdownRow.label), 1)
332
+ ]),
333
+ _: 2
334
+ }, 1024),
335
+ createVNode(unref(_sfc_main$u), { number: "" }, {
336
+ default: withCtx(() => [
337
+ createTextVNode(toDisplayString(breakdownRow.available), 1)
338
+ ]),
339
+ _: 2
340
+ }, 1024),
341
+ createVNode(unref(_sfc_main$u), { number: "" }, {
342
+ default: withCtx(() => [
343
+ createTextVNode(toDisplayString(breakdownRow.used), 1)
344
+ ]),
345
+ _: 2
346
+ }, 1024),
347
+ createVNode(unref(_sfc_main$u), { number: "" }, {
348
+ default: withCtx(() => [
349
+ createTextVNode(toDisplayString(breakdownRow.left), 1)
350
+ ]),
351
+ _: 2
352
+ }, 1024)
353
+ ]);
354
+ }), 128))
355
+ ]),
356
+ _: 2
357
+ }, 1024)
358
+ ])
359
+ ])
360
+ ])) : createCommentVNode("", true)
361
+ ], 64);
362
+ }), 128))
363
+ ]),
364
+ _: 2
365
+ }, 1024)
366
+ ]);
367
+ }), 128))
368
+ ])
369
+ ])) : createCommentVNode("", true);
370
+ };
371
+ }
372
+ });
373
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
374
+ __name: "InvoiceBlock",
375
+ props: {
376
+ invoice: { type: Object }
377
+ },
378
+ setup(__props) {
379
+ const { $t } = useIntl();
380
+ const { width } = useWindowSize();
381
+ const isSmallScreen = computed(() => width.value <= 768);
382
+ return (_ctx, _cache) => {
383
+ return openBlock(), createBlock(unref(_sfc_main$1g), {
384
+ title: unref($t)({
385
+ defaultMessage: "Invoice",
386
+ description: "Title for the invoice block on the invoice details page",
387
+ id: "sdk.invoice_details.invoice.title"
388
+ }),
389
+ class: "grow"
390
+ }, {
391
+ default: withCtx(() => [
392
+ createElementVNode("div", {
393
+ class: normalizeClass({ "p-6 pt-2": !isSmallScreen.value })
394
+ }, [
395
+ isSmallScreen.value ? (openBlock(), createBlock(unref(_sfc_main$1J), {
396
+ key: 0,
397
+ variant: "default",
398
+ "has-icon": "",
399
+ class: "justify-center bg-gray-50 border-gray-100 text-gray-800 font-semibold"
400
+ }, {
401
+ default: withCtx(() => [
402
+ createTextVNode(toDisplayString(unref($t)({
403
+ defaultMessage: "Download the PDF for a full breakdown",
404
+ description: "Download the PDF for a full breakdown",
405
+ id: "sdk.invoice_details.invoice.download_pdf"
406
+ })), 1)
407
+ ]),
408
+ _: 1
409
+ })) : createCommentVNode("", true),
410
+ createVNode(unref(_sfc_main$e), {
411
+ invoice: __props.invoice,
412
+ "is-expandable": !isSmallScreen.value
413
+ }, {
414
+ logo: withCtx(() => [
415
+ renderSlot(_ctx.$slots, "logo")
416
+ ]),
417
+ _: 3
418
+ }, 8, ["invoice", "is-expandable"]),
419
+ createVNode(_sfc_main$4, { invoice: __props.invoice }, null, 8, ["invoice"])
420
+ ], 2)
421
+ ]),
422
+ _: 3
423
+ }, 8, ["title"]);
424
+ };
425
+ }
426
+ });
427
+ const _hoisted_1 = { class: "flex flex-col gap-3 lg:flex-row lg:gap-6" };
428
+ const _hoisted_2 = { class: "flex shrink-0 flex-col gap-8 lg:w-72 lg:gap-6" };
429
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
430
+ __name: "InvoiceDetail",
431
+ props: {
432
+ invoice: { type: Object },
433
+ paymentAttempts: { default: () => [], type: Array },
434
+ downloadService: { type: Function },
435
+ showDownloadButton: { type: Boolean, default: true },
436
+ showCustomerBillingInformation: { type: Boolean, default: true },
437
+ showPaymentAttempts: { type: Boolean, default: true }
438
+ },
439
+ setup(__props) {
440
+ const { $t } = useIntl();
441
+ return (_ctx, _cache) => {
442
+ return openBlock(), createElementBlock(Fragment, null, [
443
+ createVNode(unref(_sfc_main$w), {
444
+ class: "mb-6",
445
+ "payment-attempts": __props.paymentAttempts,
446
+ invoice: __props.invoice,
447
+ "download-service": () => __props.downloadService(__props.invoice.id),
448
+ "show-download-button": __props.showDownloadButton,
449
+ variant: "external"
450
+ }, null, 8, ["payment-attempts", "invoice", "download-service", "show-download-button"]),
451
+ createElementVNode("div", _hoisted_1, [
452
+ __props.invoice ? (openBlock(), createBlock(_sfc_main$3, {
453
+ key: 0,
454
+ invoice: __props.invoice
455
+ }, null, 8, ["invoice"])) : createCommentVNode("", true),
456
+ createElementVNode("div", _hoisted_2, [
457
+ createVNode(_sfc_main$6, { invoice: __props.invoice }, null, 8, ["invoice"]),
458
+ __props.showPaymentAttempts && __props.paymentAttempts.length ? (openBlock(), createBlock(_sfc_main$7, {
459
+ key: 0,
460
+ "payment-attempts": __props.paymentAttempts,
461
+ customer: __props.invoice.customer
462
+ }, null, 8, ["payment-attempts", "customer"])) : createCommentVNode("", true),
463
+ __props.showCustomerBillingInformation ? (openBlock(), createBlock(unref(_sfc_main$z), {
464
+ key: 1,
465
+ customer: __props.invoice.customer,
466
+ title: unref($t)({
467
+ defaultMessage: "Your billing information",
468
+ description: "Title for the billing information on the detailed invoice view",
469
+ id: "sdk.invoice_details.customer_billing_information.title"
470
+ })
471
+ }, null, 8, ["customer", "title"])) : createCommentVNode("", true)
472
+ ])
473
+ ])
474
+ ], 64);
475
+ };
476
+ }
477
+ });
478
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
479
+ __name: "Invoice",
480
+ props: {
481
+ isLoading: { type: Boolean },
482
+ invoice: { type: Object },
483
+ payments: { type: Array },
484
+ invoiceDownloadService: { type: Function },
485
+ configuration: { type: Object }
486
+ },
487
+ setup(__props) {
488
+ return (_ctx, _cache) => {
489
+ var _a, _b, _c;
490
+ return openBlock(), createBlock(_sfc_main$2, {
491
+ invoice: __props.invoice,
492
+ "payment-attempts": __props.payments,
493
+ "download-service": __props.invoiceDownloadService,
494
+ "show-download-button": (_a = __props.configuration) == null ? void 0 : _a.enableDownloadButton,
495
+ "show-customer-billing-information": (_b = __props.configuration) == null ? void 0 : _b.enableCustomerBillingInformation,
496
+ "show-payment-attempts": (_c = __props.configuration) == null ? void 0 : _c.enablePaymentAttempts
497
+ }, null, 8, ["invoice", "payment-attempts", "download-service", "show-download-button", "show-customer-billing-information", "show-payment-attempts"]);
498
+ };
499
+ }
500
+ });
501
+ const _sfc_main = /* @__PURE__ */ defineComponent({
502
+ __name: "Invoice.entry",
503
+ props: {
504
+ environment: { type: String },
505
+ locale: { type: String },
506
+ dateLocale: { type: String },
507
+ messages: { type: Object },
508
+ showTimezones: { type: Boolean },
509
+ primaryColor: { type: String },
510
+ secondaryColor: { type: String },
511
+ isShadowRoot: { type: Boolean },
512
+ experimentalFeatures: { type: Array },
513
+ logLevel: { type: String },
514
+ onLog: { type: Function },
515
+ allowedPortalTypes: { type: Array },
516
+ portalObject: { type: Object },
517
+ customElementName: { type: String },
518
+ branding: { type: Object },
519
+ configuration: { type: Object }
520
+ },
521
+ setup(__props) {
522
+ var _a;
523
+ const props = __props;
524
+ if (!((_a = props.configuration) == null ? void 0 : _a.invoiceId)) {
525
+ throw new Error("Missing invoice id");
526
+ }
527
+ const resolvedProps = computed(() => ({
528
+ ...props,
529
+ configuration: {
530
+ enableCustomerBillingInformation: true,
531
+ enableDownloadButton: true,
532
+ enablePaymentAttempts: true,
533
+ ...props.configuration
534
+ }
535
+ }));
536
+ return (_ctx, _cache) => {
537
+ var _a2, _b, _c, _d;
538
+ return openBlock(), createBlock(unref(_sfc_main$8), {
539
+ "custom-element-name": unref(COMPONENT_NAME),
540
+ environment: __props.environment,
541
+ locale: __props.locale,
542
+ "portal-object": __props.portalObject,
543
+ "allowed-portal-types": ["CUSTOMER"],
544
+ "primary-color": (_b = (_a2 = __props.branding) == null ? void 0 : _a2.colors) == null ? void 0 : _b.primary,
545
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
546
+ "experimental-features": __props.experimentalFeatures,
547
+ "log-level": __props.logLevel,
548
+ "on-log": __props.onLog,
549
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
550
+ }, {
551
+ default: withCtx(() => [
552
+ createVNode(_sfc_main$5, normalizeProps(guardReactiveProps(resolvedProps.value)), {
553
+ default: withCtx(({ invoice, payments, isLoading, invoiceDownloadService }) => [
554
+ invoice ? (openBlock(), createBlock(_sfc_main$1, {
555
+ key: 0,
556
+ "is-loading": isLoading,
557
+ invoice,
558
+ "invoice-download-service": invoiceDownloadService,
559
+ payments: payments.payments.value,
560
+ configuration: __props.configuration
561
+ }, null, 8, ["is-loading", "invoice", "invoice-download-service", "payments", "configuration"])) : createCommentVNode("", true)
562
+ ]),
563
+ _: 1
564
+ }, 16)
565
+ ]),
566
+ _: 1
567
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log"]);
568
+ };
569
+ }
570
+ });
571
+ const SolvimonInvoice = defineCustomElement(_sfc_main);
572
+ const COMPONENT_NAME = getComponentName("invoice");
573
+ const defineSolvimonInvoice = () => {
574
+ if (!customElements.get(COMPONENT_NAME)) {
575
+ customElements.define(COMPONENT_NAME, SolvimonInvoice);
576
+ }
577
+ };
578
+ export {
579
+ COMPONENT_NAME as C,
580
+ SolvimonInvoice as S,
581
+ _sfc_main as _,
582
+ defineSolvimonInvoice as d
583
+ };
@@ -0,0 +1 @@
1
+ const e=require("vue"),t=require("./useLoadInitialData-BRg7IWqW.js"),o=require("./invoices-8M_3ur_U.js"),n=require("./useService-bNNi4GB8.js"),i=require("./payments-C3LPk9k9.js"),a=require("./component-Df5eNqYX.js"),r=require("./index-CWSXne1Q.js"),l=require("./InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js"),c=require("./PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.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"}),h=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)=>h.value.length>0?(e.openBlock(),e.createElementBlock("section",d,[e.createElementVNode("div",u,[(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(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"},h=e.defineComponent({__name:"InvoiceDetail",props:{invoice:{type:Object},paymentAttempts:{default:()=>[],type:Array},downloadService:{type:Function},showDownloadButton:{type:Boolean,default:!0},showCustomerBillingInformation:{type:Boolean,default:!0},showPaymentAttempts:{type:Boolean,default:!0}},setup(t){const{$t:o}=a.useIntl();return(n,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(a._sfc_main$w),{class:"mb-6","payment-attempts":t.paymentAttempts,invoice:t.invoice,"download-service":()=>t.downloadService(t.invoice.id),"show-download-button":t.showDownloadButton,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"]),t.showPaymentAttempts&&t.paymentAttempts.length?(e.openBlock(),e.createBlock(c._sfc_main,{key:0,"payment-attempts":t.paymentAttempts,customer:t.invoice.customer},null,8,["payment-attempts","customer"])):e.createCommentVNode("",!0),t.showCustomerBillingInformation?(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))}}),x=e.defineComponent({__name:"Invoice",props:{isLoading:{type:Boolean},invoice:{type:Object},payments:{type:Array},invoiceDownloadService:{type:Function},configuration:{type:Object}},setup:t=>(o,n)=>{var i,a,r;return e.openBlock(),e.createBlock(h,{invoice:t.invoice,"payment-attempts":t.payments,"download-service":t.invoiceDownloadService,"show-download-button":null==(i=t.configuration)?void 0:i.enableDownloadButton,"show-customer-billing-information":null==(a=t.configuration)?void 0:a.enableCustomerBillingInformation,"show-payment-attempts":null==(r=t.configuration)?void 0:r.enablePaymentAttempts},null,8,["invoice","payment-attempts","download-service","show-download-button","show-customer-billing-information","show-payment-attempts"])}}),k=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(N),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"])}}}),C=a.defineCustomElement(k),N=a.getComponentName("invoice");exports.COMPONENT_NAME=N,exports.SolvimonInvoice=C,exports._sfc_main=k,exports.defineSolvimonInvoice=()=>{customElements.get(N)||customElements.define(N,C)};