@tesouro/embedded-components-react 0.5.204 → 0.5.205
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/README.md +15 -14
- package/dist/index.d.ts +38 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +38 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +26 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +79 -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/index13.js +53 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +81 -283
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +47 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +303 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +68 -230
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +253 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +34 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +14 -0
- 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 +18 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +0 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +259 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +61 -412
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +407 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +73 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +213 -202
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +136 -116
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +1763 -1749
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js
CHANGED
|
@@ -2,236 +2,74 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
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";
|
|
5
|
+
import { buildReceivableRows as e, statusFilterOptions as t, typeForTab as n } from "./index8.js";
|
|
6
|
+
import { useReceivablesQuery as r } from "../../data-access/dist/index9.js";
|
|
7
|
+
import "../../data-access/dist/index.js";
|
|
8
|
+
import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
|
|
27
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js
|
|
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
|
-
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
|
-
});
|
|
10
|
+
var c = [];
|
|
11
|
+
function l({ activeTab: l, messages: d }) {
|
|
12
|
+
let [f, p] = s([]), [m, h] = s(10), [g, _] = s(), [v, y] = s(""), [b, x] = s(""), [S, C] = s("all");
|
|
13
|
+
a(() => {
|
|
14
|
+
_(void 0), C("all");
|
|
15
|
+
}, [l]), a(() => {
|
|
16
|
+
let e = setTimeout(() => {
|
|
17
|
+
x(v), _(void 0);
|
|
18
|
+
}, 300);
|
|
19
|
+
return () => clearTimeout(e);
|
|
20
|
+
}, [v]);
|
|
21
|
+
let w = f[0]?.id, T = w ? u[w] : void 0, E = f[0] ? f[0].desc ? "desc" : "asc" : void 0, D = r({
|
|
22
|
+
type: n(l),
|
|
23
|
+
limit: m,
|
|
24
|
+
pagination_token: g,
|
|
25
|
+
search_text: b || void 0,
|
|
26
|
+
status: S === "all" ? void 0 : S,
|
|
27
|
+
...T ? {
|
|
28
|
+
sort: T,
|
|
29
|
+
order: E
|
|
30
|
+
} : {}
|
|
31
|
+
}), O = D.data?.data ?? c, k = o(() => new Map(O.map((e) => [e.id, e])), [O]), A = i((e) => k.get(e), [k]), j = o(() => e({
|
|
32
|
+
receivables: O,
|
|
33
|
+
messages: d
|
|
34
|
+
}), [d, O]), M = !!b || S !== "all", N = i((e) => {
|
|
35
|
+
let t = typeof e == "function" ? e(f) : e;
|
|
36
|
+
p(t), _(void 0);
|
|
37
|
+
}, [f]), P = i((e) => {
|
|
38
|
+
h(e), _(void 0);
|
|
39
|
+
}, []), F = i((e) => {
|
|
40
|
+
C(e), _(void 0);
|
|
41
|
+
}, []), I = i(() => _(D.data?.next_pagination_token ?? void 0), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token ?? void 0), [D.data?.prev_pagination_token]), R = i(() => {
|
|
42
|
+
D.refetch();
|
|
43
|
+
}, [D]);
|
|
44
|
+
return {
|
|
45
|
+
rows: j,
|
|
46
|
+
isLoading: D.isLoading,
|
|
47
|
+
isError: D.isError,
|
|
48
|
+
sorting: f,
|
|
49
|
+
onSortingChange: N,
|
|
50
|
+
pageSize: m,
|
|
51
|
+
onPageSizeChange: P,
|
|
52
|
+
hasNextPage: !!D.data?.next_pagination_token,
|
|
53
|
+
hasPrevPage: !!D.data?.prev_pagination_token,
|
|
54
|
+
onNextPage: I,
|
|
55
|
+
onPrevPage: L,
|
|
56
|
+
searchValue: v,
|
|
57
|
+
onSearchChange: y,
|
|
58
|
+
statusFilter: S,
|
|
59
|
+
statusOptions: t(),
|
|
60
|
+
onStatusFilterChange: F,
|
|
61
|
+
isFiltering: M,
|
|
62
|
+
onRetry: R,
|
|
63
|
+
getReceivableById: A
|
|
64
|
+
};
|
|
235
65
|
}
|
|
66
|
+
var u = {
|
|
67
|
+
documentLabel: "document_id",
|
|
68
|
+
customerLabel: "counterpart_name",
|
|
69
|
+
status: "status",
|
|
70
|
+
issueDateLabel: "issue_date",
|
|
71
|
+
dueDateLabel: "due_date",
|
|
72
|
+
totalLabel: "total_amount"
|
|
73
|
+
};
|
|
236
74
|
//#endregion
|
|
237
|
-
export {
|
|
75
|
+
export { l as useReceivablesTable };
|
|
@@ -0,0 +1,115 @@
|
|
|
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 "./index16.js";
|
|
15
|
+
import { useReceivablesTable as d } from "./index17.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/index18.js
|
|
18
|
+
function g({ counterpartMessageLabels: g, defaultTab: _, embeddedBankName: v, enabledTabs: y, messageLabels: b, onReceivableCreated: x, onReceivableOpened: S }) {
|
|
19
|
+
let C = e();
|
|
20
|
+
p(() => {
|
|
21
|
+
C(t.Mounted);
|
|
22
|
+
}, [C]);
|
|
23
|
+
let w = m(() => ({
|
|
24
|
+
...o,
|
|
25
|
+
...b
|
|
26
|
+
}), [b]), T = m(() => n(y), [y]), [E, D] = h(() => r({
|
|
27
|
+
defaultTab: _,
|
|
28
|
+
enabledTabs: T
|
|
29
|
+
})), [O, k] = h(), [A, j] = h(!1);
|
|
30
|
+
p(() => {
|
|
31
|
+
T.includes(E) || D(r({
|
|
32
|
+
defaultTab: _,
|
|
33
|
+
enabledTabs: T
|
|
34
|
+
}));
|
|
35
|
+
}, [
|
|
36
|
+
E,
|
|
37
|
+
_,
|
|
38
|
+
T
|
|
39
|
+
]);
|
|
40
|
+
let M = f((e, t) => {
|
|
41
|
+
D(i(t)), k(e), j(!0), x?.(e, t);
|
|
42
|
+
}, [x]), N = d({
|
|
43
|
+
activeTab: E,
|
|
44
|
+
messages: w
|
|
45
|
+
}), P = c({
|
|
46
|
+
selectedReceivableId: O,
|
|
47
|
+
enabled: A,
|
|
48
|
+
messages: w
|
|
49
|
+
}), F = u({
|
|
50
|
+
messages: w,
|
|
51
|
+
counterpartMessageLabels: g,
|
|
52
|
+
embeddedBankName: v,
|
|
53
|
+
onCreated: M
|
|
54
|
+
}), I = f(() => {
|
|
55
|
+
let e = a(E);
|
|
56
|
+
F.openCreate(e === "quote" ? "quote" : "invoice");
|
|
57
|
+
}, [E, F.openCreate]), L = s({
|
|
58
|
+
selectedReceivable: P.receivable,
|
|
59
|
+
messages: w,
|
|
60
|
+
onCreated: M,
|
|
61
|
+
onDeleted: (e) => {
|
|
62
|
+
e === O && (k(void 0), j(!1));
|
|
63
|
+
}
|
|
64
|
+
}), R = f((e) => {
|
|
65
|
+
l() || (k(e.id), j(!0), S?.(e.id, e.type));
|
|
66
|
+
}, [S]);
|
|
67
|
+
return {
|
|
68
|
+
activeTab: E,
|
|
69
|
+
enabledTabs: T,
|
|
70
|
+
setActiveTab: D,
|
|
71
|
+
table: N,
|
|
72
|
+
details: P,
|
|
73
|
+
detailsOpen: A,
|
|
74
|
+
closeDetails: f(() => {
|
|
75
|
+
j(!1), k(void 0);
|
|
76
|
+
}, []),
|
|
77
|
+
form: F,
|
|
78
|
+
openCreate: I,
|
|
79
|
+
actions: L,
|
|
80
|
+
handleRowClick: R,
|
|
81
|
+
handleActionClick: f((e, t) => {
|
|
82
|
+
let n = N.getReceivableById(t.id);
|
|
83
|
+
if (e === "edit") {
|
|
84
|
+
if (n) {
|
|
85
|
+
F.openEdit(n);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
k(t.id), j(!0);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
k(t.id), L.openAction(e, t, n ?? null);
|
|
92
|
+
}, [
|
|
93
|
+
L,
|
|
94
|
+
F.openEdit,
|
|
95
|
+
N.getReceivableById
|
|
96
|
+
]),
|
|
97
|
+
handleDetailsActionClick: f((e, t) => {
|
|
98
|
+
if (e === "edit") {
|
|
99
|
+
P.receivable && (F.openEdit(P.receivable), j(!1));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
L.openAction(e, {
|
|
103
|
+
id: t.id,
|
|
104
|
+
title: t.title,
|
|
105
|
+
type: t.type
|
|
106
|
+
}, P.receivable ?? null);
|
|
107
|
+
}, [
|
|
108
|
+
L,
|
|
109
|
+
P.receivable,
|
|
110
|
+
F.openEdit
|
|
111
|
+
])
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { g as useReceivablesWidget };
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { EmbeddedToaster as e } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
6
|
+
import "../../../shared/ui/dist/index.js";
|
|
7
|
+
import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
+
import { WidgetProvider as n } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
9
|
+
import "../../../shared/feature/dist/index.js";
|
|
10
|
+
import { CounterpartFormSheet as r } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
11
|
+
import { CounterpartSelector as i } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
|
|
12
|
+
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
+
import { ReceivablesWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "./index2.js";
|
|
14
|
+
import { PAGE_SIZE_OPTIONS as s } from "./index4.js";
|
|
15
|
+
import { ReceivableActionDialog as c } from "../../ui/dist/index3.js";
|
|
16
|
+
import { ReceivableBankAccountSection as l } from "../../ui/dist/index4.js";
|
|
17
|
+
import { ReceivableDetailsSheet as u } from "../../ui/dist/index15.js";
|
|
18
|
+
import { ReceivableFormSheet as d } from "../../ui/dist/index17.js";
|
|
19
|
+
import { ReceivablePaymentDialog as f } from "../../ui/dist/index18.js";
|
|
20
|
+
import { ReceivableSendDialog as p } from "../../ui/dist/index19.js";
|
|
21
|
+
import { ReceivablesScreen as m } from "../../ui/dist/index20.js";
|
|
22
|
+
import "../../ui/dist/index.js";
|
|
23
|
+
import { ReceivableAttachmentsSection as h } from "./index5.js";
|
|
24
|
+
import { MeasureUnitsManagerContainer as g } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
25
|
+
import { ProductSelector as _ } from "../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
|
|
26
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
27
|
+
import { useReceivablesWidget as v } from "./index18.js";
|
|
28
|
+
import { useEffect as y, useId as b, useState as x } from "react";
|
|
29
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
30
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
|
|
31
|
+
function T({ counterpartFormLabels: n, counterpartMessageLabels: o, defaultTab: T, detailsLabels: E, embeddedBankName: D, enabledTabs: O, formLabels: k, measureUnitDeleteLabels: A, measureUnitsLabels: j, messageLabels: M, onReceivableCreated: N, onReceivableOpened: P, onTemplateSettingsClick: F, pageSizeOptions: I = s, paymentLabels: L, productMessageLabels: R, screenLabels: z, sendLabels: B, actionLabels: V }) {
|
|
32
|
+
let H = t();
|
|
33
|
+
y(() => {
|
|
34
|
+
H(a.Mounted);
|
|
35
|
+
}, [H]);
|
|
36
|
+
let U = v({
|
|
37
|
+
counterpartMessageLabels: o,
|
|
38
|
+
defaultTab: T,
|
|
39
|
+
embeddedBankName: D,
|
|
40
|
+
enabledTabs: O,
|
|
41
|
+
messageLabels: M,
|
|
42
|
+
onReceivableCreated: N,
|
|
43
|
+
onReceivableOpened: P
|
|
44
|
+
}), [W, G] = x(!1), K = b();
|
|
45
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
46
|
+
/* @__PURE__ */ C(e, {}),
|
|
47
|
+
/* @__PURE__ */ C(m, {
|
|
48
|
+
rows: U.table.rows,
|
|
49
|
+
activeTab: U.activeTab,
|
|
50
|
+
enabledTabs: U.enabledTabs,
|
|
51
|
+
onTabChange: U.setActiveTab,
|
|
52
|
+
isLoading: U.table.isLoading,
|
|
53
|
+
isError: U.table.isError,
|
|
54
|
+
sorting: U.table.sorting,
|
|
55
|
+
onSortingChange: U.table.onSortingChange,
|
|
56
|
+
pageSize: U.table.pageSize,
|
|
57
|
+
onPageSizeChange: U.table.onPageSizeChange,
|
|
58
|
+
pageSizeOptions: I,
|
|
59
|
+
hasNextPage: U.table.hasNextPage,
|
|
60
|
+
hasPrevPage: U.table.hasPrevPage,
|
|
61
|
+
onNextPage: U.table.onNextPage,
|
|
62
|
+
onPrevPage: U.table.onPrevPage,
|
|
63
|
+
searchValue: U.table.searchValue,
|
|
64
|
+
onSearchChange: U.table.onSearchChange,
|
|
65
|
+
statusFilter: U.table.statusFilter,
|
|
66
|
+
statusOptions: U.table.statusOptions,
|
|
67
|
+
onStatusFilterChange: U.table.onStatusFilterChange,
|
|
68
|
+
isFiltering: U.table.isFiltering,
|
|
69
|
+
onCreateClick: U.openCreate,
|
|
70
|
+
onTemplateSettingsClick: F,
|
|
71
|
+
onRowClick: U.handleRowClick,
|
|
72
|
+
onActionClick: U.handleActionClick,
|
|
73
|
+
onRetry: U.table.onRetry,
|
|
74
|
+
labels: z
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ C(d, {
|
|
77
|
+
open: U.form.open,
|
|
78
|
+
onOpenChange: (e) => {
|
|
79
|
+
e || U.form.close();
|
|
80
|
+
},
|
|
81
|
+
mode: U.form.mode,
|
|
82
|
+
values: U.form.sheetValues,
|
|
83
|
+
errors: U.form.errors,
|
|
84
|
+
currencyOptions: U.form.currencyOptions,
|
|
85
|
+
paymentTermsOptions: U.form.paymentTermsOptions,
|
|
86
|
+
unitOptions: U.form.lineItemUnitOptions,
|
|
87
|
+
currencySymbol: U.form.currencySymbol,
|
|
88
|
+
lineItemControls: U.form.lineItemControls,
|
|
89
|
+
autoFocusLineItemId: U.form.autoFocusLineItemId,
|
|
90
|
+
lineItemsLoading: U.form.lineItemsLoading,
|
|
91
|
+
inProgress: U.form.isSubmitting,
|
|
92
|
+
customerSelector: /* @__PURE__ */ C(i, {
|
|
93
|
+
mode: "customer",
|
|
94
|
+
value: U.form.values.customerId || void 0,
|
|
95
|
+
onValueChange: (e) => U.form.updateValues({ customerId: e }),
|
|
96
|
+
onCreateClick: U.form.openCounterpartCreate
|
|
97
|
+
}),
|
|
98
|
+
renderProductSelector: (e, t) => /* @__PURE__ */ C(_, {
|
|
99
|
+
...t,
|
|
100
|
+
inputValue: e.name,
|
|
101
|
+
selectedProductId: U.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
|
|
102
|
+
currency: U.form.values.currency,
|
|
103
|
+
maxLength: 100,
|
|
104
|
+
onInputValueChange: (t) => U.form.updateLineItem(e.id, { name: t }),
|
|
105
|
+
onProductSelect: (t) => U.form.selectProduct(e.id, t)
|
|
106
|
+
}),
|
|
107
|
+
onChange: U.form.updateValues,
|
|
108
|
+
onLineItemChange: U.form.updateLineItem,
|
|
109
|
+
onLineItemCommit: U.form.commitLineItem,
|
|
110
|
+
onLineItemQuantityStep: U.form.stepLineItem,
|
|
111
|
+
onTaxRateCommit: U.form.commitTaxRate,
|
|
112
|
+
onManageUnits: () => G(!0),
|
|
113
|
+
onAddLineItem: U.form.addLineItem,
|
|
114
|
+
onRemoveLineItem: U.form.removeLineItem,
|
|
115
|
+
bankAccountSection: /* @__PURE__ */ C(l, {
|
|
116
|
+
idPrefix: K,
|
|
117
|
+
view: U.form.bankAccount.view,
|
|
118
|
+
disabled: U.form.isSubmitting,
|
|
119
|
+
onAccountSelect: U.form.bankAccount.selectAccount,
|
|
120
|
+
onAddAccountClick: U.form.bankAccount.openAddAccount,
|
|
121
|
+
onFormChange: U.form.bankAccount.updateAccountForm,
|
|
122
|
+
onFormSave: U.form.bankAccount.saveAccount,
|
|
123
|
+
onFormCancel: U.form.bankAccount.cancelAddAccount,
|
|
124
|
+
labels: k
|
|
125
|
+
}),
|
|
126
|
+
attachmentsSection: U.form.attachmentsView && /* @__PURE__ */ C(h, {
|
|
127
|
+
view: U.form.attachmentsView,
|
|
128
|
+
disabled: U.form.isSubmitting,
|
|
129
|
+
onFilesSelect: U.form.selectAttachmentFiles,
|
|
130
|
+
onIncludeInEmailChange: U.form.setAttachmentIncludeInEmail,
|
|
131
|
+
onRemove: U.form.removeAttachment,
|
|
132
|
+
labels: k
|
|
133
|
+
}),
|
|
134
|
+
cancelDisabled: U.form.attachmentsUploading,
|
|
135
|
+
saveDisabled: U.form.saveDisabled,
|
|
136
|
+
onSubmit: U.form.submit,
|
|
137
|
+
onCancel: U.form.close,
|
|
138
|
+
labels: k
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ C(u, {
|
|
141
|
+
open: U.detailsOpen,
|
|
142
|
+
onOpenChange: (e) => {
|
|
143
|
+
e || U.closeDetails();
|
|
144
|
+
},
|
|
145
|
+
details: U.details.detailsView,
|
|
146
|
+
isLoading: U.details.isLoading,
|
|
147
|
+
isError: U.details.isError,
|
|
148
|
+
onActionClick: U.handleDetailsActionClick,
|
|
149
|
+
onClose: U.closeDetails,
|
|
150
|
+
labels: E
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ C(p, {
|
|
153
|
+
open: U.actions.sendOpen,
|
|
154
|
+
onOpenChange: (e) => {
|
|
155
|
+
e || U.actions.closeSend();
|
|
156
|
+
},
|
|
157
|
+
values: U.actions.sendValues,
|
|
158
|
+
errors: U.actions.sendErrors,
|
|
159
|
+
inProgress: U.actions.sendInProgress,
|
|
160
|
+
onChange: (e) => U.actions.setSendValues((t) => ({
|
|
161
|
+
...t,
|
|
162
|
+
...e
|
|
163
|
+
})),
|
|
164
|
+
onSubmit: U.actions.submitSend,
|
|
165
|
+
onCancel: U.actions.closeSend,
|
|
166
|
+
labels: B
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ C(f, {
|
|
169
|
+
open: U.actions.paymentOpen,
|
|
170
|
+
onOpenChange: (e) => {
|
|
171
|
+
e || U.actions.closePayment();
|
|
172
|
+
},
|
|
173
|
+
values: U.actions.paymentValues,
|
|
174
|
+
errors: U.actions.paymentErrors,
|
|
175
|
+
inProgress: U.actions.paymentInProgress,
|
|
176
|
+
onChange: (e) => U.actions.setPaymentValues((t) => ({
|
|
177
|
+
...t,
|
|
178
|
+
...e
|
|
179
|
+
})),
|
|
180
|
+
onSubmit: U.actions.submitPayment,
|
|
181
|
+
onCancel: U.actions.closePayment,
|
|
182
|
+
labels: L
|
|
183
|
+
}),
|
|
184
|
+
U.actions.actionDialog && /* @__PURE__ */ C(c, {
|
|
185
|
+
open: !!U.actions.actionTarget,
|
|
186
|
+
onOpenChange: (e) => {
|
|
187
|
+
e || U.actions.closeAction();
|
|
188
|
+
},
|
|
189
|
+
title: U.actions.actionDialog.title,
|
|
190
|
+
description: U.actions.actionDialog.description,
|
|
191
|
+
confirmLabel: U.actions.actionDialog.confirmLabel,
|
|
192
|
+
destructive: U.actions.actionDialog.destructive,
|
|
193
|
+
error: U.actions.actionError,
|
|
194
|
+
inProgress: U.actions.actionInProgress,
|
|
195
|
+
onConfirm: U.actions.confirmAction,
|
|
196
|
+
onCancel: U.actions.closeAction,
|
|
197
|
+
labels: V
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ C(r, {
|
|
200
|
+
open: U.form.counterpartView === "create",
|
|
201
|
+
onOpenChange: (e) => {
|
|
202
|
+
e || U.form.counterpartForm.close();
|
|
203
|
+
},
|
|
204
|
+
mode: "create",
|
|
205
|
+
values: U.form.counterpartForm.values,
|
|
206
|
+
errors: U.form.counterpartForm.errors,
|
|
207
|
+
stateOptions: U.form.stateOptions,
|
|
208
|
+
inProgress: U.form.counterpartForm.isSubmitting,
|
|
209
|
+
onChange: (e) => U.form.counterpartForm.setValues((t) => ({
|
|
210
|
+
...t,
|
|
211
|
+
...e
|
|
212
|
+
})),
|
|
213
|
+
onAddressChange: (e) => U.form.counterpartForm.setValues((t) => ({
|
|
214
|
+
...t,
|
|
215
|
+
address: {
|
|
216
|
+
...t.address,
|
|
217
|
+
...e
|
|
218
|
+
}
|
|
219
|
+
})),
|
|
220
|
+
onSubmit: U.form.counterpartForm.submit,
|
|
221
|
+
onCancel: U.form.counterpartForm.close,
|
|
222
|
+
labels: n
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ C(g, {
|
|
225
|
+
open: W,
|
|
226
|
+
onClose: () => G(!1),
|
|
227
|
+
managerLabels: j,
|
|
228
|
+
deleteLabels: A,
|
|
229
|
+
messageLabels: R
|
|
230
|
+
})
|
|
231
|
+
] });
|
|
232
|
+
}
|
|
233
|
+
function E({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
|
|
234
|
+
return /* @__PURE__ */ C(n, {
|
|
235
|
+
widgetName: o,
|
|
236
|
+
baseUrl: e,
|
|
237
|
+
widgetToken: t,
|
|
238
|
+
organizationId: r,
|
|
239
|
+
configClient: i,
|
|
240
|
+
gatewayRouting: a,
|
|
241
|
+
linkComponent: s,
|
|
242
|
+
implementation: c,
|
|
243
|
+
uiFramework: l,
|
|
244
|
+
errorFallback: u,
|
|
245
|
+
onError: d,
|
|
246
|
+
analytics: f,
|
|
247
|
+
disclosuresAcceptance: p,
|
|
248
|
+
providerLabels: m,
|
|
249
|
+
children: /* @__PURE__ */ C(T, { ...h })
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { E as ReceivablesWidget, E as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { ReceivableAttachmentsSection as e } from "../../ui/dist/
|
|
5
|
+
import { ReceivableAttachmentsSection as e } from "../../ui/dist/index5.js";
|
|
6
6
|
import "../../ui/dist/index.js";
|
|
7
7
|
import { useRef as t, useState as n } from "react";
|
|
8
8
|
import { jsx as r } from "react/jsx-runtime";
|