@tesouro/embedded-components-react 0.5.225 → 0.5.226

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 (41) hide show
  1. package/README.md +21 -21
  2. package/dist/index.d.ts +23 -2
  3. package/dist/index.js +1 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +23 -2
  5. package/dist/lib/ReceivablesWidget.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +45 -31
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +51 -32
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +20 -1
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +17 -202
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +220 -31
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +32 -145
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +126 -44
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +145 -117
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +46 -58
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +113 -87
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +58 -116
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +98 -225
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +111 -27
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +225 -462
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +34 -41
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +627 -34
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +39 -77
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +34 -112
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +75 -310
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +124 -0
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +324 -0
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +20 -15
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +56 -53
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +33 -29
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +184 -162
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +1 -3
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +78 -69
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +7 -6
  36. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +20 -19
  37. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +39 -39
  38. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +210 -199
  39. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +60 -52
  40. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,124 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { ReceivablesWidgetAnalyticsEvent as t } from "./index2.js";
8
+ import { RECEIVABLE_STATUS_BADGE_LABELS_EN as n } from "../../ui/dist/index4.js";
9
+ import "../../ui/dist/index.js";
10
+ import { coerceEnabledTabs as r, resolveInitialTab as i, tabForType as a, typeForTab as o } from "./index12.js";
11
+ import { RECEIVABLE_MESSAGE_LABELS_EN as s } from "./index13.js";
12
+ import { useReceivableActions as c } from "./index16.js";
13
+ import { useReceivableDetails as l } from "./index17.js";
14
+ import { hasSelectedText as u } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
15
+ import "../../../shared/product-catalog/feature/dist/index.js";
16
+ import { useReceivableForm as d } from "./index27.js";
17
+ import { useReceivablesTable as f } from "./index30.js";
18
+ import { useCallback as p, useEffect as m, useMemo as h, useState as g } from "react";
19
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js
20
+ function _({ counterpartMessageLabels: _, defaultTab: v, embeddedBankName: y, enabledTabs: b, messageLabels: x, onReceivableCreated: S, onReceivableOpened: C, screenLabels: w }) {
21
+ let T = e();
22
+ m(() => {
23
+ T(t.Mounted);
24
+ }, [T]);
25
+ let E = h(() => ({
26
+ ...s,
27
+ ...x
28
+ }), [x]), D = w?.statusBadge, O = h(() => ({
29
+ ...n,
30
+ ...D
31
+ }), [D]), k = h(() => r(b), [b]), [A, j] = g(() => i({
32
+ defaultTab: v,
33
+ enabledTabs: k
34
+ })), [M, N] = g(), [P, F] = g(!1);
35
+ m(() => {
36
+ k.includes(A) || j(i({
37
+ defaultTab: v,
38
+ enabledTabs: k
39
+ }));
40
+ }, [
41
+ A,
42
+ v,
43
+ k
44
+ ]);
45
+ let I = p((e, t) => {
46
+ j(a(t)), N(e), F(!0), S?.(e, t);
47
+ }, [S]), L = f({
48
+ activeTab: A,
49
+ messages: E,
50
+ statusLabels: O
51
+ }), R = l({
52
+ selectedReceivableId: M,
53
+ enabled: P,
54
+ messages: E
55
+ }), z = d({
56
+ messages: E,
57
+ counterpartMessageLabels: _,
58
+ embeddedBankName: y,
59
+ onCreated: I
60
+ }), B = p(() => {
61
+ let e = o(A);
62
+ z.openCreate(e === "quote" ? "quote" : "invoice");
63
+ }, [A, z.openCreate]), V = c({
64
+ selectedReceivable: R.receivable,
65
+ messages: E,
66
+ onCreated: I,
67
+ onDeleted: (e) => {
68
+ e === M && (N(void 0), F(!1));
69
+ },
70
+ onCompleteBeforeIssue: (e) => {
71
+ z.openEdit(e, { highlightForIssue: !0 }), F(!1);
72
+ }
73
+ }), H = p((e) => {
74
+ u() || (N(e.id), F(!0), C?.(e.id, e.type));
75
+ }, [C]);
76
+ return {
77
+ activeTab: A,
78
+ enabledTabs: k,
79
+ setActiveTab: j,
80
+ table: L,
81
+ details: R,
82
+ detailsOpen: P,
83
+ closeDetails: p(() => {
84
+ F(!1), N(void 0);
85
+ }, []),
86
+ form: z,
87
+ openCreate: B,
88
+ actions: V,
89
+ handleRowClick: H,
90
+ handleActionClick: p((e, t) => {
91
+ let n = L.getReceivableById(t.id);
92
+ if (e === "edit") {
93
+ if (n) {
94
+ z.openEdit(n);
95
+ return;
96
+ }
97
+ N(t.id), F(!0);
98
+ return;
99
+ }
100
+ N(t.id), V.openAction(e, t, n ?? null);
101
+ }, [
102
+ V,
103
+ z.openEdit,
104
+ L.getReceivableById
105
+ ]),
106
+ handleDetailsActionClick: p((e, t) => {
107
+ if (e === "edit") {
108
+ R.receivable && (z.openEdit(R.receivable), F(!1));
109
+ return;
110
+ }
111
+ V.openAction(e, {
112
+ id: t.id,
113
+ title: t.title,
114
+ type: t.type
115
+ }, R.receivable ?? null);
116
+ }, [
117
+ V,
118
+ R.receivable,
119
+ z.openEdit
120
+ ])
121
+ };
122
+ }
123
+ //#endregion
124
+ export { _ as useReceivablesWidget };
@@ -0,0 +1,324 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Calendar as e, Skeleton as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { EmbeddedToaster as n } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
7
+ import "../../../shared/ui/dist/index.js";
8
+ import { useAnalyticsTrack as r } from "../../../shared/feature/dist/lib/analytics/hooks.js";
9
+ import { WidgetProvider as i } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { CounterpartFormSheet as a } from "../../../shared/counterpart-management/ui/dist/index9.js";
12
+ import { CounterpartSelector as o } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
13
+ import "../../../shared/counterpart-management/feature/dist/index.js";
14
+ import { ReceivablesWidgetAnalyticsEvent as s, WIDGET_NAME as c } from "./index2.js";
15
+ import { PAGE_SIZE_OPTIONS as l } from "./index4.js";
16
+ import { ReceivableActionDialog as u } from "../../ui/dist/index5.js";
17
+ import { ReceivableBankAccountSection as d } from "../../ui/dist/index6.js";
18
+ import { ReceivableBillingSection as f } from "../../ui/dist/index11.js";
19
+ import { ReceivableDetailsSheet as p } from "../../ui/dist/index22.js";
20
+ import { ReceivableFormSheet as m } from "../../ui/dist/index25.js";
21
+ import { ReceivablePaymentDialog as h } from "../../ui/dist/index26.js";
22
+ import { ReceivableRecurrenceEmailDialog as g } from "../../ui/dist/index31.js";
23
+ import { ReceivableRecurrenceSection as _ } from "../../ui/dist/index33.js";
24
+ import { ReceivableRemindersSection as v } from "../../ui/dist/index35.js";
25
+ import { ReceivableSendDialog as y } from "../../ui/dist/index36.js";
26
+ import { ReceivablesScreen as b } from "../../ui/dist/index38.js";
27
+ import "../../ui/dist/index.js";
28
+ import { ReceivableAttachmentsSection as x } from "./index5.js";
29
+ import { MeasureUnitsManagerContainer as S } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
30
+ import { ProductSelector as C } from "../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
31
+ import "../../../shared/product-catalog/feature/dist/index.js";
32
+ import { useReceivablesWidget as w } from "./index31.js";
33
+ import { useEffect as T, useId as E, useState as D } from "react";
34
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
35
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js
36
+ function j({ counterpartFormLabels: i, counterpartMessageLabels: c, defaultTab: j, detailsLabels: M, embeddedBankName: N, enabledTabs: P, formLabels: F, measureUnitDeleteLabels: I, measureUnitsLabels: L, messageLabels: R, onReceivableCreated: z, onReceivableOpened: B, onTemplateSettingsClick: V, pageSizeOptions: H = l, paymentLabels: U, productMessageLabels: W, screenLabels: G, sendLabels: K, actionLabels: q }) {
37
+ let J = r();
38
+ T(() => {
39
+ J(s.Mounted);
40
+ }, [J]);
41
+ let Y = w({
42
+ counterpartMessageLabels: c,
43
+ defaultTab: j,
44
+ embeddedBankName: N,
45
+ enabledTabs: P,
46
+ messageLabels: R,
47
+ onReceivableCreated: z,
48
+ onReceivableOpened: B,
49
+ screenLabels: G
50
+ }), [X, Z] = D(!1), Q = E(), $ = E(), ee = E(), te = E();
51
+ return /* @__PURE__ */ A(O, { children: [
52
+ /* @__PURE__ */ k(n, {}),
53
+ /* @__PURE__ */ k(b, {
54
+ rows: Y.table.rows,
55
+ activeTab: Y.activeTab,
56
+ enabledTabs: Y.enabledTabs,
57
+ onTabChange: Y.setActiveTab,
58
+ isLoading: Y.table.isLoading,
59
+ isError: Y.table.isError,
60
+ sorting: Y.table.sorting,
61
+ onSortingChange: Y.table.onSortingChange,
62
+ pageSize: Y.table.pageSize,
63
+ onPageSizeChange: Y.table.onPageSizeChange,
64
+ pageSizeOptions: H,
65
+ hasNextPage: Y.table.hasNextPage,
66
+ hasPrevPage: Y.table.hasPrevPage,
67
+ onNextPage: Y.table.onNextPage,
68
+ onPrevPage: Y.table.onPrevPage,
69
+ searchValue: Y.table.searchValue,
70
+ onSearchChange: Y.table.onSearchChange,
71
+ statusFilter: Y.table.statusFilter,
72
+ statusOptions: Y.table.statusOptions,
73
+ onStatusFilterChange: Y.table.onStatusFilterChange,
74
+ statusCards: Y.table.statusCards,
75
+ onStatusCardSelect: Y.table.onStatusFilterChange,
76
+ isFiltering: Y.table.isFiltering,
77
+ onCreateClick: Y.openCreate,
78
+ onTemplateSettingsClick: V,
79
+ onRowClick: Y.handleRowClick,
80
+ onActionClick: Y.handleActionClick,
81
+ onRetry: Y.table.onRetry,
82
+ labels: G
83
+ }),
84
+ /* @__PURE__ */ k(m, {
85
+ open: Y.form.open,
86
+ onOpenChange: (e) => {
87
+ e || Y.form.close();
88
+ },
89
+ mode: Y.form.mode,
90
+ values: Y.form.sheetValues,
91
+ errors: Y.form.errors,
92
+ currencyOptions: Y.form.currencyOptions,
93
+ unitOptions: Y.form.lineItemUnitOptions,
94
+ currencySymbol: Y.form.currencySymbol,
95
+ lineItemControls: Y.form.lineItemControls,
96
+ autoFocusLineItemId: Y.form.autoFocusLineItemId,
97
+ lineItemsLoading: Y.form.lineItemsLoading,
98
+ inProgress: Y.form.isSubmitting,
99
+ customerSelector: /* @__PURE__ */ k(o, {
100
+ mode: "customer",
101
+ value: Y.form.values.customerId || void 0,
102
+ invalid: !!Y.form.errors.customerId,
103
+ onValueChange: (e) => Y.form.updateValues({ customerId: e }),
104
+ onCreateClick: Y.form.openCounterpartCreate
105
+ }),
106
+ renderProductSelector: (e, t) => /* @__PURE__ */ k(C, {
107
+ ...t,
108
+ inputValue: e.name,
109
+ selectedProductId: Y.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
110
+ currency: Y.form.values.currency,
111
+ maxLength: 100,
112
+ onInputValueChange: (t) => Y.form.updateLineItem(e.id, { name: t }),
113
+ onProductSelect: (t) => Y.form.selectProduct(e.id, t)
114
+ }),
115
+ onChange: Y.form.updateValues,
116
+ onLineItemChange: Y.form.updateLineItem,
117
+ onLineItemCommit: Y.form.commitLineItem,
118
+ onLineItemQuantityStep: Y.form.stepLineItem,
119
+ onTaxRateCommit: Y.form.commitTaxRate,
120
+ onDiscountFocus: Y.form.focusDiscount,
121
+ onDiscountCommit: Y.form.commitDiscount,
122
+ totals: Y.form.totalsView,
123
+ onManageUnits: () => Z(!0),
124
+ onAddLineItem: Y.form.addLineItem,
125
+ onRemoveLineItem: Y.form.removeLineItem,
126
+ showDueDateField: Y.form.showDueDateField,
127
+ billingSection: Y.form.showBillingSection && /* @__PURE__ */ k(f, {
128
+ idPrefix: Q,
129
+ paymentTerms: Y.form.paymentTerms.view,
130
+ paymentTermsError: Y.form.errors.paymentTermsId,
131
+ disabled: Y.form.isSubmitting,
132
+ onPaymentTermsChange: Y.form.paymentTerms.select,
133
+ onCustomDatePickerOpenChange: Y.form.paymentTerms.changeCustomDatePickerOpen,
134
+ customDateCalendar: /* @__PURE__ */ k(e, {
135
+ mode: "single",
136
+ captionLayout: "dropdown",
137
+ ...Y.form.paymentTerms.calendar,
138
+ onSelect: Y.form.paymentTerms.selectCustomDate
139
+ }),
140
+ recurrenceSection: Y.form.showRecurrenceSection && (Y.form.recurrenceLoading ? /* @__PURE__ */ k(t, { className: "ttw:h-9 ttw:w-full" }) : /* @__PURE__ */ k(_, {
141
+ idPrefix: $,
142
+ view: Y.form.recurrence.view,
143
+ disabled: Y.form.isSubmitting,
144
+ onFrequencyChange: Y.form.recurrence.changeFrequency,
145
+ onMonthDayChange: Y.form.recurrence.changeMonthDay,
146
+ onWeekdayChange: Y.form.recurrence.changeWeekday,
147
+ onStartDateChange: Y.form.recurrence.changeStartDate,
148
+ onEndModeChange: Y.form.recurrence.changeEndMode,
149
+ onEndDateChange: Y.form.recurrence.changeEndDate,
150
+ onMaxOccurrencesChange: Y.form.recurrence.changeMaxOccurrences,
151
+ onCreationModeChange: Y.form.recurrence.changeCreationMode,
152
+ onSetUpEmailClick: Y.form.recurrence.setUpEmail,
153
+ emailDialog: /* @__PURE__ */ k(g, {
154
+ idPrefix: $,
155
+ view: Y.form.recurrence.emailView,
156
+ onOpenChange: Y.form.recurrence.changeEmailOpen,
157
+ onChange: Y.form.recurrence.changeEmail,
158
+ onSave: Y.form.recurrence.saveEmail,
159
+ labels: F
160
+ }),
161
+ labels: F
162
+ })),
163
+ labels: F
164
+ }),
165
+ remindersSection: Y.form.reminders.view && /* @__PURE__ */ k(v, {
166
+ idPrefix: te,
167
+ view: Y.form.reminders.view,
168
+ onToggle: Y.form.reminders.toggle,
169
+ onPaymentReminderSelect: Y.form.reminders.selectPaymentReminder,
170
+ onOverdueReminderSelect: Y.form.reminders.selectOverdueReminder,
171
+ onBeforeDueInputChange: Y.form.reminders.changeBeforeDueInput,
172
+ onBeforeDueSave: Y.form.reminders.saveBeforeDue,
173
+ onOverdueTermChange: Y.form.reminders.changeOverdueTerm,
174
+ onOverdueAddTerm: Y.form.reminders.addOverdueTerm,
175
+ onOverdueClear: Y.form.reminders.clearOverdueTerms,
176
+ onOverdueSave: Y.form.reminders.saveOverdue,
177
+ labels: F
178
+ }),
179
+ bankAccountSection: /* @__PURE__ */ k(d, {
180
+ idPrefix: ee,
181
+ view: Y.form.bankAccount.view,
182
+ error: Y.form.errors.bankAccountId,
183
+ disabled: Y.form.isSubmitting,
184
+ onAccountSelect: Y.form.bankAccount.selectAccount,
185
+ onAddAccountClick: Y.form.bankAccount.openAddAccount,
186
+ onFormChange: Y.form.bankAccount.updateAccountForm,
187
+ onFormSave: Y.form.bankAccount.saveAccount,
188
+ onFormCancel: Y.form.bankAccount.cancelAddAccount,
189
+ labels: F
190
+ }),
191
+ attachmentsSection: Y.form.attachmentsView && /* @__PURE__ */ k(x, {
192
+ view: Y.form.attachmentsView,
193
+ disabled: Y.form.isSubmitting,
194
+ onFilesSelect: Y.form.selectAttachmentFiles,
195
+ onIncludeInEmailChange: Y.form.setAttachmentIncludeInEmail,
196
+ onRemove: Y.form.removeAttachment,
197
+ labels: F
198
+ }),
199
+ cancelDisabled: Y.form.isSubmitting || Y.form.attachmentsUploading,
200
+ draftButtonLabel: Y.form.draftButtonLabel,
201
+ draftDisabled: Y.form.draftDisabled,
202
+ primaryButtonLabel: Y.form.primaryButtonLabel,
203
+ primaryDisabled: Y.form.primaryDisabled,
204
+ scrollContainerRef: Y.form.scrollContainerRef,
205
+ onSubmit: Y.form.submit,
206
+ onDraftClick: Y.form.selectDraftMode,
207
+ onPrimaryClick: Y.form.selectPrimaryMode,
208
+ onCancel: Y.form.close,
209
+ labels: F
210
+ }),
211
+ /* @__PURE__ */ k(p, {
212
+ open: Y.detailsOpen,
213
+ onOpenChange: (e) => {
214
+ e || Y.closeDetails();
215
+ },
216
+ details: Y.details.detailsView,
217
+ isLoading: Y.details.isLoading,
218
+ isError: Y.details.isError,
219
+ onActionClick: Y.handleDetailsActionClick,
220
+ onClose: Y.closeDetails,
221
+ labels: M
222
+ }),
223
+ /* @__PURE__ */ k(y, {
224
+ open: Y.actions.sendOpen,
225
+ onOpenChange: (e) => {
226
+ e || Y.actions.closeSend();
227
+ },
228
+ values: Y.actions.sendValues,
229
+ errors: Y.actions.sendErrors,
230
+ inProgress: Y.actions.sendInProgress,
231
+ onChange: (e) => Y.actions.setSendValues((t) => ({
232
+ ...t,
233
+ ...e
234
+ })),
235
+ onSubmit: Y.actions.submitSend,
236
+ onCancel: Y.actions.closeSend,
237
+ labels: K
238
+ }),
239
+ /* @__PURE__ */ k(h, {
240
+ open: Y.actions.paymentOpen,
241
+ onOpenChange: (e) => {
242
+ e || Y.actions.closePayment();
243
+ },
244
+ values: Y.actions.paymentValues,
245
+ errors: Y.actions.paymentErrors,
246
+ inProgress: Y.actions.paymentInProgress,
247
+ onChange: (e) => Y.actions.setPaymentValues((t) => ({
248
+ ...t,
249
+ ...e
250
+ })),
251
+ onSubmit: Y.actions.submitPayment,
252
+ onCancel: Y.actions.closePayment,
253
+ labels: U
254
+ }),
255
+ Y.actions.actionDialog && /* @__PURE__ */ k(u, {
256
+ open: !!Y.actions.actionTarget,
257
+ onOpenChange: (e) => {
258
+ e || Y.actions.closeAction();
259
+ },
260
+ title: Y.actions.actionDialog.title,
261
+ description: Y.actions.actionDialog.description,
262
+ confirmLabel: Y.actions.actionDialog.confirmLabel,
263
+ destructive: Y.actions.actionDialog.destructive,
264
+ error: Y.actions.actionError,
265
+ inProgress: Y.actions.actionInProgress,
266
+ onConfirm: Y.actions.confirmAction,
267
+ onCancel: Y.actions.closeAction,
268
+ labels: q
269
+ }),
270
+ /* @__PURE__ */ k(a, {
271
+ open: Y.form.counterpartView === "create",
272
+ onOpenChange: (e) => {
273
+ e || Y.form.counterpartForm.close();
274
+ },
275
+ mode: "create",
276
+ values: Y.form.counterpartForm.values,
277
+ errors: Y.form.counterpartForm.errors,
278
+ stateOptions: Y.form.stateOptions,
279
+ inProgress: Y.form.counterpartForm.isSubmitting,
280
+ onChange: (e) => Y.form.counterpartForm.setValues((t) => ({
281
+ ...t,
282
+ ...e
283
+ })),
284
+ onAddressChange: (e) => Y.form.counterpartForm.setValues((t) => ({
285
+ ...t,
286
+ address: {
287
+ ...t.address,
288
+ ...e
289
+ }
290
+ })),
291
+ onSubmit: Y.form.counterpartForm.submit,
292
+ onCancel: Y.form.counterpartForm.close,
293
+ labels: i
294
+ }),
295
+ /* @__PURE__ */ k(S, {
296
+ open: X,
297
+ onClose: () => Z(!1),
298
+ managerLabels: L,
299
+ deleteLabels: I,
300
+ messageLabels: W
301
+ })
302
+ ] });
303
+ }
304
+ function M({ 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 }) {
305
+ return /* @__PURE__ */ k(i, {
306
+ widgetName: c,
307
+ baseUrl: e,
308
+ widgetToken: t,
309
+ organizationId: n,
310
+ configClient: r,
311
+ gatewayRouting: a,
312
+ linkComponent: o,
313
+ implementation: s,
314
+ uiFramework: l,
315
+ errorFallback: u,
316
+ onError: d,
317
+ analytics: f,
318
+ disclosuresAcceptance: p,
319
+ providerLabels: m,
320
+ children: /* @__PURE__ */ k(j, { ...h })
321
+ });
322
+ }
323
+ //#endregion
324
+ export { M as ReceivablesWidget, M as default };
@@ -254,22 +254,27 @@ function I(e, t) {
254
254
  function L(n) {
255
255
  return new Intl.NumberFormat().format(t / 10 ** e(n));
256
256
  }
257
- function R(e, { currency: t, messages: n }) {
258
- let r = {};
259
- for (let i of e) {
257
+ var R = .1;
258
+ function z(e, { currency: t, messages: n, requireComplete: r = !1 }) {
259
+ let i = {};
260
+ for (let o of e) {
260
261
  let e = {};
261
- i.name.length > 100 && (e.name = n.lineItemNameTooLong), c(i.price, t) > 9e15 && (e.price = n.lineItemPriceTooHigh.replace("{maxAmount}", L(t))), Object.keys(e).length > 0 && (r[i.id] = e);
262
+ r && S(o) && (e.name = n.lineItemNameRequired), r && a(o.quantity) < R && (e.quantity = n.lineItemQuantityRequired), o.name.length > 100 && (e.name = n.lineItemNameTooLong), c(o.price, t) > 9e15 && (e.price = n.lineItemPriceTooHigh.replace("{maxAmount}", L(t))), Object.keys(e).length > 0 && (i[o.id] = e);
262
263
  }
263
- return Object.keys(r).length > 0 ? r : void 0;
264
- }
265
- function z(e, t) {
266
- let n = Object.values(e ?? {}), r = [t, ...[
267
- "name",
268
- "quantity",
269
- "price",
270
- "measureUnit"
271
- ].map((e) => n.find((t) => t[e])?.[e])].filter((e) => !!e);
272
- return r.length > 0 ? r : void 0;
264
+ return Object.keys(i).length > 0 ? i : void 0;
265
+ }
266
+ function B(e, t, n) {
267
+ let r = Object.values(e ?? {}), i = [
268
+ n,
269
+ t,
270
+ ...[
271
+ "name",
272
+ "quantity",
273
+ "price",
274
+ "measureUnit"
275
+ ].map((e) => r.find((t) => t[e])?.[e])
276
+ ].filter((e) => !!e);
277
+ return i.length > 0 ? i : void 0;
273
278
  }
274
279
  //#endregion
275
- export { t as MAX_AMOUNT_MINOR_UNITS, k as buildLineItemControls, D as commitLineItemField, f as commitTaxRateInput, u as convertPriceInput, b as createLineItem, r as escapeRegex, s as formatPriceInput, v as getCurrencySymbol, n as getNumberSeparators, S as isBlankLineItem, g as isLineItemTaxable, m as keepsSavedTaxRates, T as lineItemFromProduct, h as lineItemTaxRateMinorUnits, j as lineItemToCreatePayload, M as lineItemToUpdatePayload, L as maxAmountLabel, l as parseLocaleDecimal, a as parseQuantity, c as priceInputToMinorUnits, C as reconcileLineItemIds, I as reconcileMeasureUnits, N as responseLineItemToFormValues, E as sanitizeLineItemPatch, i as sanitizeQuantityInput, d as sanitizeTaxRateInput, O as stepLineItemQuantity, w as stripBlankLineItems, z as summarizeLineItemErrors, _ as taxRateFromLineItems, p as taxRateToMinorUnits, x as toSheetLineItem, R as validateLineItems };
280
+ export { t as MAX_AMOUNT_MINOR_UNITS, k as buildLineItemControls, D as commitLineItemField, f as commitTaxRateInput, u as convertPriceInput, b as createLineItem, r as escapeRegex, s as formatPriceInput, v as getCurrencySymbol, n as getNumberSeparators, S as isBlankLineItem, g as isLineItemTaxable, m as keepsSavedTaxRates, T as lineItemFromProduct, h as lineItemTaxRateMinorUnits, j as lineItemToCreatePayload, M as lineItemToUpdatePayload, L as maxAmountLabel, l as parseLocaleDecimal, a as parseQuantity, c as priceInputToMinorUnits, C as reconcileLineItemIds, I as reconcileMeasureUnits, N as responseLineItemToFormValues, E as sanitizeLineItemPatch, i as sanitizeQuantityInput, d as sanitizeTaxRateInput, O as stepLineItemQuantity, w as stripBlankLineItems, B as summarizeLineItemErrors, _ as taxRateFromLineItems, p as taxRateToMinorUnits, x as toSheetLineItem, z as validateLineItems };