@tesouro/embedded-components-react 0.5.268 → 0.5.271

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.
Files changed (60) hide show
  1. package/dist/index.css +4 -10
  2. package/dist/index.d.ts +13 -9
  3. package/dist/lib/ReceivablesWidget.d.ts +13 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +22 -18
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +8 -4
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/invalidation.js +3 -3
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileSubmittedForApprovalQueries.js +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index.js +3 -1
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +44 -0
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +97 -0
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +76 -150
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +63 -57
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/actionsModal.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +161 -152
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +30 -34
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +12 -8
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +18 -19
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +208 -158
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +91 -85
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +197 -196
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +147 -115
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +14 -14
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +3 -5
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +37 -34
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +22 -7
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +17 -15
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +17 -13
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +37 -31
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +29 -23
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +38 -11
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +26 -28
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +20 -14
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +8 -24
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +34 -83
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +14 -404
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +28 -2
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +79 -39
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +490 -68
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +2 -502
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +41 -216
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +70 -21
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +484 -5
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +224 -0
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +21 -263
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +8 -2
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +261 -24
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +2 -237
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +100 -3
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +21 -242
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +226 -82
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +3 -59
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +233 -178
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +85 -37
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +60 -0
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +194 -0
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +45 -0
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/package.json +1 -1
  60. 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 { defaultSendValues as n, formatMoney as r, hasSendErrors as i, isReceivableReadyToIssue as a, splitEmailList as o, validateSendValues as s } from "./helpers.js";
9
- import { getIssueReminderBlocker as c, hasSelectedReminder as ee } from "./reminders.js";
10
- import { useSendReceivableEmailMutation as l } from "../../../../data-access/dist/index8.js";
11
- import { useAcceptReceivableMutation as u, useCancelReceivableMutation as d, useCloneReceivableMutation as f, useDeclineReceivableMutation as te, useDeleteReceivableMutation as ne, useIssueReceivableMutation as p } from "../../../../data-access/dist/index9.js";
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 m, useResumeRecurrenceMutation as oe } from "../../../../data-access/dist/index13.js";
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 h } from "./useReceivableIssuePreflight.js";
16
- import { useReceivablePaymentRecord as g } from "./useReceivablePaymentRecord.js";
17
- import { useCallback as _, useState as v } from "react";
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 y({ selectedReceivable: r, selectedRecurrence: y, messages: b, onCreated: x, onDeleted: S, onCompleteBeforeIssue: C }) {
20
- let w = p(), T = d(), E = f(), D = u(), O = te(), k = ne(), A = l(), j = re(), M = ie(), N = m(), P = oe(), F = ae(), [I, L] = v(), [le, R] = v(), [z, B] = v(""), [V, H] = v(), [U, W] = v(() => n(void 0, b)), [ue, G] = v({}), K = g({ messages: b }), q = K.open, J = N.mutate, Y = P.mutate, X = I?.issueCheck, Z = h({
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
- }), Q = !!X && Z.isLoading, de = _((i, o, s) => {
25
- let c = "documentLabel" in o ? o.documentLabel : o.title, l = {
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: c,
29
- action: i
30
- }, u = s === void 0 ? r : s ?? void 0;
31
- if (i === "send") {
32
- H(l), W(n(u, b)), G({});
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 d = u?.type === "invoice" ? u.recurrence_id ?? void 0 : void 0;
36
- if (i === "pauseRecurrence" || i === "resumeRecurrence") {
37
- if (!d) return;
38
- let n = i === "pauseRecurrence";
39
- (n ? J : Y)({
40
- path: { recurrence_id: d },
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 ? b.recurrencePaused : b.recurrenceResumed),
44
- onError: (n) => e.error(t(n) ?? b.genericError)
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 (i === "cancelRecurrence") {
49
- if (!d || u?.type !== "invoice") return;
50
- R(void 0), L({
51
- ...l,
52
- recurrenceId: d,
53
- description: se(u, y, b)
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 (i === "recordPayment") {
58
- u?.type === "invoice" && q(u);
114
+ if (a === "recordPayment") {
115
+ f?.type === "invoice" && K(f);
59
116
  return;
60
117
  }
61
- let f = i === "issue" && u?.type === "invoice" ? u : void 0;
62
- if (f && C && !a(f, b)) {
63
- C(f);
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
- R(void 0), B(""), L({
67
- ...l,
68
- issueCheck: f ? {
69
- counterpartId: f.counterpart_id,
70
- billingAddressId: f.counterpart_billing_address?.id ?? void 0,
71
- billingCountry: f.counterpart_billing_address?.country,
72
- hasReminder: ee(f)
73
- } : void 0
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
- J,
80
- Y,
81
- r,
82
- y
83
- ]), fe = _(() => {
84
- L(void 0), R(void 0);
85
- }, []), $ = _(() => {
86
- H(void 0), G({});
87
- }, []), pe = _(async () => {
88
- if (!I) return;
89
- let n = { receivable_id: I.id };
90
- if (I.issueCheck) {
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 F.mutateAsync({
102
- path: { recurrence_id: I.recurrenceId },
103
- receivableId: I.id
104
- }), e.success(b.recurrenceCanceled), L(void 0);
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) ?? b.genericError);
161
+ e.error(t(n) ?? y.genericError);
107
162
  }
108
163
  return;
109
164
  }
110
165
  try {
111
- if (I.action === "issue") await w.mutateAsync({ path: n });
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
- }) : I.action === "markUncollectible" && await M.mutateAsync({
169
+ }) : F.action === "markUncollectible" && await M.mutateAsync({
120
170
  path: n,
121
- body: { comment: z.trim() || void 0 }
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
- R(t(e) ?? b.genericError);
174
+ L(t(e) ?? y.genericError);
126
175
  }
127
176
  }, [
128
177
  D,
129
- z,
130
- I,
131
- T,
178
+ R,
132
179
  F,
133
- E,
180
+ T,
181
+ P,
134
182
  O,
135
183
  k,
136
- Q,
137
- w,
138
184
  j,
139
- b,
185
+ y,
140
186
  x,
141
- S,
142
- Z.counterpart,
143
- Z.isTaxIdMissing,
144
187
  M
145
- ]), me = _(async () => {
146
- if (!V) return;
147
- let e = s(U, b);
148
- if (i(e)) {
149
- G(e);
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: V.id },
197
+ path: { receivable_id: B.id },
155
198
  body: {
156
- body_text: U.body,
157
- subject_text: U.subject,
199
+ body_text: H.body,
200
+ subject_text: H.subject,
158
201
  recipients: {
159
- to: o(U.to),
160
- cc: o(U.cc),
161
- bcc: o(U.bcc)
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
- G({ form: t(e) ?? b.genericError });
209
+ W({ form: t(e) ?? y.genericError });
167
210
  }
168
211
  }, [
169
212
  $,
170
- b,
213
+ y,
171
214
  A,
172
- V,
173
- U
215
+ B,
216
+ H
174
217
  ]);
175
218
  return {
176
- actionTarget: I,
177
- actionDialog: I ? ce(I, b) : void 0,
178
- actionError: le,
179
- actionComment: I?.action === "markUncollectible" ? z : void 0,
180
- setActionComment: B,
181
- actionInProgress: Q || w.isPending || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || j.isPending || M.isPending || F.isPending,
182
- pendingActions: [...N.isPending ? ["pauseRecurrence"] : [], ...P.isPending ? ["resumeRecurrence"] : []],
183
- openAction: de,
184
- closeAction: fe,
185
- confirmAction: pe,
186
- sendOpen: !!V,
187
- sendValues: U,
188
- sendErrors: ue,
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: W,
238
+ setSendValues: U,
191
239
  closeSend: $,
192
- submitSend: me,
193
- payment: K
240
+ submitSend: Se,
241
+ payment: G
194
242
  };
195
243
  }
196
- function se(e, t, n) {
197
- let i = (t?.iterations ?? []).filter((e) => e.status === "pending").length, a = r({
198
- amount: e.total_amount_with_credit_notes * i,
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(i)).replace("{invoices}", i === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}", a),
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 ce({ action: e, description: t }, n) {
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: n.cancelRecurrenceTitle,
267
+ title: r.cancelRecurrenceTitle,
212
268
  description: t ?? "",
213
- confirmLabel: n.cancelRecurrenceConfirm,
214
- cancelLabel: n.cancelRecurrenceClose,
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: n.acceptTitle,
222
- description: n.acceptDescription,
223
- confirmLabel: n.acceptConfirm
273
+ title: r.acceptTitle,
274
+ description: r.acceptDescription,
275
+ confirmLabel: r.acceptConfirm
224
276
  } : e === "decline" ? {
225
- title: n.declineTitle,
226
- description: n.declineDescription,
227
- confirmLabel: n.declineConfirm,
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: n.cancelDescription,
232
- confirmLabel: n.cancelConfirm,
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: n.deleteTitle,
240
- description: n.deleteDescription,
241
- confirmLabel: n.deleteConfirm,
289
+ title: r.deleteTitle,
290
+ description: r.deleteDescription,
291
+ confirmLabel: r.deleteConfirm,
242
292
  destructive: !0
243
293
  } : e === "markPaid" ? {
244
- title: n.markPaidTitle,
245
- description: n.markPaidDescription,
246
- confirmLabel: n.markPaidConfirm
294
+ title: r.markPaidTitle,
295
+ description: r.markPaidDescription,
296
+ confirmLabel: r.markPaidConfirm
247
297
  } : {
248
- title: n.markUncollectibleTitle,
249
- description: n.markUncollectibleDescription,
250
- confirmLabel: n.markUncollectibleConfirm,
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 { y as useReceivableActions };
305
+ export { _ as useReceivableActions };