@tesouro/embedded-components-react 0.5.110 → 0.5.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index166.js +123 -123
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index440.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index453.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index458.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index459.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index509.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index536.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index585.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index586.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,10 @@ import { isLineItemTaxable as i } from "./index162.js";
|
|
|
7
7
|
import { getTotalsRowVisibility as a } from "./index163.js";
|
|
8
8
|
import { getDaysOverdue as ee } from "./index164.js";
|
|
9
9
|
import { formatReminderSchedule as te } from "./index165.js";
|
|
10
|
-
import { rateMinorToMajor as
|
|
11
|
-
import { parseISO as
|
|
10
|
+
import { rateMinorToMajor as ne } from "./index161.js";
|
|
11
|
+
import { parseISO as o } from "date-fns";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index166.js
|
|
13
|
-
var
|
|
13
|
+
var s = /^\d{4}-\d{2}-\d{2}$/, c = (e, t) => {
|
|
14
14
|
switch (t) {
|
|
15
15
|
case "draft": return e._("Draft");
|
|
16
16
|
case "issuing": return e._("Issuing");
|
|
@@ -27,7 +27,7 @@ var c = /^\d{4}-\d{2}-\d{2}$/, l = (e, t) => {
|
|
|
27
27
|
case "deleted": return e._("Deleted");
|
|
28
28
|
default: return e._("Unknown");
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, l = (e, t) => {
|
|
31
31
|
switch (t) {
|
|
32
32
|
case "day": return e._("Daily");
|
|
33
33
|
case "week": return e._("Weekly");
|
|
@@ -36,7 +36,7 @@ var c = /^\d{4}-\d{2}-\d{2}$/, l = (e, t) => {
|
|
|
36
36
|
case "year": return e._("Yearly");
|
|
37
37
|
default: return "";
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, u = (e, t) => {
|
|
40
40
|
switch (t) {
|
|
41
41
|
case "day": return e._("each day");
|
|
42
42
|
case "week": return e._("each week");
|
|
@@ -45,13 +45,13 @@ var c = /^\d{4}-\d{2}-\d{2}$/, l = (e, t) => {
|
|
|
45
45
|
case "year": return e._("each year");
|
|
46
46
|
default: return "";
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, d = [
|
|
49
49
|
"issued",
|
|
50
50
|
"overdue",
|
|
51
51
|
"partially_paid",
|
|
52
52
|
"paid",
|
|
53
53
|
"uncollectible"
|
|
54
|
-
],
|
|
54
|
+
], f = {
|
|
55
55
|
draft: {
|
|
56
56
|
primary: [
|
|
57
57
|
"edit",
|
|
@@ -93,147 +93,147 @@ var c = /^\d{4}-\d{2}-\d{2}$/, l = (e, t) => {
|
|
|
93
93
|
overflow: []
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
function
|
|
97
|
-
let
|
|
96
|
+
function p(p, m, re, { i18n: h, formatCurrencyToDisplay: g, locale: _ }, v = !1, y = {}, b) {
|
|
97
|
+
let x = p.currency, S = (e) => g(e ?? 0, x) ?? "", C = (e) => g(e, x, !0, !0) ?? "", w = (e) => e ? h.date(s.test(e) ? o(e) : e, _.dateFormat) : "-", T = (e) => e ? w(e) : h._("Pending"), E = p.status, D = E === "canceled", O = E === "overdue", k = p.tax_mode === "inclusive", ie = !!p.recurrence_id || E === "recurring", A = E === "recurring" && !!m, ae = !!p.recurrence_id && E !== "recurring", j = O ? ee(p.due_date) : 0, M = "default", N = [];
|
|
98
98
|
switch (E) {
|
|
99
99
|
case "draft":
|
|
100
100
|
case "recurring":
|
|
101
101
|
N.push({
|
|
102
|
-
label:
|
|
103
|
-
value:
|
|
102
|
+
label: h._("Invoice amount"),
|
|
103
|
+
value: S(p.total_amount),
|
|
104
104
|
emphasis: !0
|
|
105
105
|
});
|
|
106
106
|
break;
|
|
107
107
|
case "issued":
|
|
108
108
|
case "overdue":
|
|
109
109
|
M = O ? "danger" : "default", N.push({
|
|
110
|
-
label:
|
|
111
|
-
value:
|
|
110
|
+
label: h._("Balance due"),
|
|
111
|
+
value: S(p.amount_due),
|
|
112
112
|
emphasis: !0
|
|
113
|
-
}), (
|
|
114
|
-
label:
|
|
115
|
-
value:
|
|
113
|
+
}), (p.amount_paid ?? 0) > 0 && N.push({
|
|
114
|
+
label: h._("Amount received"),
|
|
115
|
+
value: S(p.amount_paid),
|
|
116
116
|
tone: "success"
|
|
117
117
|
});
|
|
118
118
|
break;
|
|
119
119
|
case "partially_paid":
|
|
120
120
|
N.push({
|
|
121
|
-
label:
|
|
122
|
-
value:
|
|
121
|
+
label: h._("Balance due"),
|
|
122
|
+
value: S(p.amount_due),
|
|
123
123
|
emphasis: !0
|
|
124
124
|
}, {
|
|
125
|
-
label:
|
|
126
|
-
value:
|
|
125
|
+
label: h._("Amount received"),
|
|
126
|
+
value: S(p.amount_paid),
|
|
127
127
|
tone: "success"
|
|
128
128
|
});
|
|
129
129
|
break;
|
|
130
130
|
case "paid":
|
|
131
131
|
M = "success", N.push({
|
|
132
|
-
label:
|
|
133
|
-
value:
|
|
132
|
+
label: h._("Amount received"),
|
|
133
|
+
value: S(p.amount_paid),
|
|
134
134
|
emphasis: !0
|
|
135
135
|
});
|
|
136
136
|
break;
|
|
137
137
|
case "canceled":
|
|
138
138
|
M = "muted", N.push({
|
|
139
|
-
label:
|
|
140
|
-
value:
|
|
139
|
+
label: h._("Cancelled amount"),
|
|
140
|
+
value: S(p.total_amount),
|
|
141
141
|
emphasis: !0
|
|
142
142
|
});
|
|
143
143
|
break;
|
|
144
144
|
case "uncollectible":
|
|
145
145
|
M = "muted", N.push({
|
|
146
|
-
label:
|
|
147
|
-
value:
|
|
146
|
+
label: h._("Amount written off"),
|
|
147
|
+
value: S(p.amount_due),
|
|
148
148
|
emphasis: !0
|
|
149
149
|
});
|
|
150
150
|
break;
|
|
151
151
|
default: N.push({
|
|
152
|
-
label:
|
|
153
|
-
value:
|
|
152
|
+
label: h._("Invoice amount"),
|
|
153
|
+
value: S(p.total_amount),
|
|
154
154
|
emphasis: !0
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
let P =
|
|
157
|
+
let P = p.counterpart_contact, F = p.counterpart_billing_address, I = F?.country ? e(h)[F.country] : void 0, L = [F?.city, [F?.state, F?.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", "), R = F?.line1 ? [
|
|
158
158
|
`${F.line1}${F.line2 ? ` ${F.line2}` : ""}`,
|
|
159
159
|
L,
|
|
160
160
|
I
|
|
161
161
|
].filter(Boolean).join(", ") : void 0, z = [];
|
|
162
162
|
P?.email && z.push({
|
|
163
|
-
label:
|
|
163
|
+
label: h._("Email"),
|
|
164
164
|
value: P.email
|
|
165
165
|
}), P?.phone && z.push({
|
|
166
|
-
label:
|
|
166
|
+
label: h._("Phone"),
|
|
167
167
|
value: P.phone
|
|
168
168
|
}), R && z.push({
|
|
169
|
-
label:
|
|
169
|
+
label: h._("Address"),
|
|
170
170
|
value: R
|
|
171
171
|
});
|
|
172
|
-
let B = !!(
|
|
173
|
-
label:
|
|
174
|
-
value: H ? r(H,
|
|
172
|
+
let B = !!(p.payment_reminder_id || p.overdue_reminder_id), V = te(y.paymentReminder, y.overdueReminder, h, B), H = b?.account, U = b ? [{
|
|
173
|
+
label: h._("Deposit account"),
|
|
174
|
+
value: H ? r(H, h) : b.isListIncomplete && p.bank_account_id ? "-" : h._("Not provided")
|
|
175
175
|
}] : [], W = A ? [
|
|
176
176
|
{
|
|
177
|
-
label:
|
|
178
|
-
value:
|
|
177
|
+
label: h._("Frequency"),
|
|
178
|
+
value: m ? l(h, m.frequency) : "-"
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
|
-
label:
|
|
182
|
-
value:
|
|
181
|
+
label: h._("Invoice amount"),
|
|
182
|
+
value: S(p.total_amount)
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
|
-
label:
|
|
186
|
-
value:
|
|
185
|
+
label: h._("Payment terms"),
|
|
186
|
+
value: p.payment_terms?.name ?? h._("Pending")
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
label:
|
|
189
|
+
label: h._("Payment reminders"),
|
|
190
190
|
value: V
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
|
-
label:
|
|
194
|
-
value:
|
|
193
|
+
label: h._("PO number"),
|
|
194
|
+
value: p.purchase_order || h._("Not provided")
|
|
195
195
|
},
|
|
196
196
|
...U
|
|
197
197
|
] : [
|
|
198
|
-
...
|
|
199
|
-
label:
|
|
200
|
-
value:
|
|
198
|
+
...p.document_id ? [{
|
|
199
|
+
label: h._("Invoice number"),
|
|
200
|
+
value: p.document_id
|
|
201
201
|
}] : [],
|
|
202
202
|
{
|
|
203
|
-
label:
|
|
204
|
-
value:
|
|
203
|
+
label: h._("Invoice amount"),
|
|
204
|
+
value: S(p.total_amount)
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
label:
|
|
208
|
-
value: T(
|
|
207
|
+
label: h._("Invoice date"),
|
|
208
|
+
value: T(p.issue_date)
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
|
-
label:
|
|
212
|
-
value: T(
|
|
211
|
+
label: h._("Due date"),
|
|
212
|
+
value: T(p.due_date)
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
|
-
label:
|
|
216
|
-
value:
|
|
215
|
+
label: h._("Payment terms"),
|
|
216
|
+
value: p.payment_terms?.name ?? h._("Pending")
|
|
217
217
|
},
|
|
218
218
|
{
|
|
219
|
-
label:
|
|
219
|
+
label: h._("Payment reminders"),
|
|
220
220
|
value: V
|
|
221
221
|
},
|
|
222
|
-
...
|
|
223
|
-
label:
|
|
224
|
-
value:
|
|
222
|
+
...p.purchase_order ? [{
|
|
223
|
+
label: h._("PO number"),
|
|
224
|
+
value: p.purchase_order
|
|
225
225
|
}] : [],
|
|
226
226
|
...U
|
|
227
|
-
], G = (
|
|
227
|
+
], G = (p.line_items ?? []).map((e, t) => {
|
|
228
228
|
let n = k ? e?.product?.price_after_tax?.value : e?.product?.price?.value, r = k ? e?.total_after_tax : e?.total_before_tax ?? (e?.product?.price?.value ?? 0) * (e?.quantity ?? 0);
|
|
229
229
|
return {
|
|
230
230
|
id: `${e?.product?.id ?? "item"}-${t}`,
|
|
231
231
|
name: e?.product?.name ?? "",
|
|
232
232
|
quantityLabel: String(e?.quantity ?? 0),
|
|
233
|
-
unitPriceLabel:
|
|
234
|
-
totalLabel:
|
|
233
|
+
unitPriceLabel: S(n),
|
|
234
|
+
totalLabel: S(r)
|
|
235
235
|
};
|
|
236
|
-
}), K = (
|
|
236
|
+
}), K = (p.line_items ?? []).reduce((e, t) => {
|
|
237
237
|
let n = t?.total_before_tax ?? 0, r = i(t?.tax_status);
|
|
238
238
|
return {
|
|
239
239
|
taxableItemsSubtotal: e.taxableItemsSubtotal + (r ? n : 0),
|
|
@@ -243,69 +243,69 @@ function m(m, h, ne, { i18n: g, formatCurrencyToDisplay: _, locale: v }, y = !1,
|
|
|
243
243
|
taxableItemsSubtotal: 0,
|
|
244
244
|
nonTaxableItemsSubtotal: 0
|
|
245
245
|
}), q = n({
|
|
246
|
-
discount:
|
|
246
|
+
discount: p.discount,
|
|
247
247
|
subtotal: K.taxableItemsSubtotal + K.nonTaxableItemsSubtotal
|
|
248
248
|
}), J = a({
|
|
249
249
|
...K,
|
|
250
250
|
discountAmount: q
|
|
251
|
-
}),
|
|
252
|
-
label:
|
|
253
|
-
value:
|
|
254
|
-
}] : [], { taxableSubtotal:
|
|
251
|
+
}), oe = J.showDiscounts ? [{
|
|
252
|
+
label: h._("Discount"),
|
|
253
|
+
value: C(-q)
|
|
254
|
+
}] : [], { taxableSubtotal: se, nonTaxableSubtotal: ce } = t({
|
|
255
255
|
...K,
|
|
256
256
|
discountAmount: q
|
|
257
|
-
}),
|
|
258
|
-
label:
|
|
259
|
-
value:
|
|
257
|
+
}), le = [...J.showNonTaxableSubtotal ? [{
|
|
258
|
+
label: h._("Non-taxable subtotal"),
|
|
259
|
+
value: S(ce),
|
|
260
260
|
tone: "muted"
|
|
261
261
|
}] : [], ...J.showTaxableSubtotal ? [{
|
|
262
|
-
label:
|
|
263
|
-
value:
|
|
262
|
+
label: h._("Taxable subtotal"),
|
|
263
|
+
value: S(se),
|
|
264
264
|
tone: "muted"
|
|
265
|
-
}] : []],
|
|
265
|
+
}] : []], ue = [
|
|
266
266
|
{
|
|
267
|
-
label:
|
|
268
|
-
value:
|
|
267
|
+
label: h._("Subtotal"),
|
|
268
|
+
value: S(p.subtotal)
|
|
269
269
|
},
|
|
270
|
-
...
|
|
271
|
-
...
|
|
272
|
-
...(
|
|
273
|
-
label:
|
|
274
|
-
value:
|
|
270
|
+
...oe,
|
|
271
|
+
...le,
|
|
272
|
+
...(p.total_tax_amounts ?? []).map((e) => ({
|
|
273
|
+
label: h._("Tax ({rate}%)", { rate: ne(e?.value ?? 0) }),
|
|
274
|
+
value: S(e?.amount)
|
|
275
275
|
})),
|
|
276
276
|
{
|
|
277
|
-
label:
|
|
278
|
-
value:
|
|
277
|
+
label: h._("Total"),
|
|
278
|
+
value: S(p.total_amount),
|
|
279
279
|
emphasis: !0
|
|
280
280
|
}
|
|
281
|
-
],
|
|
282
|
-
rows:
|
|
281
|
+
], Y = d.includes(E) ? {
|
|
282
|
+
rows: re.map((e) => ({
|
|
283
283
|
id: e.id,
|
|
284
|
-
dateLabel:
|
|
285
|
-
amountLabel:
|
|
284
|
+
dateLabel: w(e.paid_at),
|
|
285
|
+
amountLabel: S(e.amount)
|
|
286
286
|
})),
|
|
287
|
-
totalLabel:
|
|
287
|
+
totalLabel: S(p.amount_paid),
|
|
288
288
|
emptyTone: O ? "danger" : "default",
|
|
289
|
-
loading:
|
|
290
|
-
} : void 0,
|
|
291
|
-
status:
|
|
292
|
-
amountLabel:
|
|
293
|
-
amountPeriodLabel:
|
|
294
|
-
startsOnLabel: T(
|
|
295
|
-
endsOnLabel:
|
|
296
|
-
scheduleTitle:
|
|
297
|
-
} : void 0,
|
|
298
|
-
title:
|
|
299
|
-
name:
|
|
300
|
-
frequency:
|
|
289
|
+
loading: v
|
|
290
|
+
} : void 0, de = A && m ? {
|
|
291
|
+
status: m.status,
|
|
292
|
+
amountLabel: S(p.total_amount),
|
|
293
|
+
amountPeriodLabel: u(h, m.frequency),
|
|
294
|
+
startsOnLabel: T(m.start_date),
|
|
295
|
+
endsOnLabel: m.end_date ? w(m.end_date) : "-",
|
|
296
|
+
scheduleTitle: h._("{frequency} schedule", { frequency: l(h, m.frequency) })
|
|
297
|
+
} : void 0, fe = ae && m ? {
|
|
298
|
+
title: h._("{name} - {frequency}", {
|
|
299
|
+
name: p.counterpart_name ?? h._("Invoice"),
|
|
300
|
+
frequency: l(h, m.frequency)
|
|
301
301
|
}),
|
|
302
|
-
invoiceId:
|
|
303
|
-
} : void 0, X =
|
|
302
|
+
invoiceId: m.invoice_id
|
|
303
|
+
} : void 0, X = f[E] ?? {
|
|
304
304
|
primary: [],
|
|
305
305
|
overflow: ["clone"]
|
|
306
306
|
}, Z = X.overflow, Q = X.primary;
|
|
307
|
-
if (A &&
|
|
308
|
-
switch (
|
|
307
|
+
if (A && m) {
|
|
308
|
+
switch (m.status) {
|
|
309
309
|
case "active":
|
|
310
310
|
Z = ["pauseRecurrence", "cancelRecurrence"];
|
|
311
311
|
break;
|
|
@@ -314,38 +314,38 @@ function m(m, h, ne, { i18n: g, formatCurrencyToDisplay: _, locale: v }, y = !1,
|
|
|
314
314
|
break;
|
|
315
315
|
default: Z = [];
|
|
316
316
|
}
|
|
317
|
-
(
|
|
317
|
+
(m.status === "active" || m.status === "paused") && (Q = ["edit"]);
|
|
318
318
|
}
|
|
319
|
-
let $ =
|
|
319
|
+
let $ = p.counterpart_name ?? h._("Invoice");
|
|
320
320
|
return {
|
|
321
|
-
title: A &&
|
|
321
|
+
title: A && m ? h._("{name} - {frequency}", {
|
|
322
322
|
name: $,
|
|
323
|
-
frequency:
|
|
323
|
+
frequency: l(h, m.frequency)
|
|
324
324
|
}) : $,
|
|
325
325
|
status: E,
|
|
326
|
-
statusLabel:
|
|
327
|
-
subtitle: A ?
|
|
328
|
-
recurring:
|
|
329
|
-
overdueLabel: O && j > 0 ?
|
|
326
|
+
statusLabel: c(h, E),
|
|
327
|
+
subtitle: A ? h._("Recurring series") : p.document_id ? h._("Invoice: {number}", { number: p.document_id }) : void 0,
|
|
328
|
+
recurring: ie,
|
|
329
|
+
overdueLabel: O && j > 0 ? h._("{days} days overdue", { days: j }) : void 0,
|
|
330
330
|
amountTone: M,
|
|
331
331
|
amountRows: N,
|
|
332
|
-
invoiceDateLabel: T(
|
|
333
|
-
dueDateLabel:
|
|
334
|
-
dueDateCaption: D ?
|
|
335
|
-
paymentHistory:
|
|
332
|
+
invoiceDateLabel: T(p.issue_date),
|
|
333
|
+
dueDateLabel: D ? w(p.updated_at) : T(p.due_date),
|
|
334
|
+
dueDateCaption: D ? h._("Cancelled on") : h._("Due date"),
|
|
335
|
+
paymentHistory: Y,
|
|
336
336
|
customerContact: z,
|
|
337
|
-
recurringSeries:
|
|
338
|
-
seriesLink:
|
|
337
|
+
recurringSeries: de,
|
|
338
|
+
seriesLink: fe,
|
|
339
339
|
billingItems: W,
|
|
340
340
|
lineItems: G,
|
|
341
|
-
lineItemTotals:
|
|
342
|
-
notes:
|
|
343
|
-
opening:
|
|
344
|
-
closing:
|
|
341
|
+
lineItemTotals: ue,
|
|
342
|
+
notes: p.memo || p.footer ? {
|
|
343
|
+
opening: p.memo || void 0,
|
|
344
|
+
closing: p.footer || void 0
|
|
345
345
|
} : void 0,
|
|
346
346
|
primaryActions: Q,
|
|
347
347
|
overflowActions: Z
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
//#endregion
|
|
351
|
-
export {
|
|
351
|
+
export { p as buildInvoiceDetailsView };
|