@tesouro/embedded-components-react 0.5.204 → 0.5.206
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 +49 -4
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +49 -4
- 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/index10.js +88 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +184 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +150 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +37 -293
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +58 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +86 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +48 -233
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +336 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +270 -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 +95 -394
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +422 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +15 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +94 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +24 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +3 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +3 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +16 -421
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +1 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +4 -93
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +11 -343
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +5 -159
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +264 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +401 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +106 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +182 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +27 -154
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +203 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +161 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +16 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +25 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -17
- 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/index10.js
CHANGED
|
@@ -1,195 +1,90 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { extractApiErrorMessage as e } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
6
|
-
import { defaultPaymentValues as t, defaultSendValues as n, fromMajorUnits as r, hasPaymentErrors as i, hasSendErrors as a, splitEmailList as o, validatePaymentValues as s, validateSendValues as c } from "./index8.js";
|
|
7
|
-
import { useSendReceivableEmailMutation as l } from "../../data-access/dist/index5.js";
|
|
8
|
-
import { useAcceptReceivableMutation as ee, useCancelReceivableMutation as te, useCloneReceivableMutation as u, useDeclineReceivableMutation as d, useDeleteReceivableMutation as f, useIssueReceivableMutation as p } from "../../data-access/dist/index6.js";
|
|
9
|
-
import { useMarkReceivablePaidMutation as m, useMarkReceivablePartiallyPaidMutation as h, useMarkReceivableUncollectibleMutation as g } from "../../data-access/dist/index8.js";
|
|
10
|
-
import "../../data-access/dist/index.js";
|
|
11
|
-
import { useCallback as _, useState as v } from "react";
|
|
12
1
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
let t = s(K, x, W.currency);
|
|
101
|
-
if (i(t)) {
|
|
102
|
-
Y(t);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
let e = { receivable_id: W.id }, t = K.paidAt ? new Date(K.paidAt).toISOString() : void 0;
|
|
107
|
-
K.mode === "full" ? await j.mutateAsync({
|
|
108
|
-
path: e,
|
|
109
|
-
body: {
|
|
110
|
-
comment: K.comment || void 0,
|
|
111
|
-
paid_at: t
|
|
112
|
-
}
|
|
113
|
-
}) : await M.mutateAsync({
|
|
114
|
-
path: e,
|
|
115
|
-
body: {
|
|
116
|
-
amount_paid: r(K.amountPaid, W.currency) ?? 0,
|
|
117
|
-
comment: K.comment || void 0
|
|
118
|
-
}
|
|
119
|
-
}), $();
|
|
120
|
-
} catch (t) {
|
|
121
|
-
Y({ form: e(t) ?? x.genericError });
|
|
122
|
-
}
|
|
123
|
-
}, [
|
|
124
|
-
$,
|
|
125
|
-
j,
|
|
126
|
-
x,
|
|
127
|
-
M,
|
|
128
|
-
W,
|
|
129
|
-
K
|
|
130
|
-
]);
|
|
131
|
-
return {
|
|
132
|
-
actionTarget: P,
|
|
133
|
-
actionDialog: P ? b(P.action, x) : void 0,
|
|
134
|
-
actionError: I,
|
|
135
|
-
actionInProgress: w.isPending || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || j.isPending || N.isPending,
|
|
136
|
-
openAction: X,
|
|
137
|
-
closeAction: Z,
|
|
138
|
-
confirmAction: ne,
|
|
139
|
-
sendOpen: !!R,
|
|
140
|
-
sendValues: B,
|
|
141
|
-
sendErrors: H,
|
|
142
|
-
sendInProgress: A.isPending,
|
|
143
|
-
setSendValues: V,
|
|
144
|
-
closeSend: Q,
|
|
145
|
-
submitSend: re,
|
|
146
|
-
paymentOpen: !!W,
|
|
147
|
-
paymentValues: K,
|
|
148
|
-
paymentErrors: J,
|
|
149
|
-
paymentInProgress: j.isPending || M.isPending,
|
|
150
|
-
setPaymentValues: q,
|
|
151
|
-
closePayment: $,
|
|
152
|
-
submitPayment: ie
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function b(e, t) {
|
|
156
|
-
return e === "issue" ? {
|
|
157
|
-
title: t.issueTitle,
|
|
158
|
-
description: t.issueDescription,
|
|
159
|
-
confirmLabel: t.issueConfirm
|
|
160
|
-
} : e === "accept" ? {
|
|
161
|
-
title: t.acceptTitle,
|
|
162
|
-
description: t.acceptDescription,
|
|
163
|
-
confirmLabel: t.acceptConfirm
|
|
164
|
-
} : e === "decline" ? {
|
|
165
|
-
title: t.declineTitle,
|
|
166
|
-
description: t.declineDescription,
|
|
167
|
-
confirmLabel: t.declineConfirm,
|
|
168
|
-
destructive: !0
|
|
169
|
-
} : e === "cancel" ? {
|
|
170
|
-
title: t.cancelTitle,
|
|
171
|
-
description: t.cancelDescription,
|
|
172
|
-
confirmLabel: t.cancelConfirm,
|
|
173
|
-
destructive: !0
|
|
174
|
-
} : e === "clone" ? {
|
|
175
|
-
title: t.cloneTitle,
|
|
176
|
-
description: t.cloneDescription,
|
|
177
|
-
confirmLabel: t.cloneConfirm
|
|
178
|
-
} : e === "delete" ? {
|
|
179
|
-
title: t.deleteTitle,
|
|
180
|
-
description: t.deleteDescription,
|
|
181
|
-
confirmLabel: t.deleteConfirm,
|
|
182
|
-
destructive: !0
|
|
183
|
-
} : e === "markPaid" ? {
|
|
184
|
-
title: t.markPaidTitle,
|
|
185
|
-
description: t.markPaidDescription,
|
|
186
|
-
confirmLabel: t.markPaidConfirm
|
|
187
|
-
} : {
|
|
188
|
-
title: t.markUncollectibleTitle,
|
|
189
|
-
description: t.markUncollectibleDescription,
|
|
190
|
-
confirmLabel: t.markUncollectibleConfirm,
|
|
191
|
-
destructive: !0
|
|
192
|
-
};
|
|
193
|
-
}
|
|
2
|
+
var e = {
|
|
3
|
+
customerRequired: "Customer is required",
|
|
4
|
+
customerAddressRequired: "The selected customer needs a billing address before a receivable can be created.",
|
|
5
|
+
currencyRequired: "Currency is required",
|
|
6
|
+
lineItemNameTooLong: "Product name must be 100 characters or less",
|
|
7
|
+
lineItemPriceTooHigh: "Price must be {maxAmount} or less",
|
|
8
|
+
sendToRequired: "Enter at least one recipient",
|
|
9
|
+
sendSubjectRequired: "Subject is required",
|
|
10
|
+
sendBodyRequired: "Message is required",
|
|
11
|
+
paymentAmountInvalid: "Amount paid must be greater than 0",
|
|
12
|
+
genericError: "Something went wrong. Please try again.",
|
|
13
|
+
lineItemsLoading: "Please wait for invoice details to finish loading.",
|
|
14
|
+
paymentTermsCustomDatePlaceholder: "Mon DD, YYYY",
|
|
15
|
+
bankAccountFallbackName: "Bank Account",
|
|
16
|
+
bankAccountPoweredBy: "Powered by {embeddedBankName}",
|
|
17
|
+
bankAccountLinked: "Linked account",
|
|
18
|
+
bankAccountHolderNameRequired: "Account holder name is required",
|
|
19
|
+
bankAccountHolderNameTooLong: "Account holder name must be 255 characters or less",
|
|
20
|
+
bankAccountNumberRequired: "Account number is required",
|
|
21
|
+
bankAccountNumberDigitsOnly: "Account number must contain only digits",
|
|
22
|
+
bankAccountNumberTooShort: "Account number must be at least 4 digits",
|
|
23
|
+
bankAccountNumberTooLong: "Account number must be at most 17 digits",
|
|
24
|
+
bankAccountRoutingNumberRequired: "Routing number is required",
|
|
25
|
+
bankAccountRoutingNumberInvalid: "Routing number must be 9 digits",
|
|
26
|
+
bankAccountNicknameTooLong: "Display name must be 200 characters or less",
|
|
27
|
+
bankAccountCreated: "Bank Account \"{name}\" has been created.",
|
|
28
|
+
bankAccountCreateFailed: "Failed to create Bank Account.",
|
|
29
|
+
untitledDocument: "Untitled document",
|
|
30
|
+
unknownCustomer: "Unknown customer",
|
|
31
|
+
notAvailable: "Not available",
|
|
32
|
+
invoiceType: "Invoice",
|
|
33
|
+
quoteType: "Quote",
|
|
34
|
+
creditNoteType: "Credit note",
|
|
35
|
+
summaryDocumentType: "Document type",
|
|
36
|
+
summaryDocumentNumber: "Document number",
|
|
37
|
+
summaryCustomer: "Customer",
|
|
38
|
+
summaryIssued: "Issued",
|
|
39
|
+
summaryDue: "Due",
|
|
40
|
+
summaryCreated: "Created",
|
|
41
|
+
summaryUpdated: "Updated",
|
|
42
|
+
summaryTotal: "Total",
|
|
43
|
+
summaryAmountDue: "Amount due",
|
|
44
|
+
activityStatusChanged: "Status changed",
|
|
45
|
+
activityReceivableCreated: "Receivable created",
|
|
46
|
+
activityReceivableUpdated: "Receivable updated",
|
|
47
|
+
activityPaymentReceived: "Payment received",
|
|
48
|
+
activityMailSent: "Email sent",
|
|
49
|
+
activityUnknown: "Activity",
|
|
50
|
+
recipientsNone: "No recipients",
|
|
51
|
+
sendSubjectDefault: "Your receivable document",
|
|
52
|
+
sendBodyDefault: "Please find the receivable document attached.",
|
|
53
|
+
issueTitle: "Issue receivable?",
|
|
54
|
+
issueDescription: "Issuing locks the document and makes it ready to send to the customer.",
|
|
55
|
+
issueConfirm: "Issue",
|
|
56
|
+
acceptTitle: "Accept quote?",
|
|
57
|
+
acceptDescription: "This marks the quote as accepted.",
|
|
58
|
+
acceptConfirm: "Accept",
|
|
59
|
+
declineTitle: "Decline quote?",
|
|
60
|
+
declineDescription: "This marks the quote as declined.",
|
|
61
|
+
declineConfirm: "Decline",
|
|
62
|
+
cancelTitle: "Cancel receivable?",
|
|
63
|
+
cancelDescription: "This cancels the document. You cannot undo this action.",
|
|
64
|
+
cancelConfirm: "Cancel document",
|
|
65
|
+
cloneTitle: "Clone receivable?",
|
|
66
|
+
cloneDescription: "This creates a new draft based on the selected document.",
|
|
67
|
+
cloneConfirm: "Clone",
|
|
68
|
+
deleteTitle: "Delete draft?",
|
|
69
|
+
deleteDescription: "This permanently deletes the draft document. You cannot undo this action.",
|
|
70
|
+
deleteConfirm: "Delete",
|
|
71
|
+
markPaidTitle: "Mark invoice as paid?",
|
|
72
|
+
markPaidDescription: "This records the invoice as fully paid.",
|
|
73
|
+
markPaidConfirm: "Mark paid",
|
|
74
|
+
markUncollectibleTitle: "Mark invoice uncollectible?",
|
|
75
|
+
markUncollectibleDescription: "This records the invoice as uncollectible. You cannot undo this action.",
|
|
76
|
+
markUncollectibleConfirm: "Mark uncollectible",
|
|
77
|
+
attachmentsEmailCaption: "Selected files will be attached to the invoice email sent to the customer.",
|
|
78
|
+
attachmentsRecurringEmailCaption: "Selected files will be attached to every invoice email in the recurring series.",
|
|
79
|
+
attachmentIncludeInEmail: "Include in email:",
|
|
80
|
+
attachmentRemove: "Remove",
|
|
81
|
+
attachmentUploading: "Uploading…",
|
|
82
|
+
attachmentUploadFailed: "Upload failed. Please try again.",
|
|
83
|
+
attachmentTooLarge: "File too large (max 3 MB)",
|
|
84
|
+
attachmentUnsupportedType: "File type not supported. Use PDF, DOC, JPG or PNG",
|
|
85
|
+
attachmentsCountLimit: "You can attach up to 10 files.",
|
|
86
|
+
attachmentIncludedInEmail: "Included in email",
|
|
87
|
+
attachmentNotIncludedInEmail: "Not included in email"
|
|
88
|
+
};
|
|
194
89
|
//#endregion
|
|
195
|
-
export {
|
|
90
|
+
export { e as RECEIVABLE_MESSAGE_LABELS_EN };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
CHANGED
|
@@ -2,41 +2,194 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { extractApiErrorMessage as e } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
6
|
+
import { defaultPaymentValues as t, defaultSendValues as n, fromMajorUnits as r, hasPaymentErrors as i, hasSendErrors as a, splitEmailList as o, validatePaymentValues as s, validateSendValues as c } from "./index9.js";
|
|
7
|
+
import { useSendReceivableEmailMutation as l } from "../../data-access/dist/index5.js";
|
|
8
|
+
import { useAcceptReceivableMutation as ee, useCancelReceivableMutation as te, useCloneReceivableMutation as u, useDeclineReceivableMutation as d, useDeleteReceivableMutation as f, useIssueReceivableMutation as p } from "../../data-access/dist/index6.js";
|
|
9
|
+
import { useMarkReceivablePaidMutation as m, useMarkReceivablePartiallyPaidMutation as h, useMarkReceivableUncollectibleMutation as g } from "../../data-access/dist/index8.js";
|
|
7
10
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import {
|
|
11
|
+
import { useCallback as _, useState as v } from "react";
|
|
9
12
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
|
|
10
|
-
function
|
|
11
|
-
let l =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
function y({ selectedReceivable: y, messages: x, onCreated: S, onDeleted: C }) {
|
|
14
|
+
let w = p(), T = te(), E = u(), D = ee(), O = d(), k = f(), A = l(), j = m(), M = h(), N = g(), [P, F] = v(), [I, L] = v(), [R, z] = v(), [B, V] = v(() => n(void 0, x)), [H, U] = v({}), [W, G] = v(), [K, q] = v(() => t()), [J, Y] = v({}), X = _((e, r, i) => {
|
|
15
|
+
let a = "documentLabel" in r ? r.documentLabel : r.title, o = {
|
|
16
|
+
id: r.id,
|
|
17
|
+
type: r.type,
|
|
18
|
+
title: a,
|
|
19
|
+
action: e
|
|
20
|
+
}, s = i === void 0 ? y : i ?? void 0;
|
|
21
|
+
if (e === "send") {
|
|
22
|
+
z(o), V(n(s, x)), U({});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (e === "recordPayment") {
|
|
26
|
+
G({
|
|
27
|
+
...o,
|
|
28
|
+
currency: s?.currency
|
|
29
|
+
}), q(t()), Y({});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
L(void 0), F(o);
|
|
33
|
+
}, [x, y]), Z = _(() => {
|
|
34
|
+
F(void 0), L(void 0);
|
|
35
|
+
}, []), Q = _(() => {
|
|
36
|
+
z(void 0), U({});
|
|
37
|
+
}, []), $ = _(() => {
|
|
38
|
+
G(void 0), Y({});
|
|
39
|
+
}, []), ne = _(async () => {
|
|
40
|
+
if (!P) return;
|
|
41
|
+
let t = { receivable_id: P.id };
|
|
42
|
+
try {
|
|
43
|
+
if (P.action === "issue") await w.mutateAsync({ path: t });
|
|
44
|
+
else if (P.action === "cancel") await T.mutateAsync({ path: t });
|
|
45
|
+
else if (P.action === "clone") {
|
|
46
|
+
let e = await E.mutateAsync({ path: t });
|
|
47
|
+
e?.id && S?.(e.id, e.type);
|
|
48
|
+
} else P.action === "accept" ? await D.mutateAsync({ path: t }) : P.action === "decline" ? await O.mutateAsync({ path: t }) : P.action === "delete" ? (await k.mutateAsync({ path: t }), C?.(P.id)) : P.action === "markPaid" ? await j.mutateAsync({
|
|
49
|
+
path: t,
|
|
50
|
+
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
51
|
+
}) : P.action === "markUncollectible" && await N.mutateAsync({ path: t });
|
|
52
|
+
F(void 0), L(void 0);
|
|
53
|
+
} catch (t) {
|
|
54
|
+
L(e(t) ?? x.genericError);
|
|
55
|
+
}
|
|
56
|
+
}, [
|
|
57
|
+
D,
|
|
58
|
+
P,
|
|
59
|
+
T,
|
|
60
|
+
E,
|
|
61
|
+
O,
|
|
62
|
+
k,
|
|
63
|
+
w,
|
|
64
|
+
j,
|
|
65
|
+
x.genericError,
|
|
66
|
+
S,
|
|
67
|
+
C,
|
|
68
|
+
N
|
|
69
|
+
]), re = _(async () => {
|
|
70
|
+
if (!R) return;
|
|
71
|
+
let t = c(B, x);
|
|
72
|
+
if (a(t)) {
|
|
73
|
+
U(t);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
await A.mutateAsync({
|
|
78
|
+
path: { receivable_id: R.id },
|
|
79
|
+
body: {
|
|
80
|
+
body_text: B.body,
|
|
81
|
+
subject_text: B.subject,
|
|
82
|
+
recipients: {
|
|
83
|
+
to: o(B.to),
|
|
84
|
+
cc: o(B.cc),
|
|
85
|
+
bcc: o(B.bcc)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}), Q();
|
|
89
|
+
} catch (t) {
|
|
90
|
+
U({ form: e(t) ?? x.genericError });
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
Q,
|
|
94
|
+
x,
|
|
95
|
+
A,
|
|
96
|
+
R,
|
|
97
|
+
B
|
|
98
|
+
]), ie = _(async () => {
|
|
99
|
+
if (!W) return;
|
|
100
|
+
let t = s(K, x, W.currency);
|
|
101
|
+
if (i(t)) {
|
|
102
|
+
Y(t);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
let e = { receivable_id: W.id }, t = K.paidAt ? new Date(K.paidAt).toISOString() : void 0;
|
|
107
|
+
K.mode === "full" ? await j.mutateAsync({
|
|
108
|
+
path: e,
|
|
109
|
+
body: {
|
|
110
|
+
comment: K.comment || void 0,
|
|
111
|
+
paid_at: t
|
|
112
|
+
}
|
|
113
|
+
}) : await M.mutateAsync({
|
|
114
|
+
path: e,
|
|
115
|
+
body: {
|
|
116
|
+
amount_paid: r(K.amountPaid, W.currency) ?? 0,
|
|
117
|
+
comment: K.comment || void 0
|
|
118
|
+
}
|
|
119
|
+
}), $();
|
|
120
|
+
} catch (t) {
|
|
121
|
+
Y({ form: e(t) ?? x.genericError });
|
|
122
|
+
}
|
|
123
|
+
}, [
|
|
124
|
+
$,
|
|
125
|
+
j,
|
|
126
|
+
x,
|
|
127
|
+
M,
|
|
128
|
+
W,
|
|
129
|
+
K
|
|
33
130
|
]);
|
|
34
131
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
132
|
+
actionTarget: P,
|
|
133
|
+
actionDialog: P ? b(P.action, x) : void 0,
|
|
134
|
+
actionError: I,
|
|
135
|
+
actionInProgress: w.isPending || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || j.isPending || N.isPending,
|
|
136
|
+
openAction: X,
|
|
137
|
+
closeAction: Z,
|
|
138
|
+
confirmAction: ne,
|
|
139
|
+
sendOpen: !!R,
|
|
140
|
+
sendValues: B,
|
|
141
|
+
sendErrors: H,
|
|
142
|
+
sendInProgress: A.isPending,
|
|
143
|
+
setSendValues: V,
|
|
144
|
+
closeSend: Q,
|
|
145
|
+
submitSend: re,
|
|
146
|
+
paymentOpen: !!W,
|
|
147
|
+
paymentValues: K,
|
|
148
|
+
paymentErrors: J,
|
|
149
|
+
paymentInProgress: j.isPending || M.isPending,
|
|
150
|
+
setPaymentValues: q,
|
|
151
|
+
closePayment: $,
|
|
152
|
+
submitPayment: ie
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function b(e, t) {
|
|
156
|
+
return e === "issue" ? {
|
|
157
|
+
title: t.issueTitle,
|
|
158
|
+
description: t.issueDescription,
|
|
159
|
+
confirmLabel: t.issueConfirm
|
|
160
|
+
} : e === "accept" ? {
|
|
161
|
+
title: t.acceptTitle,
|
|
162
|
+
description: t.acceptDescription,
|
|
163
|
+
confirmLabel: t.acceptConfirm
|
|
164
|
+
} : e === "decline" ? {
|
|
165
|
+
title: t.declineTitle,
|
|
166
|
+
description: t.declineDescription,
|
|
167
|
+
confirmLabel: t.declineConfirm,
|
|
168
|
+
destructive: !0
|
|
169
|
+
} : e === "cancel" ? {
|
|
170
|
+
title: t.cancelTitle,
|
|
171
|
+
description: t.cancelDescription,
|
|
172
|
+
confirmLabel: t.cancelConfirm,
|
|
173
|
+
destructive: !0
|
|
174
|
+
} : e === "clone" ? {
|
|
175
|
+
title: t.cloneTitle,
|
|
176
|
+
description: t.cloneDescription,
|
|
177
|
+
confirmLabel: t.cloneConfirm
|
|
178
|
+
} : e === "delete" ? {
|
|
179
|
+
title: t.deleteTitle,
|
|
180
|
+
description: t.deleteDescription,
|
|
181
|
+
confirmLabel: t.deleteConfirm,
|
|
182
|
+
destructive: !0
|
|
183
|
+
} : e === "markPaid" ? {
|
|
184
|
+
title: t.markPaidTitle,
|
|
185
|
+
description: t.markPaidDescription,
|
|
186
|
+
confirmLabel: t.markPaidConfirm
|
|
187
|
+
} : {
|
|
188
|
+
title: t.markUncollectibleTitle,
|
|
189
|
+
description: t.markUncollectibleDescription,
|
|
190
|
+
confirmLabel: t.markUncollectibleConfirm,
|
|
191
|
+
destructive: !0
|
|
39
192
|
};
|
|
40
193
|
}
|
|
41
194
|
//#endregion
|
|
42
|
-
export {
|
|
195
|
+
export { y as useReceivableActions };
|