@tesouro/embedded-components-react 0.5.214 → 0.5.216
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 +144 -3
- package/dist/index.js +14 -13
- package/dist/lib/BankAccountOnboardingWidget.d.ts +56 -2
- package/dist/lib/BankAccountOnboardingWidget.js +4 -3
- package/dist/lib/MarketingWidget.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +88 -1
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/lib/WidgetSuite.d.ts +53 -0
- package/dist/libs/shared/util-validation/dist/index5.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +72 -72
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +15 -15
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +60 -60
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +12 -12
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index21.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +71 -5
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index23.js +95 -33
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index24.js +6 -17
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index25.js +16 -616
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index26.js +669 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +15 -13
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +52 -37
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +31 -37
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index12.js +33 -89
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index13.js +39 -12
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index14.js +98 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +14 -4
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +2 -185
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index17.js +4 -30
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +183 -21
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +26 -66
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +21 -233
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index21.js +66 -27
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +233 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +27 -72
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index24.js +26 -85
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index25.js +74 -8
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index26.js +83 -55
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +6 -7
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js +37 -42
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index29.js +11 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +64 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index9.js +7 -33
- 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/index10.js +63 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +160 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +32 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +25 -200
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +175 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +1 -101
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +92 -71
- 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 +44 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +93 -421
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +442 -112
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +166 -157
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +150 -204
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +202 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +145 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +44 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +113 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +83 -357
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +111 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +449 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +68 -281
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +314 -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/index6.js +34 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +444 -92
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +113 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +2 -92
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +95 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +3 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +0 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +11 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +1 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +258 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +38 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +61 -463
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +457 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +91 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +22 -338
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +236 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +26 -204
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +208 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +29 -202
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +157 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +10 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +23 -2
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index5.js +16 -19
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index6.js +157 -16
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -40
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/onboardingSuppressionReason.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +167 -156
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +66 -34
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/application/bankAccountApplication.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +13 -13
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index7.js +0 -161
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js
CHANGED
|
@@ -2,374 +2,100 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import "
|
|
11
|
-
import "../../ui/dist/index9.js";
|
|
12
|
-
import "../../ui/dist/index.js";
|
|
13
|
-
import { buildLineItemControls as ee, commitLineItemField as te, commitTaxRateInput as ne, convertPriceInput as re, createLineItem as ie, getCurrencySymbol as ae, lineItemFromProduct as oe, reconcileMeasureUnits as se, sanitizeLineItemPatch as ce, sanitizeTaxRateInput as le, stepLineItemQuantity as ue, stripBlankLineItems as de, summarizeLineItemErrors as fe, toSheetLineItem as pe, validateLineItems as me } from "./index6.js";
|
|
14
|
-
import { buildReceivableAttachmentsView as he } from "./index7.js";
|
|
15
|
-
import { convertDiscountInput as ge, decorateDiscountInput as _e, discountInputToMinorUnits as ve, sanitizeDiscountInput as ye } from "./index9.js";
|
|
16
|
-
import { buildFormTotalsView as be, calculateFormTotals as xe, validateDiscount as Se, validateInvoiceTotals as Ce } from "./index10.js";
|
|
17
|
-
import { createEmptyReceivableFormValues as a, hasReceivableFormErrors as we, receivableFormValuesToCreatePayload as Te, receivableFormValuesToLineItemChanges as Ee, receivableFormValuesToUpdatePayload as De, receivableToFormValues as Oe, validateReceivableForm as ke } from "./index11.js";
|
|
18
|
-
import { shouldShowRemindersInitially as Ae } from "./index13.js";
|
|
19
|
-
import { useCreateReceivableMutation as je, useUpdateReceivableMutation as Me } from "../../data-access/dist/index6.js";
|
|
7
|
+
import "../../../shared/ui/dist/index.js";
|
|
8
|
+
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
+
import "../../../shared/feature/dist/index.js";
|
|
10
|
+
import { useCreateEntityBankAccountMutation as r, usePaymentAccountsQuery as i } from "../../data-access/dist/index3.js";
|
|
20
11
|
import "../../data-access/dist/index.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { useReceivableBankAccount as Fe } from "./index19.js";
|
|
24
|
-
import { useReceivableReminders as Ie } from "./index20.js";
|
|
25
|
-
import { getCurrencyOptions as Le } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
26
|
-
import { useMeasureUnitsQuery as Re } from "../../../shared/product-catalog/data-access/dist/index9.js";
|
|
27
|
-
import { useMeasureUnits as ze } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
28
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
29
|
-
import { useCallback as o, useEffect as Be, useMemo as s, useRef as c, useState as l } from "react";
|
|
12
|
+
import { EMPTY_BANK_ACCOUNT_FORM_VALUES as a, bankAccountFormToPayload as o, buildBankAccountSectionView as s, buildPaymentAccountOptions as c, getBankAccountPermissions as l, validateBankAccountForm as u } from "./index20.js";
|
|
13
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
30
14
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js
|
|
31
|
-
function
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), [d]), Ye = r(S.customerId), Xe = Ye.data?.data?.[0], R = Ye.data?.data?.[0]?.id, Ze = o((e) => {
|
|
39
|
-
C((t) => ({
|
|
40
|
-
...t,
|
|
41
|
-
attachments: e(t.attachments)
|
|
42
|
-
}));
|
|
43
|
-
}, []), z = Ne({
|
|
44
|
-
attachments: S.attachments,
|
|
45
|
-
setAttachments: Ze,
|
|
46
|
-
receivableId: b
|
|
47
|
-
}), { reset: B, discardUploads: V, commitRemovals: Qe } = z, $e = S.type === "invoice" ? he({
|
|
48
|
-
attachments: S.attachments,
|
|
49
|
-
pendingUploads: z.pendingUploads,
|
|
50
|
-
isCountLimitReached: z.isCountLimitReached,
|
|
51
|
-
isRecurring: !1,
|
|
52
|
-
messages: u
|
|
53
|
-
}) : void 0, et = o((e) => {
|
|
54
|
-
C((t) => ({
|
|
55
|
-
...t,
|
|
56
|
-
customerId: e ?? ""
|
|
57
|
-
}));
|
|
58
|
-
}, []), H = i({
|
|
59
|
-
view: We,
|
|
60
|
-
setView: Ge,
|
|
61
|
-
selectedId: S.customerId || void 0,
|
|
62
|
-
setSelectedId: et,
|
|
63
|
-
messages: Je,
|
|
64
|
-
counterpartType: "customer",
|
|
65
|
-
counterpart: void 0,
|
|
66
|
-
primaryAddress: Xe
|
|
67
|
-
}), tt = o((e) => C((t) => {
|
|
68
|
-
let n = e({
|
|
69
|
-
paymentTermsId: t.paymentTermsId,
|
|
70
|
-
paymentTermsCustomDate: t.paymentTermsCustomDate
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
...t,
|
|
74
|
-
...n,
|
|
75
|
-
...n.paymentTermsId === "receipt_due" ? { paymentReminderId: "" } : {}
|
|
76
|
-
};
|
|
77
|
-
}), []), U = Pe({
|
|
78
|
-
paymentTermsId: S.paymentTermsId,
|
|
79
|
-
paymentTermsCustomDate: S.paymentTermsCustomDate,
|
|
80
|
-
messages: u,
|
|
81
|
-
onChange: tt
|
|
82
|
-
}), W = U.reset, nt = o((e) => C((t) => ({
|
|
83
|
-
...t,
|
|
84
|
-
...e
|
|
85
|
-
})), []), G = Fe({
|
|
86
|
-
open: g,
|
|
87
|
-
bankAccountId: S.bankAccountId,
|
|
88
|
-
embeddedBankName: Ve,
|
|
89
|
-
messages: u,
|
|
90
|
-
onSelect: nt
|
|
91
|
-
}), K = G.reset, rt = o((e) => C((t) => ({
|
|
92
|
-
...t,
|
|
93
|
-
...e
|
|
94
|
-
})), []), q = f.isPending || p.isPending, it = Ie({
|
|
95
|
-
open: g,
|
|
96
|
-
isInvoice: S.type === "invoice",
|
|
97
|
-
disabled: q,
|
|
98
|
-
paymentTermsId: S.paymentTermsId,
|
|
99
|
-
paymentTermsCustomDate: S.paymentTermsCustomDate,
|
|
100
|
-
paymentReminderId: S.paymentReminderId,
|
|
101
|
-
overdueReminderId: S.overdueReminderId,
|
|
102
|
-
messages: u,
|
|
103
|
-
onSelect: rt
|
|
104
|
-
}), J = it.reset, Y = o(() => {
|
|
105
|
-
m.current = [], k(void 0), y("create"), x(void 0), C(a()), w({}), j(!1), L(!1), F.current = {
|
|
106
|
-
lines: !1,
|
|
107
|
-
discount: !1
|
|
108
|
-
}, B();
|
|
109
|
-
}, [B]), at = o((e = "invoice") => {
|
|
110
|
-
W(), K();
|
|
111
|
-
let t = {
|
|
112
|
-
...a(),
|
|
113
|
-
type: e
|
|
114
|
-
};
|
|
115
|
-
J(Ae(t)), m.current = [], k(void 0), y("create"), x(void 0), C(t), w({}), B(), j(!1), L(!1), F.current = {
|
|
116
|
-
lines: !1,
|
|
117
|
-
discount: !1
|
|
118
|
-
}, _(!0);
|
|
119
|
-
}, [
|
|
120
|
-
B,
|
|
121
|
-
W,
|
|
122
|
-
K,
|
|
123
|
-
J
|
|
124
|
-
]), ot = o((e) => {
|
|
125
|
-
if (e.type === "credit_note") return;
|
|
126
|
-
W(), K();
|
|
127
|
-
let t = Oe(e, D);
|
|
128
|
-
J(Ae(t)), m.current = e.line_items, h.current = e.currency, k(void 0), y("edit"), x(e.id), C(t), w({}), j(!1), L(!1), F.current = {
|
|
129
|
-
lines: !1,
|
|
130
|
-
discount: !1
|
|
131
|
-
}, B(), _(!0);
|
|
132
|
-
}, [
|
|
133
|
-
B,
|
|
134
|
-
W,
|
|
135
|
-
K,
|
|
136
|
-
J,
|
|
137
|
-
D
|
|
138
|
-
]);
|
|
139
|
-
Be(() => {
|
|
140
|
-
D?.length && C((e) => {
|
|
141
|
-
let t = se(e.lineItems, D);
|
|
142
|
-
return t === e.lineItems ? e : {
|
|
143
|
-
...e,
|
|
144
|
-
lineItems: t
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
}, [D]);
|
|
148
|
-
let X = z.isUploading, st = o(() => {
|
|
149
|
-
X || (V(), _(!1), w({}));
|
|
150
|
-
}, [V, X]), ct = o((e) => {
|
|
151
|
-
let t = { ...e };
|
|
152
|
-
t.taxRate !== void 0 && (t.taxRate = le(t.taxRate), P.current = !0), t.type !== void 0 && t.type !== "invoice" && V(), t.discount !== void 0 && A && (N.current = !0), t.discountType !== void 0 && (N.current = !0), t.currency !== void 0 && (M.current = !0), C((e) => {
|
|
153
|
-
let n = {
|
|
154
|
-
...e,
|
|
155
|
-
...t
|
|
156
|
-
};
|
|
157
|
-
return t.discount !== void 0 && (n.discount = ye(t.discount, n.discountType, n.currency)), n.currency !== e.currency && (n.lineItems = e.lineItems.map((t) => ({
|
|
158
|
-
...t,
|
|
159
|
-
price: re(t.price, e.currency, n.currency)
|
|
160
|
-
}))), (n.currency !== e.currency || n.discountType !== e.discountType) && (n.discount = ge({
|
|
161
|
-
value: n.discount,
|
|
162
|
-
type: n.discountType,
|
|
163
|
-
currency: n.currency
|
|
164
|
-
})), n;
|
|
165
|
-
});
|
|
166
|
-
}, [V, A]), lt = o(() => L(!0), []), ut = o(() => {
|
|
167
|
-
L(!1), N.current = !0, C((e) => ({
|
|
168
|
-
...e,
|
|
169
|
-
discount: ge({
|
|
170
|
-
value: e.discount,
|
|
171
|
-
type: e.discountType,
|
|
172
|
-
currency: e.currency
|
|
173
|
-
})
|
|
174
|
-
}));
|
|
175
|
-
}, []), dt = o(() => {
|
|
176
|
-
P.current = !0, C((e) => {
|
|
177
|
-
let t = ne(e.taxRate);
|
|
178
|
-
return t === e.taxRate ? e : {
|
|
179
|
-
...e,
|
|
180
|
-
taxRate: t
|
|
181
|
-
};
|
|
182
|
-
});
|
|
183
|
-
}, []), Z = o((e, { validate: t }) => {
|
|
184
|
-
t && (M.current = !0), C((t) => ({
|
|
185
|
-
...t,
|
|
186
|
-
lineItems: e(t.lineItems)
|
|
187
|
-
}));
|
|
15
|
+
function g({ open: g, bankAccountId: _, embeddedBankName: v, messages: y, onSelect: b }) {
|
|
16
|
+
let { initResponse: x } = n(), S = p(() => l(x?.scopes), [x?.scopes]), { paymentAccounts: C, isLoading: w, isIncomplete: T } = i({
|
|
17
|
+
enabled: g,
|
|
18
|
+
canReadEmbedded: S.canReadEmbedded,
|
|
19
|
+
canReadExternal: S.canReadExternal
|
|
20
|
+
}), E = r(), [D, O] = h(!1), [k, A] = h(a), [j, M] = h({}), N = m(!1), P = d(() => {
|
|
21
|
+
N.current = !1, O(!1), A(a), M({});
|
|
188
22
|
}, []);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
messages: u
|
|
196
|
-
}) : void 0;
|
|
197
|
-
w((t) => {
|
|
198
|
-
let r = { ...t };
|
|
199
|
-
return F.current.lines && (r.lineItems = e ? n : t.lineItems, r.lineItemsSummary = fe(r.lineItems, Ce(S, u))), F.current.discount && (r.discount = Se(S, u)), r;
|
|
23
|
+
f(() => {
|
|
24
|
+
if (!g || T || N.current || C.length !== 1) return;
|
|
25
|
+
let [e] = C;
|
|
26
|
+
N.current = !0, b({
|
|
27
|
+
bankAccountId: e.id,
|
|
28
|
+
bankAccountType: e.type
|
|
200
29
|
});
|
|
201
|
-
}, [u, S]);
|
|
202
|
-
let ft = o((e, t) => {
|
|
203
|
-
let { unit: n, ...r } = t, i = ce(r);
|
|
204
|
-
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (P.current = !0), Z((t) => t.map((t) => t.id === e ? {
|
|
205
|
-
...t,
|
|
206
|
-
...i
|
|
207
|
-
} : t), { validate: A });
|
|
208
|
-
}, [Z, A]), pt = o((e, t) => {
|
|
209
|
-
Z((n) => n.map((n) => n.id === e ? {
|
|
210
|
-
...n,
|
|
211
|
-
...oe({
|
|
212
|
-
product: t,
|
|
213
|
-
currency: S.currency,
|
|
214
|
-
unitNamesById: O
|
|
215
|
-
})
|
|
216
|
-
} : n), { validate: !0 });
|
|
217
|
-
}, [
|
|
218
|
-
Z,
|
|
219
|
-
O,
|
|
220
|
-
S.currency
|
|
221
|
-
]), Q = o((e, t) => {
|
|
222
|
-
t && Z((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
|
|
223
|
-
...n,
|
|
224
|
-
...t.patch
|
|
225
|
-
} : n), { validate: !0 });
|
|
226
|
-
}, [Z]), mt = o((e, t) => {
|
|
227
|
-
let n = S.lineItems.find((t) => t.id === e);
|
|
228
|
-
n && Q(e, te({
|
|
229
|
-
lineItem: n,
|
|
230
|
-
field: t,
|
|
231
|
-
rowCount: S.lineItems.length,
|
|
232
|
-
currency: S.currency
|
|
233
|
-
}));
|
|
234
30
|
}, [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}, [Q, S.lineItems]), gt = o(() => {
|
|
246
|
-
let e = ie(S.currency);
|
|
247
|
-
k(e.id), C((t) => ({
|
|
248
|
-
...t,
|
|
249
|
-
lineItems: [...t.lineItems, e]
|
|
250
|
-
}));
|
|
251
|
-
}, [S.currency]), _t = o((e) => {
|
|
252
|
-
Z((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
|
|
253
|
-
}, [Z]), vt = o(async () => {
|
|
254
|
-
if (X) return;
|
|
255
|
-
if (E.isLoading) {
|
|
256
|
-
w({ form: u.lineItemsLoading });
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
let e = de(S.lineItems), n = e.length === S.lineItems.length ? S : {
|
|
260
|
-
...S,
|
|
261
|
-
lineItems: e
|
|
262
|
-
};
|
|
263
|
-
n !== S && C(n);
|
|
264
|
-
let r = ke({
|
|
265
|
-
values: n,
|
|
266
|
-
billingAddressId: R,
|
|
267
|
-
messages: u
|
|
31
|
+
T,
|
|
32
|
+
b,
|
|
33
|
+
g,
|
|
34
|
+
C
|
|
35
|
+
]);
|
|
36
|
+
let F = d((e) => {
|
|
37
|
+
let t = C.find((t) => t.id === e);
|
|
38
|
+
t && b({
|
|
39
|
+
bankAccountId: t.id,
|
|
40
|
+
bankAccountType: t.type
|
|
268
41
|
});
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
billingAddressId: R ?? "",
|
|
285
|
-
lineItemChanges: Ee({
|
|
286
|
-
values: n,
|
|
287
|
-
originalLineItems: m.current,
|
|
288
|
-
originalCurrency: h.current,
|
|
289
|
-
unitNamesById: O,
|
|
290
|
-
units: D
|
|
291
|
-
})
|
|
292
|
-
})
|
|
293
|
-
}), Qe(), _(!1), Y();
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
let e = await f.mutateAsync({ body: Te({
|
|
297
|
-
values: n,
|
|
298
|
-
billingAddressId: R ?? "",
|
|
299
|
-
unitNamesById: O
|
|
300
|
-
}) });
|
|
301
|
-
_(!1), Y(), e?.id && He?.(e.id, e.type);
|
|
302
|
-
} catch (e) {
|
|
303
|
-
w({ form: t(e) ?? u.genericError });
|
|
42
|
+
}, [b, C]), I = d(() => O(!0), []), L = d(() => {
|
|
43
|
+
O(!1), A(a), M({});
|
|
44
|
+
}, []), R = d((e) => A((t) => ({
|
|
45
|
+
...t,
|
|
46
|
+
...e
|
|
47
|
+
})), []), z = d(async () => {
|
|
48
|
+
let n = u(k, y);
|
|
49
|
+
if (M(n), !(Object.keys(n).length > 0)) try {
|
|
50
|
+
let t = await E.mutateAsync({ body: o(k) });
|
|
51
|
+
O(!1), A(a), b({
|
|
52
|
+
bankAccountId: t.id,
|
|
53
|
+
bankAccountType: "BANK_DETAILS"
|
|
54
|
+
}), e.success(y.bankAccountCreated.replace("{name}", t.display_name ?? ""));
|
|
55
|
+
} catch (n) {
|
|
56
|
+
e.error(t(n) ?? y.bankAccountCreateFailed);
|
|
304
57
|
}
|
|
305
58
|
}, [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
b
|
|
310
|
-
|
|
311
|
-
|
|
59
|
+
E,
|
|
60
|
+
k,
|
|
61
|
+
y,
|
|
62
|
+
b
|
|
63
|
+
]), B = p(() => c({
|
|
64
|
+
accounts: C,
|
|
65
|
+
embeddedBankName: v,
|
|
66
|
+
messages: y
|
|
67
|
+
}), [
|
|
312
68
|
v,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
O,
|
|
317
|
-
E.isLoading,
|
|
318
|
-
p,
|
|
319
|
-
S
|
|
320
|
-
]), yt = s(() => ({
|
|
321
|
-
...S,
|
|
322
|
-
discount: I ? S.discount : _e(ve(S.discount, S.discountType, S.currency), S.discountType, S.currency),
|
|
323
|
-
lineItems: S.lineItems.map(pe)
|
|
324
|
-
}), [I, S]), bt = s(() => ee(S.lineItems), [S.lineItems]), $ = s(() => xe(S), [S]), xt = s(() => be($, S.currency), [$, S.currency]);
|
|
69
|
+
y,
|
|
70
|
+
C
|
|
71
|
+
]);
|
|
325
72
|
return {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
lineItemsLoading: E.isLoading,
|
|
352
|
-
lineItemControls: bt,
|
|
353
|
-
totals: $,
|
|
354
|
-
totalsView: xt,
|
|
355
|
-
currencySymbol: ae(S.currency),
|
|
356
|
-
isSubmitting: q,
|
|
357
|
-
currencyOptions: Le(S.currency),
|
|
358
|
-
paymentTerms: U,
|
|
359
|
-
showBillingSection: S.type === "invoice" || v === "edit",
|
|
360
|
-
showDueDateField: S.type === "quote",
|
|
361
|
-
openCreate: at,
|
|
362
|
-
openEdit: ot,
|
|
363
|
-
close: st,
|
|
364
|
-
submit: vt,
|
|
365
|
-
units: T,
|
|
366
|
-
counterpartView: We,
|
|
367
|
-
counterpartForm: H,
|
|
368
|
-
stateOptions: qe,
|
|
369
|
-
openCounterpartCreate: H.openCreate,
|
|
370
|
-
bankAccount: G,
|
|
371
|
-
reminders: it
|
|
73
|
+
view: p(() => s({
|
|
74
|
+
options: B,
|
|
75
|
+
isLoading: w,
|
|
76
|
+
selectedId: _,
|
|
77
|
+
isAddingAccount: D,
|
|
78
|
+
canAddAccount: S.canAddAccount,
|
|
79
|
+
formValues: k,
|
|
80
|
+
formErrors: j,
|
|
81
|
+
isSaving: E.isPending
|
|
82
|
+
}), [
|
|
83
|
+
_,
|
|
84
|
+
E.isPending,
|
|
85
|
+
j,
|
|
86
|
+
k,
|
|
87
|
+
D,
|
|
88
|
+
w,
|
|
89
|
+
B,
|
|
90
|
+
S.canAddAccount
|
|
91
|
+
]),
|
|
92
|
+
reset: P,
|
|
93
|
+
selectAccount: F,
|
|
94
|
+
openAddAccount: I,
|
|
95
|
+
cancelAddAccount: L,
|
|
96
|
+
updateAccountForm: R,
|
|
97
|
+
saveAccount: z
|
|
372
98
|
};
|
|
373
99
|
}
|
|
374
100
|
//#endregion
|
|
375
|
-
export {
|
|
101
|
+
export { g as useReceivableBankAccount };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js
CHANGED
|
@@ -2,74 +2,120 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
+
import { usePaymentTermsQuery as n } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
|
|
8
|
+
import "../../../shared/ui/dist/index.js";
|
|
9
|
+
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
|
+
import "../../../shared/feature/dist/index.js";
|
|
11
|
+
import { areOverdueTermsValid as i, buildOverdueReminderPayload as a, buildPaymentReminderPayload as o, buildRemindersView as s, canCreateReminders as c, getImpliedDueDate as l, isBeforeDueDaysValid as u, sanitizeReminderDays as d } from "./index14.js";
|
|
12
|
+
import { useCreateOverdueReminderMutation as f, useCreatePaymentReminderMutation as p, useOverdueRemindersQuery as m, usePaymentRemindersQuery as h } from "../../data-access/dist/index11.js";
|
|
7
13
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import { useCallback as
|
|
14
|
+
import { useCallback as g, useMemo as _, useState as v } from "react";
|
|
9
15
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
var y = [""];
|
|
17
|
+
function b({ open: b, isInvoice: x, disabled: S, paymentTermsId: C, paymentTermsCustomDate: w, paymentReminderId: T, overdueReminderId: E, messages: D, onSelect: O }) {
|
|
18
|
+
let { initResponse: k } = r(), A = n().data?.data, j = _(() => c(k?.scopes), [k?.scopes]), [M, N] = v(!1), [P, F] = v(""), [I, L] = v(y), R = b && x && M, z = h({ enabled: R }), B = m({ enabled: R }), V = p(), H = f(), U = g((e) => {
|
|
19
|
+
N(e), F(""), L(y);
|
|
20
|
+
}, []), W = g((e) => {
|
|
21
|
+
e || (O({
|
|
22
|
+
paymentReminderId: "",
|
|
23
|
+
overdueReminderId: ""
|
|
24
|
+
}), F(""), L(y)), N(e);
|
|
25
|
+
}, [O]), G = g((e) => O({ paymentReminderId: e }), [O]), K = g((e) => O({ overdueReminderId: e }), [O]), q = g((e) => F(d(e)), []), J = g((e, t) => {
|
|
26
|
+
let n = d(t);
|
|
27
|
+
L((t) => t.map((t, r) => r === e ? n : t));
|
|
28
|
+
}, []), Y = g(() => {
|
|
29
|
+
L((e) => e.length < 3 ? [...e, ""] : e);
|
|
30
|
+
}, []), X = g(() => L(y), []), Z = g(() => l({
|
|
31
|
+
paymentTermsId: C,
|
|
32
|
+
paymentTermsCustomDate: w,
|
|
33
|
+
paymentTerms: A,
|
|
34
|
+
today: /* @__PURE__ */ new Date()
|
|
35
|
+
}), [
|
|
36
|
+
A,
|
|
37
|
+
w,
|
|
38
|
+
C
|
|
39
|
+
]), Q = g(async () => {
|
|
40
|
+
if (u(P)) try {
|
|
41
|
+
let t = await V.mutateAsync({ body: o({
|
|
42
|
+
daysBefore: Number(P),
|
|
43
|
+
dueDate: Z(),
|
|
44
|
+
messages: D
|
|
45
|
+
}) });
|
|
46
|
+
F(""), O({ paymentReminderId: t.id }), e.success(D.reminderAdded);
|
|
47
|
+
} catch (n) {
|
|
48
|
+
e.error(t(n) ?? D.genericError);
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
P,
|
|
52
|
+
V,
|
|
53
|
+
Z,
|
|
54
|
+
D,
|
|
55
|
+
O
|
|
56
|
+
]), $ = g(async () => {
|
|
57
|
+
if (i(I)) try {
|
|
58
|
+
let t = await H.mutateAsync({ body: a({
|
|
59
|
+
terms: I,
|
|
60
|
+
dueDate: Z(),
|
|
61
|
+
messages: D
|
|
62
|
+
}) });
|
|
63
|
+
L(y), O({ overdueReminderId: t.id }), e.success(D.reminderAdded);
|
|
64
|
+
} catch (n) {
|
|
65
|
+
e.error(t(n) ?? D.genericError);
|
|
66
|
+
}
|
|
67
|
+
}, [
|
|
68
|
+
H,
|
|
69
|
+
Z,
|
|
70
|
+
D,
|
|
71
|
+
O,
|
|
72
|
+
I
|
|
73
|
+
]);
|
|
44
74
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
view: _(() => x ? s({
|
|
76
|
+
showReminders: M,
|
|
77
|
+
paymentTermsId: C,
|
|
78
|
+
paymentTermsCustomDate: w,
|
|
79
|
+
paymentReminderId: T,
|
|
80
|
+
overdueReminderId: E,
|
|
81
|
+
paymentReminders: z.data?.data,
|
|
82
|
+
overdueReminders: B.data?.data,
|
|
83
|
+
canCreate: j,
|
|
84
|
+
disabled: S,
|
|
85
|
+
beforeDueInput: P,
|
|
86
|
+
overdueTerms: I,
|
|
87
|
+
isCreatingPaymentReminder: V.isPending,
|
|
88
|
+
isCreatingOverdueReminder: H.isPending,
|
|
89
|
+
today: /* @__PURE__ */ new Date(),
|
|
90
|
+
messages: D
|
|
91
|
+
}) : void 0, [
|
|
92
|
+
P,
|
|
93
|
+
j,
|
|
94
|
+
H.isPending,
|
|
95
|
+
V.isPending,
|
|
96
|
+
S,
|
|
97
|
+
x,
|
|
98
|
+
D,
|
|
99
|
+
E,
|
|
100
|
+
B.data?.data,
|
|
101
|
+
I,
|
|
102
|
+
T,
|
|
103
|
+
z.data?.data,
|
|
104
|
+
w,
|
|
105
|
+
C,
|
|
106
|
+
M
|
|
107
|
+
]),
|
|
108
|
+
reset: U,
|
|
109
|
+
toggle: W,
|
|
110
|
+
selectPaymentReminder: G,
|
|
111
|
+
selectOverdueReminder: K,
|
|
112
|
+
changeBeforeDueInput: q,
|
|
113
|
+
saveBeforeDue: Q,
|
|
114
|
+
changeOverdueTerm: J,
|
|
115
|
+
addOverdueTerm: Y,
|
|
116
|
+
clearOverdueTerms: X,
|
|
117
|
+
saveOverdue: $
|
|
64
118
|
};
|
|
65
119
|
}
|
|
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
|
-
};
|
|
74
120
|
//#endregion
|
|
75
|
-
export {
|
|
121
|
+
export { b as useReceivableReminders };
|