@tesouro/embedded-components-react 0.4.5 → 0.4.6

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 (40) hide show
  1. package/README.md +37 -37
  2. package/dist/index.d.ts +14 -8
  3. package/dist/lib/CreditCardsWidget.d.ts +4 -2
  4. package/dist/lib/DebitCardsWidget.d.ts +4 -2
  5. package/dist/lib/WidgetSuite.d.ts +14 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +4 -4
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +72 -56
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +77 -48
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +47 -91
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +91 -33
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +33 -167
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +168 -75
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +75 -21
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +23 -210
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +199 -203
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +198 -89
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +105 -13
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +12 -47
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +47 -31
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +27 -198
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +198 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +30 -234
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +240 -19
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +19 -342
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +344 -4
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +4 -33
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +32 -83
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +24 -24
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +2 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +2 -0
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +28 -3
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -0
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +152 -131
  35. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +84 -87
  36. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +0 -1
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +2 -2
  39. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js +12 -10
  40. package/package.json +1 -1
@@ -1,344 +1,21 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import { useAllLedgerAccountsQuery as ee } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
8
- import { useAllOrganizationUsersQuery as te } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
- import "../../../shared/data-access/dist/index.js";
10
- import { formatCalendarDate as ne } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
- import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
- import "../../../shared/feature/dist/index.js";
13
- import { usePayableHistoryQuery as ie } from "../../data-access/dist/index9.js";
14
- import { useAllPayableLineItemsQuery as ae } from "../../data-access/dist/index10.js";
15
- import { usePayableQuery as oe } from "../../data-access/dist/index15.js";
16
- import "../../data-access/dist/index.js";
17
- import { resolveVendor as se } from "./index5.js";
18
- import { BillCreateScreen as ce } from "../../ui/dist/index45.js";
19
- import { BillDecisionDialog as n } from "../../ui/dist/index51.js";
20
- import { BillDuplicateNotice as le } from "../../ui/dist/index61.js";
21
- import { ExtractionNotice as ue } from "../../ui/dist/index79.js";
22
- import { MarkAsPaidDialog as de } from "../../ui/dist/index88.js";
23
- import { UnsavedBillDialog as fe } from "../../ui/dist/index98.js";
24
- import "../../ui/dist/index.js";
25
- import { usePayableDuplicateReview as pe } from "./index10.js";
26
- import "./index11.js";
27
- import { resolveAmountDueMinorUnits as me } from "./index17.js";
28
- import { PayBillFlow as he } from "./index23.js";
29
- import "./index24.js";
30
- import { useMarkAsPaidFlow as ge } from "./index14.js";
31
- import "./index15.js";
32
- import { BILL_CREATE_MESSAGE_LABELS_EN as _e, mergeBillCreateScreenCopy as ve } from "./index41.js";
33
- import { useBillCreateController as ye } from "./index50.js";
34
- import { useBillForm as be } from "./index52.js";
35
- import { useApprovalPolicyCardView as xe } from "./index30.js";
36
- import { useCurrentApprovalRequestId as Se } from "./index31.js";
37
- import { usePayableDetailActions as Ce } from "./index32.js";
38
- import { useScheduledPayment as we } from "./index33.js";
39
- import { isEditablePayableStatus as Te } from "./index34.js";
40
- import { useDraftDelete as Ee } from "./index35.js";
41
- import { buildBillDetailView as De } from "./index37.js";
42
- import { buildBillHistory as Oe } from "./index38.js";
43
- import { SourceDocumentContainer as ke } from "./index42.js";
44
- import { useVendorSectionProps as Ae } from "./index45.js";
45
- import { usePaymentInstructionsForm as je } from "./index46.js";
46
- import { billCreateTestIds as r } from "./index53.js";
47
- import { useCallback as i, useEffect as Me, useMemo as a, useRef as Ne, useState as o } from "react";
48
- import { Fragment as Pe, jsx as s, jsxs as Fe } from "react/jsx-runtime";
49
- import { Trash2Icon as Ie } from "lucide-react";
50
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
51
- function c({ open: c, onOpenChange: l, payableId: u, readOnly: d = !1, copy: f, onCollapse: Le, poweredByBankName: Re }) {
52
- let p = a(() => ve(f), [f]), [m, h] = o(), [g, _] = o(!1), [ze, Be] = o(!1), [Ve, v] = o(!1), [He, y] = o(), b = u ?? He, x = oe(b, { pollWhileOcrProcessing: !0 }), S = ae(b), { initResponse: C } = re(), w = !!C, T = e(C?.scopes, [t.AccountingConfigReadOrg]), E = ee({ enabled: T }), D = x.data, O = !b || !!D, k = !d && O && !!b && D?.status !== "draft", Ue = !d && !!D && !Te(D?.status), A = d || Ue, j = be({
53
- payable: D,
54
- lineItems: S.lineItems
55
- }), M = D?.counterpart_id;
56
- Me(() => {
57
- g || M && (h(M), _(!0));
58
- }, [g, M]);
59
- let We = i((e) => {
60
- _(!0), h(e);
61
- }, []), N = Ae({
62
- payableId: d ? void 0 : b,
63
- counterpartId: d ? void 0 : m,
64
- payableCounterpartId: M,
65
- onCounterpartChange: We,
66
- requiredError: j.errors?.vendor,
67
- payableCounterpartBankAccountId: D?.counterpart_bank_account_id ?? void 0,
68
- extractedVendor: D?.counterpart_raw_data ?? void 0
69
- }), Ge = !!(b && g) && !m, Ke = a(() => k ? { saveDraftButton: p.submittedSaveButton } : void 0, [p.submittedSaveButton, k]), qe = a(() => k ? { draftSaved: _e.submittedSaved } : void 0, [k]), P = x.refetch, Je = i(async () => {
70
- let { data: e } = await P();
71
- return e?.status ?? void 0;
72
- }, [P]), F = ye({
73
- payableId: u,
74
- form: j,
75
- labels: qe,
76
- counterpartId: m,
77
- clearCounterpart: Ge,
78
- prepareVendorForSave: N.savePaymentInstructions,
79
- onPayableCreated: y,
80
- onSaved: y,
81
- onDraftSaved: () => l(!1),
82
- onFinalized: () => l(!1),
83
- readSavedStatus: k ? Je : void 0
84
- }), I = !!(F.isSavingDraft || F.isFinalizing), L = d ? b : void 0, R = Se({
85
- payableId: L,
86
- status: D?.status
87
- }), Ye = Ne(null), z = we({
88
- payableId: b,
89
- scheduledPaymentDate: D?.scheduled_payment_date,
90
- enabled: d || k
91
- }), Xe = se(D), B = je({
92
- payableId: L,
93
- counterpartId: d ? M : void 0,
94
- saveErrorMessage: p.detail.paymentInstructionsSaveError,
95
- linkErrorMessage: p.detail.paymentInstructionsLinkError
96
- }), Ze = e(C?.scopes, [t.PayableWriteOrg]), Qe = e(C?.scopes, [t.CounterpartWriteOrg]) && Ze, V = ge({
97
- payableId: L,
98
- amountDueMinorUnits: me(D) ?? 0,
99
- amountToPayMinorUnits: D?.amount_to_pay ?? void 0,
100
- currencyCode: D?.currency ?? void 0,
101
- dueDate: D?.due_date,
102
- hasScheduledPayment: z.hasScheduledPayment,
103
- labels: p.markAsPaid
104
- }), H = xe({
105
- payableId: L,
106
- approvalPolicyId: D?.approval_policy_id,
107
- enabled: d,
108
- copy: p.approvalPolicyCopy
109
- }), { actions: U, decisionDialog: $e, isActionPending: et } = Ce({
110
- payableId: d || k ? b : void 0,
111
- status: D?.status,
112
- currentApprovalRequestId: R.id,
113
- isPolicyApprover: R.isPolicyApprover,
114
- hasWaitingRequest: R.hasWaitingRequest,
115
- arePendingApproversUnknown: H.isLoading,
116
- hasScheduledPayment: z.hasScheduledPayment,
117
- scheduledPaymentIntentId: z.scheduledPaymentIntentId,
118
- isScheduledPaymentUnknown: z.isResolving,
119
- pendingApprovers: H.pendingApprovers,
120
- labels: p.actions,
121
- isMarkAsPaidPending: V.isPending,
122
- onMarkAsPaidSelect: V.open,
123
- onPayBillSelect: () => Ye.current?.open(),
124
- onActionSucceeded: k ? () => l(!1) : void 0
125
- }), W = Ee({
126
- payableId: b,
127
- status: D?.status,
128
- enabled: !d,
129
- labels: p.deleteDraft,
130
- onDeleted: () => l(!1)
131
- }), G = I || et, tt = a(() => [...W.menuItems, ...k ? U.menu.map((e) => ({
132
- id: e.id,
133
- label: e.label,
134
- onSelect: e.onSelect,
135
- disabled: e.disabled
136
- })) : []], [
137
- U.menu,
138
- W.menuItems,
139
- k
140
- ]), K = a(() => (E.data?.data ?? []).map((e) => ({
141
- value: e.id,
142
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
143
- })), [E.data]), q;
144
- w && (T ? E.isError ? q = p.lineItemsGlCodeUnavailable.loadError : !E.isResolving && K.length === 0 && (q = p.lineItemsGlCodeUnavailable.empty) : q = p.lineItemsGlCodeUnavailable.noAccess);
145
- let nt = !w || !!q || E.isResolving, rt = T && !E.isResolving && !E.isError, it = ie(L), at = e(C?.scopes, [t.UserReadOrg]), ot = te({ enabled: d && at }), J = a(() => Oe(it.data?.data ?? [], ot.data?.data ?? [], p.history), [
146
- it.data,
147
- ot.data,
148
- p.history
149
- ]), st = a(() => d && D ? De({
150
- payable: D,
151
- lineItems: S.lineItems,
152
- glCodeOptions: K,
153
- glCodeRosterAvailable: rt,
154
- history: J,
155
- approvalPolicy: H.view,
156
- labels: p.detail,
157
- hasScheduledPayment: z.hasScheduledPayment
158
- }) : void 0, [
159
- z.hasScheduledPayment,
160
- H.view,
161
- p.detail,
162
- K,
163
- rt,
164
- J,
165
- S.lineItems,
166
- D,
167
- d
168
- ]), ct = D?.source_of_payable_data === "ocr", Y = Xe?.name, lt = d ? Y ? p.viewTitle(Y) : p.readOnlyTitle : Y && (ct || k) ? p.extractedTitle(Y) : p.newTitle, ut = d && D?.created_at ? p.addedOn(ne(D.created_at.slice(0, 10))) : void 0, X = i(() => {
169
- let e = j.isDirty || N.hasUnsavedVendorChanges || !!F.stagedFile || F.isFileDeletionPending;
170
- if (!A && e) {
171
- v(!0);
172
- return;
173
- }
174
- l(!1);
175
- }, [
176
- F.isFileDeletionPending,
177
- F.stagedFile,
178
- j.isDirty,
179
- A,
180
- l,
181
- N.hasUnsavedVendorChanges
182
- ]), dt = i(() => {
183
- v(!1), l(!1);
184
- }, [l]), Z = S.isResolving || N.mode === "creating", ft = i(async () => {
185
- if (Z) return;
186
- let e = await F.saveDraft();
187
- v(!1), e && l(!1);
188
- }, [
189
- F,
190
- Z,
191
- l
192
- ]), Q = pe({
193
- payable: D,
194
- onRemoved: () => l(!1),
195
- canManage: Ze
196
- }), pt = i((e) => {
197
- if (!(G || Q.isBusy)) return e ? l(!0) : X();
198
- }, [
199
- Q.isBusy,
200
- G,
201
- X,
202
- l
203
- ]), mt = Q.isPossibleDuplicate, $ = !d && ct && !ze, ht = mt || $ ? /* @__PURE__ */ Fe(Pe, { children: [mt ? /* @__PURE__ */ s(le, {
204
- onNotADuplicate: Q.onNotADuplicate,
205
- onRemoveBill: Q.onRemoveBill,
206
- isActionDisabled: Q.isBusy,
207
- labels: Q.removeBillLabel ? { removeBillButton: Q.removeBillLabel } : void 0,
208
- testId: r.duplicateNotice
209
- }) : null, $ ? /* @__PURE__ */ s(ue, { onDismiss: () => Be(!0) }) : null] }) : void 0;
210
- return /* @__PURE__ */ Fe(Pe, { children: [
211
- /* @__PURE__ */ s(ce, {
212
- open: c,
213
- onOpenChange: pt,
214
- title: lt,
215
- subtitle: ut,
216
- notice: ht,
217
- vendor: {
218
- ...N,
219
- testId: r.vendorSection
220
- },
221
- values: j.values,
222
- errors: j.errors,
223
- onChange: j.onChange,
224
- lineItems: {
225
- items: j.lineItemRows,
226
- glCodeOptions: K,
227
- glCodeDisabled: nt,
228
- glCodeUnavailableMessage: q,
229
- discount: j.discount,
230
- onDiscountChange: j.onDiscountChange,
231
- tax: j.tax,
232
- onTaxChange: j.onTaxChange,
233
- total: j.total,
234
- onTotalChange: j.onTotalChange,
235
- onAddLineItem: j.onAddLineItem,
236
- errors: j.lineItemErrors,
237
- totalsErrors: j.totalsErrors,
238
- testId: r.lineItems
239
- },
240
- documentPanel: /* @__PURE__ */ s(ke, {
241
- payableId: b,
242
- readOnly: A,
243
- isDocumentPending: !!b && !D?.file && (x.isLoading || D?.ocr_status === "processing"),
244
- file: D?.file ? {
245
- id: D.file.id,
246
- name: D.file.name,
247
- url: D.file.url,
248
- mimetype: D.file.mimetype
249
- } : void 0,
250
- staging: {
251
- stagedFile: F.stagedFile,
252
- onFileStaged: F.stageFile,
253
- onClearStagedFile: F.clearStagedFile,
254
- isSaving: I
255
- },
256
- deletion: {
257
- isPending: F.isFileDeletionPending,
258
- onRequest: F.requestFileDeletion,
259
- onDetachNow: F.detachFileNow,
260
- isDeleting: F.isDeletingFile,
261
- hasFailed: F.hasFileDeletionFailed
262
- }
263
- }),
264
- menuItems: tt,
265
- readOnly: A,
266
- detail: d ? {
267
- view: st,
268
- actions: U,
269
- scheduledSummary: z.hasScheduledPayment && z.scheduledDateLabel ? p.scheduledSummary(z.scheduledDateLabel) : void 0,
270
- paymentInstructionsForm: M && Qe ? {
271
- isOpen: B.isOpen,
272
- values: B.values,
273
- errors: B.errors,
274
- isSaving: B.isSaving,
275
- onOpen: B.open,
276
- onCancel: B.close,
277
- onChange: B.onChange,
278
- onSave: B.save
279
- } : void 0,
280
- isLoading: x.isLoading || S.isResolving || E.isResolving,
281
- isError: x.isError || S.isError || E.isError
282
- } : void 0,
283
- isLineItemsLoading: S.isResolving,
284
- isSaving: G,
285
- isSavingDraft: F.isSavingDraft,
286
- isFinalizing: F.isFinalizing,
287
- onCancel: X,
288
- onCollapse: d ? Le : void 0,
289
- onSaveDraft: F.saveDraft,
290
- onFinalize: F.finalize,
291
- scrollToErrorToken: F.scrollToErrorToken,
292
- showFinalize: !k && O,
293
- labels: Ke,
294
- testId: r.dialog
295
- }),
296
- /* @__PURE__ */ s(fe, {
297
- open: Ve,
298
- onSaveDraft: ft,
299
- onDiscard: dt,
300
- onCancel: () => v(!1),
301
- isSaving: F.isSavingDraft,
302
- isSaveDraftDisabled: Z,
303
- labels: p.unsavedChanges,
304
- testId: r.unsavedDialog,
305
- saveDraftTestId: r.unsavedSaveDraft,
306
- discardTestId: r.unsavedDiscard,
307
- closeTestId: r.unsavedClose
308
- }),
309
- /* @__PURE__ */ s(n, {
310
- ...$e,
311
- labels: { cancelButton: p.actions.decisionDialog.cancelButton },
312
- testId: r.decisionDialog,
313
- confirmTestId: r.decisionConfirm,
314
- reasonTestId: r.decisionReason
315
- }),
316
- /* @__PURE__ */ s(n, {
317
- ...W.dialog,
318
- labels: { cancelButton: p.actions.decisionDialog.cancelButton },
319
- testId: r.deleteDraftDialog,
320
- confirmTestId: r.deleteDraftConfirm
321
- }),
322
- /* @__PURE__ */ s(n, {
323
- open: Q.removeConfirmation.open,
324
- copy: Q.removeConfirmation.copy,
325
- onConfirm: Q.removeConfirmation.onConfirm,
326
- onCancel: Q.removeConfirmation.onCancel,
327
- isPending: Q.removeConfirmation.isPending,
328
- confirmIcon: /* @__PURE__ */ s(Ie, {}),
329
- labels: { cancelButton: Q.removeConfirmation.cancelButtonLabel },
330
- testId: r.duplicateRemoveDialog,
331
- confirmTestId: r.duplicateRemoveConfirm
332
- }),
333
- /* @__PURE__ */ s(de, { ...V.dialogProps }),
334
- d && D ? /* @__PURE__ */ s(he, {
335
- ref: Ye,
336
- payable: D,
337
- onMissingAchInstructions: Qe ? B.open : void 0,
338
- poweredByBankName: Re,
339
- labels: p.payBill
340
- }) : null
341
- ] });
342
- }
2
+ var e = {
3
+ dialog: "bill-pay-bill-create-dialog",
4
+ vendorSection: "bill-pay-bill-create-vendor",
5
+ lineItems: "bill-pay-bill-create-line-items",
6
+ documentPanel: "bill-pay-bill-create-document",
7
+ duplicateNotice: "bill-pay-bill-create-duplicate-notice",
8
+ duplicateRemoveDialog: "bill-pay-bill-create-duplicate-remove-dialog",
9
+ duplicateRemoveConfirm: "bill-pay-bill-create-duplicate-remove-confirm",
10
+ decisionDialog: "bill-pay-bill-decision-dialog",
11
+ decisionConfirm: "bill-pay-bill-decision-confirm",
12
+ decisionReason: "bill-pay-bill-decision-reason",
13
+ deleteDraftDialog: "bill-pay-bill-delete-draft-dialog",
14
+ deleteDraftConfirm: "bill-pay-bill-delete-draft-confirm",
15
+ unsavedDialog: "bill-pay-bill-unsaved-dialog",
16
+ unsavedSaveDraft: "bill-pay-bill-unsaved-save-draft",
17
+ unsavedDiscard: "bill-pay-bill-unsaved-discard",
18
+ unsavedClose: "bill-pay-bill-unsaved-close"
19
+ };
343
20
  //#endregion
344
- export { c as BillCreateDialog, c as default };
21
+ export { e as billCreateTestIds };