@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.
Files changed (78) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +4 -0
  3. package/dist/index.d.ts +105 -2
  4. package/dist/index.js +1 -1
  5. package/dist/lib/ReceivablesWidget.d.ts +105 -2
  6. package/dist/lib/ReceivablesWidget.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +11 -10
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +92 -55
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +67 -142
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +186 -17
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +27 -0
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +45 -74
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +68 -53
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +66 -32
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +28 -34
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +24 -166
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +177 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +42 -95
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +36 -33
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +38 -0
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +206 -147
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +2 -2
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +39 -58
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +53 -227
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +216 -287
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +453 -43
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +103 -126
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +122 -146
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +145 -41
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +39 -115
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +113 -90
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +81 -98
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +111 -27
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +26 -633
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +639 -39
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +41 -40
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +35 -74
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +73 -130
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +133 -329
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index36.js +345 -0
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +13 -12
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +15 -12
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +35 -24
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +8 -71
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +70 -17
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +31 -12
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +18 -30
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +12 -301
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +33 -1
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +14 -46
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +23 -67
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +76 -485
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +395 -95
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +2 -0
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +48 -2
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +72 -4
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +496 -1
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +97 -91
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +2 -236
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +3 -2
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +1 -249
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +89 -82
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +23 -54
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +223 -340
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +3 -0
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +249 -0
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +93 -0
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +59 -0
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +353 -0
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -1
  73. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +41 -41
  74. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
  75. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +75 -43
  76. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  77. package/package.json +1 -1
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +0 -28
@@ -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, fromMajorUnits as i, hasPaymentErrors as a, hasSendErrors as o, isReceivableReadyToIssue as s, splitEmailList as c, validatePaymentValues as l, validateSendValues as u } from "./index13.js";
9
- import { getIssueReminderBlocker as d, hasSelectedReminder as ee } from "./index15.js";
10
- import { useSendReceivableEmailMutation as te } from "../../data-access/dist/index6.js";
11
- import { useAcceptReceivableMutation as f, useCancelReceivableMutation as p, useCloneReceivableMutation as m, useDeclineReceivableMutation as h, useDeleteReceivableMutation as ne, useIssueReceivableMutation as re } from "../../data-access/dist/index7.js";
12
- import { useMarkReceivablePaidMutation as ie, useMarkReceivablePartiallyPaidMutation as ae, useMarkReceivableUncollectibleMutation as oe } from "../../data-access/dist/index9.js";
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 g } from "./index16.js";
15
- import { useCallback as _, useState as v } from "react";
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 y({ selectedReceivable: y, messages: x, onCreated: S, onDeleted: C, onCompleteBeforeIssue: w }) {
18
- let T = re(), E = p(), D = m(), O = f(), k = h(), A = ne(), j = te(), M = ie(), N = ae(), P = oe(), [F, I] = v(), [se, L] = v(), [R, z] = v(), [B, V] = v(() => r(void 0, x)), [H, U] = v({}), [W, G] = v(), [K, q] = v(() => n()), [ce, J] = v({}), Y = F?.issueCheck, X = g({
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, le = _((e, t, i) => {
23
- let a = "documentLabel" in t ? t.documentLabel : t.title, o = {
24
- id: t.id,
25
- type: t.type,
26
- title: a,
27
- action: e
28
- }, c = i === void 0 ? y : i ?? void 0;
29
- if (e === "send") {
30
- z(o), V(r(c, x)), U({});
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
- if (e === "recordPayment") {
34
- G({
35
- ...o,
36
- currency: c?.currency
37
- }), q(n()), J({});
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
- let l = e === "issue" && c?.type === "invoice" ? c : void 0;
41
- if (l && w && !s(l, x)) {
42
- w(l);
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
- L(void 0), I({
46
- ...o,
47
- issueCheck: l ? {
48
- counterpartId: l.counterpart_id,
49
- billingAddressId: l.counterpart_billing_address?.id ?? void 0,
50
- billingCountry: l.counterpart_billing_address?.country,
51
- hasReminder: ee(l)
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
- x,
56
- w,
57
- y
58
- ]), ue = _(() => {
59
- I(void 0), L(void 0);
60
- }, []), Q = _(() => {
61
- z(void 0), U({});
62
- }, []), $ = _(() => {
63
- G(void 0), J({});
64
- }, []), de = _(async () => {
65
- if (!F) return;
66
- let n = { receivable_id: F.id };
67
- if (F.issueCheck) {
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 ? x.issueTaxIdRequired : F.issueCheck.hasReminder ? d(X.counterpart, x) : void 0;
95
+ let t = X.isTaxIdMissing ? _.issueTaxIdRequired : P.issueCheck.hasReminder ? d(X.counterpart, _) : void 0;
70
96
  if (t) {
71
- e.error(t), I(void 0);
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 (F.action === "issue") await T.mutateAsync({ path: n });
77
- else if (F.action === "cancel") await E.mutateAsync({ path: n });
78
- else if (F.action === "clone") {
79
- let e = await D.mutateAsync({ path: n });
80
- e?.id && S?.(e.id, e.type);
81
- } else F.action === "accept" ? await O.mutateAsync({ path: n }) : F.action === "decline" ? await k.mutateAsync({ path: n }) : F.action === "delete" ? (await A.mutateAsync({ path: n }), C?.(F.id)) : F.action === "markPaid" ? await M.mutateAsync({
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
- }) : F.action === "markUncollectible" && await P.mutateAsync({ path: n });
85
- I(void 0), L(void 0);
122
+ }) : P.action === "markUncollectible" && await A.mutateAsync({ path: n });
123
+ F(void 0), I(void 0);
86
124
  } catch (e) {
87
- L(t(e) ?? x.genericError);
125
+ I(t(e) ?? _.genericError);
88
126
  }
89
127
  }, [
90
- O,
91
- F,
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
- S,
101
- C,
137
+ O,
138
+ _,
139
+ v,
140
+ y,
102
141
  X.counterpart,
103
142
  X.isTaxIdMissing,
104
- P
105
- ]), fe = _(async () => {
106
- if (!R) return;
107
- let e = u(B, x);
108
- if (o(e)) {
109
- U(e);
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 j.mutateAsync({
114
- path: { receivable_id: R.id },
152
+ await D.mutateAsync({
153
+ path: { receivable_id: L.id },
115
154
  body: {
116
- body_text: B.body,
117
- subject_text: B.subject,
155
+ body_text: z.body,
156
+ subject_text: z.subject,
118
157
  recipients: {
119
- to: c(B.to),
120
- cc: c(B.cc),
121
- bcc: c(B.bcc)
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
- U({ form: t(e) ?? x.genericError });
165
+ V({ form: t(e) ?? _.genericError });
127
166
  }
128
167
  }, [
129
168
  Q,
130
- x,
131
- j,
132
- R,
133
- B
134
- ]), pe = _(async () => {
135
- if (!W) return;
136
- let e = l(K, x, W.currency);
137
- if (a(e)) {
138
- J(e);
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: W.id }, t = K.paidAt ? new Date(K.paidAt).toISOString() : void 0;
143
- K.mode === "full" ? await M.mutateAsync({
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: K.comment || void 0,
185
+ comment: W.comment || void 0,
147
186
  paid_at: t
148
187
  }
149
- }) : await N.mutateAsync({
188
+ }) : await k.mutateAsync({
150
189
  path: e,
151
190
  body: {
152
- amount_paid: i(K.amountPaid, W.currency) ?? 0,
153
- comment: K.comment || void 0
191
+ amount_paid: a(W.amountPaid, H.currency) ?? 0,
192
+ comment: W.comment || void 0
154
193
  }
155
194
  }), $();
156
195
  } catch (e) {
157
- J({ form: t(e) ?? x.genericError });
196
+ K({ form: t(e) ?? _.genericError });
158
197
  }
159
198
  }, [
160
199
  $,
161
- M,
162
- x,
163
- N,
164
- W,
165
- K
200
+ O,
201
+ _,
202
+ k,
203
+ H,
204
+ W
166
205
  ]);
167
206
  return {
168
- actionTarget: F,
169
- actionDialog: F ? b(F.action, x) : void 0,
170
- actionError: se,
171
- actionInProgress: Z || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || A.isPending || M.isPending || P.isPending,
172
- openAction: le,
173
- closeAction: ue,
174
- confirmAction: de,
175
- sendOpen: !!R,
176
- sendValues: B,
177
- sendErrors: H,
178
- sendInProgress: j.isPending,
179
- setSendValues: V,
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: fe,
182
- paymentOpen: !!W,
183
- paymentValues: K,
184
- paymentErrors: ce,
185
- paymentInProgress: M.isPending || N.isPending,
186
- setPaymentValues: q,
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: pe
228
+ submitPayment: Ce
189
229
  };
190
230
  }
191
- function b(e, t) {
192
- return e === "issue" ? {
193
- title: t.issueTitle,
194
- description: t.issueDescription,
195
- confirmLabel: t.issueConfirm
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: t.acceptTitle,
198
- description: t.acceptDescription,
199
- confirmLabel: t.acceptConfirm
256
+ title: n.acceptTitle,
257
+ description: n.acceptDescription,
258
+ confirmLabel: n.acceptConfirm
200
259
  } : e === "decline" ? {
201
- title: t.declineTitle,
202
- description: t.declineDescription,
203
- confirmLabel: t.declineConfirm,
260
+ title: n.declineTitle,
261
+ description: n.declineDescription,
262
+ confirmLabel: n.declineConfirm,
204
263
  destructive: !0
205
264
  } : e === "cancel" ? {
206
- title: t.cancelTitle,
207
- description: t.cancelDescription,
208
- confirmLabel: t.cancelConfirm,
265
+ title: n.cancelTitle,
266
+ description: n.cancelDescription,
267
+ confirmLabel: n.cancelConfirm,
209
268
  destructive: !0
210
269
  } : e === "clone" ? {
211
- title: t.cloneTitle,
212
- description: t.cloneDescription,
213
- confirmLabel: t.cloneConfirm
270
+ title: n.cloneTitle,
271
+ description: n.cloneDescription,
272
+ confirmLabel: n.cloneConfirm
214
273
  } : e === "delete" ? {
215
- title: t.deleteTitle,
216
- description: t.deleteDescription,
217
- confirmLabel: t.deleteConfirm,
274
+ title: n.deleteTitle,
275
+ description: n.deleteDescription,
276
+ confirmLabel: n.deleteConfirm,
218
277
  destructive: !0
219
278
  } : e === "markPaid" ? {
220
- title: t.markPaidTitle,
221
- description: t.markPaidDescription,
222
- confirmLabel: t.markPaidConfirm
279
+ title: n.markPaidTitle,
280
+ description: n.markPaidDescription,
281
+ confirmLabel: n.markPaidConfirm
223
282
  } : {
224
- title: t.markUncollectibleTitle,
225
- description: t.markUncollectibleDescription,
226
- confirmLabel: t.markUncollectibleConfirm,
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 { y as useReceivableActions };
290
+ export { g as useReceivableActions };
@@ -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/index6.js";
15
- import { useReceivableQuery as f } from "../../data-access/dist/index10.js";
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
@@ -1,63 +1,44 @@
1
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
- import "../../../shared/data-access/dist/index.js";
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
- var n = {
6
- routingNumber: "",
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
- canReadEmbedded: e(r, [t.BankAccountReadOrg]),
15
- canReadExternal: e(r, [t.ExternalBankAccountReadOrg]),
16
- canAddAccount: e(r, [t.BankAccountWriteOrg])
17
- };
18
- }
19
- function i(e, t) {
20
- return [e.displayName || t.bankAccountFallbackName, e.accountNumberLast4].filter(Boolean).join(" - ");
21
- }
22
- function a(e, t, n) {
23
- switch (e) {
24
- case "INTERNAL": return t ? n.bankAccountPoweredBy.replace("{embeddedBankName}", t) : void 0;
25
- case "EXTERNAL": return n.bankAccountLinked;
26
- default: return;
27
- }
28
- }
29
- function o({ accounts: e, embeddedBankName: t, messages: n }) {
30
- return e.map((e) => ({
31
- value: e.id,
32
- label: i(e, n),
33
- sourceLabel: a(e.type, t, n)
34
- })).sort((e, t) => e.label.localeCompare(t.label));
35
- }
36
- function s({ options: e, isLoading: t, selectedId: n, isAddingAccount: r, canAddAccount: i, formValues: a, formErrors: o, isSaving: s }) {
37
- return t ? { kind: "loading" } : e.length > 0 && !r ? {
38
- kind: "picker",
39
- options: e,
40
- selected: e.find((e) => e.value === n),
41
- canAddAccount: i
42
- } : i ? {
43
- kind: "form",
44
- values: a,
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 { n as EMPTY_BANK_ACCOUNT_FORM_VALUES, l as bankAccountFormToPayload, s as buildBankAccountSectionView, o as buildPaymentAccountOptions, r as getBankAccountPermissions, i as getPaymentAccountLineLabel, a as getPaymentAccountSourceLabel, c as validateBankAccountForm };
44
+ export { a as buildReceivableAuditHistoryLabels };