@tesouro/embedded-components-react 0.5.267 → 0.5.270
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.css +4 -10
- package/dist/index.d.ts +13 -9
- package/dist/lib/ReceivablesWidget.d.ts +13 -9
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +44 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +97 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +76 -150
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +63 -57
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/actionsModal.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +161 -152
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +30 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +12 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +18 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +208 -158
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +91 -85
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +197 -196
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +147 -115
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +3 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +37 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +22 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +17 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +17 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +37 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +29 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +38 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +26 -28
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +20 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +8 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +34 -83
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +14 -404
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +28 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +79 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +490 -68
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +2 -502
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +41 -216
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +70 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +484 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +224 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +21 -263
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +261 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +2 -237
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +100 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +21 -242
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +226 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +3 -59
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +233 -178
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +85 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +60 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +194 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +45 -0
- 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/index45.js +0 -100
|
@@ -5,251 +5,301 @@
|
|
|
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 {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { getCounterpartEmail as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
9
|
+
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
10
|
+
import { defaultSendValues as r, formatMoney as i, hasSendErrors as a, isReceivableReadyToIssue as ee, splitEmailList as o, validateSendValues as s } from "./helpers.js";
|
|
11
|
+
import { getIssueReminderBlocker as c, hasSelectedReminder as l } from "./reminders.js";
|
|
12
|
+
import { useSendReceivableEmailMutation as u } from "../../../../data-access/dist/index8.js";
|
|
13
|
+
import { useAcceptReceivableMutation as d, useCancelReceivableMutation as f, useCloneReceivableMutation as p, useDeclineReceivableMutation as m, useDeleteReceivableMutation as te, useIssueReceivableMutation as ne } from "../../../../data-access/dist/index9.js";
|
|
12
14
|
import { useMarkReceivablePaidMutation as re, useMarkReceivableUncollectibleMutation as ie } from "../../../../data-access/dist/index11.js";
|
|
13
|
-
import { useCancelRecurrenceMutation as ae, usePauseRecurrenceMutation as
|
|
15
|
+
import { useCancelRecurrenceMutation as ae, usePauseRecurrenceMutation as oe, useResumeRecurrenceMutation as se } from "../../../../data-access/dist/index13.js";
|
|
14
16
|
import "../../../../data-access/dist/index.js";
|
|
15
|
-
import { useReceivableIssuePreflight as
|
|
16
|
-
import { useReceivablePaymentRecord as
|
|
17
|
-
import { useCallback as
|
|
17
|
+
import { useReceivableIssuePreflight as ce } from "./useReceivableIssuePreflight.js";
|
|
18
|
+
import { useReceivablePaymentRecord as le } from "./useReceivablePaymentRecord.js";
|
|
19
|
+
import { useCallback as h, useEffect as ue, useState as g } from "react";
|
|
18
20
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js
|
|
19
|
-
function
|
|
20
|
-
let w =
|
|
21
|
+
function _({ selectedReceivable: i, selectedRecurrence: _, messages: y, onCreated: b, onDeleted: x, onCompleteBeforeIssue: S, onIssuedForSend: C }) {
|
|
22
|
+
let w = ne(), T = f(), E = p(), D = d(), O = m(), k = te(), A = u(), j = re(), M = ie(), pe = oe(), N = se(), P = ae(), [F, I] = g(), [me, L] = g(), [R, z] = g(""), [B, V] = g(), [H, U] = g(() => r(void 0, y)), [he, W] = g({}), G = le({ messages: y }), K = G.open, q = pe.mutate, ge = E.mutate, _e = N.mutate, J = i?.type === "invoice" && i.status === "draft" ? i : void 0, [Y, ve] = g(), X = Y?.issueCheck ?? (J ? v(J) : void 0), Z = w.mutate, Q = ce({
|
|
21
23
|
counterpartId: X?.counterpartId,
|
|
22
24
|
billingAddressId: X?.billingAddressId,
|
|
23
25
|
billingCountry: X?.billingCountry
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
+
});
|
|
27
|
+
ue(() => {
|
|
28
|
+
if (!Y || Q.isLoading) return;
|
|
29
|
+
ve(void 0);
|
|
30
|
+
let t = Y.issueCheck ? Q.isTaxIdMissing ? y.issueTaxIdRequired : Y.issueCheck.hasReminder ? c(Q.counterpart, y) : void 0 : void 0;
|
|
31
|
+
if (t) {
|
|
32
|
+
e.error(t);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
Z({ path: { receivable_id: Y.id } }, {
|
|
36
|
+
onSuccess: () => e.success(y.issueSucceeded),
|
|
37
|
+
onError: () => e.error(y.issueFailed)
|
|
38
|
+
});
|
|
39
|
+
}, [
|
|
40
|
+
Z,
|
|
41
|
+
y,
|
|
42
|
+
Y,
|
|
43
|
+
Q.counterpart,
|
|
44
|
+
Q.isLoading,
|
|
45
|
+
Q.isTaxIdMissing
|
|
46
|
+
]);
|
|
47
|
+
let ye = h((a, o, s) => {
|
|
48
|
+
let u = "documentLabel" in o ? o.documentLabel : o.title, d = {
|
|
26
49
|
id: o.id,
|
|
27
50
|
type: o.type,
|
|
28
|
-
title:
|
|
29
|
-
action:
|
|
30
|
-
},
|
|
31
|
-
if (
|
|
32
|
-
|
|
51
|
+
title: u,
|
|
52
|
+
action: a
|
|
53
|
+
}, f = s === void 0 ? i : s ?? void 0;
|
|
54
|
+
if (a === "send") {
|
|
55
|
+
V(d), U(r(f, y)), W({});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (a === "issueAndSend") {
|
|
59
|
+
if (f?.type !== "invoice") return;
|
|
60
|
+
let t = f;
|
|
61
|
+
if (Q.isLoading) return;
|
|
62
|
+
if (!Q.counterpart || !n(Q.counterpart)) {
|
|
63
|
+
e.error(y.issueAndSendNoEmail);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (S && !ee(t, y)) {
|
|
67
|
+
S(t, "issueAndSend");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let r = Q.isTaxIdMissing ? y.issueTaxIdRequired : l(t) ? c(Q.counterpart, y) : void 0;
|
|
71
|
+
if (r) {
|
|
72
|
+
e.error(r);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
Z({ path: { receivable_id: t.id } }, {
|
|
76
|
+
onSuccess: () => {
|
|
77
|
+
e.success(y.issueSucceeded), C?.(t.id, t.counterpart_id);
|
|
78
|
+
},
|
|
79
|
+
onError: () => e.error(y.issueFailed)
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (a === "clone") {
|
|
84
|
+
ge({ path: { receivable_id: o.id } }, {
|
|
85
|
+
onSuccess: (t) => {
|
|
86
|
+
t?.id && b?.(t.id, t.type), e.success(y.cloneSuccess);
|
|
87
|
+
},
|
|
88
|
+
onError: (n) => e.error(t(n) ?? y.cloneError)
|
|
89
|
+
});
|
|
33
90
|
return;
|
|
34
91
|
}
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
37
|
-
if (!
|
|
38
|
-
let n =
|
|
39
|
-
(n ?
|
|
40
|
-
path: { recurrence_id:
|
|
92
|
+
let p = f?.type === "invoice" ? f.recurrence_id ?? void 0 : void 0;
|
|
93
|
+
if (a === "pauseRecurrence" || a === "resumeRecurrence") {
|
|
94
|
+
if (!p) return;
|
|
95
|
+
let n = a === "pauseRecurrence";
|
|
96
|
+
(n ? q : _e)({
|
|
97
|
+
path: { recurrence_id: p },
|
|
41
98
|
receivableId: o.id
|
|
42
99
|
}, {
|
|
43
|
-
onSuccess: () => e.success(n ?
|
|
44
|
-
onError: (n) => e.error(t(n) ??
|
|
100
|
+
onSuccess: () => e.success(n ? y.recurrencePaused : y.recurrenceResumed),
|
|
101
|
+
onError: (n) => e.error(t(n) ?? y.genericError)
|
|
45
102
|
});
|
|
46
103
|
return;
|
|
47
104
|
}
|
|
48
|
-
if (
|
|
49
|
-
if (!
|
|
50
|
-
|
|
51
|
-
...
|
|
52
|
-
recurrenceId:
|
|
53
|
-
description:
|
|
105
|
+
if (a === "cancelRecurrence") {
|
|
106
|
+
if (!p || f?.type !== "invoice") return;
|
|
107
|
+
L(void 0), I({
|
|
108
|
+
...d,
|
|
109
|
+
recurrenceId: p,
|
|
110
|
+
description: de(f, _, y)
|
|
54
111
|
});
|
|
55
112
|
return;
|
|
56
113
|
}
|
|
57
|
-
if (
|
|
58
|
-
|
|
114
|
+
if (a === "recordPayment") {
|
|
115
|
+
f?.type === "invoice" && K(f);
|
|
59
116
|
return;
|
|
60
117
|
}
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
|
|
118
|
+
let m = a === "issue" && f?.type === "invoice" ? f : void 0;
|
|
119
|
+
if (m && S && !ee(m, y)) {
|
|
120
|
+
S(m, "issue");
|
|
64
121
|
return;
|
|
65
122
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
123
|
+
if (a === "issue") {
|
|
124
|
+
ve({
|
|
125
|
+
id: o.id,
|
|
126
|
+
issueCheck: m ? v(m) : void 0
|
|
127
|
+
});
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
L(void 0), z(""), I(d);
|
|
75
131
|
}, [
|
|
132
|
+
ge,
|
|
133
|
+
Z,
|
|
134
|
+
y,
|
|
135
|
+
S,
|
|
76
136
|
b,
|
|
77
137
|
C,
|
|
138
|
+
K,
|
|
139
|
+
Q.counterpart,
|
|
140
|
+
Q.isLoading,
|
|
141
|
+
Q.isTaxIdMissing,
|
|
78
142
|
q,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (Q) return;
|
|
92
|
-
let t = Z.isTaxIdMissing ? b.issueTaxIdRequired : I.issueCheck.hasReminder ? c(Z.counterpart, b) : void 0;
|
|
93
|
-
if (t) {
|
|
94
|
-
e.error(t), L(void 0);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (I.action === "cancelRecurrence") {
|
|
99
|
-
if (!I.recurrenceId) return;
|
|
143
|
+
_e,
|
|
144
|
+
i,
|
|
145
|
+
_
|
|
146
|
+
]), be = h(() => {
|
|
147
|
+
I(void 0), L(void 0);
|
|
148
|
+
}, []), $ = h(() => {
|
|
149
|
+
V(void 0), W({});
|
|
150
|
+
}, []), xe = h(async () => {
|
|
151
|
+
if (!F) return;
|
|
152
|
+
let n = { receivable_id: F.id };
|
|
153
|
+
if (F.action === "cancelRecurrence") {
|
|
154
|
+
if (!F.recurrenceId) return;
|
|
100
155
|
try {
|
|
101
|
-
await
|
|
102
|
-
path: { recurrence_id:
|
|
103
|
-
receivableId:
|
|
104
|
-
}), e.success(
|
|
156
|
+
await P.mutateAsync({
|
|
157
|
+
path: { recurrence_id: F.recurrenceId },
|
|
158
|
+
receivableId: F.id
|
|
159
|
+
}), e.success(y.recurrenceCanceled), I(void 0);
|
|
105
160
|
} catch (n) {
|
|
106
|
-
e.error(t(n) ??
|
|
161
|
+
e.error(t(n) ?? y.genericError);
|
|
107
162
|
}
|
|
108
163
|
return;
|
|
109
164
|
}
|
|
110
165
|
try {
|
|
111
|
-
|
|
112
|
-
else if (I.action === "cancel") await T.mutateAsync({ path: n });
|
|
113
|
-
else if (I.action === "clone") {
|
|
114
|
-
let e = await E.mutateAsync({ path: n });
|
|
115
|
-
e?.id && x?.(e.id, e.type);
|
|
116
|
-
} else I.action === "accept" ? await D.mutateAsync({ path: n }) : I.action === "decline" ? await O.mutateAsync({ path: n }) : I.action === "delete" ? (await k.mutateAsync({ path: n }), S?.(I.id)) : I.action === "markPaid" ? await j.mutateAsync({
|
|
166
|
+
F.action === "cancel" ? await T.mutateAsync({ path: n }) : F.action === "accept" ? await D.mutateAsync({ path: n }) : F.action === "decline" ? await O.mutateAsync({ path: n }) : F.action === "delete" ? (await k.mutateAsync({ path: n }), x?.(F.id)) : F.action === "markPaid" ? await j.mutateAsync({
|
|
117
167
|
path: n,
|
|
118
168
|
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
119
|
-
}) :
|
|
169
|
+
}) : F.action === "markUncollectible" && await M.mutateAsync({
|
|
120
170
|
path: n,
|
|
121
|
-
body: { comment:
|
|
122
|
-
});
|
|
123
|
-
L(void 0), R(void 0);
|
|
171
|
+
body: { comment: R.trim() || void 0 }
|
|
172
|
+
}), I(void 0), L(void 0);
|
|
124
173
|
} catch (e) {
|
|
125
|
-
|
|
174
|
+
L(t(e) ?? y.genericError);
|
|
126
175
|
}
|
|
127
176
|
}, [
|
|
128
177
|
D,
|
|
129
|
-
|
|
130
|
-
I,
|
|
131
|
-
T,
|
|
178
|
+
R,
|
|
132
179
|
F,
|
|
133
|
-
|
|
180
|
+
T,
|
|
181
|
+
P,
|
|
134
182
|
O,
|
|
135
183
|
k,
|
|
136
|
-
Q,
|
|
137
|
-
w,
|
|
138
184
|
j,
|
|
139
|
-
|
|
185
|
+
y,
|
|
140
186
|
x,
|
|
141
|
-
S,
|
|
142
|
-
Z.counterpart,
|
|
143
|
-
Z.isTaxIdMissing,
|
|
144
187
|
M
|
|
145
|
-
]),
|
|
146
|
-
if (!
|
|
147
|
-
let e = s(
|
|
148
|
-
if (
|
|
149
|
-
|
|
188
|
+
]), Se = h(async () => {
|
|
189
|
+
if (!B) return;
|
|
190
|
+
let e = s(H, y);
|
|
191
|
+
if (a(e)) {
|
|
192
|
+
W(e);
|
|
150
193
|
return;
|
|
151
194
|
}
|
|
152
195
|
try {
|
|
153
196
|
await A.mutateAsync({
|
|
154
|
-
path: { receivable_id:
|
|
197
|
+
path: { receivable_id: B.id },
|
|
155
198
|
body: {
|
|
156
|
-
body_text:
|
|
157
|
-
subject_text:
|
|
199
|
+
body_text: H.body,
|
|
200
|
+
subject_text: H.subject,
|
|
158
201
|
recipients: {
|
|
159
|
-
to: o(
|
|
160
|
-
cc: o(
|
|
161
|
-
bcc: o(
|
|
202
|
+
to: o(H.to),
|
|
203
|
+
cc: o(H.cc),
|
|
204
|
+
bcc: o(H.bcc)
|
|
162
205
|
}
|
|
163
206
|
}
|
|
164
207
|
}), $();
|
|
165
208
|
} catch (e) {
|
|
166
|
-
|
|
209
|
+
W({ form: t(e) ?? y.genericError });
|
|
167
210
|
}
|
|
168
211
|
}, [
|
|
169
212
|
$,
|
|
170
|
-
|
|
213
|
+
y,
|
|
171
214
|
A,
|
|
172
|
-
|
|
173
|
-
|
|
215
|
+
B,
|
|
216
|
+
H
|
|
174
217
|
]);
|
|
175
218
|
return {
|
|
176
|
-
actionTarget:
|
|
177
|
-
actionDialog:
|
|
178
|
-
actionError:
|
|
179
|
-
actionComment:
|
|
180
|
-
setActionComment:
|
|
181
|
-
actionInProgress:
|
|
182
|
-
pendingActions: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
219
|
+
actionTarget: F,
|
|
220
|
+
actionDialog: F ? fe(F, y) : void 0,
|
|
221
|
+
actionError: me,
|
|
222
|
+
actionComment: F?.action === "markUncollectible" ? R : void 0,
|
|
223
|
+
setActionComment: z,
|
|
224
|
+
actionInProgress: w.isPending || T.isPending || D.isPending || O.isPending || k.isPending || j.isPending || M.isPending || P.isPending,
|
|
225
|
+
pendingActions: [
|
|
226
|
+
...pe.isPending ? ["pauseRecurrence"] : [],
|
|
227
|
+
...N.isPending ? ["resumeRecurrence"] : [],
|
|
228
|
+
...E.isPending ? ["clone"] : [],
|
|
229
|
+
...w.isPending || Y || J && Q.isLoading ? ["issue", "issueAndSend"] : []
|
|
230
|
+
],
|
|
231
|
+
openAction: ye,
|
|
232
|
+
closeAction: be,
|
|
233
|
+
confirmAction: xe,
|
|
234
|
+
sendOpen: !!B,
|
|
235
|
+
sendValues: H,
|
|
236
|
+
sendErrors: he,
|
|
189
237
|
sendInProgress: A.isPending,
|
|
190
|
-
setSendValues:
|
|
238
|
+
setSendValues: U,
|
|
191
239
|
closeSend: $,
|
|
192
|
-
submitSend:
|
|
193
|
-
payment:
|
|
240
|
+
submitSend: Se,
|
|
241
|
+
payment: G
|
|
194
242
|
};
|
|
195
243
|
}
|
|
196
|
-
function
|
|
197
|
-
let
|
|
198
|
-
amount: e.total_amount_with_credit_notes *
|
|
244
|
+
function de(e, t, n) {
|
|
245
|
+
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length, a = i({
|
|
246
|
+
amount: e.total_amount_with_credit_notes * r,
|
|
199
247
|
currency: e.currency,
|
|
200
248
|
fallback: ""
|
|
201
249
|
});
|
|
202
250
|
return [
|
|
203
251
|
n.cancelRecurrenceQuestion,
|
|
204
252
|
n.cancelRecurrenceFutureIterations,
|
|
205
|
-
n.cancelRecurrenceTotal.replace("{count}", String(
|
|
253
|
+
n.cancelRecurrenceTotal.replace("{count}", String(r)).replace("{invoices}", r === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}", a),
|
|
206
254
|
n.cancelRecurrenceIrreversible
|
|
207
255
|
].join("\n");
|
|
208
256
|
}
|
|
209
|
-
function
|
|
257
|
+
function v(e) {
|
|
258
|
+
return {
|
|
259
|
+
counterpartId: e.counterpart_id,
|
|
260
|
+
billingAddressId: e.counterpart_billing_address?.id ?? void 0,
|
|
261
|
+
billingCountry: e.counterpart_billing_address?.country,
|
|
262
|
+
hasReminder: l(e)
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function fe({ action: e, description: t, title: n }, r) {
|
|
210
266
|
return e === "cancelRecurrence" ? {
|
|
211
|
-
title:
|
|
267
|
+
title: r.cancelRecurrenceTitle,
|
|
212
268
|
description: t ?? "",
|
|
213
|
-
confirmLabel:
|
|
214
|
-
cancelLabel:
|
|
269
|
+
confirmLabel: r.cancelRecurrenceConfirm,
|
|
270
|
+
cancelLabel: r.cancelRecurrenceClose,
|
|
215
271
|
destructive: !0
|
|
216
|
-
} : e === "issue" ? {
|
|
217
|
-
title: n.issueTitle,
|
|
218
|
-
description: n.issueDescription,
|
|
219
|
-
confirmLabel: n.issueConfirm
|
|
220
272
|
} : e === "accept" ? {
|
|
221
|
-
title:
|
|
222
|
-
description:
|
|
223
|
-
confirmLabel:
|
|
273
|
+
title: r.acceptTitle,
|
|
274
|
+
description: r.acceptDescription,
|
|
275
|
+
confirmLabel: r.acceptConfirm
|
|
224
276
|
} : e === "decline" ? {
|
|
225
|
-
title:
|
|
226
|
-
description:
|
|
227
|
-
confirmLabel:
|
|
277
|
+
title: r.declineTitle,
|
|
278
|
+
description: r.declineDescription,
|
|
279
|
+
confirmLabel: r.declineConfirm,
|
|
228
280
|
destructive: !0
|
|
229
281
|
} : e === "cancel" ? {
|
|
230
|
-
title: n.cancelTitle,
|
|
231
|
-
description:
|
|
232
|
-
confirmLabel:
|
|
282
|
+
title: n && n !== r.untitledDocument ? r.cancelNumberedTitle.replace("{number}", n) : r.cancelTitle,
|
|
283
|
+
description: r.cancelDescription,
|
|
284
|
+
confirmLabel: r.cancelConfirm,
|
|
285
|
+
cancelLabel: r.cancelClose,
|
|
286
|
+
cancelVariant: "outline",
|
|
233
287
|
destructive: !0
|
|
234
|
-
} : e === "clone" ? {
|
|
235
|
-
title: n.cloneTitle,
|
|
236
|
-
description: n.cloneDescription,
|
|
237
|
-
confirmLabel: n.cloneConfirm
|
|
238
288
|
} : e === "delete" ? {
|
|
239
|
-
title:
|
|
240
|
-
description:
|
|
241
|
-
confirmLabel:
|
|
289
|
+
title: r.deleteTitle,
|
|
290
|
+
description: r.deleteDescription,
|
|
291
|
+
confirmLabel: r.deleteConfirm,
|
|
242
292
|
destructive: !0
|
|
243
293
|
} : e === "markPaid" ? {
|
|
244
|
-
title:
|
|
245
|
-
description:
|
|
246
|
-
confirmLabel:
|
|
294
|
+
title: r.markPaidTitle,
|
|
295
|
+
description: r.markPaidDescription,
|
|
296
|
+
confirmLabel: r.markPaidConfirm
|
|
247
297
|
} : {
|
|
248
|
-
title:
|
|
249
|
-
description:
|
|
250
|
-
confirmLabel:
|
|
298
|
+
title: r.markUncollectibleTitle,
|
|
299
|
+
description: r.markUncollectibleDescription,
|
|
300
|
+
confirmLabel: r.markUncollectibleConfirm,
|
|
251
301
|
cancelVariant: "outline"
|
|
252
302
|
};
|
|
253
303
|
}
|
|
254
304
|
//#endregion
|
|
255
|
-
export {
|
|
305
|
+
export { _ as useReceivableActions };
|