@tesouro/embedded-components-react 0.5.272 → 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 (33) hide show
  1. package/README.md +4 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/lib/ReceivablesWidget.d.ts +1 -0
  4. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +10 -9
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +173 -44
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +42 -94
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +91 -76
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +67 -173
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +186 -17
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +27 -0
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +16 -62
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +66 -28
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +28 -34
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +24 -168
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +9 -9
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +47 -44
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +125 -122
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +50 -47
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +3 -3
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +3 -0
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +54 -0
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +41 -41
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +83 -71
  32. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  33. package/package.json +7 -2
@@ -2,195 +2,89 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { patchRecurrencesId as e, postOverdueReminders as t, postPaymentReminders as n, postRecurrences as r, postRecurrencesIdCancel as i, postRecurrencesIdPause as a, postRecurrencesIdResume as o } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { getOverdueRemindersOptions as s, getPaymentRemindersOptions as c, getRecurrencesIdOptions as l } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { withAuthEpoch as u } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
- import { invalidateAllClients as d } from "../../../shared/data-access/dist/lib/clientRegistry.js";
9
- import { useEmbedApi as f } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
- import { organizationHeaders as p } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
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";
11
9
  import "../../../shared/data-access/dist/index.js";
12
- import { overdueRemindersInvalidationKey as m, paymentRemindersInvalidationKey as h, recurrenceInvalidationKey as g, recurrencesInvalidationKey as _ } from "./index2.js";
13
- import { invalidateReceivable as v } from "./index7.js";
14
- import { useMutation as y, useQuery as b } from "@tanstack/react-query";
10
+ import { useQueries as s, useQuery as c } from "@tanstack/react-query";
15
11
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js
16
- function x() {
17
- let e = f();
18
- return {
19
- ...e,
20
- isEnabled: !!(e.organizationId && e.widgetToken)
21
- };
22
- }
23
- function S({ enabled: e = !0 } = {}) {
24
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = c({
25
- client: t,
26
- headers: p(n)
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
27
17
  });
28
- return b({
29
- ...u(o, {
30
- authEpoch: r,
31
- organizationStatus: i
32
- }),
33
- enabled: a && e
18
+ return c({
19
+ ...i(p, {
20
+ authEpoch: u,
21
+ organizationStatus: d
22
+ }, { carryWithinOrg: !0 }),
23
+ enabled: f
34
24
  });
35
25
  }
36
- function C({ enabled: e = !0 } = {}) {
37
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = s({
38
- client: t,
39
- headers: p(n)
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 ?? "" }
40
31
  });
41
- return b({
42
- ...u(o, {
43
- authEpoch: r,
44
- organizationStatus: i
32
+ return c({
33
+ ...i(p, {
34
+ authEpoch: u,
35
+ organizationStatus: d
45
36
  }),
46
- enabled: a && e
47
- });
48
- }
49
- function w() {
50
- let { client: e, organizationId: t } = f();
51
- return y({
52
- mutationFn: async ({ body: r }) => {
53
- let { data: i } = await n({
54
- client: e,
55
- headers: p(t),
56
- body: r,
57
- throwOnError: !0
58
- });
59
- return i;
60
- },
61
- onSuccess: async () => {
62
- await d(h({
63
- client: e,
64
- organizationId: t
65
- }));
66
- }
37
+ enabled: f
67
38
  });
68
39
  }
69
- function T() {
70
- let { client: e, organizationId: n } = f();
71
- return y({
72
- mutationFn: async ({ body: r }) => {
73
- let { data: i } = await t({
74
- client: e,
75
- headers: p(n),
76
- body: r,
77
- throwOnError: !0
78
- });
79
- return i;
80
- },
81
- onSuccess: async () => {
82
- await d(m({
83
- client: e,
84
- organizationId: n
85
- }));
86
- }
87
- });
88
- }
89
- async function E({ client: e, organizationId: t, recurrenceId: n, receivableId: r }) {
90
- await Promise.all([
91
- d(_({
92
- client: e,
93
- organizationId: t
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
94
54
  })),
95
- ...n ? [d(g({
96
- client: e,
97
- organizationId: t,
98
- recurrenceId: n
99
- }))] : [],
100
- v({
101
- client: e,
102
- organizationId: t,
103
- receivableId: r
104
- })
105
- ]);
55
+ combine: d
56
+ });
106
57
  }
107
- function D(e) {
108
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = l({
109
- client: t,
110
- headers: p(n),
111
- path: { recurrence_id: e ?? "" }
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
112
63
  });
113
- return b({
114
- ...u(o, {
115
- authEpoch: r,
116
- organizationStatus: i
64
+ return c({
65
+ ...i(p, {
66
+ authEpoch: u,
67
+ organizationStatus: d
117
68
  }),
118
- enabled: a && !!e
69
+ enabled: f
119
70
  });
120
71
  }
121
- function O() {
122
- let { client: e, organizationId: t } = f();
123
- return y({
124
- mutationFn: async ({ body: n }) => {
125
- let { data: i } = await r({
126
- client: e,
127
- headers: p(t),
128
- body: n,
129
- throwOnError: !0
130
- });
131
- return i;
132
- },
133
- onSuccess: async (n, r) => {
134
- await E({
135
- client: e,
136
- organizationId: t,
137
- receivableId: r.body.invoice_id
138
- });
139
- }
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 ?? "" }
140
78
  });
141
- }
142
- function k() {
143
- let { client: t, organizationId: n } = f();
144
- return y({
145
- mutationFn: async ({ path: r, body: i }) => {
146
- let { data: a } = await e({
147
- client: t,
148
- headers: p(n),
149
- path: r,
150
- body: i,
151
- throwOnError: !0
152
- });
153
- return a;
154
- },
155
- onSuccess: async (e, r) => {
156
- await E({
157
- client: t,
158
- organizationId: n,
159
- recurrenceId: r.path.recurrence_id
160
- });
161
- }
162
- });
163
- }
164
- function A(e) {
165
- let { client: t, organizationId: n } = f();
166
- return y({
167
- mutationFn: async ({ path: r }) => {
168
- let { data: i } = await e({
169
- client: t,
170
- headers: p(n),
171
- path: r,
172
- throwOnError: !0
173
- });
174
- return i;
175
- },
176
- onSuccess: async (e, r) => {
177
- await E({
178
- client: t,
179
- organizationId: n,
180
- recurrenceId: r.path.recurrence_id,
181
- receivableId: r.receivableId
182
- });
183
- }
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
184
87
  });
185
88
  }
186
- function j() {
187
- return A(i);
188
- }
189
- function M() {
190
- return A(a);
191
- }
192
- function N() {
193
- return A(o);
194
- }
195
89
  //#endregion
196
- export { j as useCancelRecurrenceMutation, T as useCreateOverdueReminderMutation, w as useCreatePaymentReminderMutation, O as useCreateRecurrenceMutation, C as useOverdueRemindersQuery, M as usePauseRecurrenceMutation, S as usePaymentRemindersQuery, D as useRecurrenceQuery, N as useResumeRecurrenceMutation, k as useUpdateRecurrenceMutation };
90
+ export { g as useReceivablePdfLinkQuery, u as useReceivableQuery, p as useReceivableRequiredFieldsQuery, f as useReceivablesByIdQueries, l as useReceivablesQuery };
@@ -2,26 +2,195 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getAnalyticsReceivablesOptions as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
- import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.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";
5
+ import { patchRecurrencesId as e, postOverdueReminders as t, postPaymentReminders as n, postRecurrences as r, postRecurrencesIdCancel as i, postRecurrencesIdPause as a, postRecurrencesIdResume as o } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { getOverdueRemindersOptions as s, getPaymentRemindersOptions as c, getRecurrencesIdOptions as l } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpoch as u } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
+ import { invalidateAllClients as d } from "../../../shared/data-access/dist/lib/clientRegistry.js";
9
+ import { useEmbedApi as f } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
+ import { organizationHeaders as p } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
11
  import "../../../shared/data-access/dist/index.js";
10
- import { useQuery as i } from "@tanstack/react-query";
12
+ import { overdueRemindersInvalidationKey as m, paymentRemindersInvalidationKey as h, recurrenceInvalidationKey as g, recurrencesInvalidationKey as _ } from "./index2.js";
13
+ import { invalidateReceivable as v } from "./index8.js";
14
+ import { useMutation as y, useQuery as b } from "@tanstack/react-query";
11
15
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js
12
- function a({ enabled: a = !0, ...o }) {
13
- let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = !!(c && l) && a, p = e({
14
- client: s,
15
- headers: r(c),
16
- query: o
17
- });
18
- return i({
19
- ...t(p, {
20
- authEpoch: u,
21
- organizationStatus: d
16
+ function x() {
17
+ let e = f();
18
+ return {
19
+ ...e,
20
+ isEnabled: !!(e.organizationId && e.widgetToken)
21
+ };
22
+ }
23
+ function S({ enabled: e = !0 } = {}) {
24
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = c({
25
+ client: t,
26
+ headers: p(n)
27
+ });
28
+ return b({
29
+ ...u(o, {
30
+ authEpoch: r,
31
+ organizationStatus: i
32
+ }),
33
+ enabled: a && e
34
+ });
35
+ }
36
+ function C({ enabled: e = !0 } = {}) {
37
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = s({
38
+ client: t,
39
+ headers: p(n)
40
+ });
41
+ return b({
42
+ ...u(o, {
43
+ authEpoch: r,
44
+ organizationStatus: i
45
+ }),
46
+ enabled: a && e
47
+ });
48
+ }
49
+ function w() {
50
+ let { client: e, organizationId: t } = f();
51
+ return y({
52
+ mutationFn: async ({ body: r }) => {
53
+ let { data: i } = await n({
54
+ client: e,
55
+ headers: p(t),
56
+ body: r,
57
+ throwOnError: !0
58
+ });
59
+ return i;
60
+ },
61
+ onSuccess: async () => {
62
+ await d(h({
63
+ client: e,
64
+ organizationId: t
65
+ }));
66
+ }
67
+ });
68
+ }
69
+ function T() {
70
+ let { client: e, organizationId: n } = f();
71
+ return y({
72
+ mutationFn: async ({ body: r }) => {
73
+ let { data: i } = await t({
74
+ client: e,
75
+ headers: p(n),
76
+ body: r,
77
+ throwOnError: !0
78
+ });
79
+ return i;
80
+ },
81
+ onSuccess: async () => {
82
+ await d(m({
83
+ client: e,
84
+ organizationId: n
85
+ }));
86
+ }
87
+ });
88
+ }
89
+ async function E({ client: e, organizationId: t, recurrenceId: n, receivableId: r }) {
90
+ await Promise.all([
91
+ d(_({
92
+ client: e,
93
+ organizationId: t
94
+ })),
95
+ ...n ? [d(g({
96
+ client: e,
97
+ organizationId: t,
98
+ recurrenceId: n
99
+ }))] : [],
100
+ v({
101
+ client: e,
102
+ organizationId: t,
103
+ receivableId: r
104
+ })
105
+ ]);
106
+ }
107
+ function D(e) {
108
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = x(), o = l({
109
+ client: t,
110
+ headers: p(n),
111
+ path: { recurrence_id: e ?? "" }
112
+ });
113
+ return b({
114
+ ...u(o, {
115
+ authEpoch: r,
116
+ organizationStatus: i
22
117
  }),
23
- enabled: f
118
+ enabled: a && !!e
119
+ });
120
+ }
121
+ function O() {
122
+ let { client: e, organizationId: t } = f();
123
+ return y({
124
+ mutationFn: async ({ body: n }) => {
125
+ let { data: i } = await r({
126
+ client: e,
127
+ headers: p(t),
128
+ body: n,
129
+ throwOnError: !0
130
+ });
131
+ return i;
132
+ },
133
+ onSuccess: async (n, r) => {
134
+ await E({
135
+ client: e,
136
+ organizationId: t,
137
+ receivableId: r.body.invoice_id
138
+ });
139
+ }
140
+ });
141
+ }
142
+ function k() {
143
+ let { client: t, organizationId: n } = f();
144
+ return y({
145
+ mutationFn: async ({ path: r, body: i }) => {
146
+ let { data: a } = await e({
147
+ client: t,
148
+ headers: p(n),
149
+ path: r,
150
+ body: i,
151
+ throwOnError: !0
152
+ });
153
+ return a;
154
+ },
155
+ onSuccess: async (e, r) => {
156
+ await E({
157
+ client: t,
158
+ organizationId: n,
159
+ recurrenceId: r.path.recurrence_id
160
+ });
161
+ }
162
+ });
163
+ }
164
+ function A(e) {
165
+ let { client: t, organizationId: n } = f();
166
+ return y({
167
+ mutationFn: async ({ path: r }) => {
168
+ let { data: i } = await e({
169
+ client: t,
170
+ headers: p(n),
171
+ path: r,
172
+ throwOnError: !0
173
+ });
174
+ return i;
175
+ },
176
+ onSuccess: async (e, r) => {
177
+ await E({
178
+ client: t,
179
+ organizationId: n,
180
+ recurrenceId: r.path.recurrence_id,
181
+ receivableId: r.receivableId
182
+ });
183
+ }
24
184
  });
25
185
  }
186
+ function j() {
187
+ return A(i);
188
+ }
189
+ function M() {
190
+ return A(a);
191
+ }
192
+ function N() {
193
+ return A(o);
194
+ }
26
195
  //#endregion
27
- export { a as useReceivablesAnalyticsQuery };
196
+ export { j as useCancelRecurrenceMutation, T as useCreateOverdueReminderMutation, w as useCreatePaymentReminderMutation, O as useCreateRecurrenceMutation, C as useOverdueRemindersQuery, M as usePauseRecurrenceMutation, S as usePaymentRemindersQuery, D as useRecurrenceQuery, N as useResumeRecurrenceMutation, k as useUpdateRecurrenceMutation };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getAnalyticsReceivablesOptions as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.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";
9
+ import "../../../shared/data-access/dist/index.js";
10
+ import { useQuery as i } from "@tanstack/react-query";
11
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js
12
+ function a({ enabled: a = !0, ...o }) {
13
+ let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = !!(c && l) && a, p = e({
14
+ client: s,
15
+ headers: r(c),
16
+ query: o
17
+ });
18
+ return i({
19
+ ...t(p, {
20
+ authEpoch: u,
21
+ organizationStatus: d
22
+ }),
23
+ enabled: f
24
+ });
25
+ }
26
+ //#endregion
27
+ export { a as useReceivablesAnalyticsQuery };
@@ -2,69 +2,23 @@
2
2
  "use client";
3
3
  "use client";
4
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";
5
+ import { postPaymentLinks as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import { organizationHeaders as n } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
8
  import "../../../shared/data-access/dist/index.js";
10
- import { receivableAttachmentsInvalidationKey as a, receivableInvalidationKey as o } from "./index2.js";
11
- import { useMutation as s } from "@tanstack/react-query";
9
+ import { useMutation as r } from "@tanstack/react-query";
12
10
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js
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
- });
11
+ function i() {
12
+ let { client: i, organizationId: a } = t();
13
+ return r({ mutationFn: async ({ body: t }) => {
14
+ let { data: r } = await e({
15
+ client: i,
16
+ headers: n(a),
17
+ body: t,
18
+ throwOnError: !0
19
+ });
20
+ return r;
21
+ } });
68
22
  }
69
23
  //#endregion
70
- export { d as useDeleteReceivableAttachmentMutation, u as useUploadReceivableAttachmentMutation };
24
+ export { i as useCreatePaymentLinkMutation };