@tesouro/embedded-components-react 0.5.246 → 0.5.248

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.
package/README.md CHANGED
@@ -505,32 +505,33 @@ Lists, creates, edits and acts on an organization's invoices, quotes and credit
505
505
 
506
506
  #### Props
507
507
 
508
- | Prop | Type | Default | Description |
509
- | -------------------------- | ---------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
510
- | `defaultTab` | `ReceivablesWidgetTab` | `'invoices'` | Initial tab; if omitted or disabled, the widget starts on the first enabled tab. |
511
- | `enabledTabs` | `ReceivablesWidgetTab[]` | `['invoices', 'quotes', 'credit_notes']` | Tabs visible to the user. Duplicate or unknown values are ignored. |
512
- | `initialCounterpartId` | `string` | `undefined` | Opens the invoice list filtered to this customer, with a chip naming them. Clear all removes it. |
513
- | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices. The first page loads with a page size of `10`. |
514
- | `onReceivableCreated` | `(id: string, type: ReceivableDocumentType) => void` | `undefined` | Called after a create or clone succeeds. |
515
- | `onReceivableOpened` | `(id: string, type: ReceivableDocumentType) => void` | `undefined` | Called when the user opens a row's details panel. |
516
- | `onTemplateSettingsClick` | `() => void` | `undefined` | Shows a template settings action in the header and calls this handler when clicked. |
517
- | `embeddedBankName` | `string` | `undefined` | Sponsor bank name shown as "Powered by {embeddedBankName}" next to embedded accounts in the invoice payment-account picker. Omitted when unset. |
518
- | `screenLabels` | `ReceivablesScreenLabelOverrides` | English labels | Table, tab, filter, empty, error, action and status badge copy. |
519
- | `filterBarLabels` | `InvoicesFilterBarLabelOverrides` | English labels | Invoice filter bar copy: field names, search, amount bounds, the customer panel and Clear all. |
520
- | `filterLabels` | `InvoicesFilterLabelOverrides` | English labels | Invoice filter copy built from state: date presets, status descriptions and chip wording. |
521
- | `formLabels` | `Partial<ReceivableFormSheetLabels>` | English labels | Create/edit form copy; the save and issue buttons are in `messageLabels`. |
522
- | `detailsLabels` | `ReceivableDetailsPanelLabelOverrides` | English labels | Details panel copy. Status badge copy comes from `screenLabels.statusBadge`. |
523
- | `auditHistoryLabels` | `Partial<ReceivableAuditHistoryLabels>` | English labels | Audit history row copy. Document and status names follow `messageLabels` and `screenLabels.statusBadge` unless overridden here. |
524
- | `sendLabels` | `Partial<ReceivableSendDialogLabels>` | English labels | Send-email dialog copy. |
525
- | `paymentLabels` | `Partial<ReceivablePaymentDialogLabels>` | English labels | Manual payment dialog copy. |
526
- | `actionLabels` | `Partial<ReceivableActionDialogLabels>` | English labels | Confirmation dialog buttons; per-action titles come from `messageLabels`. |
527
- | `actionsModalLabels` | `Partial<ReceivableActionsModalLabels>` | English labels | Copy of the modal shown after a create: the email step and the save-items-as-products step. Its titles, toasts and select-all toggle are in `messageLabels`. |
528
- | `counterpartFormLabels` | `PartialDeep<CounterpartFormSheetLabels>` | English labels | Inline customer creation copy. |
529
- | `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-unit manager copy. |
530
- | `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy. |
531
- | `messageLabels` | `Partial<ReceivableMessageLabels>` | English labels | Validation, fallback, details panel, reminder and confirmation messages, including the form's save and issue buttons and a new reminder's subject and body. |
532
- | `productMessageLabels` | `Partial<ProductMessageLabels>` | English labels | Product validation and error messages. |
533
- | `counterpartMessageLabels` | `Partial<CounterpartMessageLabels>` | English labels | Customer validation and error messages. |
508
+ | Prop | Type | Default | Description |
509
+ | -------------------------- | ---------------------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
510
+ | `defaultTab` | `ReceivablesWidgetTab` | `'invoices'` | Initial tab; if omitted or disabled, the widget starts on the first enabled tab. |
511
+ | `enabledTabs` | `ReceivablesWidgetTab[]` | `['invoices', 'quotes', 'credit_notes']` | Tabs visible to the user. Duplicate or unknown values are ignored. |
512
+ | `initialView` | `'create'` | `undefined` | Opens the create-invoice form once on mount, when the user can create invoices. Closing it does not reopen it. |
513
+ | `initialCounterpartId` | `string` | `undefined` | With `initialView: 'create'`, preselects this customer in that first create form only. Otherwise, opens the invoice list filtered to this customer, with a chip naming them. Clear all removes it. |
514
+ | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices. The first page loads with a page size of `10`. |
515
+ | `onReceivableCreated` | `(id: string, type: ReceivableDocumentType) => void` | `undefined` | Called after a create or clone succeeds. |
516
+ | `onReceivableOpened` | `(id: string, type: ReceivableDocumentType) => void` | `undefined` | Called when the user opens a row's details panel. |
517
+ | `onTemplateSettingsClick` | `() => void` | `undefined` | Shows a template settings action in the header and calls this handler when clicked. |
518
+ | `embeddedBankName` | `string` | `undefined` | Sponsor bank name shown as "Powered by {embeddedBankName}" next to embedded accounts in the invoice payment-account picker. Omitted when unset. |
519
+ | `screenLabels` | `ReceivablesScreenLabelOverrides` | English labels | Table, tab, filter, empty, error, action and status badge copy. |
520
+ | `filterBarLabels` | `InvoicesFilterBarLabelOverrides` | English labels | Invoice filter bar copy: field names, search, amount bounds, the customer panel and Clear all. |
521
+ | `filterLabels` | `InvoicesFilterLabelOverrides` | English labels | Invoice filter copy built from state: date presets, status descriptions and chip wording. |
522
+ | `formLabels` | `Partial<ReceivableFormSheetLabels>` | English labels | Create/edit form copy; the save and issue buttons are in `messageLabels`. |
523
+ | `detailsLabels` | `ReceivableDetailsPanelLabelOverrides` | English labels | Details panel copy. Status badge copy comes from `screenLabels.statusBadge`. |
524
+ | `auditHistoryLabels` | `Partial<ReceivableAuditHistoryLabels>` | English labels | Audit history row copy. Document and status names follow `messageLabels` and `screenLabels.statusBadge` unless overridden here. |
525
+ | `sendLabels` | `Partial<ReceivableSendDialogLabels>` | English labels | Send-email dialog copy. |
526
+ | `paymentLabels` | `Partial<ReceivablePaymentDialogLabels>` | English labels | Manual payment dialog copy. |
527
+ | `actionLabels` | `Partial<ReceivableActionDialogLabels>` | English labels | Confirmation dialog buttons; per-action titles come from `messageLabels`. |
528
+ | `actionsModalLabels` | `Partial<ReceivableActionsModalLabels>` | English labels | Copy of the modal shown after a create: the email step and the save-items-as-products step. Its titles, toasts and select-all toggle are in `messageLabels`. |
529
+ | `counterpartFormLabels` | `PartialDeep<CounterpartFormSheetLabels>` | English labels | Inline customer creation copy. |
530
+ | `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-unit manager copy. |
531
+ | `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy. |
532
+ | `messageLabels` | `Partial<ReceivableMessageLabels>` | English labels | Validation, fallback, details panel, reminder and confirmation messages, including the form's save and issue buttons and a new reminder's subject and body. |
533
+ | `productMessageLabels` | `Partial<ProductMessageLabels>` | English labels | Product validation and error messages. |
534
+ | `counterpartMessageLabels` | `Partial<CounterpartMessageLabels>` | English labels | Customer validation and error messages. |
534
535
 
535
536
  ### SettingsWidget
536
537
 
package/dist/index.d.ts CHANGED
@@ -5615,7 +5615,8 @@ interface ReceivablesWidgetOwnProps {
5615
5615
  /** Sponsor bank shown as "Powered by {bank}" beside embedded accounts. */
5616
5616
  embeddedBankName?: string;
5617
5617
  enabledTabs?: ReceivablesWidgetTab[];
5618
- /** Opens the invoice list filtered to this customer. */
5618
+ initialView?: 'create';
5619
+ /** Preselects this customer in the create form with `initialView: 'create'`; otherwise filters the invoice list to them. */
5619
5620
  initialCounterpartId?: string;
5620
5621
  pageSizeOptions?: number[];
5621
5622
  onReceivableCreated?: (id: string, type: ReceivableDocumentType) => void;
@@ -1624,7 +1624,8 @@ interface ReceivablesWidgetOwnProps {
1624
1624
  /** Sponsor bank shown as "Powered by {bank}" beside embedded accounts. */
1625
1625
  embeddedBankName?: string;
1626
1626
  enabledTabs?: ReceivablesWidgetTab[];
1627
- /** Opens the invoice list filtered to this customer. */
1627
+ initialView?: 'create';
1628
+ /** Preselects this customer in the create form with `initialView: 'create'`; otherwise filters the invoice list to them. */
1628
1629
  initialCounterpartId?: string;
1629
1630
  pageSizeOptions?: number[];
1630
1631
  onReceivableCreated?: (id: string, type: ReceivableDocumentType) => void;
@@ -25,37 +25,38 @@ import { ReceivableRecurrenceEmailDialog as v } from "../../../../ui/dist/index4
25
25
  import { ReceivableRecurrenceSection as y } from "../../../../ui/dist/index46.js";
26
26
  import { ReceivableRemindersSection as b } from "../../../../ui/dist/index48.js";
27
27
  import { ReceivableSendDialog as x } from "../../../../ui/dist/index49.js";
28
- import { ReceivablesScreen as S } from "../../../../ui/dist/index51.js";
28
+ import { ReceivablesScreen as ee } from "../../../../ui/dist/index51.js";
29
29
  import "../../../../ui/dist/index.js";
30
- import { ReceivableAttachmentsSection as ee } from "./ReceivableAttachmentsSection.js";
31
- import { MeasureUnitsManagerContainer as te } from "../../../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
32
- import { ProductSelector as C } from "../../../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
30
+ import { ReceivableAttachmentsSection as te } from "./ReceivableAttachmentsSection.js";
31
+ import { MeasureUnitsManagerContainer as ne } from "../../../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
32
+ import { ProductSelector as S } from "../../../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
33
33
  import "../../../../../shared/product-catalog/feature/dist/index.js";
34
- import { useReceivablesWidget as w } from "./useReceivablesWidget.js";
35
- import { useEffect as T, useId as E } from "react";
36
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
34
+ import { useReceivablesWidget as C } from "./useReceivablesWidget.js";
35
+ import { useEffect as w, useId as T } from "react";
36
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
37
37
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js
38
- function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessageLabels: A, defaultTab: j, detailsLabels: M, embeddedBankName: N, enabledTabs: P, filterBarLabels: F, filterLabels: I, formLabels: L, initialCounterpartId: R, measureUnitDeleteLabels: z, measureUnitsLabels: ne, messageLabels: B, onReceivableCreated: V, onReceivableOpened: H, onTemplateSettingsClick: U, pageSizeOptions: W = l, paymentLabels: G, productMessageLabels: K, screenLabels: q, sendLabels: J, actionLabels: Y, actionsModalLabels: X }) {
38
+ function k({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessageLabels: k, defaultTab: A, detailsLabels: j, embeddedBankName: M, enabledTabs: N, filterBarLabels: P, filterLabels: F, formLabels: I, initialCounterpartId: L, initialView: R, measureUnitDeleteLabels: re, measureUnitsLabels: z, messageLabels: B, onReceivableCreated: V, onReceivableOpened: H, onTemplateSettingsClick: U, pageSizeOptions: W = l, paymentLabels: G, productMessageLabels: K, screenLabels: q, sendLabels: J, actionLabels: Y, actionsModalLabels: X }) {
39
39
  let Z = r();
40
- T(() => {
40
+ w(() => {
41
41
  Z(s.Mounted);
42
42
  }, [Z]);
43
- let Q = w({
43
+ let Q = C({
44
44
  auditHistoryLabels: i,
45
- counterpartMessageLabels: A,
46
- defaultTab: j,
47
- embeddedBankName: N,
48
- enabledTabs: P,
49
- filterLabels: I,
50
- initialCounterpartId: R,
45
+ counterpartMessageLabels: k,
46
+ defaultTab: A,
47
+ embeddedBankName: M,
48
+ enabledTabs: N,
49
+ filterLabels: F,
50
+ initialCounterpartId: L,
51
+ initialView: R,
51
52
  messageLabels: B,
52
53
  onReceivableCreated: V,
53
54
  onReceivableOpened: H,
54
55
  screenLabels: q
55
- }), re = E(), $ = E(), ie = E(), ae = E(), oe = E();
56
- return /* @__PURE__ */ k(D, { children: [
57
- /* @__PURE__ */ O(n, {}),
58
- /* @__PURE__ */ O(S, {
56
+ }), ie = T(), $ = T(), ae = T(), oe = T(), se = T();
57
+ return /* @__PURE__ */ O(E, { children: [
58
+ /* @__PURE__ */ D(n, {}),
59
+ /* @__PURE__ */ D(ee, {
59
60
  rows: Q.table.rows,
60
61
  activeTab: Q.activeTab,
61
62
  enabledTabs: Q.enabledTabs,
@@ -79,9 +80,9 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
79
80
  onStatusFilterChange: Q.table.onStatusFilterChange,
80
81
  statusCards: Q.table.statusCards,
81
82
  onStatusCardSelect: Q.table.onStatusCardSelect,
82
- filterBar: Q.table.invoicesFilterBar && /* @__PURE__ */ O(u, {
83
+ filterBar: Q.table.invoicesFilterBar && /* @__PURE__ */ D(u, {
83
84
  ...Q.table.invoicesFilterBar,
84
- labels: F
85
+ labels: P
85
86
  }),
86
87
  isFiltering: Q.table.isFiltering,
87
88
  onCreateClick: Q.canWrite ? Q.openCreate : void 0,
@@ -91,7 +92,7 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
91
92
  onRetry: Q.onRetry,
92
93
  labels: q
93
94
  }),
94
- /* @__PURE__ */ O(g, {
95
+ /* @__PURE__ */ D(g, {
95
96
  open: Q.form.open,
96
97
  onOpenChange: (e) => {
97
98
  e || Q.form.close();
@@ -106,14 +107,14 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
106
107
  autoFocusLineItemId: Q.form.autoFocusLineItemId,
107
108
  lineItemsLoading: Q.form.lineItemsLoading,
108
109
  inProgress: Q.form.isSubmitting || Q.actionsSuspended,
109
- customerSelector: /* @__PURE__ */ O(o, {
110
+ customerSelector: /* @__PURE__ */ D(o, {
110
111
  mode: "customer",
111
112
  value: Q.form.values.customerId || void 0,
112
113
  invalid: !!Q.form.errors.customerId,
113
114
  onValueChange: (e) => Q.form.updateValues({ customerId: e }),
114
115
  onCreateClick: Q.form.openCounterpartCreate
115
116
  }),
116
- renderProductSelector: (e, t) => /* @__PURE__ */ O(C, {
117
+ renderProductSelector: (e, t) => /* @__PURE__ */ D(S, {
117
118
  ...t,
118
119
  inputValue: e.name,
119
120
  selectedProductId: Q.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
@@ -134,20 +135,20 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
134
135
  onAddLineItem: Q.form.addLineItem,
135
136
  onRemoveLineItem: Q.form.removeLineItem,
136
137
  showDueDateField: Q.form.showDueDateField,
137
- billingSection: Q.form.showBillingSection && /* @__PURE__ */ O(m, {
138
- idPrefix: re,
138
+ billingSection: Q.form.showBillingSection && /* @__PURE__ */ D(m, {
139
+ idPrefix: ie,
139
140
  paymentTerms: Q.form.paymentTerms.view,
140
141
  paymentTermsError: Q.form.errors.paymentTermsId,
141
142
  disabled: Q.form.isSubmitting,
142
143
  onPaymentTermsChange: Q.form.paymentTerms.select,
143
144
  onCustomDatePickerOpenChange: Q.form.paymentTerms.changeCustomDatePickerOpen,
144
- customDateCalendar: /* @__PURE__ */ O(e, {
145
+ customDateCalendar: /* @__PURE__ */ D(e, {
145
146
  mode: "single",
146
147
  captionLayout: "dropdown",
147
148
  ...Q.form.paymentTerms.calendar,
148
149
  onSelect: Q.form.paymentTerms.selectCustomDate
149
150
  }),
150
- recurrenceSection: Q.form.showRecurrenceSection && (Q.form.recurrenceLoading ? /* @__PURE__ */ O(t, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ O(y, {
151
+ recurrenceSection: Q.form.showRecurrenceSection && (Q.form.recurrenceLoading ? /* @__PURE__ */ D(t, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ D(y, {
151
152
  idPrefix: $,
152
153
  view: Q.form.recurrence.view,
153
154
  disabled: Q.form.isSubmitting,
@@ -160,20 +161,20 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
160
161
  onMaxOccurrencesChange: Q.form.recurrence.changeMaxOccurrences,
161
162
  onCreationModeChange: Q.form.recurrence.changeCreationMode,
162
163
  onSetUpEmailClick: Q.form.recurrence.setUpEmail,
163
- emailDialog: /* @__PURE__ */ O(v, {
164
+ emailDialog: /* @__PURE__ */ D(v, {
164
165
  idPrefix: $,
165
166
  view: Q.form.recurrence.emailView,
166
167
  onOpenChange: Q.form.recurrence.changeEmailOpen,
167
168
  onChange: Q.form.recurrence.changeEmail,
168
169
  onSave: Q.form.recurrence.saveEmail,
169
- labels: L
170
+ labels: I
170
171
  }),
171
- labels: L
172
+ labels: I
172
173
  })),
173
- labels: L
174
+ labels: I
174
175
  }),
175
- remindersSection: Q.form.reminders.view && /* @__PURE__ */ O(b, {
176
- idPrefix: ae,
176
+ remindersSection: Q.form.reminders.view && /* @__PURE__ */ D(b, {
177
+ idPrefix: oe,
177
178
  view: Q.form.reminders.view,
178
179
  onToggle: Q.form.reminders.toggle,
179
180
  onPaymentReminderSelect: Q.form.reminders.selectPaymentReminder,
@@ -184,10 +185,10 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
184
185
  onOverdueAddTerm: Q.form.reminders.addOverdueTerm,
185
186
  onOverdueClear: Q.form.reminders.clearOverdueTerms,
186
187
  onOverdueSave: Q.form.reminders.saveOverdue,
187
- labels: L
188
+ labels: I
188
189
  }),
189
- bankAccountSection: /* @__PURE__ */ O(p, {
190
- idPrefix: ie,
190
+ bankAccountSection: /* @__PURE__ */ D(p, {
191
+ idPrefix: ae,
191
192
  view: Q.form.bankAccount.view,
192
193
  error: Q.form.errors.bankAccountId,
193
194
  disabled: Q.form.isSubmitting,
@@ -196,15 +197,15 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
196
197
  onFormChange: Q.form.bankAccount.updateAccountForm,
197
198
  onFormSave: Q.form.bankAccount.saveAccount,
198
199
  onFormCancel: Q.form.bankAccount.cancelAddAccount,
199
- labels: L
200
+ labels: I
200
201
  }),
201
- attachmentsSection: Q.form.attachmentsView && /* @__PURE__ */ O(ee, {
202
+ attachmentsSection: Q.form.attachmentsView && /* @__PURE__ */ D(te, {
202
203
  view: Q.form.attachmentsView,
203
204
  disabled: Q.form.isSubmitting,
204
205
  onFilesSelect: Q.form.selectAttachmentFiles,
205
206
  onIncludeInEmailChange: Q.form.setAttachmentIncludeInEmail,
206
207
  onRemove: Q.form.removeAttachment,
207
- labels: L
208
+ labels: I
208
209
  }),
209
210
  cancelDisabled: Q.form.isSubmitting || Q.form.attachmentsUploading,
210
211
  draftButtonLabel: Q.form.draftButtonLabel,
@@ -218,9 +219,9 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
218
219
  onDraftClick: Q.form.selectDraftMode,
219
220
  onPrimaryClick: Q.form.selectPrimaryMode,
220
221
  onCancel: Q.form.close,
221
- labels: L
222
+ labels: I
222
223
  }),
223
- /* @__PURE__ */ O(h, {
224
+ /* @__PURE__ */ D(h, {
224
225
  open: Q.detailsOpen,
225
226
  onOpenChange: (e) => {
226
227
  e || Q.closeDetails();
@@ -234,9 +235,9 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
234
235
  openSections: Q.details.openSections,
235
236
  onOpenSectionsChange: Q.details.setOpenSections,
236
237
  disabledActions: Q.actions.pendingActions,
237
- labels: M
238
+ labels: j
238
239
  }),
239
- /* @__PURE__ */ O(x, {
240
+ /* @__PURE__ */ D(x, {
240
241
  open: Q.actions.sendOpen,
241
242
  onOpenChange: (e) => {
242
243
  e || Q.actions.closeSend();
@@ -252,7 +253,7 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
252
253
  onCancel: Q.actions.closeSend,
253
254
  labels: J
254
255
  }),
255
- /* @__PURE__ */ O(_, {
256
+ /* @__PURE__ */ D(_, {
256
257
  open: Q.actions.paymentOpen,
257
258
  onOpenChange: (e) => {
258
259
  e || Q.actions.closePayment();
@@ -268,7 +269,7 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
268
269
  onCancel: Q.actions.closePayment,
269
270
  labels: G
270
271
  }),
271
- Q.actions.actionDialog && /* @__PURE__ */ O(f, {
272
+ Q.actions.actionDialog && /* @__PURE__ */ D(f, {
272
273
  open: !!Q.actions.actionTarget,
273
274
  onOpenChange: (e) => {
274
275
  e || Q.actions.closeAction();
@@ -287,8 +288,8 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
287
288
  onCancel: Q.actions.closeAction,
288
289
  labels: Y
289
290
  }),
290
- /* @__PURE__ */ O(d, {
291
- idPrefix: oe,
291
+ /* @__PURE__ */ D(d, {
292
+ idPrefix: se,
292
293
  open: Q.actionsModal.isOpen,
293
294
  view: Q.actionsModal.view,
294
295
  onSkip: Q.actionsModal.skip,
@@ -301,7 +302,7 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
301
302
  onSaveItems: Q.actionsModal.saveItems,
302
303
  labels: X
303
304
  }),
304
- /* @__PURE__ */ O(a, {
305
+ /* @__PURE__ */ D(a, {
305
306
  open: Q.form.counterpartView === "create",
306
307
  onOpenChange: (e) => {
307
308
  e || Q.form.counterpartForm.close();
@@ -326,18 +327,18 @@ function A({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
326
327
  onCancel: Q.form.counterpartForm.close,
327
328
  labels: c
328
329
  }),
329
- /* @__PURE__ */ O(te, {
330
+ /* @__PURE__ */ D(ne, {
330
331
  open: Q.measureUnitsOpen,
331
332
  onClose: Q.closeMeasureUnits,
332
333
  suspended: Q.actionsSuspended,
333
- managerLabels: ne,
334
- deleteLabels: z,
334
+ managerLabels: z,
335
+ deleteLabels: re,
335
336
  messageLabels: K
336
337
  })
337
338
  ] });
338
339
  }
339
- function j({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
340
- return /* @__PURE__ */ O(i, {
340
+ function A({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: m, ...h }) {
341
+ return /* @__PURE__ */ D(i, {
341
342
  widgetName: c,
342
343
  baseUrl: e,
343
344
  widgetToken: t,
@@ -352,8 +353,8 @@ function j({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gat
352
353
  analytics: f,
353
354
  disclosuresAcceptance: p,
354
355
  providerLabels: m,
355
- children: /* @__PURE__ */ O(A, { ...h })
356
+ children: /* @__PURE__ */ D(k, { ...h })
356
357
  });
357
358
  }
358
359
  //#endregion
359
- export { j as ReceivablesWidget, j as default };
360
+ export { A as ReceivablesWidget, A as default };
@@ -170,13 +170,14 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
170
170
  lines: !1,
171
171
  discount: !1
172
172
  }, B(), K();
173
- }, [B, K]), on = f((e = "invoice") => {
173
+ }, [B, K]), on = f((e = "invoice", { customerId: t = "" } = {}) => {
174
174
  Gt(), qt(), K();
175
- let t = {
175
+ let n = {
176
176
  ...je(),
177
- type: e
177
+ type: e,
178
+ customerId: t
178
179
  };
179
- rn(Be(t)), S.current = [], x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, G.current = void 0, Dt(void 0), _t("create"), yt(void 0), xt(void 0), D(t), O({}), B(), Ot(!1), I(!1), F.current = {
180
+ rn(Be(n)), S.current = [], x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, G.current = void 0, Dt(void 0), _t("create"), yt(void 0), xt(void 0), D(n), O({}), B(), Ot(!1), I(!1), F.current = {
180
181
  lines: !1,
181
182
  discount: !1
182
183
  }, w(!0);
@@ -19,195 +19,204 @@ import { useReceivableActionsModal as fe } from "./useReceivableActionsModal.js"
19
19
  import { useReceivableDetails as pe } from "./useReceivableDetails.js";
20
20
  import { useReceivableForm as me } from "./useReceivableForm.js";
21
21
  import { useReceivablesTable as he } from "./useReceivablesTable.js";
22
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
22
+ import { useCallback as o, useEffect as s, useMemo as c, useRef as ge, useState as l } from "react";
23
23
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js
24
- function u({ auditHistoryLabels: u, counterpartMessageLabels: ge, defaultTab: f, embeddedBankName: _e, enabledTabs: ve, filterLabels: ye, initialCounterpartId: be, messageLabels: p, onReceivableCreated: m, onReceivableOpened: h, screenLabels: xe }) {
25
- let g = e();
24
+ function u({ auditHistoryLabels: u, counterpartMessageLabels: _e, defaultTab: f, embeddedBankName: ve, enabledTabs: p, filterLabels: ye, initialCounterpartId: m, initialView: h, messageLabels: g, onReceivableCreated: _, onReceivableOpened: v, screenLabels: be }) {
25
+ let y = e();
26
26
  s(() => {
27
- g(ne.Mounted);
28
- }, [g]);
29
- let { initResponse: _, widgetToken: Se } = n(), v = te(), Ce = r(), we = t(), y = ee(), b = !!_ && !y, x = c(() => ue(_?.scopes), [_?.scopes]), Te = !!_ && y, S = !!_ && x.canRead, C = !!_ && x.canWrite, w = b && x.canRead, T = b && x.canWrite, E = !!Ce && !b && !v, D = !b && !E && !!(Se || v), O = c(() => ({
27
+ y(ne.Mounted);
28
+ }, [y]);
29
+ let { initResponse: b, widgetToken: xe } = n(), x = te(), Se = r(), Ce = t(), S = ee(), C = !!b && !S, w = c(() => ue(b?.scopes), [b?.scopes]), we = !!b && S, T = !!b && w.canRead, E = !!b && w.canWrite, D = C && w.canRead, O = C && w.canWrite, k = !!Se && !C && !x, A = !C && !k && !!(xe || x), j = c(() => ({
30
30
  ...le,
31
- ...p
32
- }), [p]), k = xe?.statusBadge, A = c(() => ({
31
+ ...g
32
+ }), [g]), M = be?.statusBadge, N = c(() => ({
33
33
  ...re,
34
- ...k
35
- }), [k]), j = c(() => oe(ve), [ve]), [M, N] = l(() => i({
34
+ ...M
35
+ }), [M]), P = c(() => oe(p), [p]), [F, I] = l(() => i({
36
36
  defaultTab: f,
37
- enabledTabs: j
38
- })), [Ee, P] = l(), [F, I] = l(!1), [L, R] = l(!1), De = o(() => R(!0), []), z = o(() => R(!1), []);
37
+ enabledTabs: P
38
+ })), [Te, L] = l(), [R, z] = l(!1), [B, V] = l(!1), Ee = o(() => V(!0), []), H = o(() => V(!1), []);
39
39
  s(() => {
40
- j.includes(M) || N(i({
40
+ P.includes(F) || I(i({
41
41
  defaultTab: f,
42
- enabledTabs: j
42
+ enabledTabs: P
43
43
  }));
44
44
  }, [
45
- M,
45
+ F,
46
46
  f,
47
- j
47
+ P
48
48
  ]);
49
- let Oe = o((e, t) => {
50
- N(a(t)), P(e), I(!0), m?.(e, t);
51
- }, [m]), B = fe({ messages: O }), V = B.open, ke = o((e, t, n) => {
52
- N(a(t));
49
+ let De = o((e, t) => {
50
+ I(a(t)), L(e), z(!0), _?.(e, t);
51
+ }, [_]), U = fe({ messages: j }), W = U.open, Oe = o((e, t, n) => {
52
+ I(a(t));
53
53
  let r = ae(n);
54
- r.openDetails && (P(e), I(!0)), r.actionsModal && V({
54
+ r.openDetails && (L(e), z(!0)), r.actionsModal && W({
55
55
  action: n.mode,
56
56
  receivableId: e,
57
57
  counterpartId: n.counterpartId,
58
58
  inlineItems: n.inlineItems,
59
59
  showEmailStep: r.actionsModal.showEmailStep
60
- }), m?.(e, t);
61
- }, [m, V]), H = he({
62
- activeTab: M,
63
- initialCounterpartId: be,
64
- messages: O,
65
- statusLabels: A,
60
+ }), _?.(e, t);
61
+ }, [_, W]), G = he({
62
+ activeTab: F,
63
+ initialCounterpartId: h === "create" ? void 0 : m,
64
+ messages: j,
65
+ statusLabels: N,
66
66
  filterLabels: ye,
67
- enabled: w,
68
- visible: S
69
- }), Ae = o((e) => {
70
- P(e), I(!0), h?.(e, "invoice");
71
- }, [h]), U = pe({
72
- selectedReceivableId: Ee,
73
- enabled: F && w,
74
- canWrite: C,
75
- messages: O,
76
- statusLabels: A,
67
+ enabled: D,
68
+ visible: T
69
+ }), ke = o((e) => {
70
+ L(e), z(!0), v?.(e, "invoice");
71
+ }, [v]), K = pe({
72
+ selectedReceivableId: Te,
73
+ enabled: R && D,
74
+ canWrite: E,
75
+ messages: j,
76
+ statusLabels: N,
77
77
  auditHistoryLabels: u,
78
- onOpenReceivable: Ae
79
- }), W = me({
80
- messages: O,
81
- counterpartMessageLabels: ge,
82
- embeddedBankName: _e,
83
- onCreated: ke
84
- }), je = o(() => {
85
- if (!T) return;
86
- let e = ce(M);
87
- W.openCreate(e === "quote" ? "quote" : "invoice");
78
+ onOpenReceivable: ke
79
+ }), q = me({
80
+ messages: j,
81
+ counterpartMessageLabels: _e,
82
+ embeddedBankName: ve,
83
+ onCreated: Oe
84
+ }), Ae = o(() => {
85
+ if (!O) return;
86
+ let e = ce(F);
87
+ q.openCreate(e === "quote" ? "quote" : "invoice");
88
+ }, [
89
+ F,
90
+ O,
91
+ q.openCreate
92
+ ]), J = ge(!1);
93
+ s(() => {
94
+ J.current || h === "create" && O && (J.current = !0, q.openCreate("invoice", { customerId: m }));
88
95
  }, [
89
- M,
90
- T,
91
- W.openCreate
92
- ]), G = de({
93
- selectedReceivable: U.receivable,
94
- selectedRecurrence: U.recurrence,
95
- messages: O,
96
- onCreated: Oe,
96
+ O,
97
+ q.openCreate,
98
+ m,
99
+ h
100
+ ]);
101
+ let Y = de({
102
+ selectedReceivable: K.receivable,
103
+ selectedRecurrence: K.recurrence,
104
+ messages: j,
105
+ onCreated: De,
97
106
  onDeleted: (e) => {
98
- e === Ee && (P(void 0), I(!1));
107
+ e === Te && (L(void 0), z(!1));
99
108
  },
100
109
  onCompleteBeforeIssue: (e) => {
101
- W.openEdit(e, { highlightForIssue: !0 }), I(!1);
110
+ q.openEdit(e, { highlightForIssue: !0 }), z(!1);
102
111
  }
103
- }), K = b && !x.canWrite, q = W.open || W.counterpartView !== "none" || !!G.actionTarget || G.sendOpen || G.paymentOpen || B.isOpen || L, J = W.close, Y = W.counterpartForm.close, { closeAction: X, closeSend: Z, closePayment: Q } = G, $ = B.close;
112
+ }), X = C && !w.canWrite, Z = q.open || q.counterpartView !== "none" || !!Y.actionTarget || Y.sendOpen || Y.paymentOpen || U.isOpen || B, je = q.close, Q = q.counterpartForm.close, { closeAction: Me, closeSend: Ne, closePayment: Pe } = Y, $ = U.close;
104
113
  s(() => {
105
- K && q && (J(), Y(), X(), Z(), Q(), $(), z());
114
+ X && Z && (je(), Q(), Me(), Ne(), Pe(), $(), H());
106
115
  }, [
107
- X,
116
+ Me,
108
117
  $,
109
- Y,
110
- J,
111
- z,
112
118
  Q,
119
+ je,
120
+ H,
121
+ Pe,
122
+ Ne,
113
123
  Z,
114
- q,
115
- K
124
+ X
116
125
  ]);
117
- let Me = o((e) => {
118
- ie() || (P(e.id), I(!0), h?.(e.id, e.type));
119
- }, [h]), Ne = o(() => {
120
- I(!1), P(void 0);
121
- }, []), Pe = o((e, t) => {
122
- if (!T) return;
123
- let n = H.getReceivableById(t.id);
126
+ let Fe = o((e) => {
127
+ ie() || (L(e.id), z(!0), v?.(e.id, e.type));
128
+ }, [v]), Ie = o(() => {
129
+ z(!1), L(void 0);
130
+ }, []), Le = o((e, t) => {
131
+ if (!O) return;
132
+ let n = G.getReceivableById(t.id);
124
133
  if (e === "edit") {
125
134
  if (n) {
126
- W.openEdit(n);
135
+ q.openEdit(n);
127
136
  return;
128
137
  }
129
- P(t.id), I(!0);
138
+ L(t.id), z(!0);
130
139
  return;
131
140
  }
132
- P(t.id), G.openAction(e, t, n ?? null);
141
+ L(t.id), Y.openAction(e, t, n ?? null);
133
142
  }, [
134
- G,
135
- T,
136
- W.openEdit,
137
- H.getReceivableById
138
- ]), Fe = o((e, t) => {
139
- if (T) {
143
+ Y,
144
+ O,
145
+ q.openEdit,
146
+ G.getReceivableById
147
+ ]), Re = o((e, t) => {
148
+ if (O) {
140
149
  if (e === "edit") {
141
- U.receivable && (W.openEdit(U.receivable), I(!1));
150
+ K.receivable && (q.openEdit(K.receivable), z(!1));
142
151
  return;
143
152
  }
144
- G.openAction(e, {
153
+ Y.openAction(e, {
145
154
  id: t.id,
146
- title: U.receivable ? se(U.receivable, O) : t.title,
155
+ title: K.receivable ? se(K.receivable, j) : t.title,
147
156
  type: t.type
148
- }, U.receivable ?? null);
157
+ }, K.receivable ?? null);
149
158
  }
150
159
  }, [
151
- G,
152
- T,
153
- U.receivable,
154
- W.openEdit,
155
- O
160
+ Y,
161
+ O,
162
+ K.receivable,
163
+ q.openEdit,
164
+ j
156
165
  ]);
157
166
  return {
158
- activeTab: M,
159
- enabledTabs: j,
160
- setActiveTab: N,
161
- canWrite: C,
162
- actionsSuspended: Te,
163
- isAccessRestricted: b && !x.canRead,
164
- table: S ? H : {
165
- ...H,
167
+ activeTab: F,
168
+ enabledTabs: P,
169
+ setActiveTab: I,
170
+ canWrite: E,
171
+ actionsSuspended: we,
172
+ isAccessRestricted: C && !w.canRead,
173
+ table: T ? G : {
174
+ ...G,
166
175
  rows: [],
167
176
  statusCards: void 0,
168
177
  isError: !1
169
178
  },
170
- isTableLoading: S ? H.isLoading || D && H.rows.length === 0 : D,
171
- isError: E || S && H.isError,
172
- onRetry: E ? we : H.onRetry,
173
- details: U,
174
- detailsOpen: F && S,
175
- closeDetails: Ne,
179
+ isTableLoading: T ? G.isLoading || A && G.rows.length === 0 : A,
180
+ isError: k || T && G.isError,
181
+ onRetry: k ? Ce : G.onRetry,
182
+ details: K,
183
+ detailsOpen: R && T,
184
+ closeDetails: Ie,
176
185
  form: {
177
- ...W,
178
- open: C && W.open,
179
- counterpartView: C ? W.counterpartView : "none",
186
+ ...q,
187
+ open: E && q.open,
188
+ counterpartView: E ? q.counterpartView : "none",
180
189
  counterpartForm: {
181
- ...W.counterpartForm,
182
- submit: d(T, W.counterpartForm.submit)
190
+ ...q.counterpartForm,
191
+ submit: d(O, q.counterpartForm.submit)
183
192
  },
184
- submit: d(T, W.submit),
185
- submitDraft: d(T, W.submitDraft),
186
- submitPrimary: d(T, W.submitPrimary)
193
+ submit: d(O, q.submit),
194
+ submitDraft: d(O, q.submitDraft),
195
+ submitPrimary: d(O, q.submitPrimary)
187
196
  },
188
- openCreate: je,
189
- measureUnitsOpen: C && L,
190
- openMeasureUnits: De,
191
- closeMeasureUnits: z,
197
+ openCreate: Ae,
198
+ measureUnitsOpen: E && B,
199
+ openMeasureUnits: Ee,
200
+ closeMeasureUnits: H,
192
201
  actions: {
193
- ...G,
194
- actionDialog: C ? G.actionDialog : void 0,
195
- sendOpen: C && G.sendOpen,
196
- paymentOpen: C && G.paymentOpen,
197
- openAction: d(T, G.openAction),
198
- confirmAction: d(T, G.confirmAction),
199
- submitSend: d(T, G.submitSend),
200
- submitPayment: d(T, G.submitPayment)
202
+ ...Y,
203
+ actionDialog: E ? Y.actionDialog : void 0,
204
+ sendOpen: E && Y.sendOpen,
205
+ paymentOpen: E && Y.paymentOpen,
206
+ openAction: d(O, Y.openAction),
207
+ confirmAction: d(O, Y.confirmAction),
208
+ submitSend: d(O, Y.submitSend),
209
+ submitPayment: d(O, Y.submitPayment)
201
210
  },
202
211
  actionsModal: {
203
- ...B,
204
- isOpen: C && B.isOpen,
205
- send: d(T, B.send),
206
- saveItems: d(T, B.saveItems)
212
+ ...U,
213
+ isOpen: E && U.isOpen,
214
+ send: d(O, U.send),
215
+ saveItems: d(O, U.saveItems)
207
216
  },
208
- handleRowClick: Me,
209
- handleActionClick: Pe,
210
- handleDetailsActionClick: Fe
217
+ handleRowClick: Fe,
218
+ handleActionClick: Le,
219
+ handleDetailsActionClick: Re
211
220
  };
212
221
  }
213
222
  function d(e, t) {
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.246", n = "67e112d0dfb7b18df201bb61e9c0b2da298bd3a8", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.248", n = "1e98d8cd5ad737f67b5124bf65db872b4cb5ebf8", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.246",
3
+ "version": "0.5.248",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {