@tesouro/embedded-components-react 0.5.231 → 0.5.233
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 +1 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +105 -2
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +105 -2
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +92 -55
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +67 -142
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +186 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +45 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +68 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +66 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +28 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +24 -166
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +177 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +42 -95
- 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 +36 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +206 -147
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +39 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +53 -227
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +216 -287
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +453 -43
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +103 -126
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +122 -146
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +145 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +39 -115
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +113 -90
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +81 -98
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +111 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +26 -633
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +639 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +41 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +35 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +73 -130
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +133 -329
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index36.js +345 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +15 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +35 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +8 -71
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +70 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +31 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +18 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +12 -301
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +33 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +14 -46
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +23 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +76 -485
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +395 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +48 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +72 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +496 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +97 -91
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +2 -236
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +1 -249
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +23 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +223 -340
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +59 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +353 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +41 -41
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +75 -43
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +0 -28
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js
CHANGED
|
@@ -5,227 +5,286 @@
|
|
|
5
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
7
|
import "../../../shared/ui/dist/index.js";
|
|
8
|
-
import { defaultPaymentValues as n, defaultSendValues as r,
|
|
9
|
-
import { getIssueReminderBlocker as d, hasSelectedReminder as
|
|
10
|
-
import { useSendReceivableEmailMutation as
|
|
11
|
-
import { useAcceptReceivableMutation as
|
|
12
|
-
import { useMarkReceivablePaidMutation as
|
|
8
|
+
import { defaultPaymentValues as n, defaultSendValues as r, formatMoney as i, fromMajorUnits as a, hasPaymentErrors as o, hasSendErrors as s, isReceivableReadyToIssue as ee, splitEmailList as c, validatePaymentValues as l, validateSendValues as u } from "./index13.js";
|
|
9
|
+
import { getIssueReminderBlocker as d, hasSelectedReminder as te } from "./index15.js";
|
|
10
|
+
import { useSendReceivableEmailMutation as f } from "../../data-access/dist/index7.js";
|
|
11
|
+
import { useAcceptReceivableMutation as ne, useCancelReceivableMutation as re, useCloneReceivableMutation as p, useDeclineReceivableMutation as ie, useDeleteReceivableMutation as ae, useIssueReceivableMutation as oe } from "../../data-access/dist/index8.js";
|
|
12
|
+
import { useMarkReceivablePaidMutation as se, useMarkReceivablePartiallyPaidMutation as ce, useMarkReceivableUncollectibleMutation as le } from "../../data-access/dist/index10.js";
|
|
13
|
+
import { useCancelRecurrenceMutation as ue, usePauseRecurrenceMutation as de, useResumeRecurrenceMutation as fe } from "../../data-access/dist/index12.js";
|
|
13
14
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import { useReceivableIssuePreflight as
|
|
15
|
-
import { useCallback as
|
|
15
|
+
import { useReceivableIssuePreflight as pe } from "./index16.js";
|
|
16
|
+
import { useCallback as m, useState as h } from "react";
|
|
16
17
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js
|
|
17
|
-
function
|
|
18
|
-
let
|
|
18
|
+
function g({ selectedReceivable: i, selectedRecurrence: g, messages: _, onCreated: v, onDeleted: y, onCompleteBeforeIssue: b }) {
|
|
19
|
+
let x = oe(), S = re(), C = p(), w = ne(), T = ie(), E = ae(), D = f(), O = se(), k = ce(), A = le(), j = de(), M = fe(), N = ue(), [P, F] = h(), [ge, I] = h(), [L, R] = h(), [z, B] = h(() => r(void 0, _)), [_e, V] = h({}), [H, U] = h(), [W, G] = h(() => n()), [ve, K] = h({}), q = j.mutate, J = M.mutate, Y = P?.issueCheck, X = pe({
|
|
19
20
|
counterpartId: Y?.counterpartId,
|
|
20
21
|
billingAddressId: Y?.billingAddressId,
|
|
21
22
|
billingCountry: Y?.billingCountry
|
|
22
|
-
}), Z = !!Y && X.isLoading,
|
|
23
|
-
let
|
|
24
|
-
id:
|
|
25
|
-
type:
|
|
26
|
-
title:
|
|
27
|
-
action:
|
|
28
|
-
},
|
|
29
|
-
if (
|
|
30
|
-
|
|
23
|
+
}), Z = !!Y && X.isLoading, ye = m((a, o, s) => {
|
|
24
|
+
let c = "documentLabel" in o ? o.documentLabel : o.title, l = {
|
|
25
|
+
id: o.id,
|
|
26
|
+
type: o.type,
|
|
27
|
+
title: c,
|
|
28
|
+
action: a
|
|
29
|
+
}, u = s === void 0 ? i : s ?? void 0;
|
|
30
|
+
if (a === "send") {
|
|
31
|
+
R(l), B(r(u, _)), V({});
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
let d = u?.type === "invoice" ? u.recurrence_id ?? void 0 : void 0;
|
|
35
|
+
if (a === "pauseRecurrence" || a === "resumeRecurrence") {
|
|
36
|
+
if (!d) return;
|
|
37
|
+
let n = a === "pauseRecurrence";
|
|
38
|
+
(n ? q : J)({
|
|
39
|
+
path: { recurrence_id: d },
|
|
40
|
+
receivableId: o.id
|
|
41
|
+
}, {
|
|
42
|
+
onSuccess: () => e.success(n ? _.recurrencePaused : _.recurrenceResumed),
|
|
43
|
+
onError: (n) => e.error(t(n) ?? _.genericError)
|
|
44
|
+
});
|
|
38
45
|
return;
|
|
39
46
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
if (a === "cancelRecurrence") {
|
|
48
|
+
if (!d || u?.type !== "invoice") return;
|
|
49
|
+
I(void 0), F({
|
|
50
|
+
...l,
|
|
51
|
+
recurrenceId: d,
|
|
52
|
+
description: me(u, g, _)
|
|
53
|
+
});
|
|
43
54
|
return;
|
|
44
55
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
if (a === "recordPayment") {
|
|
57
|
+
U({
|
|
58
|
+
...l,
|
|
59
|
+
currency: u?.currency
|
|
60
|
+
}), G(n()), K({});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let f = a === "issue" && u?.type === "invoice" ? u : void 0;
|
|
64
|
+
if (f && b && !ee(f, _)) {
|
|
65
|
+
b(f);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
I(void 0), F({
|
|
69
|
+
...l,
|
|
70
|
+
issueCheck: f ? {
|
|
71
|
+
counterpartId: f.counterpart_id,
|
|
72
|
+
billingAddressId: f.counterpart_billing_address?.id ?? void 0,
|
|
73
|
+
billingCountry: f.counterpart_billing_address?.country,
|
|
74
|
+
hasReminder: te(f)
|
|
52
75
|
} : void 0
|
|
53
76
|
});
|
|
54
77
|
}, [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
_,
|
|
79
|
+
b,
|
|
80
|
+
q,
|
|
81
|
+
J,
|
|
82
|
+
i,
|
|
83
|
+
g
|
|
84
|
+
]), be = m(() => {
|
|
85
|
+
F(void 0), I(void 0);
|
|
86
|
+
}, []), Q = m(() => {
|
|
87
|
+
R(void 0), V({});
|
|
88
|
+
}, []), $ = m(() => {
|
|
89
|
+
U(void 0), K({});
|
|
90
|
+
}, []), xe = m(async () => {
|
|
91
|
+
if (!P) return;
|
|
92
|
+
let n = { receivable_id: P.id };
|
|
93
|
+
if (P.issueCheck) {
|
|
68
94
|
if (Z) return;
|
|
69
|
-
let t = X.isTaxIdMissing ?
|
|
95
|
+
let t = X.isTaxIdMissing ? _.issueTaxIdRequired : P.issueCheck.hasReminder ? d(X.counterpart, _) : void 0;
|
|
70
96
|
if (t) {
|
|
71
|
-
e.error(t),
|
|
97
|
+
e.error(t), F(void 0);
|
|
72
98
|
return;
|
|
73
99
|
}
|
|
74
100
|
}
|
|
101
|
+
if (P.action === "cancelRecurrence") {
|
|
102
|
+
if (!P.recurrenceId) return;
|
|
103
|
+
try {
|
|
104
|
+
await N.mutateAsync({
|
|
105
|
+
path: { recurrence_id: P.recurrenceId },
|
|
106
|
+
receivableId: P.id
|
|
107
|
+
}), e.success(_.recurrenceCanceled), F(void 0);
|
|
108
|
+
} catch (n) {
|
|
109
|
+
e.error(t(n) ?? _.genericError);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
75
113
|
try {
|
|
76
|
-
if (
|
|
77
|
-
else if (
|
|
78
|
-
else if (
|
|
79
|
-
let e = await
|
|
80
|
-
e?.id &&
|
|
81
|
-
} else
|
|
114
|
+
if (P.action === "issue") await x.mutateAsync({ path: n });
|
|
115
|
+
else if (P.action === "cancel") await S.mutateAsync({ path: n });
|
|
116
|
+
else if (P.action === "clone") {
|
|
117
|
+
let e = await C.mutateAsync({ path: n });
|
|
118
|
+
e?.id && v?.(e.id, e.type);
|
|
119
|
+
} else P.action === "accept" ? await w.mutateAsync({ path: n }) : P.action === "decline" ? await T.mutateAsync({ path: n }) : P.action === "delete" ? (await E.mutateAsync({ path: n }), y?.(P.id)) : P.action === "markPaid" ? await O.mutateAsync({
|
|
82
120
|
path: n,
|
|
83
121
|
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
84
|
-
}) :
|
|
85
|
-
|
|
122
|
+
}) : P.action === "markUncollectible" && await A.mutateAsync({ path: n });
|
|
123
|
+
F(void 0), I(void 0);
|
|
86
124
|
} catch (e) {
|
|
87
|
-
|
|
125
|
+
I(t(e) ?? _.genericError);
|
|
88
126
|
}
|
|
89
127
|
}, [
|
|
90
|
-
|
|
91
|
-
|
|
128
|
+
w,
|
|
129
|
+
P,
|
|
130
|
+
S,
|
|
131
|
+
N,
|
|
132
|
+
C,
|
|
133
|
+
T,
|
|
92
134
|
E,
|
|
93
|
-
D,
|
|
94
|
-
k,
|
|
95
|
-
A,
|
|
96
135
|
Z,
|
|
97
|
-
T,
|
|
98
|
-
M,
|
|
99
136
|
x,
|
|
100
|
-
|
|
101
|
-
|
|
137
|
+
O,
|
|
138
|
+
_,
|
|
139
|
+
v,
|
|
140
|
+
y,
|
|
102
141
|
X.counterpart,
|
|
103
142
|
X.isTaxIdMissing,
|
|
104
|
-
|
|
105
|
-
]),
|
|
106
|
-
if (!
|
|
107
|
-
let e = u(
|
|
108
|
-
if (
|
|
109
|
-
|
|
143
|
+
A
|
|
144
|
+
]), Se = m(async () => {
|
|
145
|
+
if (!L) return;
|
|
146
|
+
let e = u(z, _);
|
|
147
|
+
if (s(e)) {
|
|
148
|
+
V(e);
|
|
110
149
|
return;
|
|
111
150
|
}
|
|
112
151
|
try {
|
|
113
|
-
await
|
|
114
|
-
path: { receivable_id:
|
|
152
|
+
await D.mutateAsync({
|
|
153
|
+
path: { receivable_id: L.id },
|
|
115
154
|
body: {
|
|
116
|
-
body_text:
|
|
117
|
-
subject_text:
|
|
155
|
+
body_text: z.body,
|
|
156
|
+
subject_text: z.subject,
|
|
118
157
|
recipients: {
|
|
119
|
-
to: c(
|
|
120
|
-
cc: c(
|
|
121
|
-
bcc: c(
|
|
158
|
+
to: c(z.to),
|
|
159
|
+
cc: c(z.cc),
|
|
160
|
+
bcc: c(z.bcc)
|
|
122
161
|
}
|
|
123
162
|
}
|
|
124
163
|
}), Q();
|
|
125
164
|
} catch (e) {
|
|
126
|
-
|
|
165
|
+
V({ form: t(e) ?? _.genericError });
|
|
127
166
|
}
|
|
128
167
|
}, [
|
|
129
168
|
Q,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
]),
|
|
135
|
-
if (!
|
|
136
|
-
let e = l(
|
|
137
|
-
if (
|
|
138
|
-
|
|
169
|
+
_,
|
|
170
|
+
D,
|
|
171
|
+
L,
|
|
172
|
+
z
|
|
173
|
+
]), Ce = m(async () => {
|
|
174
|
+
if (!H) return;
|
|
175
|
+
let e = l(W, _, H.currency);
|
|
176
|
+
if (o(e)) {
|
|
177
|
+
K(e);
|
|
139
178
|
return;
|
|
140
179
|
}
|
|
141
180
|
try {
|
|
142
|
-
let e = { receivable_id:
|
|
143
|
-
|
|
181
|
+
let e = { receivable_id: H.id }, t = W.paidAt ? new Date(W.paidAt).toISOString() : void 0;
|
|
182
|
+
W.mode === "full" ? await O.mutateAsync({
|
|
144
183
|
path: e,
|
|
145
184
|
body: {
|
|
146
|
-
comment:
|
|
185
|
+
comment: W.comment || void 0,
|
|
147
186
|
paid_at: t
|
|
148
187
|
}
|
|
149
|
-
}) : await
|
|
188
|
+
}) : await k.mutateAsync({
|
|
150
189
|
path: e,
|
|
151
190
|
body: {
|
|
152
|
-
amount_paid:
|
|
153
|
-
comment:
|
|
191
|
+
amount_paid: a(W.amountPaid, H.currency) ?? 0,
|
|
192
|
+
comment: W.comment || void 0
|
|
154
193
|
}
|
|
155
194
|
}), $();
|
|
156
195
|
} catch (e) {
|
|
157
|
-
|
|
196
|
+
K({ form: t(e) ?? _.genericError });
|
|
158
197
|
}
|
|
159
198
|
}, [
|
|
160
199
|
$,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
200
|
+
O,
|
|
201
|
+
_,
|
|
202
|
+
k,
|
|
203
|
+
H,
|
|
204
|
+
W
|
|
166
205
|
]);
|
|
167
206
|
return {
|
|
168
|
-
actionTarget:
|
|
169
|
-
actionDialog:
|
|
170
|
-
actionError:
|
|
171
|
-
actionInProgress: Z ||
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
207
|
+
actionTarget: P,
|
|
208
|
+
actionDialog: P ? he(P, _) : void 0,
|
|
209
|
+
actionError: ge,
|
|
210
|
+
actionInProgress: Z || x.isPending || S.isPending || C.isPending || w.isPending || T.isPending || E.isPending || O.isPending || A.isPending || N.isPending,
|
|
211
|
+
pendingActions: [...j.isPending ? ["pauseRecurrence"] : [], ...M.isPending ? ["resumeRecurrence"] : []],
|
|
212
|
+
openAction: ye,
|
|
213
|
+
closeAction: be,
|
|
214
|
+
confirmAction: xe,
|
|
215
|
+
sendOpen: !!L,
|
|
216
|
+
sendValues: z,
|
|
217
|
+
sendErrors: _e,
|
|
218
|
+
sendInProgress: D.isPending,
|
|
219
|
+
setSendValues: B,
|
|
180
220
|
closeSend: Q,
|
|
181
|
-
submitSend:
|
|
182
|
-
paymentOpen: !!
|
|
183
|
-
paymentValues:
|
|
184
|
-
paymentErrors:
|
|
185
|
-
paymentInProgress:
|
|
186
|
-
setPaymentValues:
|
|
221
|
+
submitSend: Se,
|
|
222
|
+
paymentOpen: !!H,
|
|
223
|
+
paymentValues: W,
|
|
224
|
+
paymentErrors: ve,
|
|
225
|
+
paymentInProgress: O.isPending || k.isPending,
|
|
226
|
+
setPaymentValues: G,
|
|
187
227
|
closePayment: $,
|
|
188
|
-
submitPayment:
|
|
228
|
+
submitPayment: Ce
|
|
189
229
|
};
|
|
190
230
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
231
|
+
function me(e, t, n) {
|
|
232
|
+
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length, a = i({
|
|
233
|
+
amount: e.total_amount_with_credit_notes * r,
|
|
234
|
+
currency: e.currency,
|
|
235
|
+
fallback: ""
|
|
236
|
+
});
|
|
237
|
+
return [
|
|
238
|
+
n.cancelRecurrenceQuestion,
|
|
239
|
+
n.cancelRecurrenceFutureIterations,
|
|
240
|
+
n.cancelRecurrenceTotal.replace("{count}", String(r)).replace("{invoices}", r === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}", a),
|
|
241
|
+
n.cancelRecurrenceIrreversible
|
|
242
|
+
].join("\n");
|
|
243
|
+
}
|
|
244
|
+
function he({ action: e, description: t }, n) {
|
|
245
|
+
return e === "cancelRecurrence" ? {
|
|
246
|
+
title: n.cancelRecurrenceTitle,
|
|
247
|
+
description: t ?? "",
|
|
248
|
+
confirmLabel: n.cancelRecurrenceConfirm,
|
|
249
|
+
cancelLabel: n.cancelRecurrenceClose,
|
|
250
|
+
destructive: !0
|
|
251
|
+
} : e === "issue" ? {
|
|
252
|
+
title: n.issueTitle,
|
|
253
|
+
description: n.issueDescription,
|
|
254
|
+
confirmLabel: n.issueConfirm
|
|
196
255
|
} : e === "accept" ? {
|
|
197
|
-
title:
|
|
198
|
-
description:
|
|
199
|
-
confirmLabel:
|
|
256
|
+
title: n.acceptTitle,
|
|
257
|
+
description: n.acceptDescription,
|
|
258
|
+
confirmLabel: n.acceptConfirm
|
|
200
259
|
} : e === "decline" ? {
|
|
201
|
-
title:
|
|
202
|
-
description:
|
|
203
|
-
confirmLabel:
|
|
260
|
+
title: n.declineTitle,
|
|
261
|
+
description: n.declineDescription,
|
|
262
|
+
confirmLabel: n.declineConfirm,
|
|
204
263
|
destructive: !0
|
|
205
264
|
} : e === "cancel" ? {
|
|
206
|
-
title:
|
|
207
|
-
description:
|
|
208
|
-
confirmLabel:
|
|
265
|
+
title: n.cancelTitle,
|
|
266
|
+
description: n.cancelDescription,
|
|
267
|
+
confirmLabel: n.cancelConfirm,
|
|
209
268
|
destructive: !0
|
|
210
269
|
} : e === "clone" ? {
|
|
211
|
-
title:
|
|
212
|
-
description:
|
|
213
|
-
confirmLabel:
|
|
270
|
+
title: n.cloneTitle,
|
|
271
|
+
description: n.cloneDescription,
|
|
272
|
+
confirmLabel: n.cloneConfirm
|
|
214
273
|
} : e === "delete" ? {
|
|
215
|
-
title:
|
|
216
|
-
description:
|
|
217
|
-
confirmLabel:
|
|
274
|
+
title: n.deleteTitle,
|
|
275
|
+
description: n.deleteDescription,
|
|
276
|
+
confirmLabel: n.deleteConfirm,
|
|
218
277
|
destructive: !0
|
|
219
278
|
} : e === "markPaid" ? {
|
|
220
|
-
title:
|
|
221
|
-
description:
|
|
222
|
-
confirmLabel:
|
|
279
|
+
title: n.markPaidTitle,
|
|
280
|
+
description: n.markPaidDescription,
|
|
281
|
+
confirmLabel: n.markPaidConfirm
|
|
223
282
|
} : {
|
|
224
|
-
title:
|
|
225
|
-
description:
|
|
226
|
-
confirmLabel:
|
|
283
|
+
title: n.markUncollectibleTitle,
|
|
284
|
+
description: n.markUncollectibleDescription,
|
|
285
|
+
confirmLabel: n.markUncollectibleConfirm,
|
|
227
286
|
destructive: !0
|
|
228
287
|
};
|
|
229
288
|
}
|
|
230
289
|
//#endregion
|
|
231
|
-
export {
|
|
290
|
+
export { g as useReceivableActions };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js
CHANGED
|
@@ -11,8 +11,8 @@ import { useCreateProductMutation as i } from "../../../shared/product-catalog/d
|
|
|
11
11
|
import { useMeasureUnits as a } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
12
12
|
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
13
13
|
import { getInlineItemPriceLabel as o, getIssueAttachments as s, getIssueSubject as c, getProductsStepTitle as l, inlineItemToProductRequest as u } from "./index8.js";
|
|
14
|
-
import { useSendReceivableEmailMutation as d } from "../../data-access/dist/
|
|
15
|
-
import { useReceivableQuery as f } from "../../data-access/dist/
|
|
14
|
+
import { useSendReceivableEmailMutation as d } from "../../data-access/dist/index7.js";
|
|
15
|
+
import { useReceivableQuery as f } from "../../data-access/dist/index11.js";
|
|
16
16
|
import "../../data-access/dist/index.js";
|
|
17
17
|
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
18
18
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
CHANGED
|
@@ -1,63 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "
|
|
1
|
+
import { RECEIVABLE_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index9.js";
|
|
2
|
+
import "../../ui/dist/index.js";
|
|
3
|
+
import { formatDate as t, formatMoney as n, getDocumentTypeLabel as r } from "./index13.js";
|
|
4
|
+
import { RECEIVABLE_MESSAGE_LABELS_EN as i } from "./index14.js";
|
|
4
5
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
accountNumber: "",
|
|
8
|
-
accountHolderName: "",
|
|
9
|
-
displayName: ""
|
|
10
|
-
};
|
|
11
|
-
function r(n) {
|
|
12
|
-
let r = new Set(n ?? []);
|
|
6
|
+
function a(e, i) {
|
|
7
|
+
let a = new Map(Object.entries(i));
|
|
13
8
|
return {
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
errors: o,
|
|
46
|
-
canCancel: e.length > 0,
|
|
47
|
-
isSaving: s
|
|
48
|
-
} : { kind: "restricted" };
|
|
49
|
-
}
|
|
50
|
-
function c(e, t) {
|
|
51
|
-
let n = {}, r = e.accountHolderName.trim(), i = e.accountNumber.trim(), a = e.routingNumber.trim();
|
|
52
|
-
return r ? r.length > 255 && (n.accountHolderName = t.bankAccountHolderNameTooLong) : n.accountHolderName = t.bankAccountHolderNameRequired, i ? /^\d+$/.test(i) ? i.length < 4 ? n.accountNumber = t.bankAccountNumberTooShort : i.length > 17 && (n.accountNumber = t.bankAccountNumberTooLong) : n.accountNumber = t.bankAccountNumberDigitsOnly : n.accountNumber = t.bankAccountNumberRequired, a ? /^\d{9}$/.test(a) || (n.routingNumber = t.bankAccountRoutingNumberInvalid) : n.routingNumber = t.bankAccountRoutingNumberRequired, e.displayName.length > 200 && (n.displayName = t.bankAccountNicknameTooLong), n;
|
|
53
|
-
}
|
|
54
|
-
function l(e) {
|
|
55
|
-
return {
|
|
56
|
-
display_name: e.displayName || void 0,
|
|
57
|
-
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
58
|
-
account_number: e.accountNumber.trim() || void 0,
|
|
59
|
-
routing_number: e.routingNumber.trim() || void 0
|
|
9
|
+
dateLabel: (e) => t(e, ""),
|
|
10
|
+
timeLabel: (e) => new Date(e).toLocaleTimeString(void 0, {
|
|
11
|
+
hour: "numeric",
|
|
12
|
+
minute: "2-digit",
|
|
13
|
+
timeZoneName: "short"
|
|
14
|
+
}),
|
|
15
|
+
byActor: (e, t) => `${e} by ${t}`,
|
|
16
|
+
documentTypeLabel: (t) => t === "unknown" ? "Document" : r(t, e),
|
|
17
|
+
statusLabel: (e) => a.get(e) ?? i.unknown,
|
|
18
|
+
formatAmount: (e, t) => n({
|
|
19
|
+
amount: e,
|
|
20
|
+
currency: t,
|
|
21
|
+
fallback: ""
|
|
22
|
+
}),
|
|
23
|
+
created: (e) => `${e} created`,
|
|
24
|
+
recurringSeriesCreated: "Recurring series created",
|
|
25
|
+
duplicatedFrom: (e) => `Duplicated from ${e}`,
|
|
26
|
+
documentUpdated: "Document updated",
|
|
27
|
+
statusUpdated: "Status updated",
|
|
28
|
+
changedTo: (e) => `Changed to ${e}`,
|
|
29
|
+
quoteExpired: "Quote expired",
|
|
30
|
+
paymentReceived: "Payment received",
|
|
31
|
+
received: (e) => `Received ${e}`,
|
|
32
|
+
sentToCustomer: (e) => `${e} sent to customer`,
|
|
33
|
+
sentToRecipients: (e, t) => `${e} sent to ${t}`,
|
|
34
|
+
sendFailed: (e) => `${e} could not be sent`,
|
|
35
|
+
paymentReminderSent: "Payment reminder sent",
|
|
36
|
+
overdueReminderSent: "Overdue reminder sent",
|
|
37
|
+
dueInDays: (e) => e === 0 ? "Payment is due today" : e === 1 ? "Payment is due in 1 day" : `Payment is due in ${e} days`,
|
|
38
|
+
daysOverdue: (e) => e === 1 ? "Payment is 1 day overdue" : `Payment is ${e} days overdue`,
|
|
39
|
+
draftDeleted: "Draft deleted"
|
|
60
40
|
};
|
|
61
41
|
}
|
|
42
|
+
a(i, e);
|
|
62
43
|
//#endregion
|
|
63
|
-
export {
|
|
44
|
+
export { a as buildReceivableAuditHistoryLabels };
|