@tesouro/embedded-components-react 0.5.273 → 0.5.274

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 (32) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/lib/ReceivablesWidget.d.ts +1 -0
  3. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +10 -9
  4. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +173 -44
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +42 -94
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +91 -76
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +67 -173
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +186 -17
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +27 -0
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +16 -62
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +66 -28
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +28 -34
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +24 -168
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +9 -9
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +47 -44
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +125 -122
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +50 -47
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +3 -3
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +2 -2
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +3 -0
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +54 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +41 -41
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +83 -71
  31. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  32. package/package.json +1 -1
@@ -1,32 +1,70 @@
1
- import { invalidateAllClients as e, resetAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { deleteFilesId as e, postFiles as t } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { invalidateAllClients as n } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
+ import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as i } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
2
9
  import "../../../shared/data-access/dist/index.js";
3
- import { receivableHistoryInvalidationKey as n, receivableInvalidationKey as r, receivablePdfInvalidationKey as i, receivablesAnalyticsInvalidationKey as a, receivablesInvalidationKey as o } from "./index2.js";
10
+ import { receivableAttachmentsInvalidationKey as a, receivableInvalidationKey as o } from "./index2.js";
11
+ import { useMutation as s } from "@tanstack/react-query";
4
12
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js
5
- async function s({ client: s, organizationId: c, receivableId: l, resetPdf: u = !1 }) {
6
- let d = [
7
- o({
8
- client: s,
9
- organizationId: c
10
- }),
11
- a({
12
- client: s,
13
- organizationId: c
14
- }),
15
- ...l ? [r({
16
- client: s,
17
- organizationId: c,
18
- receivableId: l
19
- }), n({
20
- client: s,
21
- organizationId: c,
22
- receivableId: l
23
- })] : []
24
- ], f = l ? i({
25
- client: s,
26
- organizationId: c,
27
- receivableId: l
28
- }) : void 0;
29
- await Promise.all([...d.map((t) => e(t)), ...f ? [u ? t(f) : e(f)] : []]);
13
+ var c = "attachments";
14
+ async function l({ client: e, organizationId: t, receivableId: r }) {
15
+ let i = [a({
16
+ client: e,
17
+ organizationId: t
18
+ }), ...r ? [o({
19
+ client: e,
20
+ organizationId: t,
21
+ receivableId: r
22
+ })] : []];
23
+ await Promise.all(i.map((e) => n(e)));
24
+ }
25
+ function u() {
26
+ let { client: e, organizationId: n } = r();
27
+ return s({
28
+ mutationFn: async ({ file: r }) => {
29
+ let { data: a } = await t({
30
+ client: e,
31
+ headers: i(n),
32
+ body: {
33
+ file: r,
34
+ file_type: c
35
+ },
36
+ throwOnError: !0
37
+ });
38
+ return a;
39
+ },
40
+ onSuccess: async (t, r) => {
41
+ await l({
42
+ client: e,
43
+ organizationId: n,
44
+ receivableId: r.receivableId
45
+ });
46
+ }
47
+ });
48
+ }
49
+ function d() {
50
+ let { client: t, organizationId: n } = r();
51
+ return s({
52
+ mutationFn: async ({ path: r }) => {
53
+ await e({
54
+ client: t,
55
+ headers: i(n),
56
+ path: r,
57
+ throwOnError: !0
58
+ });
59
+ },
60
+ onSuccess: async (e, r) => {
61
+ await l({
62
+ client: t,
63
+ organizationId: n,
64
+ receivableId: r.receivableId
65
+ });
66
+ }
67
+ });
30
68
  }
31
69
  //#endregion
32
- export { s as invalidateReceivable };
70
+ export { d as useDeleteReceivableAttachmentMutation, u as useUploadReceivableAttachmentMutation };
@@ -1,38 +1,32 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { postReceivablesIdSend as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { invalidateAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
- import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
1
+ import { invalidateAllClients as e, resetAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
9
2
  import "../../../shared/data-access/dist/index.js";
10
- import { receivableMailsInvalidationKey as i } from "./index2.js";
11
- import { invalidateReceivable as a } from "./index7.js";
12
- import { useMutation as o } from "@tanstack/react-query";
3
+ import { receivableHistoryInvalidationKey as n, receivableInvalidationKey as r, receivablePdfInvalidationKey as i, receivablesAnalyticsInvalidationKey as a, receivablesInvalidationKey as o } from "./index2.js";
13
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js
14
- function s() {
15
- let { client: s, organizationId: c } = n();
16
- return o({
17
- mutationFn: async ({ path: t, body: n }) => {
18
- let { data: i } = await e({
19
- client: s,
20
- headers: r(c),
21
- path: t,
22
- body: n,
23
- throwOnError: !0
24
- });
25
- return i;
26
- },
27
- onSuccess: async (e, n) => {
28
- let r = {
29
- client: s,
30
- organizationId: c,
31
- receivableId: n.path.receivable_id
32
- };
33
- await Promise.all([t(i(r)), a(r)]);
34
- }
35
- });
5
+ async function s({ client: s, organizationId: c, receivableId: l, resetPdf: u = !1 }) {
6
+ let d = [
7
+ o({
8
+ client: s,
9
+ organizationId: c
10
+ }),
11
+ a({
12
+ client: s,
13
+ organizationId: c
14
+ }),
15
+ ...l ? [r({
16
+ client: s,
17
+ organizationId: c,
18
+ receivableId: l
19
+ }), n({
20
+ client: s,
21
+ organizationId: c,
22
+ receivableId: l
23
+ })] : []
24
+ ], f = l ? i({
25
+ client: s,
26
+ organizationId: c,
27
+ receivableId: l
28
+ }) : void 0;
29
+ await Promise.all([...d.map((t) => e(t)), ...f ? [u ? t(f) : e(f)] : []]);
36
30
  }
37
31
  //#endregion
38
- export { s as useSendReceivableEmailMutation };
32
+ export { s as invalidateReceivable };
@@ -2,181 +2,37 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { deleteReceivablesId as e, patchReceivablesId as t, postReceivables as n, postReceivablesIdAccept as r, postReceivablesIdCancel as i, postReceivablesIdClone as a, postReceivablesIdDecline as o, postReceivablesIdIssue as s } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { useEmbedApi as c } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import { organizationHeaders as l } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
5
+ import { postReceivablesIdSend as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { invalidateAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
+ import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
8
9
  import "../../../shared/data-access/dist/index.js";
9
- import { invalidateReceivable as u } from "./index7.js";
10
- import { useMutation as d } from "@tanstack/react-query";
10
+ import { receivableMailsInvalidationKey as i } from "./index2.js";
11
+ import { invalidateReceivable as a } from "./index8.js";
12
+ import { useMutation as o } from "@tanstack/react-query";
11
13
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js
12
- function f() {
13
- let { client: e, organizationId: t } = c();
14
- return d({
15
- mutationFn: async ({ body: r }) => {
16
- let { data: i } = await n({
17
- client: e,
18
- headers: l(t),
19
- body: r,
14
+ function s() {
15
+ let { client: s, organizationId: c } = n();
16
+ return o({
17
+ mutationFn: async ({ path: t, body: n }) => {
18
+ let { data: i } = await e({
19
+ client: s,
20
+ headers: r(c),
21
+ path: t,
22
+ body: n,
20
23
  throwOnError: !0
21
24
  });
22
25
  return i;
23
26
  },
24
- onSuccess: async () => {
25
- await u({
26
- client: e,
27
- organizationId: t
28
- });
29
- }
30
- });
31
- }
32
- function p() {
33
- let { client: e, organizationId: n } = c();
34
- return d({
35
- mutationFn: async ({ path: r, body: i }) => {
36
- let { data: a } = await t({
37
- client: e,
38
- headers: l(n),
39
- path: r,
40
- body: i,
41
- throwOnError: !0
42
- });
43
- return a;
44
- },
45
- onSuccess: async (t, r) => {
46
- await u({
47
- client: e,
48
- organizationId: n,
49
- receivableId: r.path.receivable_id,
50
- resetPdf: !0
51
- });
52
- }
53
- });
54
- }
55
- function m() {
56
- let { client: t, organizationId: n } = c();
57
- return d({
58
- mutationFn: async ({ path: r }) => {
59
- await e({
60
- client: t,
61
- headers: l(n),
62
- path: r,
63
- throwOnError: !0
64
- });
65
- },
66
- onSuccess: async (e, r) => {
67
- await u({
68
- client: t,
69
- organizationId: n,
70
- receivableId: r.path.receivable_id
71
- });
72
- }
73
- });
74
- }
75
- function h() {
76
- let { client: e, organizationId: t } = c();
77
- return d({
78
- mutationFn: async ({ path: n }) => {
79
- let { data: r } = await s({
80
- client: e,
81
- headers: l(t),
82
- path: n,
83
- throwOnError: !0
84
- });
85
- return r;
86
- },
87
- onSuccess: async (n, r) => {
88
- await u({
89
- client: e,
90
- organizationId: t,
91
- receivableId: r.path.receivable_id,
92
- resetPdf: !0
93
- });
94
- }
95
- });
96
- }
97
- function g() {
98
- let { client: e, organizationId: t } = c();
99
- return d({
100
- mutationFn: async ({ path: n }) => {
101
- await i({
102
- client: e,
103
- headers: l(t),
104
- path: n,
105
- throwOnError: !0
106
- });
107
- },
108
- onSuccess: async (n, r) => {
109
- await u({
110
- client: e,
111
- organizationId: t,
112
- receivableId: r.path.receivable_id
113
- });
114
- }
115
- });
116
- }
117
- function _() {
118
- let { client: e, organizationId: t } = c();
119
- return d({
120
- mutationFn: async ({ path: n }) => {
121
- let { data: r } = await a({
122
- client: e,
123
- headers: l(t),
124
- path: n,
125
- throwOnError: !0
126
- });
127
- return r;
128
- },
129
- onSuccess: async () => {
130
- await u({
131
- client: e,
132
- organizationId: t
133
- });
134
- }
135
- });
136
- }
137
- function v() {
138
- let { client: e, organizationId: t } = c();
139
- return d({
140
- mutationFn: async ({ path: n, body: i }) => {
141
- let { data: a } = await r({
142
- client: e,
143
- headers: l(t),
144
- path: n,
145
- body: i,
146
- throwOnError: !0
147
- });
148
- return a;
149
- },
150
- onSuccess: async (n, r) => {
151
- await u({
152
- client: e,
153
- organizationId: t,
154
- receivableId: r.path.receivable_id
155
- });
156
- }
157
- });
158
- }
159
- function y() {
160
- let { client: e, organizationId: t } = c();
161
- return d({
162
- mutationFn: async ({ path: n, body: r }) => {
163
- let { data: i } = await o({
164
- client: e,
165
- headers: l(t),
166
- path: n,
167
- body: r,
168
- throwOnError: !0
169
- });
170
- return i;
171
- },
172
- onSuccess: async (n, r) => {
173
- await u({
174
- client: e,
175
- organizationId: t,
176
- receivableId: r.path.receivable_id
177
- });
27
+ onSuccess: async (e, n) => {
28
+ let r = {
29
+ client: s,
30
+ organizationId: c,
31
+ receivableId: n.path.receivable_id
32
+ };
33
+ await Promise.all([t(i(r)), a(r)]);
178
34
  }
179
35
  });
180
36
  }
181
37
  //#endregion
182
- export { v as useAcceptReceivableMutation, g as useCancelReceivableMutation, _ as useCloneReceivableMutation, f as useCreateReceivableMutation, y as useDeclineReceivableMutation, m as useDeleteReceivableMutation, h as useIssueReceivableMutation, p as useUpdateReceivableMutation };
38
+ export { s as useSendReceivableEmailMutation };
@@ -2,8 +2,8 @@ import { isLineItemTaxable as e } from "./lineItems.js";
2
2
  import { buildReceivableAttachmentDetailsView as t } from "./attachments.js";
3
3
  import { allocateDiscount as n, resolveDiscountAmount as r } from "./totals.js";
4
4
  import { buildReceivableNotesView as i, formatDate as a, formatMoney as o } from "./helpers.js";
5
- import { getPaymentAccountLineLabel as s } from "./bankAccounts.js";
6
- import { formatCountryName as c, formatDeduction as l } from "./preview.js";
5
+ import { formatCountryName as s, formatDeduction as c } from "./preview.js";
6
+ import { getPaymentAccountLineLabel as l } from "./bankAccounts.js";
7
7
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js
8
8
  var u = {
9
9
  draft: {
@@ -181,7 +181,7 @@ function re(e) {
181
181
  return [
182
182
  e.line2 ? `${e.line1} ${e.line2}` : e.line1,
183
183
  t,
184
- e.country ? c(e.country) : void 0
184
+ e.country ? s(e.country) : void 0
185
185
  ].filter(Boolean).join(", ");
186
186
  }
187
187
  function C(e, t, n) {
@@ -262,7 +262,7 @@ function ie(t, i, a) {
262
262
  }), s = r({
263
263
  discount: t.discount,
264
264
  subtotal: o.taxableItemsSubtotal + o.nonTaxableItemsSubtotal
265
- }), { taxableSubtotal: c, nonTaxableSubtotal: u } = n({
265
+ }), { taxableSubtotal: l, nonTaxableSubtotal: u } = n({
266
266
  ...o,
267
267
  discountAmount: s
268
268
  }), d = s > 0, f = o.taxableItemsSubtotal > 0, p = o.nonTaxableItemsSubtotal > 0, m = [{
@@ -271,14 +271,14 @@ function ie(t, i, a) {
271
271
  }];
272
272
  d && m.push({
273
273
  label: a.previewDiscount,
274
- value: l(s, t.currency)
274
+ value: c(s, t.currency)
275
275
  }), p && (f || d) && m.push({
276
276
  label: a.previewNonTaxableSubtotal,
277
277
  value: i(u),
278
278
  tone: "muted"
279
279
  }), f && (p || d) && m.push({
280
280
  label: a.previewTaxableSubtotal,
281
- value: i(c),
281
+ value: i(l),
282
282
  tone: "muted"
283
283
  });
284
284
  for (let e of t.total_tax_amounts ?? []) m.push({
@@ -295,7 +295,7 @@ var ae = {
295
295
  primary: [],
296
296
  overflow: []
297
297
  };
298
- function w({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: c, depositAccount: l, isAccountListIncomplete: m, recurrence: v, paymentRecords: y = [], isLoadingPaymentRecords: x = !1, iterationInvoices: w = /* @__PURE__ */ new Map(), auditHistory: T, statusLabels: E, messages: D, canRecordPayment: O, canWrite: k = !0, onOpenReceivable: A, onOpenCustomer: j, now: oe }) {
298
+ function w({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: s, depositAccount: c, isAccountListIncomplete: m, recurrence: v, paymentRecords: y = [], isLoadingPaymentRecords: x = !1, iterationInvoices: w = /* @__PURE__ */ new Map(), auditHistory: T, statusLabels: E, messages: D, canRecordPayment: O, canWrite: k = !0, onOpenReceivable: A, onOpenCustomer: j, now: oe }) {
299
299
  if (!e || e.type !== "invoice") return;
300
300
  let M = e, N = (e) => o({
301
301
  amount: e ?? 0,
@@ -322,13 +322,13 @@ function w({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: c, d
322
322
  label: D.detailsPaymentReminders,
323
323
  value: h({
324
324
  paymentReminder: r,
325
- overdueReminder: c,
325
+ overdueReminder: s,
326
326
  remindersConfigured: !!(M.payment_reminder_id || M.overdue_reminder_id),
327
327
  messages: D
328
328
  })
329
329
  }, J = {
330
330
  label: D.detailsDepositAccount,
331
- value: l ? s(l, D) : m && M.bank_account_id ? "-" : D.detailsNotProvided
331
+ value: c ? l(c, D) : m && M.bank_account_id ? "-" : D.detailsNotProvided
332
332
  }, Y = {
333
333
  label: D.detailsPaymentTerms,
334
334
  value: M.payment_terms?.name ?? D.detailsPending
@@ -245,6 +245,7 @@ var e = {
245
245
  actionsSubject: "Invoice for {name}",
246
246
  actionsSendSucceeded: "Invoice sent successfully",
247
247
  actionsSendFailed: "Failed to send invoice.",
248
+ actionsSendWithoutPaymentLink: "You haven't onboarded for any payment method. Invoice is sent without a payment link.",
248
249
  actionsTitleSent: "Invoice sent",
249
250
  actionsTitleIssued: "Invoice issued",
250
251
  actionsTitleRecurrence: "Recurring billing activated",