@tesouro/embedded-components-react 0.5.198 → 0.5.201
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 +4 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +4 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/data-access/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +78 -77
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index25.js +258 -257
- 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 +47 -250
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +267 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +66 -105
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +103 -214
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +226 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +67 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +83 -79
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +207 -172
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/shared/bank-disclosures/feature/dist/lib/BankDisclosuresWidget/collectDisclosureDocuments.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/personDisclosure.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useAcceptWidgetDisclosures.js +20 -19
- package/dist/libs/tesouro-embedded-components-react/shared/data-access-mocks/dist/lib/fixtures.js +27 -11
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
6
|
+
import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
7
|
+
import "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { CounterpartFormSheet as n } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
9
|
+
import { CounterpartSelector as r } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
|
|
10
|
+
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
11
|
+
import { ReceivablesWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
|
|
12
|
+
import { PAGE_SIZE_OPTIONS as o } from "./index4.js";
|
|
13
|
+
import { MeasureUnitsManagerContainer as s } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
14
|
+
import { ProductSelector as c } from "../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
|
|
15
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
16
|
+
import { useReceivablesWidget as l } from "./index13.js";
|
|
17
|
+
import { ReceivableActionDialog as u } from "../../ui/dist/index3.js";
|
|
18
|
+
import { ReceivableDetailsSheet as d } from "../../ui/dist/index12.js";
|
|
19
|
+
import { ReceivableFormSheet as f } from "../../ui/dist/index14.js";
|
|
20
|
+
import { ReceivablePaymentDialog as p } from "../../ui/dist/index15.js";
|
|
21
|
+
import { ReceivableSendDialog as m } from "../../ui/dist/index16.js";
|
|
22
|
+
import { ReceivablesScreen as h } from "../../ui/dist/index17.js";
|
|
23
|
+
import "../../ui/dist/index.js";
|
|
24
|
+
import { useEffect as g, useState as _ } from "react";
|
|
25
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
26
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js
|
|
27
|
+
function x({ counterpartFormLabels: t, counterpartMessageLabels: a, defaultTab: x, detailsLabels: S, enabledTabs: C, formLabels: w, measureUnitDeleteLabels: T, measureUnitsLabels: E, messageLabels: D, onReceivableCreated: O, onReceivableOpened: k, onTemplateSettingsClick: A, pageSizeOptions: j = o, paymentLabels: M, productMessageLabels: N, screenLabels: P, sendLabels: F, actionLabels: I }) {
|
|
28
|
+
let L = e();
|
|
29
|
+
g(() => {
|
|
30
|
+
L(i.Mounted);
|
|
31
|
+
}, [L]);
|
|
32
|
+
let R = l({
|
|
33
|
+
counterpartMessageLabels: a,
|
|
34
|
+
defaultTab: x,
|
|
35
|
+
enabledTabs: C,
|
|
36
|
+
messageLabels: D,
|
|
37
|
+
onReceivableCreated: O,
|
|
38
|
+
onReceivableOpened: k
|
|
39
|
+
}), [z, B] = _(!1);
|
|
40
|
+
return /* @__PURE__ */ b(v, { children: [
|
|
41
|
+
/* @__PURE__ */ y(h, {
|
|
42
|
+
rows: R.table.rows,
|
|
43
|
+
activeTab: R.activeTab,
|
|
44
|
+
enabledTabs: R.enabledTabs,
|
|
45
|
+
onTabChange: R.setActiveTab,
|
|
46
|
+
isLoading: R.table.isLoading,
|
|
47
|
+
isError: R.table.isError,
|
|
48
|
+
sorting: R.table.sorting,
|
|
49
|
+
onSortingChange: R.table.onSortingChange,
|
|
50
|
+
pageSize: R.table.pageSize,
|
|
51
|
+
onPageSizeChange: R.table.onPageSizeChange,
|
|
52
|
+
pageSizeOptions: j,
|
|
53
|
+
hasNextPage: R.table.hasNextPage,
|
|
54
|
+
hasPrevPage: R.table.hasPrevPage,
|
|
55
|
+
onNextPage: R.table.onNextPage,
|
|
56
|
+
onPrevPage: R.table.onPrevPage,
|
|
57
|
+
searchValue: R.table.searchValue,
|
|
58
|
+
onSearchChange: R.table.onSearchChange,
|
|
59
|
+
statusFilter: R.table.statusFilter,
|
|
60
|
+
statusOptions: R.table.statusOptions,
|
|
61
|
+
onStatusFilterChange: R.table.onStatusFilterChange,
|
|
62
|
+
isFiltering: R.table.isFiltering,
|
|
63
|
+
onCreateClick: R.openCreate,
|
|
64
|
+
onTemplateSettingsClick: A,
|
|
65
|
+
onRowClick: R.handleRowClick,
|
|
66
|
+
onActionClick: R.handleActionClick,
|
|
67
|
+
onRetry: R.table.onRetry,
|
|
68
|
+
labels: P
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ y(f, {
|
|
71
|
+
open: R.form.open,
|
|
72
|
+
onOpenChange: (e) => {
|
|
73
|
+
e || R.form.close();
|
|
74
|
+
},
|
|
75
|
+
mode: R.form.mode,
|
|
76
|
+
values: R.form.sheetValues,
|
|
77
|
+
errors: R.form.errors,
|
|
78
|
+
currencyOptions: R.form.currencyOptions,
|
|
79
|
+
paymentTermsOptions: R.form.paymentTermsOptions,
|
|
80
|
+
unitOptions: R.form.lineItemUnitOptions,
|
|
81
|
+
currencySymbol: R.form.currencySymbol,
|
|
82
|
+
lineItemControls: R.form.lineItemControls,
|
|
83
|
+
autoFocusLineItemId: R.form.autoFocusLineItemId,
|
|
84
|
+
lineItemsLoading: R.form.lineItemsLoading,
|
|
85
|
+
inProgress: R.form.isSubmitting,
|
|
86
|
+
customerSelector: /* @__PURE__ */ y(r, {
|
|
87
|
+
mode: "customer",
|
|
88
|
+
value: R.form.values.customerId || void 0,
|
|
89
|
+
onValueChange: (e) => R.form.updateValues({ customerId: e }),
|
|
90
|
+
onCreateClick: R.form.openCounterpartCreate
|
|
91
|
+
}),
|
|
92
|
+
renderProductSelector: (e, t) => /* @__PURE__ */ y(c, {
|
|
93
|
+
...t,
|
|
94
|
+
inputValue: e.name,
|
|
95
|
+
selectedProductId: R.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
|
|
96
|
+
currency: R.form.values.currency,
|
|
97
|
+
maxLength: 100,
|
|
98
|
+
onInputValueChange: (t) => R.form.updateLineItem(e.id, { name: t }),
|
|
99
|
+
onProductSelect: (t) => R.form.selectProduct(e.id, t)
|
|
100
|
+
}),
|
|
101
|
+
onChange: R.form.updateValues,
|
|
102
|
+
onLineItemChange: R.form.updateLineItem,
|
|
103
|
+
onLineItemCommit: R.form.commitLineItem,
|
|
104
|
+
onLineItemQuantityStep: R.form.stepLineItem,
|
|
105
|
+
onTaxRateCommit: R.form.commitTaxRate,
|
|
106
|
+
onManageUnits: () => B(!0),
|
|
107
|
+
onAddLineItem: R.form.addLineItem,
|
|
108
|
+
onRemoveLineItem: R.form.removeLineItem,
|
|
109
|
+
onSubmit: R.form.submit,
|
|
110
|
+
onCancel: R.form.close,
|
|
111
|
+
labels: w
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ y(d, {
|
|
114
|
+
open: R.detailsOpen,
|
|
115
|
+
onOpenChange: (e) => {
|
|
116
|
+
e || R.closeDetails();
|
|
117
|
+
},
|
|
118
|
+
details: R.details.detailsView,
|
|
119
|
+
isLoading: R.details.isLoading,
|
|
120
|
+
isError: R.details.isError,
|
|
121
|
+
onActionClick: R.handleDetailsActionClick,
|
|
122
|
+
onClose: R.closeDetails,
|
|
123
|
+
labels: S
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ y(m, {
|
|
126
|
+
open: R.actions.sendOpen,
|
|
127
|
+
onOpenChange: (e) => {
|
|
128
|
+
e || R.actions.closeSend();
|
|
129
|
+
},
|
|
130
|
+
values: R.actions.sendValues,
|
|
131
|
+
errors: R.actions.sendErrors,
|
|
132
|
+
inProgress: R.actions.sendInProgress,
|
|
133
|
+
onChange: (e) => R.actions.setSendValues((t) => ({
|
|
134
|
+
...t,
|
|
135
|
+
...e
|
|
136
|
+
})),
|
|
137
|
+
onSubmit: R.actions.submitSend,
|
|
138
|
+
onCancel: R.actions.closeSend,
|
|
139
|
+
labels: F
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ y(p, {
|
|
142
|
+
open: R.actions.paymentOpen,
|
|
143
|
+
onOpenChange: (e) => {
|
|
144
|
+
e || R.actions.closePayment();
|
|
145
|
+
},
|
|
146
|
+
values: R.actions.paymentValues,
|
|
147
|
+
errors: R.actions.paymentErrors,
|
|
148
|
+
inProgress: R.actions.paymentInProgress,
|
|
149
|
+
onChange: (e) => R.actions.setPaymentValues((t) => ({
|
|
150
|
+
...t,
|
|
151
|
+
...e
|
|
152
|
+
})),
|
|
153
|
+
onSubmit: R.actions.submitPayment,
|
|
154
|
+
onCancel: R.actions.closePayment,
|
|
155
|
+
labels: M
|
|
156
|
+
}),
|
|
157
|
+
R.actions.actionDialog && /* @__PURE__ */ y(u, {
|
|
158
|
+
open: !!R.actions.actionTarget,
|
|
159
|
+
onOpenChange: (e) => {
|
|
160
|
+
e || R.actions.closeAction();
|
|
161
|
+
},
|
|
162
|
+
title: R.actions.actionDialog.title,
|
|
163
|
+
description: R.actions.actionDialog.description,
|
|
164
|
+
confirmLabel: R.actions.actionDialog.confirmLabel,
|
|
165
|
+
destructive: R.actions.actionDialog.destructive,
|
|
166
|
+
error: R.actions.actionError,
|
|
167
|
+
inProgress: R.actions.actionInProgress,
|
|
168
|
+
onConfirm: R.actions.confirmAction,
|
|
169
|
+
onCancel: R.actions.closeAction,
|
|
170
|
+
labels: I
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ y(n, {
|
|
173
|
+
open: R.form.counterpartView === "create",
|
|
174
|
+
onOpenChange: (e) => {
|
|
175
|
+
e || R.form.counterpartForm.close();
|
|
176
|
+
},
|
|
177
|
+
mode: "create",
|
|
178
|
+
values: R.form.counterpartForm.values,
|
|
179
|
+
errors: R.form.counterpartForm.errors,
|
|
180
|
+
stateOptions: R.form.stateOptions,
|
|
181
|
+
inProgress: R.form.counterpartForm.isSubmitting,
|
|
182
|
+
onChange: (e) => R.form.counterpartForm.setValues((t) => ({
|
|
183
|
+
...t,
|
|
184
|
+
...e
|
|
185
|
+
})),
|
|
186
|
+
onAddressChange: (e) => R.form.counterpartForm.setValues((t) => ({
|
|
187
|
+
...t,
|
|
188
|
+
address: {
|
|
189
|
+
...t.address,
|
|
190
|
+
...e
|
|
191
|
+
}
|
|
192
|
+
})),
|
|
193
|
+
onSubmit: R.form.counterpartForm.submit,
|
|
194
|
+
onCancel: R.form.counterpartForm.close,
|
|
195
|
+
labels: t
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ y(s, {
|
|
198
|
+
open: z,
|
|
199
|
+
onClose: () => B(!1),
|
|
200
|
+
managerLabels: E,
|
|
201
|
+
deleteLabels: T,
|
|
202
|
+
messageLabels: N
|
|
203
|
+
})
|
|
204
|
+
] });
|
|
205
|
+
}
|
|
206
|
+
function S({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
|
|
207
|
+
return /* @__PURE__ */ y(t, {
|
|
208
|
+
widgetName: a,
|
|
209
|
+
baseUrl: e,
|
|
210
|
+
widgetToken: n,
|
|
211
|
+
organizationId: r,
|
|
212
|
+
configClient: i,
|
|
213
|
+
gatewayRouting: o,
|
|
214
|
+
linkComponent: s,
|
|
215
|
+
implementation: c,
|
|
216
|
+
uiFramework: l,
|
|
217
|
+
errorFallback: u,
|
|
218
|
+
onError: d,
|
|
219
|
+
analytics: f,
|
|
220
|
+
disclosuresAcceptance: p,
|
|
221
|
+
providerLabels: m,
|
|
222
|
+
children: /* @__PURE__ */ y(x, { ...h })
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
export { S as ReceivablesWidget, S as default };
|
|
@@ -42,6 +42,23 @@ function l(t, r, i, a = n()) {
|
|
|
42
42
|
return s(Math.round(o * 10 ** e(i)), i);
|
|
43
43
|
}
|
|
44
44
|
function u(e) {
|
|
45
|
+
let t = i(e);
|
|
46
|
+
return t.length > 1 && t.startsWith("0") && t[1] !== "." && (t = t.replace(/^0+/, "") || "0"), t === "" || t === "." ? t : Number(t) > 100 ? "100" : t;
|
|
47
|
+
}
|
|
48
|
+
function d(e) {
|
|
49
|
+
return e.endsWith(".") ? e.slice(0, -1) : e;
|
|
50
|
+
}
|
|
51
|
+
function f(e) {
|
|
52
|
+
return Math.round((Number(e) || 0) * 100);
|
|
53
|
+
}
|
|
54
|
+
function p(e) {
|
|
55
|
+
return (e ?? "taxable") === "taxable";
|
|
56
|
+
}
|
|
57
|
+
function m(e) {
|
|
58
|
+
let t = e.find((e) => p(e.tax_status))?.product.tax_rate?.value;
|
|
59
|
+
return t === void 0 ? "" : String(t / 100);
|
|
60
|
+
}
|
|
61
|
+
function h(e) {
|
|
45
62
|
try {
|
|
46
63
|
return new Intl.NumberFormat(void 0, {
|
|
47
64
|
style: "currency",
|
|
@@ -51,38 +68,40 @@ function u(e) {
|
|
|
51
68
|
return e;
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
|
-
function
|
|
71
|
+
function g() {
|
|
55
72
|
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
56
73
|
}
|
|
57
|
-
function
|
|
74
|
+
function _(e = "USD") {
|
|
58
75
|
return {
|
|
59
|
-
id:
|
|
76
|
+
id: g(),
|
|
60
77
|
productId: "",
|
|
61
78
|
name: "",
|
|
62
79
|
quantity: "1",
|
|
63
80
|
price: s(0, e),
|
|
64
81
|
measureUnitId: "",
|
|
65
82
|
measureUnitName: "",
|
|
66
|
-
productType: "product"
|
|
83
|
+
productType: "product",
|
|
84
|
+
taxable: !0
|
|
67
85
|
};
|
|
68
86
|
}
|
|
69
|
-
function
|
|
87
|
+
function v({ id: e, name: t, quantity: n, price: r, measureUnitId: i, taxable: a }) {
|
|
70
88
|
return {
|
|
71
89
|
id: e,
|
|
72
90
|
name: t,
|
|
73
91
|
quantity: n,
|
|
74
92
|
price: r,
|
|
75
|
-
unit: i
|
|
93
|
+
unit: i,
|
|
94
|
+
taxable: a
|
|
76
95
|
};
|
|
77
96
|
}
|
|
78
|
-
function
|
|
97
|
+
function y(e) {
|
|
79
98
|
return !e.name.trim();
|
|
80
99
|
}
|
|
81
|
-
function
|
|
82
|
-
let t = e.filter((e) => !
|
|
100
|
+
function b(e) {
|
|
101
|
+
let t = e.filter((e) => !y(e));
|
|
83
102
|
return t.length > 0 ? t : e.slice(0, 1);
|
|
84
103
|
}
|
|
85
|
-
function
|
|
104
|
+
function x({ product: e, currency: t, unitNamesById: n }) {
|
|
86
105
|
let r = e.measure_unit_id ?? "";
|
|
87
106
|
return {
|
|
88
107
|
productId: e.id,
|
|
@@ -96,13 +115,13 @@ function g({ product: e, currency: t, unitNamesById: n }) {
|
|
|
96
115
|
} : {}
|
|
97
116
|
};
|
|
98
117
|
}
|
|
99
|
-
function
|
|
118
|
+
function S(e) {
|
|
100
119
|
return e.quantity === void 0 ? e : {
|
|
101
120
|
...e,
|
|
102
121
|
quantity: i(e.quantity)
|
|
103
122
|
};
|
|
104
123
|
}
|
|
105
|
-
function
|
|
124
|
+
function C({ lineItem: e, field: t, rowCount: r, currency: l, separators: u = n() }) {
|
|
106
125
|
if (t === "price") return {
|
|
107
126
|
kind: "update",
|
|
108
127
|
patch: { price: s(c(e.price, l, u), l) }
|
|
@@ -116,54 +135,64 @@ function v({ lineItem: e, field: t, rowCount: r, currency: l, separators: u = n(
|
|
|
116
135
|
patch: { quantity: String(d) }
|
|
117
136
|
};
|
|
118
137
|
}
|
|
119
|
-
function
|
|
120
|
-
if (
|
|
138
|
+
function w({ lineItem: e, step: t, rowCount: n }) {
|
|
139
|
+
if (y(e)) return;
|
|
121
140
|
let r = o(Math.max(0, a(e.quantity)) + t);
|
|
122
141
|
return r <= 0 && n > 1 ? { kind: "remove" } : {
|
|
123
142
|
kind: "update",
|
|
124
143
|
patch: { quantity: String(Math.max(n > 1 ? 0 : 1, r)) }
|
|
125
144
|
};
|
|
126
145
|
}
|
|
127
|
-
function
|
|
146
|
+
function T(e) {
|
|
128
147
|
return Object.fromEntries(e.map((t) => {
|
|
129
|
-
let n = !
|
|
148
|
+
let n = !y(t), r = a(t.quantity);
|
|
130
149
|
return [t.id, {
|
|
131
150
|
canDecreaseQuantity: n && (e.length > 1 || r > 1),
|
|
132
151
|
canIncreaseQuantity: n
|
|
133
152
|
}];
|
|
134
153
|
}));
|
|
135
154
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
155
|
+
function E(e, t) {
|
|
156
|
+
return {
|
|
157
|
+
tax_status: e.taxable ? "taxable" : "non_taxable",
|
|
158
|
+
tax_rate_value: e.taxable ? f(t) : void 0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function D({ lineItem: e, currency: t, taxRate: n, unitNamesById: r }) {
|
|
162
|
+
let i = e.measureUnitId ? r[e.measureUnitId] : void 0, { tax_status: o, tax_rate_value: s } = E(e, n);
|
|
138
163
|
return {
|
|
139
164
|
quantity: a(e.quantity),
|
|
165
|
+
tax_status: o,
|
|
140
166
|
product: {
|
|
141
167
|
name: e.name,
|
|
142
168
|
price: {
|
|
143
169
|
currency: t,
|
|
144
170
|
value: c(e.price, t)
|
|
145
171
|
},
|
|
146
|
-
measure_unit:
|
|
172
|
+
measure_unit: i ? { name: i } : void 0,
|
|
147
173
|
type: "product"
|
|
148
|
-
}
|
|
174
|
+
},
|
|
175
|
+
tax_rate_value: s
|
|
149
176
|
};
|
|
150
177
|
}
|
|
151
|
-
function
|
|
152
|
-
let
|
|
178
|
+
function O({ lineItem: e, currency: t, taxRate: n, unitNamesById: r }) {
|
|
179
|
+
let i = e.measureUnitId && r[e.measureUnitId] || e.measureUnitName || void 0, { tax_status: o, tax_rate_value: s } = E(e, n);
|
|
153
180
|
return {
|
|
154
181
|
quantity: a(e.quantity),
|
|
182
|
+
tax_status: o,
|
|
155
183
|
product: {
|
|
156
184
|
name: e.name,
|
|
157
185
|
type: e.productType,
|
|
158
|
-
measure_unit:
|
|
186
|
+
measure_unit: i ? { name: i } : void 0,
|
|
159
187
|
price: {
|
|
160
188
|
currency: t,
|
|
161
189
|
value: c(e.price, t)
|
|
162
190
|
}
|
|
163
|
-
}
|
|
191
|
+
},
|
|
192
|
+
tax_rate_value: s
|
|
164
193
|
};
|
|
165
194
|
}
|
|
166
|
-
function
|
|
195
|
+
function k({ lineItem: e, currency: t, units: n }) {
|
|
167
196
|
let r = e.product.measure_unit;
|
|
168
197
|
return {
|
|
169
198
|
id: e.id,
|
|
@@ -171,22 +200,23 @@ function C({ lineItem: e, currency: t, units: n }) {
|
|
|
171
200
|
name: e.product.name,
|
|
172
201
|
quantity: String(e.quantity),
|
|
173
202
|
price: s(e.product.price?.value ?? 0, t),
|
|
174
|
-
measureUnitId:
|
|
203
|
+
measureUnitId: j(r?.id ?? "", r?.name ?? "", n),
|
|
175
204
|
measureUnitName: r?.name ?? "",
|
|
176
|
-
productType: e.product.type ?? "product"
|
|
205
|
+
productType: e.product.type ?? "product",
|
|
206
|
+
taxable: p(e.tax_status)
|
|
177
207
|
};
|
|
178
208
|
}
|
|
179
|
-
function
|
|
209
|
+
function A(e, t) {
|
|
180
210
|
if (!t) return;
|
|
181
211
|
let n = t.toLowerCase();
|
|
182
212
|
return e.find((e) => e.name.toLowerCase() === n);
|
|
183
213
|
}
|
|
184
|
-
function
|
|
185
|
-
return n?.length ? ((e ? n.find((t) => t.id === e) : void 0) ??
|
|
214
|
+
function j(e, t, n) {
|
|
215
|
+
return n?.length ? ((e ? n.find((t) => t.id === e) : void 0) ?? A(n, t))?.id ?? (t ? "" : e) : e;
|
|
186
216
|
}
|
|
187
|
-
function
|
|
217
|
+
function M(e, t) {
|
|
188
218
|
let n = !1, r = e.map((e) => {
|
|
189
|
-
let r =
|
|
219
|
+
let r = j(e.measureUnitId, e.measureUnitName, t);
|
|
190
220
|
return r === e.measureUnitId ? e : (n = !0, {
|
|
191
221
|
...e,
|
|
192
222
|
measureUnitId: r
|
|
@@ -194,18 +224,18 @@ function E(e, t) {
|
|
|
194
224
|
});
|
|
195
225
|
return n ? r : e;
|
|
196
226
|
}
|
|
197
|
-
function
|
|
227
|
+
function N(n) {
|
|
198
228
|
return new Intl.NumberFormat().format(t / 10 ** e(n));
|
|
199
229
|
}
|
|
200
|
-
function
|
|
230
|
+
function P(e, { currency: n, messages: r }) {
|
|
201
231
|
let i = {};
|
|
202
232
|
for (let a of e) {
|
|
203
233
|
let e = {};
|
|
204
|
-
a.name.length > 100 && (e.name = r.lineItemNameTooLong), c(a.price, n) > t && (e.price = r.lineItemPriceTooHigh.replace("{maxAmount}",
|
|
234
|
+
a.name.length > 100 && (e.name = r.lineItemNameTooLong), c(a.price, n) > t && (e.price = r.lineItemPriceTooHigh.replace("{maxAmount}", N(n))), Object.keys(e).length > 0 && (i[a.id] = e);
|
|
205
235
|
}
|
|
206
236
|
return Object.keys(i).length > 0 ? i : void 0;
|
|
207
237
|
}
|
|
208
|
-
function
|
|
238
|
+
function F(e) {
|
|
209
239
|
if (!e) return;
|
|
210
240
|
let t = Object.values(e), n = [
|
|
211
241
|
"name",
|
|
@@ -216,4 +246,4 @@ function k(e) {
|
|
|
216
246
|
return n.length > 0 ? n : void 0;
|
|
217
247
|
}
|
|
218
248
|
//#endregion
|
|
219
|
-
export {
|
|
249
|
+
export { T as buildLineItemControls, C as commitLineItemField, d as commitTaxRateInput, l as convertPriceInput, _ as createLineItem, s as formatPriceInput, h as getCurrencySymbol, n as getNumberSeparators, y as isBlankLineItem, p as isLineItemTaxable, x as lineItemFromProduct, D as lineItemToCreatePayload, O as lineItemToUpdatePayload, a as parseQuantity, c as priceInputToMinorUnits, M as reconcileMeasureUnits, k as responseLineItemToFormValues, S as sanitizeLineItemPatch, i as sanitizeQuantityInput, u as sanitizeTaxRateInput, w as stepLineItemQuantity, b as stripBlankLineItems, F as summarizeLineItemErrors, m as taxRateFromLineItems, f as taxRateToMinorUnits, v as toSheetLineItem, P as validateLineItems };
|