@tesouro/embedded-components-react 0.5.293 → 0.5.294

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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +26 -1
  3. package/dist/lib/CounterpartsWidget.d.ts +2 -0
  4. package/dist/lib/CounterpartsWidgetPublic.d.ts +2 -0
  5. package/dist/lib/CustomersWidget.d.ts +2 -0
  6. package/dist/lib/ReceivablesWidget.d.ts +26 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +3 -2
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +5 -88
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +70 -173
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +210 -17
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index17.js +29 -0
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +6 -7
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +142 -141
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +84 -54
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +21 -3
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +27 -27
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +2 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +13 -10
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +84 -80
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +32 -30
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +417 -414
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +83 -66
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +133 -129
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +26 -22
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js +16 -0
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +20 -22
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +2 -2
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +1 -1
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +91 -85
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +1 -0
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +119 -88
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +19 -16
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +130 -96
  41. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +24 -8
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -0
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +101 -98
  44. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +34 -20
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +4 -3
  47. package/dist/packages/shared-ui-shadcn/dist/index.js +15 -10
  48. package/package.json +1 -1
@@ -2,26 +2,219 @@
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 "./index9.js";
14
+ import { REFETCH_ON_RETURN as y } from "./index14.js";
15
+ import { useMutation as b, useQueries as x, useQuery as S } from "@tanstack/react-query";
11
16
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.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
17
+ function C() {
18
+ let e = f();
19
+ return {
20
+ ...e,
21
+ isEnabled: !!(e.organizationId && e.widgetToken)
22
+ };
23
+ }
24
+ function w({ enabled: e = !0 } = {}) {
25
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = C(), o = c({
26
+ client: t,
27
+ headers: p(n)
28
+ });
29
+ return S({
30
+ ...u(o, {
31
+ authEpoch: r,
32
+ organizationStatus: i
33
+ }),
34
+ enabled: a && e
35
+ });
36
+ }
37
+ function T({ enabled: e = !0 } = {}) {
38
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = C(), o = s({
39
+ client: t,
40
+ headers: p(n)
41
+ });
42
+ return S({
43
+ ...u(o, {
44
+ authEpoch: r,
45
+ organizationStatus: i
46
+ }),
47
+ enabled: a && e
48
+ });
49
+ }
50
+ function E() {
51
+ let { client: e, organizationId: t } = f();
52
+ return b({
53
+ mutationFn: async ({ body: r }) => {
54
+ let { data: i } = await n({
55
+ client: e,
56
+ headers: p(t),
57
+ body: r,
58
+ throwOnError: !0
59
+ });
60
+ return i;
61
+ },
62
+ onSuccess: async () => {
63
+ await d(h({
64
+ client: e,
65
+ organizationId: t
66
+ }));
67
+ }
68
+ });
69
+ }
70
+ function D() {
71
+ let { client: e, organizationId: n } = f();
72
+ return b({
73
+ mutationFn: async ({ body: r }) => {
74
+ let { data: i } = await t({
75
+ client: e,
76
+ headers: p(n),
77
+ body: r,
78
+ throwOnError: !0
79
+ });
80
+ return i;
81
+ },
82
+ onSuccess: async () => {
83
+ await d(m({
84
+ client: e,
85
+ organizationId: n
86
+ }));
87
+ }
88
+ });
89
+ }
90
+ async function O({ client: e, organizationId: t, recurrenceId: n, receivableId: r }) {
91
+ await Promise.all([
92
+ d(_({
93
+ client: e,
94
+ organizationId: t
95
+ })),
96
+ ...n ? [d(g({
97
+ client: e,
98
+ organizationId: t,
99
+ recurrenceId: n
100
+ }))] : [],
101
+ v({
102
+ client: e,
103
+ organizationId: t,
104
+ receivableId: r
105
+ })
106
+ ]);
107
+ }
108
+ function k(e) {
109
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = C(), o = l({
110
+ client: t,
111
+ headers: p(n),
112
+ path: { recurrence_id: e ?? "" }
113
+ });
114
+ return S({
115
+ ...u(o, {
116
+ authEpoch: r,
117
+ organizationStatus: i
22
118
  }),
23
- enabled: f
119
+ ...y,
120
+ enabled: a && !!e
121
+ });
122
+ }
123
+ var A = (e) => e.map(({ data: e, isLoading: t }) => ({
124
+ data: e,
125
+ isLoading: t
126
+ }));
127
+ function j(e, { enabled: t = !0 } = {}) {
128
+ let { client: n, organizationId: r, authEpoch: i, organizationStatus: a, isEnabled: o } = C();
129
+ return x({
130
+ queries: e.map((e) => ({
131
+ ...u(l({
132
+ client: n,
133
+ headers: p(r),
134
+ path: { recurrence_id: e }
135
+ }), {
136
+ authEpoch: i,
137
+ organizationStatus: a
138
+ }),
139
+ ...y,
140
+ enabled: o && t
141
+ })),
142
+ combine: A
24
143
  });
25
144
  }
145
+ function M() {
146
+ let { client: e, organizationId: t } = f();
147
+ return b({
148
+ mutationFn: async ({ body: n }) => {
149
+ let { data: i } = await r({
150
+ client: e,
151
+ headers: p(t),
152
+ body: n,
153
+ throwOnError: !0
154
+ });
155
+ return i;
156
+ },
157
+ onSuccess: async (n, r) => {
158
+ await O({
159
+ client: e,
160
+ organizationId: t,
161
+ receivableId: r.body.invoice_id
162
+ });
163
+ }
164
+ });
165
+ }
166
+ function N() {
167
+ let { client: t, organizationId: n } = f();
168
+ return b({
169
+ mutationFn: async ({ path: r, body: i }) => {
170
+ let { data: a } = await e({
171
+ client: t,
172
+ headers: p(n),
173
+ path: r,
174
+ body: i,
175
+ throwOnError: !0
176
+ });
177
+ return a;
178
+ },
179
+ onSuccess: async (e, r) => {
180
+ await O({
181
+ client: t,
182
+ organizationId: n,
183
+ recurrenceId: r.path.recurrence_id
184
+ });
185
+ }
186
+ });
187
+ }
188
+ function P(e) {
189
+ let { client: t, organizationId: n } = f();
190
+ return b({
191
+ mutationFn: async ({ path: r }) => {
192
+ let { data: i } = await e({
193
+ client: t,
194
+ headers: p(n),
195
+ path: r,
196
+ throwOnError: !0
197
+ });
198
+ return i;
199
+ },
200
+ onSuccess: async (e, r) => {
201
+ await O({
202
+ client: t,
203
+ organizationId: n,
204
+ recurrenceId: r.path.recurrence_id,
205
+ receivableId: r.receivableId
206
+ });
207
+ }
208
+ });
209
+ }
210
+ function F() {
211
+ return P(i);
212
+ }
213
+ function I() {
214
+ return P(a);
215
+ }
216
+ function L() {
217
+ return P(o);
218
+ }
26
219
  //#endregion
27
- export { a as useReceivablesAnalyticsQuery };
220
+ export { F as useCancelRecurrenceMutation, D as useCreateOverdueReminderMutation, E as useCreatePaymentReminderMutation, M as useCreateRecurrenceMutation, T as useOverdueRemindersQuery, I as usePauseRecurrenceMutation, w as usePaymentRemindersQuery, k as useRecurrenceQuery, j as useRecurrencesByIdQueries, L as useResumeRecurrenceMutation, N as useUpdateRecurrenceMutation };
@@ -0,0 +1,29 @@
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 { REFETCH_ON_RETURN as i } from "./index14.js";
11
+ import { useQuery as a } from "@tanstack/react-query";
12
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index17.js
13
+ function o({ enabled: o = !0, ...s }) {
14
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = !!(l && u) && o, m = e({
15
+ client: c,
16
+ headers: r(l),
17
+ query: s
18
+ });
19
+ return a({
20
+ ...t(m, {
21
+ authEpoch: d,
22
+ organizationStatus: f
23
+ }),
24
+ ...i,
25
+ enabled: p
26
+ });
27
+ }
28
+ //#endregion
29
+ export { o as useReceivablesAnalyticsQuery };
@@ -98,7 +98,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
98
98
  lineItemControls: Z.form.lineItemControls,
99
99
  autoFocusLineItemId: Z.form.autoFocusLineItemId,
100
100
  lineItemsLoading: Z.form.lineItemsLoading,
101
- inProgress: Z.form.isSubmitting || Z.actionsSuspended,
101
+ inProgress: Z.form.fieldsDisabled || Z.actionsSuspended,
102
102
  customerSection: /* @__PURE__ */ O(ne, {
103
103
  idPrefix: Q,
104
104
  customerId: Z.form.values.customerId,
@@ -109,7 +109,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
109
109
  customerEmailError: Z.form.errors.customerEmail,
110
110
  canCreate: Z.canCreateCustomer,
111
111
  messages: Z.messages,
112
- disabled: Z.form.isSubmitting,
112
+ disabled: Z.form.fieldsDisabled,
113
113
  onCustomerSelect: (e) => Z.form.updateValues({ customerId: e }),
114
114
  onCustomerNameChange: (e) => Z.form.updateValues({ customerName: e }),
115
115
  onCustomerEmailChange: (e) => Z.form.updateValues({ customerEmail: e }),
@@ -148,7 +148,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
148
148
  idPrefix: se,
149
149
  paymentTerms: Z.form.paymentTerms.view,
150
150
  paymentTermsError: Z.form.errors.paymentTermsId,
151
- disabled: Z.form.isSubmitting,
151
+ disabled: Z.form.fieldsDisabled,
152
152
  onPaymentTermsChange: Z.form.paymentTerms.select,
153
153
  onCustomDatePickerOpenChange: Z.form.paymentTerms.changeCustomDatePickerOpen,
154
154
  purchaseOrder: Z.form.purchaseOrder,
@@ -162,7 +162,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
162
162
  recurrenceSection: Z.form.showRecurrenceSection && (Z.form.recurrenceLoading ? /* @__PURE__ */ O(t, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ O(b, {
163
163
  idPrefix: $,
164
164
  view: Z.form.recurrence.view,
165
- disabled: Z.form.isSubmitting,
165
+ disabled: Z.form.fieldsDisabled,
166
166
  onFrequencyChange: Z.form.recurrence.changeFrequency,
167
167
  onMonthDayChange: Z.form.recurrence.changeMonthDay,
168
168
  onWeekdayChange: Z.form.recurrence.changeWeekday,
@@ -202,7 +202,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
202
202
  idPrefix: ce,
203
203
  view: Z.form.bankAccount.view,
204
204
  error: Z.form.errors.bankAccountId,
205
- disabled: Z.form.isSubmitting,
205
+ disabled: Z.form.fieldsDisabled,
206
206
  onAccountSelect: Z.form.bankAccount.selectAccount,
207
207
  onAddAccountClick: Z.form.bankAccount.openAddAccount,
208
208
  onFormChange: Z.form.bankAccount.updateAccountForm,
@@ -212,7 +212,7 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
212
212
  }),
213
213
  attachmentsSection: Z.form.attachmentsView && /* @__PURE__ */ O(te, {
214
214
  view: Z.form.attachmentsView,
215
- disabled: Z.form.isSubmitting,
215
+ disabled: Z.form.fieldsDisabled,
216
216
  onFilesSelect: Z.form.selectAttachmentFiles,
217
217
  onIncludeInEmailChange: Z.form.setAttachmentIncludeInEmail,
218
218
  onRemove: Z.form.removeAttachment,
@@ -291,7 +291,6 @@ function A({ auditHistoryLabels: i, bankAttribution: c, counterpartFormLabels: A
291
291
  cancelLabel: Z.actions.actionDialog.cancelLabel,
292
292
  cancelVariant: Z.actions.actionDialog.cancelVariant,
293
293
  destructive: Z.actions.actionDialog.destructive,
294
- error: Z.actions.actionError,
295
294
  inProgress: Z.actions.actionInProgress || Z.actionsSuspended,
296
295
  comment: Z.actions.actionComment,
297
296
  onCommentChange: Z.actions.setActionComment,