@tesouro/embedded-components-react 0.5.201 → 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.
- 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/data-access/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +24 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +65 -2
- 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 +188 -45
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +30 -265
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +144 -64
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +47 -109
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +293 -216
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +114 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +237 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index4.js +14 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +28 -243
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +212 -375
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +64 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +409 -187
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +73 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +0 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +10 -263
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +1 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +241 -398
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +66 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +406 -76
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +92 -330
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -4
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +37 -37
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +54 -54
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +115 -94
- 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,114 @@
|
|
|
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 "../../../shared/feature/dist/index.js";
|
|
7
|
+
import { ReceivablesWidgetAnalyticsEvent as t } from "./index2.js";
|
|
8
|
+
import { coerceEnabledTabs as n, resolveInitialTab as r, tabForType as i, typeForTab as a } from "./index8.js";
|
|
9
|
+
import { RECEIVABLE_MESSAGE_LABELS_EN as o } from "./index9.js";
|
|
10
|
+
import { useReceivableActions as s } from "./index10.js";
|
|
11
|
+
import { useReceivableDetails as c } from "./index11.js";
|
|
12
|
+
import { hasSelectedText as l } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
13
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
14
|
+
import { useReceivableForm as u } from "./index14.js";
|
|
15
|
+
import { useReceivablesTable as d } from "./index15.js";
|
|
16
|
+
import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
|
|
17
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js
|
|
18
|
+
function g({ counterpartMessageLabels: g, defaultTab: _, enabledTabs: v, messageLabels: y, onReceivableCreated: b, onReceivableOpened: x }) {
|
|
19
|
+
let S = e();
|
|
20
|
+
p(() => {
|
|
21
|
+
S(t.Mounted);
|
|
22
|
+
}, [S]);
|
|
23
|
+
let C = m(() => ({
|
|
24
|
+
...o,
|
|
25
|
+
...y
|
|
26
|
+
}), [y]), w = m(() => n(v), [v]), [T, E] = h(() => r({
|
|
27
|
+
defaultTab: _,
|
|
28
|
+
enabledTabs: w
|
|
29
|
+
})), [D, O] = h(), [k, A] = h(!1);
|
|
30
|
+
p(() => {
|
|
31
|
+
w.includes(T) || E(r({
|
|
32
|
+
defaultTab: _,
|
|
33
|
+
enabledTabs: w
|
|
34
|
+
}));
|
|
35
|
+
}, [
|
|
36
|
+
T,
|
|
37
|
+
_,
|
|
38
|
+
w
|
|
39
|
+
]);
|
|
40
|
+
let j = f((e, t) => {
|
|
41
|
+
E(i(t)), O(e), A(!0), b?.(e, t);
|
|
42
|
+
}, [b]), M = d({
|
|
43
|
+
activeTab: T,
|
|
44
|
+
messages: C
|
|
45
|
+
}), N = c({
|
|
46
|
+
selectedReceivableId: D,
|
|
47
|
+
enabled: k,
|
|
48
|
+
messages: C
|
|
49
|
+
}), P = u({
|
|
50
|
+
messages: C,
|
|
51
|
+
counterpartMessageLabels: g,
|
|
52
|
+
onCreated: j
|
|
53
|
+
}), F = f(() => {
|
|
54
|
+
let e = a(T);
|
|
55
|
+
P.openCreate(e === "quote" ? "quote" : "invoice");
|
|
56
|
+
}, [T, P.openCreate]), I = s({
|
|
57
|
+
selectedReceivable: N.receivable,
|
|
58
|
+
messages: C,
|
|
59
|
+
onCreated: j,
|
|
60
|
+
onDeleted: (e) => {
|
|
61
|
+
e === D && (O(void 0), A(!1));
|
|
62
|
+
}
|
|
63
|
+
}), L = f((e) => {
|
|
64
|
+
l() || (O(e.id), A(!0), x?.(e.id, e.type));
|
|
65
|
+
}, [x]);
|
|
66
|
+
return {
|
|
67
|
+
activeTab: T,
|
|
68
|
+
enabledTabs: w,
|
|
69
|
+
setActiveTab: E,
|
|
70
|
+
table: M,
|
|
71
|
+
details: N,
|
|
72
|
+
detailsOpen: k,
|
|
73
|
+
closeDetails: f(() => {
|
|
74
|
+
A(!1), O(void 0);
|
|
75
|
+
}, []),
|
|
76
|
+
form: P,
|
|
77
|
+
openCreate: F,
|
|
78
|
+
actions: I,
|
|
79
|
+
handleRowClick: L,
|
|
80
|
+
handleActionClick: f((e, t) => {
|
|
81
|
+
let n = M.getReceivableById(t.id);
|
|
82
|
+
if (e === "edit") {
|
|
83
|
+
if (n) {
|
|
84
|
+
P.openEdit(n);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
O(t.id), A(!0);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
O(t.id), I.openAction(e, t, n ?? null);
|
|
91
|
+
}, [
|
|
92
|
+
I,
|
|
93
|
+
P.openEdit,
|
|
94
|
+
M.getReceivableById
|
|
95
|
+
]),
|
|
96
|
+
handleDetailsActionClick: f((e, t) => {
|
|
97
|
+
if (e === "edit") {
|
|
98
|
+
N.receivable && (P.openEdit(N.receivable), A(!1));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
I.openAction(e, {
|
|
102
|
+
id: t.id,
|
|
103
|
+
title: t.title,
|
|
104
|
+
type: t.type
|
|
105
|
+
}, N.receivable ?? null);
|
|
106
|
+
}, [
|
|
107
|
+
I,
|
|
108
|
+
N.receivable,
|
|
109
|
+
P.openEdit
|
|
110
|
+
])
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { g as useReceivablesWidget };
|
|
@@ -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,249 +1,34 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
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) {
|
|
62
|
-
try {
|
|
63
|
-
return new Intl.NumberFormat(void 0, {
|
|
64
|
-
style: "currency",
|
|
65
|
-
currency: e
|
|
66
|
-
}).formatToParts(0).find((e) => e.type === "currency")?.value ?? e;
|
|
67
|
-
} catch {
|
|
68
|
-
return e;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function g() {
|
|
72
|
-
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
73
|
-
}
|
|
74
|
-
function _(e = "USD") {
|
|
75
|
-
return {
|
|
76
|
-
id: g(),
|
|
77
|
-
productId: "",
|
|
78
|
-
name: "",
|
|
79
|
-
quantity: "1",
|
|
80
|
-
price: s(0, e),
|
|
81
|
-
measureUnitId: "",
|
|
82
|
-
measureUnitName: "",
|
|
83
|
-
productType: "product",
|
|
84
|
-
taxable: !0
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function v({ id: e, name: t, quantity: n, price: r, measureUnitId: i, taxable: a }) {
|
|
88
|
-
return {
|
|
89
|
-
id: e,
|
|
90
|
-
name: t,
|
|
91
|
-
quantity: n,
|
|
92
|
-
price: r,
|
|
93
|
-
unit: i,
|
|
94
|
-
taxable: a
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function y(e) {
|
|
98
|
-
return !e.name.trim();
|
|
99
|
-
}
|
|
100
|
-
function b(e) {
|
|
101
|
-
let t = e.filter((e) => !y(e));
|
|
102
|
-
return t.length > 0 ? t : e.slice(0, 1);
|
|
103
|
-
}
|
|
104
|
-
function x({ product: e, currency: t, unitNamesById: n }) {
|
|
105
|
-
let r = e.measure_unit_id ?? "";
|
|
106
|
-
return {
|
|
107
|
-
productId: e.id,
|
|
108
|
-
name: e.name,
|
|
109
|
-
quantity: String(e.smallest_amount || 1),
|
|
110
|
-
price: s(e.price?.value ?? 0, t),
|
|
111
|
-
productType: "product",
|
|
112
|
-
...r && n[r] ? {
|
|
113
|
-
measureUnitId: r,
|
|
114
|
-
measureUnitName: ""
|
|
115
|
-
} : {}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function S(e) {
|
|
119
|
-
return e.quantity === void 0 ? e : {
|
|
120
|
-
...e,
|
|
121
|
-
quantity: i(e.quantity)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function C({ lineItem: e, field: t, rowCount: r, currency: l, separators: u = n() }) {
|
|
125
|
-
if (t === "price") return {
|
|
126
|
-
kind: "update",
|
|
127
|
-
patch: { price: s(c(e.price, l, u), l) }
|
|
128
|
-
};
|
|
129
|
-
let d = o(a(i(e.quantity)));
|
|
130
|
-
return d <= 0 ? r > 1 ? { kind: "remove" } : {
|
|
131
|
-
kind: "update",
|
|
132
|
-
patch: { quantity: "1" }
|
|
133
|
-
} : {
|
|
134
|
-
kind: "update",
|
|
135
|
-
patch: { quantity: String(d) }
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function w({ lineItem: e, step: t, rowCount: n }) {
|
|
139
|
-
if (y(e)) return;
|
|
140
|
-
let r = o(Math.max(0, a(e.quantity)) + t);
|
|
141
|
-
return r <= 0 && n > 1 ? { kind: "remove" } : {
|
|
142
|
-
kind: "update",
|
|
143
|
-
patch: { quantity: String(Math.max(n > 1 ? 0 : 1, r)) }
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function T(e) {
|
|
147
|
-
return Object.fromEntries(e.map((t) => {
|
|
148
|
-
let n = !y(t), r = a(t.quantity);
|
|
149
|
-
return [t.id, {
|
|
150
|
-
canDecreaseQuantity: n && (e.length > 1 || r > 1),
|
|
151
|
-
canIncreaseQuantity: n
|
|
152
|
-
}];
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
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);
|
|
163
|
-
return {
|
|
164
|
-
quantity: a(e.quantity),
|
|
165
|
-
tax_status: o,
|
|
166
|
-
product: {
|
|
167
|
-
name: e.name,
|
|
168
|
-
price: {
|
|
169
|
-
currency: t,
|
|
170
|
-
value: c(e.price, t)
|
|
171
|
-
},
|
|
172
|
-
measure_unit: i ? { name: i } : void 0,
|
|
173
|
-
type: "product"
|
|
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);
|
|
174
20
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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);
|
|
180
|
-
return {
|
|
181
|
-
quantity: a(e.quantity),
|
|
182
|
-
tax_status: o,
|
|
183
|
-
product: {
|
|
184
|
-
name: e.name,
|
|
185
|
-
type: e.productType,
|
|
186
|
-
measure_unit: i ? { name: i } : void 0,
|
|
187
|
-
price: {
|
|
188
|
-
currency: t,
|
|
189
|
-
value: c(e.price, t)
|
|
190
|
-
}
|
|
21
|
+
onDragLeave: () => f(!1),
|
|
22
|
+
onDrop: (e) => {
|
|
23
|
+
f(!1), a || o(e);
|
|
191
24
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
id: e.id,
|
|
199
|
-
productId: e.product.id,
|
|
200
|
-
name: e.product.name,
|
|
201
|
-
quantity: String(e.quantity),
|
|
202
|
-
price: s(e.product.price?.value ?? 0, t),
|
|
203
|
-
measureUnitId: j(r?.id ?? "", r?.name ?? "", n),
|
|
204
|
-
measureUnitName: r?.name ?? "",
|
|
205
|
-
productType: e.product.type ?? "product",
|
|
206
|
-
taxable: p(e.tax_status)
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function A(e, t) {
|
|
210
|
-
if (!t) return;
|
|
211
|
-
let n = t.toLowerCase();
|
|
212
|
-
return e.find((e) => e.name.toLowerCase() === n);
|
|
213
|
-
}
|
|
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;
|
|
216
|
-
}
|
|
217
|
-
function M(e, t) {
|
|
218
|
-
let n = !1, r = e.map((e) => {
|
|
219
|
-
let r = j(e.measureUnitId, e.measureUnitName, t);
|
|
220
|
-
return r === e.measureUnitId ? e : (n = !0, {
|
|
221
|
-
...e,
|
|
222
|
-
measureUnitId: r
|
|
223
|
-
});
|
|
25
|
+
onFilesSelect: (e) => {
|
|
26
|
+
o(e), u.current && (u.current.value = "");
|
|
27
|
+
},
|
|
28
|
+
onIncludeInEmailChange: s,
|
|
29
|
+
onRemove: c,
|
|
30
|
+
labels: l
|
|
224
31
|
});
|
|
225
|
-
return n ? r : e;
|
|
226
|
-
}
|
|
227
|
-
function N(n) {
|
|
228
|
-
return new Intl.NumberFormat().format(t / 10 ** e(n));
|
|
229
|
-
}
|
|
230
|
-
function P(e, { currency: n, messages: r }) {
|
|
231
|
-
let i = {};
|
|
232
|
-
for (let a of e) {
|
|
233
|
-
let e = {};
|
|
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);
|
|
235
|
-
}
|
|
236
|
-
return Object.keys(i).length > 0 ? i : void 0;
|
|
237
|
-
}
|
|
238
|
-
function F(e) {
|
|
239
|
-
if (!e) return;
|
|
240
|
-
let t = Object.values(e), n = [
|
|
241
|
-
"name",
|
|
242
|
-
"quantity",
|
|
243
|
-
"price",
|
|
244
|
-
"measureUnit"
|
|
245
|
-
].map((e) => t.find((t) => t[e])?.[e]).filter((e) => !!e);
|
|
246
|
-
return n.length > 0 ? n : void 0;
|
|
247
32
|
}
|
|
248
33
|
//#endregion
|
|
249
|
-
export {
|
|
34
|
+
export { i as ReceivableAttachmentsSection };
|