@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
package/dist/index.d.ts CHANGED
@@ -5701,6 +5701,7 @@ interface ReceivableMessageLabels {
5701
5701
  actionsSubject: string;
5702
5702
  actionsSendSucceeded: string;
5703
5703
  actionsSendFailed: string;
5704
+ actionsSendWithoutPaymentLink: string;
5704
5705
  actionsTitleSent: string;
5705
5706
  actionsTitleIssued: string;
5706
5707
  actionsTitleRecurrence: string;
@@ -1621,6 +1621,7 @@ interface ReceivableMessageLabels {
1621
1621
  actionsSubject: string;
1622
1622
  actionsSendSucceeded: string;
1623
1623
  actionsSendFailed: string;
1624
+ actionsSendWithoutPaymentLink: string;
1624
1625
  actionsTitleSent: string;
1625
1626
  actionsTitleIssued: string;
1626
1627
  actionsTitleRecurrence: string;
@@ -4,12 +4,13 @@ import "./index2.js";
4
4
  import { useAllReceivableHistoryQuery as t } from "./index3.js";
5
5
  import { useEntityPaymentMethodsQuery as n, useEntitySettingsQuery as r } from "./index4.js";
6
6
  import { useCreateEntityBankAccountMutation as i, usePaymentAccountQuery as a, usePaymentAccountsQuery as o } from "./index5.js";
7
- import { useDeleteReceivableAttachmentMutation as s, useUploadReceivableAttachmentMutation as c } from "./index6.js";
8
- import { useSendReceivableEmailMutation as l } from "./index8.js";
9
- import { useAcceptReceivableMutation as u, useCancelReceivableMutation as d, useCloneReceivableMutation as f, useCreateReceivableMutation as p, useDeclineReceivableMutation as m, useDeleteReceivableMutation as h, useIssueReceivableMutation as g, useUpdateReceivableMutation as _ } from "./index9.js";
10
- import { useReceivablePaymentRecordsQuery as v } from "./index10.js";
11
- import { useCreateReceivablePaymentRecordMutation as y, useMarkReceivablePaidMutation as b, useMarkReceivableUncollectibleMutation as x } from "./index11.js";
12
- import { useReceivablePdfLinkQuery as S, useReceivableQuery as C, useReceivableRequiredFieldsQuery as w, useReceivablesByIdQueries as T, useReceivablesQuery as E } from "./index12.js";
13
- import { useCancelRecurrenceMutation as D, useCreateOverdueReminderMutation as O, useCreatePaymentReminderMutation as k, useCreateRecurrenceMutation as A, useOverdueRemindersQuery as j, usePauseRecurrenceMutation as M, usePaymentRemindersQuery as N, useRecurrenceQuery as P, useResumeRecurrenceMutation as F, useUpdateRecurrenceMutation as I } from "./index13.js";
14
- import { useReceivablesAnalyticsQuery as L } from "./index14.js";
15
- export { u as useAcceptReceivableMutation, t as useAllReceivableHistoryQuery, d as useCancelReceivableMutation, D as useCancelRecurrenceMutation, f as useCloneReceivableMutation, i as useCreateEntityBankAccountMutation, O as useCreateOverdueReminderMutation, k as useCreatePaymentReminderMutation, p as useCreateReceivableMutation, y as useCreateReceivablePaymentRecordMutation, A as useCreateRecurrenceMutation, m as useDeclineReceivableMutation, s as useDeleteReceivableAttachmentMutation, h as useDeleteReceivableMutation, n as useEntityPaymentMethodsQuery, r as useEntitySettingsQuery, g as useIssueReceivableMutation, b as useMarkReceivablePaidMutation, x as useMarkReceivableUncollectibleMutation, j as useOverdueRemindersQuery, M as usePauseRecurrenceMutation, a as usePaymentAccountQuery, o as usePaymentAccountsQuery, N as usePaymentRemindersQuery, e as usePaymentTermsQuery, v as useReceivablePaymentRecordsQuery, S as useReceivablePdfLinkQuery, C as useReceivableQuery, w as useReceivableRequiredFieldsQuery, L as useReceivablesAnalyticsQuery, T as useReceivablesByIdQueries, E as useReceivablesQuery, P as useRecurrenceQuery, F as useResumeRecurrenceMutation, l as useSendReceivableEmailMutation, _ as useUpdateReceivableMutation, I as useUpdateRecurrenceMutation, c as useUploadReceivableAttachmentMutation };
7
+ import { useCreatePaymentLinkMutation as s } from "./index6.js";
8
+ import { useDeleteReceivableAttachmentMutation as c, useUploadReceivableAttachmentMutation as l } from "./index7.js";
9
+ import { useSendReceivableEmailMutation as u } from "./index9.js";
10
+ import { useAcceptReceivableMutation as d, useCancelReceivableMutation as f, useCloneReceivableMutation as p, useCreateReceivableMutation as m, useDeclineReceivableMutation as h, useDeleteReceivableMutation as g, useIssueReceivableMutation as _, useUpdateReceivableMutation as v } from "./index10.js";
11
+ import { useReceivablePaymentRecordsQuery as y } from "./index11.js";
12
+ import { useCreateReceivablePaymentRecordMutation as b, useMarkReceivablePaidMutation as x, useMarkReceivableUncollectibleMutation as S } from "./index12.js";
13
+ import { useReceivablePdfLinkQuery as C, useReceivableQuery as w, useReceivableRequiredFieldsQuery as T, useReceivablesByIdQueries as E, useReceivablesQuery as D } from "./index13.js";
14
+ import { useCancelRecurrenceMutation as O, useCreateOverdueReminderMutation as k, useCreatePaymentReminderMutation as A, useCreateRecurrenceMutation as j, useOverdueRemindersQuery as M, usePauseRecurrenceMutation as N, usePaymentRemindersQuery as P, useRecurrenceQuery as F, useResumeRecurrenceMutation as I, useUpdateRecurrenceMutation as L } from "./index14.js";
15
+ import { useReceivablesAnalyticsQuery as R } from "./index15.js";
16
+ export { d as useAcceptReceivableMutation, t as useAllReceivableHistoryQuery, f as useCancelReceivableMutation, O as useCancelRecurrenceMutation, p as useCloneReceivableMutation, i as useCreateEntityBankAccountMutation, k as useCreateOverdueReminderMutation, s as useCreatePaymentLinkMutation, A as useCreatePaymentReminderMutation, m as useCreateReceivableMutation, b as useCreateReceivablePaymentRecordMutation, j as useCreateRecurrenceMutation, h as useDeclineReceivableMutation, c as useDeleteReceivableAttachmentMutation, g as useDeleteReceivableMutation, n as useEntityPaymentMethodsQuery, r as useEntitySettingsQuery, _ as useIssueReceivableMutation, x as useMarkReceivablePaidMutation, S as useMarkReceivableUncollectibleMutation, M as useOverdueRemindersQuery, N as usePauseRecurrenceMutation, a as usePaymentAccountQuery, o as usePaymentAccountsQuery, P as usePaymentRemindersQuery, e as usePaymentTermsQuery, y as useReceivablePaymentRecordsQuery, C as useReceivablePdfLinkQuery, w as useReceivableQuery, T as useReceivableRequiredFieldsQuery, R as useReceivablesAnalyticsQuery, E as useReceivablesByIdQueries, D as useReceivablesQuery, F as useRecurrenceQuery, I as useResumeRecurrenceMutation, u as useSendReceivableEmailMutation, v as useUpdateReceivableMutation, L as useUpdateRecurrenceMutation, l as useUploadReceivableAttachmentMutation };
@@ -2,52 +2,181 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getPaymentRecords as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { getPaymentRecordsQueryKey as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
- import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
- import { organizationHeaders as i } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
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";
10
8
  import "../../../shared/data-access/dist/index.js";
11
- import { queryOptions as a, useQuery as o } from "@tanstack/react-query";
9
+ import { invalidateReceivable as u } from "./index8.js";
10
+ import { useMutation as d } from "@tanstack/react-query";
12
11
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js
13
- var s = 100;
14
- function c(c, { enabled: l = !0 } = {}) {
15
- let { client: u, organizationId: d, widgetToken: f, authEpoch: p, organizationStatus: m } = r(), h = i(d), g = {
16
- object_id: c ?? "",
17
- limit: s
18
- }, _ = a({
19
- queryKey: [...t({
20
- client: u,
21
- headers: h,
22
- query: g
23
- }), "all"],
24
- queryFn: async ({ signal: t }) => {
25
- let n = [], r = /* @__PURE__ */ new Set(), i;
26
- do {
27
- let { data: a } = await e({
28
- client: u,
29
- headers: h,
30
- query: {
31
- ...g,
32
- ...i ? { pagination_token: i } : {}
33
- },
34
- signal: t,
35
- throwOnError: !0
36
- });
37
- n.push(...a.data ?? []);
38
- let o = a.next_pagination_token ?? void 0;
39
- i = o && !r.has(o) ? o : void 0, i && r.add(i);
40
- } while (i);
41
- return { data: n };
42
- }
43
- });
44
- return o({
45
- ...n(_, {
46
- authEpoch: p,
47
- organizationStatus: m
48
- }),
49
- enabled: !!(d && f && c) && l
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,
20
+ throwOnError: !0
21
+ });
22
+ return i;
23
+ },
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
+ });
178
+ }
50
179
  });
51
180
  }
52
181
  //#endregion
53
- export { c as useReceivablePaymentRecordsQuery };
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 };
@@ -2,104 +2,52 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postPaymentRecords as e, postReceivablesIdMarkAsPaid as t, postReceivablesIdMarkAsUncollectible as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { invalidateAllClients as r } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
- import { useEmbedApi as i } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { organizationHeaders as a } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
5
+ import { getPaymentRecords as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { getPaymentRecordsQueryKey as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
+ import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
+ import { organizationHeaders as i } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
10
  import "../../../shared/data-access/dist/index.js";
10
- import { paymentRecordsInvalidationKey as o, receivableHistoryInvalidationKey as s, receivableInvalidationKey as c, receivablesAnalyticsInvalidationKey as l, receivablesInvalidationKey as u } from "./index2.js";
11
- import { useMutation as d } from "@tanstack/react-query";
11
+ import { queryOptions as a, useQuery as o } from "@tanstack/react-query";
12
12
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js
13
- async function f({ client: e, organizationId: t, receivableId: n }) {
14
- await Promise.all([
15
- r(u({
16
- client: e,
17
- organizationId: t
18
- })),
19
- r(c({
20
- client: e,
21
- organizationId: t,
22
- receivableId: n
23
- })),
24
- r(s({
25
- client: e,
26
- organizationId: t,
27
- receivableId: n
28
- })),
29
- r(l({
30
- client: e,
31
- organizationId: t
32
- })),
33
- r(o({
34
- client: e,
35
- organizationId: t
36
- }))
37
- ]);
38
- }
39
- function p() {
40
- let { client: e, organizationId: n } = i();
41
- return d({
42
- mutationFn: async ({ path: r, body: i }) => {
43
- let { data: o } = await t({
44
- client: e,
45
- headers: a(n),
46
- path: r,
47
- body: i,
48
- throwOnError: !0
49
- });
50
- return o;
51
- },
52
- onSuccess: async (t, r) => {
53
- await f({
54
- client: e,
55
- organizationId: n,
56
- receivableId: r.path.receivable_id
57
- });
58
- }
59
- });
60
- }
61
- function m() {
62
- let { client: t, organizationId: n } = i();
63
- return d({
64
- mutationFn: async ({ body: r }) => {
65
- let { data: i } = await e({
66
- client: t,
67
- headers: a(n),
68
- body: r,
69
- throwOnError: !0
70
- });
71
- return i;
72
- },
73
- onSuccess: async (e, r) => {
74
- await f({
75
- client: t,
76
- organizationId: n,
77
- receivableId: r.body.object.id
78
- });
13
+ var s = 100;
14
+ function c(c, { enabled: l = !0 } = {}) {
15
+ let { client: u, organizationId: d, widgetToken: f, authEpoch: p, organizationStatus: m } = r(), h = i(d), g = {
16
+ object_id: c ?? "",
17
+ limit: s
18
+ }, _ = a({
19
+ queryKey: [...t({
20
+ client: u,
21
+ headers: h,
22
+ query: g
23
+ }), "all"],
24
+ queryFn: async ({ signal: t }) => {
25
+ let n = [], r = /* @__PURE__ */ new Set(), i;
26
+ do {
27
+ let { data: a } = await e({
28
+ client: u,
29
+ headers: h,
30
+ query: {
31
+ ...g,
32
+ ...i ? { pagination_token: i } : {}
33
+ },
34
+ signal: t,
35
+ throwOnError: !0
36
+ });
37
+ n.push(...a.data ?? []);
38
+ let o = a.next_pagination_token ?? void 0;
39
+ i = o && !r.has(o) ? o : void 0, i && r.add(i);
40
+ } while (i);
41
+ return { data: n };
79
42
  }
80
43
  });
81
- }
82
- function h() {
83
- let { client: e, organizationId: t } = i();
84
- return d({
85
- mutationFn: async ({ path: r, body: i }) => {
86
- let { data: o } = await n({
87
- client: e,
88
- headers: a(t),
89
- path: r,
90
- body: i,
91
- throwOnError: !0
92
- });
93
- return o;
94
- },
95
- onSuccess: async (n, r) => {
96
- await f({
97
- client: e,
98
- organizationId: t,
99
- receivableId: r.path.receivable_id
100
- });
101
- }
44
+ return o({
45
+ ...n(_, {
46
+ authEpoch: p,
47
+ organizationStatus: m
48
+ }),
49
+ enabled: !!(d && f && c) && l
102
50
  });
103
51
  }
104
52
  //#endregion
105
- export { m as useCreateReceivablePaymentRecordMutation, p as useMarkReceivablePaidMutation, h as useMarkReceivableUncollectibleMutation };
53
+ export { c as useReceivablePaymentRecordsQuery };
@@ -2,89 +2,104 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getReceivablesIdOptions as e, getReceivablesIdPdfLinkOptions as t, getReceivablesOptions as n, getReceivablesRequiredFieldsOptions as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
- import { withAuthEpoch as i } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
- import { useEmbedApi as a } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { organizationHeaders as o } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
5
+ import { postPaymentRecords as e, postReceivablesIdMarkAsPaid as t, postReceivablesIdMarkAsUncollectible as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { invalidateAllClients as r } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
+ import { useEmbedApi as i } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as a } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
9
  import "../../../shared/data-access/dist/index.js";
10
- import { useQueries as s, useQuery as c } from "@tanstack/react-query";
10
+ import { paymentRecordsInvalidationKey as o, receivableHistoryInvalidationKey as s, receivableInvalidationKey as c, receivablesAnalyticsInvalidationKey as l, receivablesInvalidationKey as u } from "./index2.js";
11
+ import { useMutation as d } from "@tanstack/react-query";
11
12
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js
12
- function l({ enabled: e, ...t } = {}) {
13
- let { client: r, organizationId: s, widgetToken: l, authEpoch: u, organizationStatus: d } = a(), f = !!(s && l) && (e === !0 || e === void 0), p = n({
14
- client: r,
15
- headers: o(s),
16
- query: t
17
- });
18
- return c({
19
- ...i(p, {
20
- authEpoch: u,
21
- organizationStatus: d
22
- }, { carryWithinOrg: !0 }),
23
- enabled: f
24
- });
25
- }
26
- function u(t, { enabled: n = !0 } = {}) {
27
- let { client: r, organizationId: s, widgetToken: l, authEpoch: u, organizationStatus: d } = a(), f = !!(s && l && t) && n, p = e({
28
- client: r,
29
- headers: o(s),
30
- path: { receivable_id: t ?? "" }
31
- });
32
- return c({
33
- ...i(p, {
34
- authEpoch: u,
35
- organizationStatus: d
36
- }),
37
- enabled: f
38
- });
39
- }
40
- var d = (e) => e.map((e) => e.data);
41
- function f(t, { enabled: n = !0 } = {}) {
42
- let { client: r, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: f } = a(), p = !!(c && l) && n;
43
- return s({
44
- queries: t.map((t) => ({
45
- ...i(e({
46
- client: r,
47
- headers: o(c),
48
- path: { receivable_id: t }
49
- }), {
50
- authEpoch: u,
51
- organizationStatus: f
52
- }),
53
- enabled: p
13
+ async function f({ client: e, organizationId: t, receivableId: n }) {
14
+ await Promise.all([
15
+ r(u({
16
+ client: e,
17
+ organizationId: t
54
18
  })),
55
- combine: d
56
- });
19
+ r(c({
20
+ client: e,
21
+ organizationId: t,
22
+ receivableId: n
23
+ })),
24
+ r(s({
25
+ client: e,
26
+ organizationId: t,
27
+ receivableId: n
28
+ })),
29
+ r(l({
30
+ client: e,
31
+ organizationId: t
32
+ })),
33
+ r(o({
34
+ client: e,
35
+ organizationId: t
36
+ }))
37
+ ]);
57
38
  }
58
- function p({ enabled: e, ...t } = {}) {
59
- let { client: n, organizationId: s, widgetToken: l, authEpoch: u, organizationStatus: d } = a(), f = !!(s && l) && (e === !0 || e === void 0), p = r({
60
- client: n,
61
- headers: o(s),
62
- query: t
63
- });
64
- return c({
65
- ...i(p, {
66
- authEpoch: u,
67
- organizationStatus: d
68
- }),
69
- enabled: f
39
+ function p() {
40
+ let { client: e, organizationId: n } = i();
41
+ return d({
42
+ mutationFn: async ({ path: r, body: i }) => {
43
+ let { data: o } = await t({
44
+ client: e,
45
+ headers: a(n),
46
+ path: r,
47
+ body: i,
48
+ throwOnError: !0
49
+ });
50
+ return o;
51
+ },
52
+ onSuccess: async (t, r) => {
53
+ await f({
54
+ client: e,
55
+ organizationId: n,
56
+ receivableId: r.path.receivable_id
57
+ });
58
+ }
70
59
  });
71
60
  }
72
- var m = 1e3, h = 30;
73
- function g(e, { enabled: n = !0 } = {}) {
74
- let { client: r, organizationId: s, widgetToken: l, authEpoch: u, organizationStatus: d } = a(), f = !!(s && l && e) && n, p = t({
75
- client: r,
76
- headers: o(s),
77
- path: { receivable_id: e ?? "" }
61
+ function m() {
62
+ let { client: t, organizationId: n } = i();
63
+ return d({
64
+ mutationFn: async ({ body: r }) => {
65
+ let { data: i } = await e({
66
+ client: t,
67
+ headers: a(n),
68
+ body: r,
69
+ throwOnError: !0
70
+ });
71
+ return i;
72
+ },
73
+ onSuccess: async (e, r) => {
74
+ await f({
75
+ client: t,
76
+ organizationId: n,
77
+ receivableId: r.body.object.id
78
+ });
79
+ }
78
80
  });
79
- return c({
80
- ...i(p, {
81
- authEpoch: u,
82
- organizationStatus: d
83
- }),
84
- enabled: f,
85
- refetchInterval: ({ state: e }) => e.data?.file_url || e.dataUpdateCount + e.errorUpdateCount > h ? !1 : m,
86
- refetchIntervalInBackground: !0
81
+ }
82
+ function h() {
83
+ let { client: e, organizationId: t } = i();
84
+ return d({
85
+ mutationFn: async ({ path: r, body: i }) => {
86
+ let { data: o } = await n({
87
+ client: e,
88
+ headers: a(t),
89
+ path: r,
90
+ body: i,
91
+ throwOnError: !0
92
+ });
93
+ return o;
94
+ },
95
+ onSuccess: async (n, r) => {
96
+ await f({
97
+ client: e,
98
+ organizationId: t,
99
+ receivableId: r.path.receivable_id
100
+ });
101
+ }
87
102
  });
88
103
  }
89
104
  //#endregion
90
- export { g as useReceivablePdfLinkQuery, u as useReceivableQuery, p as useReceivableRequiredFieldsQuery, f as useReceivablesByIdQueries, l as useReceivablesQuery };
105
+ export { m as useCreateReceivablePaymentRecordMutation, p as useMarkReceivablePaidMutation, h as useMarkReceivableUncollectibleMutation };