@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
@@ -2,164 +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 } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { getOverdueRemindersOptions as i, getPaymentRemindersOptions as a, getRecurrencesIdOptions as o } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { withAuthEpoch as s } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
- import { invalidateAllClients as c } from "../../../shared/data-access/dist/lib/clientRegistry.js";
9
- import { useEmbedApi as l } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
- import { organizationHeaders as u } 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 d, paymentRemindersInvalidationKey as f, recurrenceInvalidationKey as p, recurrencesInvalidationKey as m } from "./index2.js";
13
- import { invalidateReceivable as h } from "./index5.js";
14
- import { useMutation as g, useQuery as _ } 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/index11.js
16
- function v() {
17
- let e = l();
18
- return {
19
- ...e,
20
- isEnabled: !!(e.organizationId && e.widgetToken)
21
- };
22
- }
23
- function y({ enabled: e = !0 } = {}) {
24
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: o } = v(), c = a({
25
- client: t,
26
- headers: u(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 _({
29
- ...s(c, {
30
- authEpoch: r,
31
- organizationStatus: i
32
- }),
33
- enabled: o && 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 b({ enabled: e = !0 } = {}) {
37
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: a, isEnabled: o } = v(), c = i({
38
- client: t,
39
- headers: u(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 _({
42
- ...s(c, {
43
- authEpoch: r,
44
- organizationStatus: a
32
+ return c({
33
+ ...i(p, {
34
+ authEpoch: u,
35
+ organizationStatus: d
45
36
  }),
46
- enabled: o && e
37
+ enabled: f
47
38
  });
48
39
  }
49
- function x() {
50
- let { client: e, organizationId: t } = l();
51
- return g({
52
- mutationFn: async ({ body: r }) => {
53
- let { data: i } = await n({
54
- client: e,
55
- headers: u(t),
56
- body: r,
57
- throwOnError: !0
58
- });
59
- return i;
60
- },
61
- onSuccess: async () => {
62
- await c(f({
63
- client: e,
64
- organizationId: t
65
- }));
66
- }
67
- });
68
- }
69
- function S() {
70
- let { client: e, organizationId: n } = l();
71
- return g({
72
- mutationFn: async ({ body: r }) => {
73
- let { data: i } = await t({
74
- client: e,
75
- headers: u(n),
76
- body: r,
77
- throwOnError: !0
78
- });
79
- return i;
80
- },
81
- onSuccess: async () => {
82
- await c(d({
83
- client: e,
84
- organizationId: n
85
- }));
86
- }
87
- });
88
- }
89
- async function C({ client: e, organizationId: t, recurrenceId: n, receivableId: r }) {
90
- await Promise.all([
91
- c(m({
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 ? [c(p({
96
- client: e,
97
- organizationId: t,
98
- recurrenceId: n
99
- }))] : [],
100
- h({
101
- client: e,
102
- organizationId: t,
103
- receivableId: r
104
- })
105
- ]);
55
+ combine: d
56
+ });
106
57
  }
107
- function w(e) {
108
- let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = v(), c = o({
109
- client: t,
110
- headers: u(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 _({
114
- ...s(c, {
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 T() {
122
- let { client: e, organizationId: t } = l();
123
- return g({
124
- mutationFn: async ({ body: n }) => {
125
- let { data: i } = await r({
126
- client: e,
127
- headers: u(t),
128
- body: n,
129
- throwOnError: !0
130
- });
131
- return i;
132
- },
133
- onSuccess: async (n, r) => {
134
- await C({
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 E() {
143
- let { client: t, organizationId: n } = l();
144
- return g({
145
- mutationFn: async ({ path: r, body: i }) => {
146
- let { data: a } = await e({
147
- client: t,
148
- headers: u(n),
149
- path: r,
150
- body: i,
151
- throwOnError: !0
152
- });
153
- return a;
154
- },
155
- onSuccess: async (e, r) => {
156
- await C({
157
- client: t,
158
- organizationId: n,
159
- recurrenceId: r.path.recurrence_id
160
- });
161
- }
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
162
87
  });
163
88
  }
164
89
  //#endregion
165
- export { S as useCreateOverdueReminderMutation, x as useCreatePaymentReminderMutation, T as useCreateRecurrenceMutation, b as useOverdueRemindersQuery, y as usePaymentRemindersQuery, w as useRecurrenceQuery, E 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 "./index6.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/index12.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/index13.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,84 +2,55 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postBankDetails as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { getBankDetailsOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { OrganizationStatus as n } from "../../../shared/data-access/dist/lib/organizationStatus.js";
8
- import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
- import { invalidateAllClients as i } from "../../../shared/data-access/dist/lib/clientRegistry.js";
10
- import { useEmbedApi as a } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
11
- import { organizationHeaders as o } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
12
- import { useAllBankAccountsQuery as s } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
13
- import { useAllExternalBankAccountsQuery as c } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
5
+ import { getReceivablesIdHistory as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { getReceivablesIdHistoryQueryKey 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";
14
10
  import "../../../shared/data-access/dist/index.js";
15
- import { entityBankAccountsInvalidationKey as l } from "./index2.js";
16
- import { useMemo as u } from "react";
17
- import { useMutation as d, useQuery as f } from "@tanstack/react-query";
11
+ import { queryOptions as a, useQuery as o } from "@tanstack/react-query";
18
12
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js
19
- function p({ enabled: e = !0 } = {}) {
20
- let { client: n, organizationId: i, widgetToken: s, authEpoch: c, organizationStatus: l } = a(), u = t({
21
- client: n,
22
- headers: o(i)
13
+ var s = {
14
+ limit: 100,
15
+ sort: "timestamp",
16
+ order: "desc"
17
+ };
18
+ function c(c, { enabled: l = !0 } = {}) {
19
+ let { client: u, organizationId: d, widgetToken: f, authEpoch: p, organizationStatus: m } = r(), h = i(d), g = { receivable_id: c ?? "" }, _ = a({
20
+ queryKey: [...t({
21
+ client: u,
22
+ headers: h,
23
+ path: g,
24
+ query: s
25
+ }), "all"],
26
+ queryFn: async ({ signal: t }) => {
27
+ let n = [], r = /* @__PURE__ */ new Set(), i;
28
+ do {
29
+ let { data: a } = await e({
30
+ client: u,
31
+ headers: h,
32
+ path: g,
33
+ query: {
34
+ ...s,
35
+ ...i ? { pagination_token: i } : {}
36
+ },
37
+ signal: t,
38
+ throwOnError: !0
39
+ });
40
+ n.push(...a.data ?? []);
41
+ let o = a.next_pagination_token ?? void 0;
42
+ i = o && !r.has(o) ? o : void 0, i && r.add(i);
43
+ } while (i);
44
+ return { data: n };
45
+ }
23
46
  });
24
- return f({
25
- ...r(u, {
26
- authEpoch: c,
27
- organizationStatus: l
47
+ return o({
48
+ ...n(_, {
49
+ authEpoch: p,
50
+ organizationStatus: m
28
51
  }),
29
- enabled: e && !!(i && s)
52
+ enabled: !!(d && f && c) && l
30
53
  });
31
54
  }
32
- function m() {
33
- let { client: t, organizationId: n } = a();
34
- return d({
35
- mutationFn: async ({ body: r }) => {
36
- let { data: i } = await e({
37
- client: t,
38
- headers: o(n),
39
- body: r,
40
- throwOnError: !0
41
- });
42
- return i;
43
- },
44
- onSuccess: async () => {
45
- await i(l({
46
- client: t,
47
- organizationId: n
48
- }));
49
- }
50
- });
51
- }
52
- var h = (e) => e ? e.slice(-4) : null;
53
- function g({ enabled: e = !0, canReadEmbedded: t = !1, canReadExternal: r = !1 } = {}) {
54
- let { organizationId: i, widgetToken: o, organizationStatus: l } = a(), d = l === n.Rotating, f = e && !!(o && (i || d)), m = f && t, g = f && r, _ = p({ enabled: e }), v = s({ enabled: m }), y = c({ enabled: g }), b = f ? _.data?.data : void 0, x = m ? v.data?.data : void 0, S = g ? y.data?.data : void 0, C = u(() => [
55
- ...(b ?? []).map((e) => ({
56
- id: e.id,
57
- type: "BANK_DETAILS",
58
- displayName: e.display_name ?? null,
59
- accountNumberLast4: h(e.account_number) ?? e.account_number_last4 ?? null
60
- })),
61
- ...(x ?? []).filter((e) => e.status === "ACTIVE").map((e) => ({
62
- id: e.id,
63
- type: "INTERNAL",
64
- displayName: e.nickname ?? null,
65
- accountNumberLast4: h(e.accountNumber)
66
- })),
67
- ...(S ?? []).filter((e) => e.accountStatus === "ACTIVE" && e.verificationStatus === "VERIFIED").map((e) => ({
68
- id: e.id,
69
- type: "EXTERNAL",
70
- displayName: e.nickname || e.nameOnAccount || null,
71
- accountNumberLast4: h(e.accountNumber)
72
- }))
73
- ], [
74
- b,
75
- x,
76
- S
77
- ]), w = f && _.isLoading || m && v.isLoading || g && y.isLoading;
78
- return {
79
- paymentAccounts: C,
80
- isLoading: w,
81
- isIncomplete: w || f && d || f && (_.isFetching || _.isError) || m && (v.isFetching || v.isError || v.hasNextPage) || g && (y.isFetching || y.isError || y.hasNextPage) || !!(f && _.data?.next_pagination_token)
82
- };
83
- }
84
55
  //#endregion
85
- export { m as useCreateEntityBankAccountMutation, p as useEntityBankAccountsQuery, g as usePaymentAccountsQuery };
56
+ export { c as useAllReceivableHistoryQuery };