@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
|
@@ -27,38 +27,47 @@ function s(t, n) {
|
|
|
27
27
|
maximumFractionDigits: r
|
|
28
28
|
}).format(t / 10 ** r);
|
|
29
29
|
}
|
|
30
|
-
function c(t,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
function c(t, r, i = n()) {
|
|
31
|
+
return Math.round(l(t, i) * 10 ** e(r));
|
|
32
|
+
}
|
|
33
|
+
function l(e, t = n()) {
|
|
34
|
+
if (e.trim() === "") return 0;
|
|
35
|
+
let i = Array.from(e, (e) => {
|
|
36
|
+
let n = t.digits.indexOf(e);
|
|
37
|
+
return n === -1 ? e : String(n);
|
|
35
38
|
}).join("");
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
return Number.isNaN(
|
|
39
|
+
t.group && (i = i.replace(new RegExp(r(t.group), "g"), "")), i = i.replace(t.decimal, ".");
|
|
40
|
+
let a = parseFloat(i);
|
|
41
|
+
return Number.isNaN(a) ? 0 : a;
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function u(t, r, i, a = n()) {
|
|
41
44
|
let o = c(t, r, a) / 10 ** e(r);
|
|
42
45
|
return s(Math.round(o * 10 ** e(i)), i);
|
|
43
46
|
}
|
|
44
|
-
function
|
|
47
|
+
function d(e) {
|
|
45
48
|
let t = i(e);
|
|
46
49
|
return t.length > 1 && t.startsWith("0") && t[1] !== "." && (t = t.replace(/^0+/, "") || "0"), t === "" || t === "." ? t : Number(t) > 100 ? "100" : t;
|
|
47
50
|
}
|
|
48
|
-
function
|
|
51
|
+
function f(e) {
|
|
49
52
|
return e.endsWith(".") ? e.slice(0, -1) : e;
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function p(e) {
|
|
52
55
|
return Math.round((Number(e) || 0) * 100);
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function m(e, t) {
|
|
58
|
+
return t !== void 0 && p(e) === p(t);
|
|
59
|
+
}
|
|
60
|
+
function h(e, t, n) {
|
|
61
|
+
return n && e.savedTaxRate !== void 0 && g(e.savedTaxStatus) ? e.savedTaxRate : t;
|
|
62
|
+
}
|
|
63
|
+
function g(e) {
|
|
55
64
|
return (e ?? "taxable") === "taxable";
|
|
56
65
|
}
|
|
57
|
-
function
|
|
58
|
-
let t = e.find((e) =>
|
|
66
|
+
function _(e) {
|
|
67
|
+
let t = e.find((e) => g(e.tax_status))?.product.tax_rate?.value;
|
|
59
68
|
return t === void 0 ? "" : String(t / 100);
|
|
60
69
|
}
|
|
61
|
-
function
|
|
70
|
+
function v(e) {
|
|
62
71
|
try {
|
|
63
72
|
return new Intl.NumberFormat(void 0, {
|
|
64
73
|
style: "currency",
|
|
@@ -68,12 +77,12 @@ function h(e) {
|
|
|
68
77
|
return e;
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
|
-
function
|
|
80
|
+
function y() {
|
|
72
81
|
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
73
82
|
}
|
|
74
|
-
function
|
|
83
|
+
function b(e = "USD") {
|
|
75
84
|
return {
|
|
76
|
-
id:
|
|
85
|
+
id: y(),
|
|
77
86
|
productId: "",
|
|
78
87
|
name: "",
|
|
79
88
|
quantity: "1",
|
|
@@ -84,7 +93,7 @@ function _(e = "USD") {
|
|
|
84
93
|
taxable: !0
|
|
85
94
|
};
|
|
86
95
|
}
|
|
87
|
-
function
|
|
96
|
+
function x({ id: e, name: t, quantity: n, price: r, measureUnitId: i, taxable: a }) {
|
|
88
97
|
return {
|
|
89
98
|
id: e,
|
|
90
99
|
name: t,
|
|
@@ -94,14 +103,14 @@ function v({ id: e, name: t, quantity: n, price: r, measureUnitId: i, taxable: a
|
|
|
94
103
|
taxable: a
|
|
95
104
|
};
|
|
96
105
|
}
|
|
97
|
-
function
|
|
106
|
+
function S(e) {
|
|
98
107
|
return !e.name.trim();
|
|
99
108
|
}
|
|
100
|
-
function
|
|
101
|
-
let t = e.filter((e) => !
|
|
109
|
+
function C(e) {
|
|
110
|
+
let t = e.filter((e) => !S(e));
|
|
102
111
|
return t.length > 0 ? t : e.slice(0, 1);
|
|
103
112
|
}
|
|
104
|
-
function
|
|
113
|
+
function w({ product: e, currency: t, unitNamesById: n }) {
|
|
105
114
|
let r = e.measure_unit_id ?? "";
|
|
106
115
|
return {
|
|
107
116
|
productId: e.id,
|
|
@@ -115,13 +124,13 @@ function x({ product: e, currency: t, unitNamesById: n }) {
|
|
|
115
124
|
} : {}
|
|
116
125
|
};
|
|
117
126
|
}
|
|
118
|
-
function
|
|
127
|
+
function T(e) {
|
|
119
128
|
return e.quantity === void 0 ? e : {
|
|
120
129
|
...e,
|
|
121
130
|
quantity: i(e.quantity)
|
|
122
131
|
};
|
|
123
132
|
}
|
|
124
|
-
function
|
|
133
|
+
function E({ lineItem: e, field: t, rowCount: r, currency: l, separators: u = n() }) {
|
|
125
134
|
if (t === "price") return {
|
|
126
135
|
kind: "update",
|
|
127
136
|
patch: { price: s(c(e.price, l, u), l) }
|
|
@@ -135,31 +144,34 @@ function C({ lineItem: e, field: t, rowCount: r, currency: l, separators: u = n(
|
|
|
135
144
|
patch: { quantity: String(d) }
|
|
136
145
|
};
|
|
137
146
|
}
|
|
138
|
-
function
|
|
139
|
-
if (
|
|
147
|
+
function D({ lineItem: e, step: t, rowCount: n }) {
|
|
148
|
+
if (S(e)) return;
|
|
140
149
|
let r = o(Math.max(0, a(e.quantity)) + t);
|
|
141
150
|
return r <= 0 && n > 1 ? { kind: "remove" } : {
|
|
142
151
|
kind: "update",
|
|
143
152
|
patch: { quantity: String(Math.max(n > 1 ? 0 : 1, r)) }
|
|
144
153
|
};
|
|
145
154
|
}
|
|
146
|
-
function
|
|
155
|
+
function O(e) {
|
|
147
156
|
return Object.fromEntries(e.map((t) => {
|
|
148
|
-
let n = !
|
|
157
|
+
let n = !S(t), r = a(t.quantity);
|
|
149
158
|
return [t.id, {
|
|
150
159
|
canDecreaseQuantity: n && (e.length > 1 || r > 1),
|
|
151
160
|
canIncreaseQuantity: n
|
|
152
161
|
}];
|
|
153
162
|
}));
|
|
154
163
|
}
|
|
155
|
-
function
|
|
156
|
-
return {
|
|
157
|
-
tax_status:
|
|
158
|
-
tax_rate_value: e
|
|
164
|
+
function k(e, t, n = !1) {
|
|
165
|
+
return e.taxable ? {
|
|
166
|
+
tax_status: "taxable",
|
|
167
|
+
tax_rate_value: h(e, p(t), n)
|
|
168
|
+
} : {
|
|
169
|
+
tax_status: e.savedTaxStatus === "exempt" ? "exempt" : "non_taxable",
|
|
170
|
+
tax_rate_value: void 0
|
|
159
171
|
};
|
|
160
172
|
}
|
|
161
|
-
function
|
|
162
|
-
let i = e.measureUnitId ? r[e.measureUnitId] : void 0, { tax_status: o, tax_rate_value: s } =
|
|
173
|
+
function A({ lineItem: e, currency: t, taxRate: n, unitNamesById: r }) {
|
|
174
|
+
let i = e.measureUnitId ? r[e.measureUnitId] : void 0, { tax_status: o, tax_rate_value: s } = k(e, n);
|
|
163
175
|
return {
|
|
164
176
|
quantity: a(e.quantity),
|
|
165
177
|
tax_status: o,
|
|
@@ -175,24 +187,25 @@ function D({ lineItem: e, currency: t, taxRate: n, unitNamesById: r }) {
|
|
|
175
187
|
tax_rate_value: s
|
|
176
188
|
};
|
|
177
189
|
}
|
|
178
|
-
function
|
|
179
|
-
let
|
|
190
|
+
function j({ lineItem: e, currency: t, taxRate: n, keepSavedRate: r, unitNamesById: i }) {
|
|
191
|
+
let o = e.measureUnitId && i[e.measureUnitId] || e.measureUnitName || void 0, { tax_status: s, tax_rate_value: l } = k(e, n, r);
|
|
180
192
|
return {
|
|
181
193
|
quantity: a(e.quantity),
|
|
182
|
-
tax_status:
|
|
194
|
+
tax_status: s,
|
|
183
195
|
product: {
|
|
184
196
|
name: e.name,
|
|
185
197
|
type: e.productType,
|
|
186
|
-
measure_unit:
|
|
198
|
+
measure_unit: o ? { name: o } : void 0,
|
|
187
199
|
price: {
|
|
188
200
|
currency: t,
|
|
189
201
|
value: c(e.price, t)
|
|
190
202
|
}
|
|
191
203
|
},
|
|
192
|
-
tax_rate_value:
|
|
204
|
+
tax_rate_value: l,
|
|
205
|
+
discount: e.savedDiscount
|
|
193
206
|
};
|
|
194
207
|
}
|
|
195
|
-
function
|
|
208
|
+
function M({ lineItem: e, currency: t, units: n }) {
|
|
196
209
|
let r = e.product.measure_unit;
|
|
197
210
|
return {
|
|
198
211
|
id: e.id,
|
|
@@ -200,23 +213,26 @@ function k({ lineItem: e, currency: t, units: n }) {
|
|
|
200
213
|
name: e.product.name,
|
|
201
214
|
quantity: String(e.quantity),
|
|
202
215
|
price: s(e.product.price?.value ?? 0, t),
|
|
203
|
-
measureUnitId:
|
|
216
|
+
measureUnitId: P(r?.id ?? "", r?.name ?? "", n),
|
|
204
217
|
measureUnitName: r?.name ?? "",
|
|
205
218
|
productType: e.product.type ?? "product",
|
|
206
|
-
taxable:
|
|
219
|
+
taxable: g(e.tax_status),
|
|
220
|
+
savedTaxStatus: e.tax_status,
|
|
221
|
+
savedTaxRate: e.product.tax_rate?.value,
|
|
222
|
+
savedDiscount: e.discount ?? void 0
|
|
207
223
|
};
|
|
208
224
|
}
|
|
209
|
-
function
|
|
225
|
+
function N(e, t) {
|
|
210
226
|
if (!t) return;
|
|
211
227
|
let n = t.toLowerCase();
|
|
212
228
|
return e.find((e) => e.name.toLowerCase() === n);
|
|
213
229
|
}
|
|
214
|
-
function
|
|
215
|
-
return n?.length ? ((e ? n.find((t) => t.id === e) : void 0) ??
|
|
230
|
+
function P(e, t, n) {
|
|
231
|
+
return n?.length ? ((e ? n.find((t) => t.id === e) : void 0) ?? N(n, t))?.id ?? (t ? "" : e) : e;
|
|
216
232
|
}
|
|
217
|
-
function
|
|
233
|
+
function F(e, t) {
|
|
218
234
|
let n = !1, r = e.map((e) => {
|
|
219
|
-
let r =
|
|
235
|
+
let r = P(e.measureUnitId, e.measureUnitName, t);
|
|
220
236
|
return r === e.measureUnitId ? e : (n = !0, {
|
|
221
237
|
...e,
|
|
222
238
|
measureUnitId: r
|
|
@@ -224,26 +240,25 @@ function M(e, t) {
|
|
|
224
240
|
});
|
|
225
241
|
return n ? r : e;
|
|
226
242
|
}
|
|
227
|
-
function
|
|
243
|
+
function I(n) {
|
|
228
244
|
return new Intl.NumberFormat().format(t / 10 ** e(n));
|
|
229
245
|
}
|
|
230
|
-
function
|
|
231
|
-
let
|
|
232
|
-
for (let
|
|
246
|
+
function L(e, { currency: t, messages: n }) {
|
|
247
|
+
let r = {};
|
|
248
|
+
for (let i of e) {
|
|
233
249
|
let e = {};
|
|
234
|
-
|
|
250
|
+
i.name.length > 100 && (e.name = n.lineItemNameTooLong), c(i.price, t) > 9e15 && (e.price = n.lineItemPriceTooHigh.replace("{maxAmount}", I(t))), Object.keys(e).length > 0 && (r[i.id] = e);
|
|
235
251
|
}
|
|
236
|
-
return Object.keys(
|
|
252
|
+
return Object.keys(r).length > 0 ? r : void 0;
|
|
237
253
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
240
|
-
let t = Object.values(e), n = [
|
|
254
|
+
function R(e, t) {
|
|
255
|
+
let n = Object.values(e ?? {}), r = [t, ...[
|
|
241
256
|
"name",
|
|
242
257
|
"quantity",
|
|
243
258
|
"price",
|
|
244
259
|
"measureUnit"
|
|
245
|
-
].map((e) =>
|
|
246
|
-
return
|
|
260
|
+
].map((e) => n.find((t) => t[e])?.[e])].filter((e) => !!e);
|
|
261
|
+
return r.length > 0 ? r : void 0;
|
|
247
262
|
}
|
|
248
263
|
//#endregion
|
|
249
|
-
export {
|
|
264
|
+
export { t as MAX_AMOUNT_MINOR_UNITS, O as buildLineItemControls, E as commitLineItemField, f as commitTaxRateInput, u as convertPriceInput, b as createLineItem, r as escapeRegex, s as formatPriceInput, v as getCurrencySymbol, n as getNumberSeparators, S as isBlankLineItem, g as isLineItemTaxable, m as keepsSavedTaxRates, w as lineItemFromProduct, h as lineItemTaxRateMinorUnits, A as lineItemToCreatePayload, j as lineItemToUpdatePayload, I as maxAmountLabel, l as parseLocaleDecimal, a as parseQuantity, c as priceInputToMinorUnits, F as reconcileMeasureUnits, M as responseLineItemToFormValues, T as sanitizeLineItemPatch, i as sanitizeQuantityInput, d as sanitizeTaxRateInput, D as stepLineItemQuantity, C as stripBlankLineItems, R as summarizeLineItemErrors, _ as taxRateFromLineItems, p as taxRateToMinorUnits, x as toSheetLineItem, L as validateLineItems };
|