@tesouro/embedded-components-react 0.5.247 → 0.5.249

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 };
@@ -35,6 +35,8 @@ function w() {
35
35
  lineItems: [n()],
36
36
  bankAccountId: "",
37
37
  bankAccountType: "",
38
+ billingAddressId: "",
39
+ shippingAddressId: "",
38
40
  paymentReminderId: "",
39
41
  overdueReminderId: "",
40
42
  attachments: [],
@@ -169,7 +171,15 @@ function z(e) {
169
171
  closing: e.footer || void 0
170
172
  };
171
173
  }
172
- function B({ values: e, billingAddressId: t, messages: n, willIssue: r = !1, hasStartedRecurrence: i = !1 }) {
174
+ function B({ values: e, counterpart: t, addresses: n }) {
175
+ let r = n?.length && t?.id === e.customerId ? t : void 0, i = e.billingAddressId || r?.default_billing_address_id || (n?.length === 1 ? n[0].id : ""), a = e.shippingAddressId || r?.default_shipping_address_id || "";
176
+ return {
177
+ billingAddressId: i,
178
+ billingAddress: n?.find((e) => e.id === i),
179
+ shippingAddressId: a
180
+ };
181
+ }
182
+ function V({ values: e, billingAddressId: t, messages: n, willIssue: r = !1, hasStartedRecurrence: i = !1 }) {
173
183
  let a = {};
174
184
  e.customerId ? t || (a.customerId = n.customerAddressRequired) : a.customerId = n.customerRequired, e.currency || (a.currency = n.currencyRequired), r && !e.paymentTermsId && (a.paymentTermsId = n.paymentTermsRequired), r && !e.bankAccountId && (a.bankAccountId = n.bankAccountRequired);
175
185
  let o = u(e.lineItems, {
@@ -181,45 +191,46 @@ function B({ values: e, billingAddressId: t, messages: n, willIssue: r = !1, has
181
191
  let l = b(e, n);
182
192
  return l && (a.discount = l), a;
183
193
  }
184
- function V(e) {
194
+ function H(e) {
185
195
  return Object.keys(e).length > 0;
186
196
  }
187
- function H(e, t) {
188
- return !V(B({
189
- values: G(e),
197
+ function U(e, t) {
198
+ return !H(V({
199
+ values: K(e),
190
200
  billingAddressId: e.type === "invoice" ? e.counterpart_billing_address?.id ?? void 0 : void 0,
191
201
  messages: t,
192
202
  willIssue: !0
193
203
  }));
194
204
  }
195
- function U({ bankAccountId: e, bankAccountType: t }) {
205
+ function W({ bankAccountId: e, bankAccountType: t }) {
196
206
  return {
197
207
  bank_account_id: e || void 0,
198
208
  bank_account_type: e && t || void 0
199
209
  };
200
210
  }
201
- function W({ values: e, billingAddressId: t, unitNamesById: n }) {
202
- let i = e.lineItems.filter((e) => !r(e)).map((t) => a({
211
+ function G({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: i }) {
212
+ let o = e.lineItems.filter((e) => !r(e)).map((t) => a({
203
213
  lineItem: t,
204
214
  currency: e.currency,
205
215
  taxRate: e.taxRate,
206
- unitNamesById: n
207
- })), o = {
216
+ unitNamesById: i
217
+ })), s = {
208
218
  counterpart_billing_address_id: t,
219
+ counterpart_shipping_address_id: n || void 0,
209
220
  counterpart_id: e.customerId,
210
221
  currency: e.currency,
211
- line_items: i,
222
+ line_items: o,
212
223
  memo: e.openingNote,
213
224
  footer: e.closingNote,
214
225
  discount: v(e) ?? void 0,
215
- ...U(e)
226
+ ...W(e)
216
227
  };
217
228
  return e.type === "quote" ? {
218
- ...o,
229
+ ...s,
219
230
  expiry_date: e.dueDate || void 0,
220
231
  type: "quote"
221
232
  } : {
222
- ...o,
233
+ ...s,
223
234
  ...m(e),
224
235
  payment_reminder_id: e.paymentReminderId || void 0,
225
236
  overdue_reminder_id: e.overdueReminderId || void 0,
@@ -227,7 +238,7 @@ function W({ values: e, billingAddressId: t, unitNamesById: n }) {
227
238
  type: "invoice"
228
239
  };
229
240
  }
230
- function G(e, t) {
241
+ function K(e, t) {
231
242
  let r = e.type === "quote" ? "quote" : "invoice", i = l(e.line_items), a = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => s({
232
243
  lineItem: n,
233
244
  currency: e.currency,
@@ -238,8 +249,8 @@ function G(e, t) {
238
249
  type: r,
239
250
  customerId: e.counterpart_id,
240
251
  currency: e.currency,
241
- issueDate: X(e.issue_date),
242
- dueDate: e.type === "quote" ? X(e.expiry_date) : "",
252
+ issueDate: Z(e.issue_date),
253
+ dueDate: e.type === "quote" ? Z(e.expiry_date) : "",
243
254
  openingNote: e.memo ?? "",
244
255
  closingNote: e.footer ?? "",
245
256
  ...e.type === "invoice" ? g(e.payment_terms) : {},
@@ -248,41 +259,44 @@ function G(e, t) {
248
259
  ...y(e.discount, e.currency),
249
260
  lineItems: o.length > 0 ? o : [n(e.currency)],
250
261
  bankAccountId: e.bank_account_id ?? "",
251
- bankAccountType: K(e.bank_account_type),
262
+ bankAccountType: q(e.bank_account_type),
263
+ billingAddressId: e.counterpart_billing_address?.id ?? "",
264
+ shippingAddressId: e.counterpart_shipping_address?.id ?? "",
252
265
  paymentReminderId: a?.payment_reminder_id ?? "",
253
266
  overdueReminderId: a?.overdue_reminder_id ?? "",
254
267
  attachments: f(e)
255
268
  };
256
269
  }
257
- function K(e) {
270
+ function q(e) {
258
271
  return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
259
272
  }
260
- function q({ values: e, billingAddressId: t, lineItemChanges: n }) {
261
- let r = {
273
+ function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
274
+ let i = {
262
275
  counterpart_billing_address_id: t,
276
+ counterpart_shipping_address_id: n || null,
263
277
  counterpart_id: e.customerId,
264
278
  currency: e.currency,
265
279
  issue_date: e.issueDate || void 0,
266
280
  memo: e.openingNote,
267
281
  footer: e.closingNote,
268
282
  discount: v(e),
269
- ...U(e)
283
+ ...W(e)
270
284
  };
271
285
  return e.type === "quote" ? { quote: {
272
- ...r,
273
- ...n ? { line_items: n } : {},
286
+ ...i,
287
+ ...r ? { line_items: r } : {},
274
288
  expiry_date: e.dueDate || void 0,
275
289
  ...h(e)
276
290
  } } : { invoice: {
277
- ...r,
278
- ...n ? { line_items: n } : {},
291
+ ...i,
292
+ ...r ? { line_items: r } : {},
279
293
  ...h(e),
280
294
  payment_reminder_id: e.paymentReminderId || null,
281
295
  overdue_reminder_id: e.overdueReminderId || null,
282
296
  attachments: d(e.attachments) ?? null
283
297
  } };
284
298
  }
285
- function J({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: a, units: c }) {
299
+ function Y({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: a, units: c }) {
286
300
  let u = l(t), d = i(e.taxRate, u), f = (e, t, n) => o({
287
301
  lineItem: e,
288
302
  currency: t,
@@ -308,7 +322,7 @@ function J({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
308
322
  ...v.length ? { remove: v } : {}
309
323
  };
310
324
  }
311
- function Y({ values: e, originalLineItems: t, changes: n }) {
325
+ function X({ values: e, originalLineItems: t, changes: n }) {
312
326
  let i = e.lineItems.filter((e) => !r(e)).map((e) => e.id);
313
327
  if (!t) return { created: i };
314
328
  let a = new Set(t.map((e) => e.id));
@@ -317,20 +331,20 @@ function Y({ values: e, originalLineItems: t, changes: n }) {
317
331
  replaced: n?.replace?.map((e) => e.id) ?? []
318
332
  };
319
333
  }
320
- function X(e) {
334
+ function Z(e) {
321
335
  return e?.slice(0, 10) ?? "";
322
336
  }
323
- function Z(e, t) {
337
+ function Q(e, t) {
324
338
  let n = {};
325
339
  return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
326
340
  }
327
- function Q(e) {
341
+ function $(e) {
328
342
  return Object.keys(e).length > 0;
329
343
  }
330
- function $(e) {
344
+ function ee(e) {
331
345
  return e.split(",").map((e) => e.trim()).filter(Boolean);
332
346
  }
333
- function ee(e, t, n) {
347
+ function te(e, t, n) {
334
348
  let r = {};
335
349
  if (e.mode === "partial") {
336
350
  let i = j(e.amountPaid, n);
@@ -338,10 +352,10 @@ function ee(e, t, n) {
338
352
  }
339
353
  return r;
340
354
  }
341
- function te(e) {
355
+ function ne(e) {
342
356
  return Object.keys(e).length > 0;
343
357
  }
344
- function ne(e, t) {
358
+ function re(e, t) {
345
359
  return {
346
360
  ...S,
347
361
  to: e?.counterpart_contact?.email ?? "",
@@ -349,13 +363,13 @@ function ne(e, t) {
349
363
  body: t.sendBodyDefault
350
364
  };
351
365
  }
352
- function re() {
366
+ function ie() {
353
367
  return {
354
368
  ...C,
355
369
  paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
356
370
  };
357
371
  }
358
- function ie(e = "all") {
372
+ function ae(e = "all") {
359
373
  let t = [
360
374
  "draft",
361
375
  "issued",
@@ -376,4 +390,4 @@ function ie(e = "all") {
376
390
  }));
377
391
  }
378
392
  //#endregion
379
- export { C as EMPTY_RECEIVABLE_PAYMENT_VALUES, S as EMPTY_RECEIVABLE_SEND_VALUES, F as buildReceivableActions, z as buildReceivableNotesView, R as buildReceivableRows, D as coerceEnabledTabs, w as createEmptyReceivableFormValues, n as createLineItem, re as defaultPaymentValues, ne as defaultSendValues, k as formatDate, A as formatMoney, j as fromMajorUnits, M as getDocumentTitle, N as getDocumentTypeLabel, P as getStatusTone, te as hasPaymentErrors, V as hasReceivableFormErrors, Q as hasSendErrors, H as isReceivableReadyToIssue, W as receivableFormValuesToCreatePayload, J as receivableFormValuesToLineItemChanges, q as receivableFormValuesToUpdatePayload, G as receivableToFormValues, O as resolveInitialTab, $ as splitEmailList, ie as statusFilterOptions, Y as submittedLineItemRows, E as tabForType, T as typeForTab, ee as validatePaymentValues, B as validateReceivableForm, Z as validateSendValues };
393
+ export { C as EMPTY_RECEIVABLE_PAYMENT_VALUES, S as EMPTY_RECEIVABLE_SEND_VALUES, F as buildReceivableActions, z as buildReceivableNotesView, R as buildReceivableRows, D as coerceEnabledTabs, w as createEmptyReceivableFormValues, n as createLineItem, ie as defaultPaymentValues, re as defaultSendValues, k as formatDate, A as formatMoney, j as fromMajorUnits, M as getDocumentTitle, N as getDocumentTypeLabel, P as getStatusTone, ne as hasPaymentErrors, H as hasReceivableFormErrors, $ as hasSendErrors, U as isReceivableReadyToIssue, G as receivableFormValuesToCreatePayload, Y as receivableFormValuesToLineItemChanges, J as receivableFormValuesToUpdatePayload, K as receivableToFormValues, B as resolveCounterpartAddresses, O as resolveInitialTab, ee as splitEmailList, ae as statusFilterOptions, X as submittedLineItemRows, E as tabForType, T as typeForTab, te as validatePaymentValues, V as validateReceivableForm, Q as validateSendValues };