@tesouro/embedded-components-react 0.5.211 → 0.5.212
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/index.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +16 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +113 -109
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +416 -132
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +113 -211
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +154 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +193 -135
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +32 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +150 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +35 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +96 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +103 -347
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +364 -64
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +66 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +105 -275
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +288 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +76 -61
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +48 -422
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +38 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +61 -391
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +457 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +91 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +234 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4927,6 +4927,16 @@ interface ReceivableFormSheetLabels extends ReceivableBillingSectionLabels {
|
|
|
4927
4927
|
taxRateLabel: string;
|
|
4928
4928
|
taxRatePlaceholder: string;
|
|
4929
4929
|
taxRateSuffix: string;
|
|
4930
|
+
discountLabel: string;
|
|
4931
|
+
discountPercentageOption: string;
|
|
4932
|
+
discountAmountOptionAriaLabel: string;
|
|
4933
|
+
discountPercentageOptionAriaLabel: string;
|
|
4934
|
+
subtotalLabel: string;
|
|
4935
|
+
discountTotalLabel: string;
|
|
4936
|
+
nonTaxableSubtotalLabel: string;
|
|
4937
|
+
taxableSubtotalLabel: string;
|
|
4938
|
+
taxTotalLabel: string;
|
|
4939
|
+
totalLabel: string;
|
|
4930
4940
|
decreaseQuantityButton: string;
|
|
4931
4941
|
increaseQuantityButton: string;
|
|
4932
4942
|
addLineItemButton: string;
|
|
@@ -5053,6 +5063,12 @@ interface ReceivableMessageLabels {
|
|
|
5053
5063
|
lineItemNameTooLong: string;
|
|
5054
5064
|
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
5055
5065
|
lineItemPriceTooHigh: string;
|
|
5066
|
+
discountPercentageTooHigh: string;
|
|
5067
|
+
discountExceedsSubtotal: string;
|
|
5068
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
5069
|
+
invoiceSubtotalTooHigh: string;
|
|
5070
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
5071
|
+
invoiceTotalTooHigh: string;
|
|
5056
5072
|
sendToRequired: string;
|
|
5057
5073
|
sendSubjectRequired: string;
|
|
5058
5074
|
sendBodyRequired: string;
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { InsightsWidget as L } from "./libs/tesouro-embedded-components-react/in
|
|
|
27
27
|
import { UploadReceiptWidget as R } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index2.js";
|
|
28
28
|
import { ExpenseManagementWidget as z } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index21.js";
|
|
29
29
|
import { InvoicingWidget as B } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js";
|
|
30
|
-
import { ReceivablesWidget as V } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/
|
|
30
|
+
import { ReceivablesWidget as V } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js";
|
|
31
31
|
import { SettingsSection as H } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js";
|
|
32
32
|
import { HELP_FAQ_EN as U } from "./libs/tesouro-embedded-components-react/settings-widget/help/ui/contract/dist/index3.js";
|
|
33
33
|
import { SettingsWidget as W } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js";
|
|
@@ -971,6 +971,16 @@ interface ReceivableFormSheetLabels extends ReceivableBillingSectionLabels {
|
|
|
971
971
|
taxRateLabel: string;
|
|
972
972
|
taxRatePlaceholder: string;
|
|
973
973
|
taxRateSuffix: string;
|
|
974
|
+
discountLabel: string;
|
|
975
|
+
discountPercentageOption: string;
|
|
976
|
+
discountAmountOptionAriaLabel: string;
|
|
977
|
+
discountPercentageOptionAriaLabel: string;
|
|
978
|
+
subtotalLabel: string;
|
|
979
|
+
discountTotalLabel: string;
|
|
980
|
+
nonTaxableSubtotalLabel: string;
|
|
981
|
+
taxableSubtotalLabel: string;
|
|
982
|
+
taxTotalLabel: string;
|
|
983
|
+
totalLabel: string;
|
|
974
984
|
decreaseQuantityButton: string;
|
|
975
985
|
increaseQuantityButton: string;
|
|
976
986
|
addLineItemButton: string;
|
|
@@ -1097,6 +1107,12 @@ interface ReceivableMessageLabels {
|
|
|
1097
1107
|
lineItemNameTooLong: string;
|
|
1098
1108
|
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
1099
1109
|
lineItemPriceTooHigh: string;
|
|
1110
|
+
discountPercentageTooHigh: string;
|
|
1111
|
+
discountExceedsSubtotal: string;
|
|
1112
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
1113
|
+
invoiceSubtotalTooHigh: string;
|
|
1114
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
1115
|
+
invoiceTotalTooHigh: string;
|
|
1100
1116
|
sendToRequired: string;
|
|
1101
1117
|
sendSubjectRequired: string;
|
|
1102
1118
|
sendBodyRequired: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReceivablesWidget as e } from "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/
|
|
1
|
+
import { ReceivablesWidget as e } from "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js";
|
|
2
2
|
import "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js";
|
|
3
3
|
export { e as ReceivablesWidget };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
CHANGED
|
@@ -1,111 +1,115 @@
|
|
|
1
|
+
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
+
import { isBlankLineItem as t, keepsSavedTaxRates as n, lineItemTaxRateMinorUnits as r, maxAmountLabel as i, parseQuantity as a, priceInputToMinorUnits as o } from "./index6.js";
|
|
3
|
+
import { discountFromDraft as s } from "./index9.js";
|
|
1
4
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
5
|
+
var c = 1e4;
|
|
6
|
+
function l(e, t) {
|
|
7
|
+
return Math.round(o(e.price, t) * a(e.quantity));
|
|
8
|
+
}
|
|
9
|
+
function u({ lineItems: e, currency: t, taxRate: n }) {
|
|
10
|
+
let r = n ? Math.round(n * 100) : 0, i = 0, a = 0;
|
|
11
|
+
for (let n of e) {
|
|
12
|
+
let e = l(n, t);
|
|
13
|
+
n.taxable ? i += e : a += e;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
taxableItemsSubtotal: i,
|
|
17
|
+
nonTaxableItemsSubtotal: a,
|
|
18
|
+
subtotal: i + a,
|
|
19
|
+
rateMinorUnits: r
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function d({ discount: e, subtotal: t }) {
|
|
23
|
+
if (!e) return 0;
|
|
24
|
+
let n = e.value ?? (e.type === "amount" ? e.amount : Math.round(t * e.amount / 1e4));
|
|
25
|
+
return Math.min(Math.max(n, 0), t);
|
|
26
|
+
}
|
|
27
|
+
function f({ taxableItemsSubtotal: e, nonTaxableItemsSubtotal: t, discountAmount: n }) {
|
|
28
|
+
let r = e + t, i = r > 0 ? Math.round(e / r * n) : 0;
|
|
29
|
+
return {
|
|
30
|
+
taxableSubtotal: e - i,
|
|
31
|
+
nonTaxableSubtotal: t - (n - i)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function p({ lineItems: e, currency: t, rateMinorUnits: n, keepSavedRate: i, taxableItemsSubtotal: a, taxableSubtotal: o }) {
|
|
35
|
+
if (a <= 0) return 0;
|
|
36
|
+
let s = /* @__PURE__ */ new Map();
|
|
37
|
+
for (let a of e) {
|
|
38
|
+
if (!a.taxable) continue;
|
|
39
|
+
let e = r(a, n, i);
|
|
40
|
+
s.set(e, (s.get(e) ?? 0) + l(a, t));
|
|
41
|
+
}
|
|
42
|
+
let u = [...s], d = o, f = 0;
|
|
43
|
+
return u.forEach(([e, t], n) => {
|
|
44
|
+
let r = n === u.length - 1 ? d : Math.round(o * t / a);
|
|
45
|
+
d -= r, f += r * e;
|
|
46
|
+
}), Math.round(f / c);
|
|
47
|
+
}
|
|
48
|
+
function m({ lineItems: e, currency: t, taxRate: n, keepSavedRate: r = !1, discount: i }) {
|
|
49
|
+
let a = u({
|
|
50
|
+
lineItems: e,
|
|
51
|
+
currency: t,
|
|
52
|
+
taxRate: n
|
|
53
|
+
}), o = d({
|
|
54
|
+
discount: i,
|
|
55
|
+
subtotal: a.subtotal
|
|
56
|
+
}), { taxableSubtotal: s, nonTaxableSubtotal: c } = f({
|
|
57
|
+
...a,
|
|
58
|
+
discountAmount: o
|
|
59
|
+
}), l = p({
|
|
60
|
+
lineItems: e,
|
|
61
|
+
currency: t,
|
|
62
|
+
rateMinorUnits: a.rateMinorUnits,
|
|
63
|
+
keepSavedRate: r,
|
|
64
|
+
taxableItemsSubtotal: a.taxableItemsSubtotal,
|
|
65
|
+
taxableSubtotal: s
|
|
66
|
+
}), m = a.subtotal - o;
|
|
67
|
+
return {
|
|
68
|
+
...a,
|
|
69
|
+
discountAmount: o,
|
|
70
|
+
discountedSubtotal: m,
|
|
71
|
+
taxableSubtotal: s,
|
|
72
|
+
nonTaxableSubtotal: c,
|
|
73
|
+
totalTaxes: l,
|
|
74
|
+
total: m + l
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function h(e) {
|
|
78
|
+
return m({
|
|
79
|
+
lineItems: e.lineItems.filter((e) => !t(e)),
|
|
80
|
+
currency: e.currency,
|
|
81
|
+
taxRate: Number(e.taxRate) || void 0,
|
|
82
|
+
keepSavedRate: n(e.taxRate, e.savedTaxRate),
|
|
83
|
+
discount: s(e)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function g(e, t) {
|
|
87
|
+
let n = s(e);
|
|
88
|
+
if (n) return n.type === "percentage" ? n.amount > 1e4 ? t.discountPercentageTooHigh : void 0 : n.amount > h(e).subtotal ? t.discountExceedsSubtotal : void 0;
|
|
89
|
+
}
|
|
90
|
+
function _(e, n) {
|
|
91
|
+
if (e.lineItems.filter((e) => !t(e)).some((t) => o(t.price, e.currency) > 9e15)) return;
|
|
92
|
+
let { subtotal: r, total: a } = h(e), s = i(e.currency);
|
|
93
|
+
if (r > 9e15) return n.invoiceSubtotalTooHigh.replace("{maxAmount}", s);
|
|
94
|
+
if (a > 9e15) return n.invoiceTotalTooHigh.replace("{maxAmount}", s);
|
|
95
|
+
}
|
|
96
|
+
function v(t, n, r) {
|
|
97
|
+
return new Intl.NumberFormat(void 0, {
|
|
98
|
+
style: "currency",
|
|
99
|
+
currency: n,
|
|
100
|
+
currencyDisplay: "narrowSymbol",
|
|
101
|
+
currencySign: r
|
|
102
|
+
}).format(t / 10 ** e(n));
|
|
103
|
+
}
|
|
104
|
+
function y(e, t) {
|
|
105
|
+
return {
|
|
106
|
+
subtotal: v(e.subtotal, t),
|
|
107
|
+
discount: e.discountAmount > 0 ? v(-e.discountAmount, t, "accounting") : v(0, t),
|
|
108
|
+
nonTaxableSubtotal: v(e.nonTaxableSubtotal, t),
|
|
109
|
+
taxableSubtotal: v(e.taxableSubtotal, t),
|
|
110
|
+
tax: v(e.totalTaxes, t),
|
|
111
|
+
total: v(e.total, t)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
110
114
|
//#endregion
|
|
111
|
-
export {
|
|
115
|
+
export { c as FULL_PERCENT_MINOR_UNITS, f as allocateDiscount, y as buildFormTotalsView, h as calculateFormTotals, m as calculateInvoiceTotals, u as calculateItemsSubtotals, d as resolveDiscountAmount, g as validateDiscount, _ as validateInvoiceTotals };
|