@tesouro/embedded-components-react 0.5.200 → 0.5.202

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