@tesouro/embedded-components-react 0.3.11 → 0.3.13

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 (81) hide show
  1. package/dist/index.d.ts +12 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/CardsWidget.d.ts +12 -0
  5. package/dist/lib/CreateCardWidget.d.ts +12 -0
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +13 -14
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -46
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +54 -16
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +24 -52
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +61 -113
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +123 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +11 -31
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +40 -50
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +51 -5
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +5 -72
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +71 -48
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -79
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +91 -33
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +33 -137
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +138 -67
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +63 -200
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +194 -184
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +180 -50
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +64 -12
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +12 -46
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +46 -30
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -158
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +159 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +32 -98
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +102 -13
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +13 -241
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +244 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +4 -29
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +28 -81
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +77 -130
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +145 -3
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +2 -43
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +45 -1
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +1 -8
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -9
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -92
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +94 -3
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -9
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +7 -20
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +14 -51
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +59 -3
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -110
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +107 -8
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +8 -40
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +38 -15
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +18 -98
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +92 -173
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +180 -4
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +5 -8
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +6 -112
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +114 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +0 -24
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +25 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +56 -18
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +4 -1
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +75 -46
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +3 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +120 -115
  66. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +1 -2
  67. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +3 -2
  68. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +19 -12
  69. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +22 -0
  70. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +4 -1
  71. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +0 -1
  72. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +22 -37
  73. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +167 -110
  74. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +18 -18
  75. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +111 -104
  76. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +144 -128
  77. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +20 -18
  78. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  79. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  80. package/dist/packages/shared-ui-shadcn/dist/index.js +1998 -1935
  81. package/package.json +1 -1
@@ -1,243 +1,15 @@
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 { resolveVendor as ie } from "./index3.js";
14
- import { BillCreateScreen as ae } from "../../ui/dist/index41.js";
15
- import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
16
- import { BillDuplicateNotice as oe } from "../../ui/dist/index57.js";
17
- import { ExtractionNotice as se } from "../../ui/dist/index70.js";
18
- import "../../ui/dist/index.js";
19
- import { usePayableHistoryQuery as ce } from "../../data-access/dist/index6.js";
20
- import { useAllPayableLineItemsQuery as le } from "../../data-access/dist/index7.js";
21
- import { usePayableQuery as ue } from "../../data-access/dist/index13.js";
22
- import "../../data-access/dist/index.js";
23
- import { PayBillFlow as de } from "./index10.js";
24
- import "./index11.js";
25
- import { mergeBillCreateScreenCopy as fe } from "./index27.js";
26
- import { useBillCreateController as pe } from "./index35.js";
27
- import { useBillForm as me } from "./index37.js";
28
- import { useApprovalPolicyCardView as he } from "./index15.js";
29
- import { useCurrentApprovalRequestId as ge } from "./index16.js";
30
- import { usePayableDetailActions as _e } from "./index18.js";
31
- import { useScheduledPayment as r } from "./index19.js";
32
- import { useDraftDelete as ve } from "./index20.js";
33
- import { buildBillDetailView as ye } from "./index23.js";
34
- import { buildBillHistory as be } from "./index24.js";
35
- import { SourceDocumentContainer as xe } from "./index28.js";
36
- import { useVendorSectionProps as Se } from "./index30.js";
37
- import { usePaymentInstructionsForm as Ce } from "./index31.js";
38
- import { billCreateTestIds as i } from "./index38.js";
39
- import { useCallback as a, useEffect as we, useMemo as o, useRef as Te, useState as s } from "react";
40
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
41
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js
42
- function Ee(e) {
43
- return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
44
- }
45
- function d({ open: d, onOpenChange: f, payableId: p, readOnly: m = !1, copy: h, poweredByBankName: De, isPossibleDuplicate: Oe }) {
46
- let g = o(() => fe(h), [h]), [_, v] = s(), [y, b] = s(!1), [ke, x] = s(!1), [Ae, S] = s(!1), [C, w] = s(), T = p ?? C, E = ue(T, { pollWhileOcrProcessing: !0 }), D = le(T), O = ee(), k = E.data, A = me({
47
- payable: k,
48
- lineItems: D.lineItems
49
- }), j = k?.counterpart_id;
50
- we(() => {
51
- y || j && (v(j), b(!0));
52
- }, [y, j]);
53
- let je = a((e) => {
54
- b(!0), v(e);
55
- }, []), M = Se({
56
- payableId: m ? void 0 : T,
57
- counterpartId: m ? void 0 : _,
58
- payableCounterpartId: j,
59
- onCounterpartChange: je,
60
- requiredError: A.errors?.vendor
61
- }), N = pe({
62
- payableId: p,
63
- form: A,
64
- counterpartId: _,
65
- clearCounterpart: !!(T && y) && !_,
66
- prepareVendorForSave: M.savePaymentInstructions,
67
- onPayableCreated: w,
68
- onSaved: w,
69
- onDraftSaved: () => f(!1),
70
- onFinalized: () => f(!1)
71
- }), P = !!(N.isSavingDraft || N.isFinalizing), F = m ? T : void 0, I = ge({
72
- payableId: F,
73
- status: k?.status
74
- }), L = Te(null), R = r({
75
- payableId: T,
76
- scheduledPaymentDate: k?.scheduled_payment_date,
77
- enabled: m
78
- }), z = ie(k), B = Ce({
79
- payableId: F,
80
- counterpartId: m ? j : void 0,
81
- saveErrorMessage: g.detail.paymentInstructionsSaveError
82
- }), { initResponse: V } = re(), H = e(V?.scopes, [t.CounterpartWriteOrg]) && e(V?.scopes, [t.PayableWriteOrg]), { actions: Me, decisionDialog: Ne } = _e({
83
- payableId: F,
84
- status: k?.status,
85
- currentApprovalRequestId: I.id,
86
- isPolicyApprover: I.isPolicyApprover,
87
- hasWaitingRequest: I.hasWaitingRequest,
88
- hasScheduledPayment: R.hasScheduledPayment,
89
- scheduledPaymentRecordId: R.scheduledPaymentRecordId,
90
- isScheduledPaymentUnknown: R.isResolving,
91
- labels: g.actions,
92
- onPayBillSelect: () => Ee(z) || !H ? L.current?.open() : B.open()
93
- }), U = ve({
94
- payableId: T,
95
- status: k?.status,
96
- enabled: !m,
97
- labels: g.deleteDraft,
98
- onDeleted: () => f(!1)
99
- }), W = o(() => (O.data?.data ?? []).map((e) => ({
100
- value: e.id,
101
- label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
102
- })), [O.data]), G = ce(F), Pe = e(V?.scopes, [t.UserReadOrg]), K = te({ enabled: m && Pe }), q = o(() => be(G.data?.data ?? [], K.data?.data ?? [], g.history), [
103
- G.data,
104
- K.data,
105
- g.history
106
- ]), J = he({
107
- payableId: F,
108
- approvalPolicyId: k?.approval_policy_id,
109
- enabled: m,
110
- copy: g.approvalPolicyCopy
111
- }), Fe = o(() => m && k ? ye({
112
- payable: k,
113
- lineItems: D.lineItems,
114
- glCodeOptions: W,
115
- history: q,
116
- approvalPolicy: J.view,
117
- labels: g.detail,
118
- hasScheduledPayment: R.hasScheduledPayment
119
- }) : void 0, [
120
- R.hasScheduledPayment,
121
- J.view,
122
- g.detail,
123
- W,
124
- q,
125
- D.lineItems,
126
- k,
127
- m
128
- ]), Y = k?.source_of_payable_data === "ocr", X = z?.name, Ie = m ? X ? g.viewTitle(X) : g.readOnlyTitle : Y && X ? g.extractedTitle(X) : g.newTitle, Le = m && k?.created_at ? g.addedOn(ne(k.created_at.slice(0, 10))) : void 0, Z = a(() => {
129
- let e = A.isDirty || M.hasUnsavedVendorChanges || !!N.stagedFile;
130
- !m && e && !window.confirm(g.discardConfirm) || f(!1);
131
- }, [
132
- N.stagedFile,
133
- g.discardConfirm,
134
- A.isDirty,
135
- f,
136
- m,
137
- M.hasUnsavedVendorChanges
138
- ]), Re = a((e) => {
139
- if (!P) return e ? f(!0) : Z();
140
- }, [
141
- Z,
142
- P,
143
- f
144
- ]), Q = !!Oe && !Ae, $ = !m && Y && !ke, ze = Q || $ ? /* @__PURE__ */ u(c, { children: [Q ? /* @__PURE__ */ l(oe, {
145
- onNotADuplicate: m ? void 0 : () => S(!0),
146
- onRemoveBill: m ? void 0 : () => S(!0),
147
- testId: i.duplicateNotice
148
- }) : null, $ ? /* @__PURE__ */ l(se, { onDismiss: () => x(!0) }) : null] }) : void 0;
149
- return /* @__PURE__ */ u(c, { children: [
150
- /* @__PURE__ */ l(ae, {
151
- open: d,
152
- onOpenChange: Re,
153
- title: Ie,
154
- subtitle: Le,
155
- notice: ze,
156
- vendor: {
157
- ...M,
158
- testId: i.vendorSection
159
- },
160
- values: A.values,
161
- errors: A.errors,
162
- onChange: A.onChange,
163
- lineItems: {
164
- items: A.lineItemRows,
165
- glCodeOptions: W,
166
- discount: A.discount,
167
- onDiscountChange: A.onDiscountChange,
168
- tax: A.tax,
169
- onTaxChange: A.onTaxChange,
170
- total: A.total,
171
- onTotalChange: A.onTotalChange,
172
- onAddLineItem: A.onAddLineItem,
173
- errors: A.lineItemErrors,
174
- testId: i.lineItems
175
- },
176
- documentPanel: /* @__PURE__ */ l(xe, {
177
- payableId: T,
178
- readOnly: m,
179
- isDocumentPending: !!T && !k?.file && (E.isLoading || k?.ocr_status === "processing"),
180
- file: k?.file ? {
181
- id: k.file.id,
182
- name: k.file.name,
183
- url: k.file.url,
184
- mimetype: k.file.mimetype
185
- } : void 0,
186
- staging: {
187
- stagedFile: N.stagedFile,
188
- onFileStaged: N.stageFile,
189
- onClearStagedFile: N.clearStagedFile,
190
- isSaving: P
191
- }
192
- }),
193
- menuItems: U.menuItems,
194
- readOnly: m,
195
- detail: m ? {
196
- view: Fe,
197
- actions: Me,
198
- scheduledSummary: R.hasScheduledPayment && R.scheduledDateLabel ? g.scheduledSummary(R.scheduledDateLabel) : void 0,
199
- paymentInstructionsForm: j && H ? {
200
- isOpen: B.isOpen,
201
- values: B.values,
202
- errors: B.errors,
203
- isSaving: B.isSaving,
204
- onOpen: B.open,
205
- onCancel: B.close,
206
- onChange: B.onChange,
207
- onSave: B.save
208
- } : void 0,
209
- isLoading: E.isLoading || D.isResolving || O.isResolving,
210
- isError: E.isError || D.isError || O.isError
211
- } : void 0,
212
- isLineItemsLoading: D.isResolving,
213
- isSaving: P,
214
- isSavingDraft: N.isSavingDraft,
215
- isFinalizing: N.isFinalizing,
216
- onCancel: Z,
217
- onSaveDraft: N.saveDraft,
218
- onFinalize: N.finalize,
219
- testId: i.dialog
220
- }),
221
- /* @__PURE__ */ l(n, {
222
- ...Ne,
223
- labels: { cancelButton: g.actions.decisionDialog.cancelButton },
224
- testId: i.decisionDialog,
225
- confirmTestId: i.decisionConfirm,
226
- reasonTestId: i.decisionReason
227
- }),
228
- /* @__PURE__ */ l(n, {
229
- ...U.dialog,
230
- labels: { cancelButton: g.actions.decisionDialog.cancelButton },
231
- testId: i.deleteDraftDialog,
232
- confirmTestId: i.deleteDraftConfirm
233
- }),
234
- m && k ? /* @__PURE__ */ l(de, {
235
- ref: L,
236
- payable: k,
237
- poweredByBankName: De,
238
- labels: g.payBill
239
- }) : null
240
- ] });
241
- }
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
+ decisionDialog: "bill-pay-bill-decision-dialog",
9
+ decisionConfirm: "bill-pay-bill-decision-confirm",
10
+ decisionReason: "bill-pay-bill-decision-reason",
11
+ deleteDraftDialog: "bill-pay-bill-delete-draft-dialog",
12
+ deleteDraftConfirm: "bill-pay-bill-delete-draft-confirm"
13
+ };
242
14
  //#endregion
243
- export { d as BillCreateDialog, d as default };
15
+ export { e as billCreateTestIds };
@@ -1,4 +1,244 @@
1
- import "./index27.js";
2
- import "./index35.js";
3
- import "./index37.js";
4
- import "./index39.js";
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 { resolveVendor as ie } from "./index3.js";
14
+ import { BillCreateScreen as ae } from "../../ui/dist/index41.js";
15
+ import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
16
+ import { BillDuplicateNotice as oe } from "../../ui/dist/index57.js";
17
+ import { ExtractionNotice as se } from "../../ui/dist/index70.js";
18
+ import "../../ui/dist/index.js";
19
+ import { usePayableHistoryQuery as ce } from "../../data-access/dist/index6.js";
20
+ import { useAllPayableLineItemsQuery as le } from "../../data-access/dist/index7.js";
21
+ import { usePayableQuery as ue } from "../../data-access/dist/index13.js";
22
+ import "../../data-access/dist/index.js";
23
+ import { PayBillFlow as de } from "./index10.js";
24
+ import "./index11.js";
25
+ import { mergeBillCreateScreenCopy as fe } from "./index28.js";
26
+ import { useBillCreateController as pe } from "./index36.js";
27
+ import { useBillForm as me } from "./index38.js";
28
+ import { useApprovalPolicyCardView as he } from "./index16.js";
29
+ import { useCurrentApprovalRequestId as ge } from "./index17.js";
30
+ import { usePayableDetailActions as _e } from "./index19.js";
31
+ import { useScheduledPayment as r } from "./index20.js";
32
+ import { useDraftDelete as ve } from "./index21.js";
33
+ import { buildBillDetailView as ye } from "./index24.js";
34
+ import { buildBillHistory as be } from "./index25.js";
35
+ import { SourceDocumentContainer as xe } from "./index29.js";
36
+ import { useVendorSectionProps as Se } from "./index31.js";
37
+ import { usePaymentInstructionsForm as Ce } from "./index32.js";
38
+ import { billCreateTestIds as i } from "./index39.js";
39
+ import { useCallback as a, useEffect as we, useMemo as o, useRef as Te, useState as s } from "react";
40
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
41
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
42
+ function Ee(e) {
43
+ return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
44
+ }
45
+ function d({ open: d, onOpenChange: f, payableId: p, readOnly: m = !1, copy: h, poweredByBankName: De, isPossibleDuplicate: Oe }) {
46
+ let g = o(() => fe(h), [h]), [_, v] = s(), [y, b] = s(!1), [ke, x] = s(!1), [Ae, S] = s(!1), [C, w] = s(), T = p ?? C, E = ue(T, { pollWhileOcrProcessing: !0 }), D = le(T), O = ee(), k = E.data, A = me({
47
+ payable: k,
48
+ lineItems: D.lineItems
49
+ }), j = k?.counterpart_id;
50
+ we(() => {
51
+ y || j && (v(j), b(!0));
52
+ }, [y, j]);
53
+ let je = a((e) => {
54
+ b(!0), v(e);
55
+ }, []), M = Se({
56
+ payableId: m ? void 0 : T,
57
+ counterpartId: m ? void 0 : _,
58
+ payableCounterpartId: j,
59
+ onCounterpartChange: je,
60
+ requiredError: A.errors?.vendor
61
+ }), N = pe({
62
+ payableId: p,
63
+ form: A,
64
+ counterpartId: _,
65
+ clearCounterpart: !!(T && y) && !_,
66
+ prepareVendorForSave: M.savePaymentInstructions,
67
+ onPayableCreated: w,
68
+ onSaved: w,
69
+ onDraftSaved: () => f(!1),
70
+ onFinalized: () => f(!1)
71
+ }), P = !!(N.isSavingDraft || N.isFinalizing), F = m ? T : void 0, I = ge({
72
+ payableId: F,
73
+ status: k?.status
74
+ }), L = Te(null), R = r({
75
+ payableId: T,
76
+ scheduledPaymentDate: k?.scheduled_payment_date,
77
+ enabled: m
78
+ }), z = ie(k), B = Ce({
79
+ payableId: F,
80
+ counterpartId: m ? j : void 0,
81
+ saveErrorMessage: g.detail.paymentInstructionsSaveError
82
+ }), { initResponse: V } = re(), H = e(V?.scopes, [t.CounterpartWriteOrg]) && e(V?.scopes, [t.PayableWriteOrg]), U = he({
83
+ payableId: F,
84
+ approvalPolicyId: k?.approval_policy_id,
85
+ enabled: m,
86
+ copy: g.approvalPolicyCopy
87
+ }), { actions: Me, decisionDialog: Ne } = _e({
88
+ payableId: F,
89
+ status: k?.status,
90
+ currentApprovalRequestId: I.id,
91
+ isPolicyApprover: I.isPolicyApprover,
92
+ hasWaitingRequest: I.hasWaitingRequest,
93
+ hasScheduledPayment: R.hasScheduledPayment,
94
+ scheduledPaymentRecordId: R.scheduledPaymentRecordId,
95
+ isScheduledPaymentUnknown: R.isResolving,
96
+ pendingApprovers: U.pendingApprovers,
97
+ labels: g.actions,
98
+ onPayBillSelect: () => Ee(z) || !H ? L.current?.open() : B.open()
99
+ }), W = ve({
100
+ payableId: T,
101
+ status: k?.status,
102
+ enabled: !m,
103
+ labels: g.deleteDraft,
104
+ onDeleted: () => f(!1)
105
+ }), G = o(() => (O.data?.data ?? []).map((e) => ({
106
+ value: e.id,
107
+ label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
108
+ })), [O.data]), K = ce(F), Pe = e(V?.scopes, [t.UserReadOrg]), q = te({ enabled: m && Pe }), J = o(() => be(K.data?.data ?? [], q.data?.data ?? [], g.history), [
109
+ K.data,
110
+ q.data,
111
+ g.history
112
+ ]), Fe = o(() => m && k ? ye({
113
+ payable: k,
114
+ lineItems: D.lineItems,
115
+ glCodeOptions: G,
116
+ history: J,
117
+ approvalPolicy: U.view,
118
+ labels: g.detail,
119
+ hasScheduledPayment: R.hasScheduledPayment
120
+ }) : void 0, [
121
+ R.hasScheduledPayment,
122
+ U.view,
123
+ g.detail,
124
+ G,
125
+ J,
126
+ D.lineItems,
127
+ k,
128
+ m
129
+ ]), Y = k?.source_of_payable_data === "ocr", X = z?.name, Ie = m ? X ? g.viewTitle(X) : g.readOnlyTitle : Y && X ? g.extractedTitle(X) : g.newTitle, Le = m && k?.created_at ? g.addedOn(ne(k.created_at.slice(0, 10))) : void 0, Z = a(() => {
130
+ let e = A.isDirty || M.hasUnsavedVendorChanges || !!N.stagedFile;
131
+ !m && e && !window.confirm(g.discardConfirm) || f(!1);
132
+ }, [
133
+ N.stagedFile,
134
+ g.discardConfirm,
135
+ A.isDirty,
136
+ f,
137
+ m,
138
+ M.hasUnsavedVendorChanges
139
+ ]), Re = a((e) => {
140
+ if (!P) return e ? f(!0) : Z();
141
+ }, [
142
+ Z,
143
+ P,
144
+ f
145
+ ]), Q = !!Oe && !Ae, $ = !m && Y && !ke, ze = Q || $ ? /* @__PURE__ */ u(c, { children: [Q ? /* @__PURE__ */ l(oe, {
146
+ onNotADuplicate: m ? void 0 : () => S(!0),
147
+ onRemoveBill: m ? void 0 : () => S(!0),
148
+ testId: i.duplicateNotice
149
+ }) : null, $ ? /* @__PURE__ */ l(se, { onDismiss: () => x(!0) }) : null] }) : void 0;
150
+ return /* @__PURE__ */ u(c, { children: [
151
+ /* @__PURE__ */ l(ae, {
152
+ open: d,
153
+ onOpenChange: Re,
154
+ title: Ie,
155
+ subtitle: Le,
156
+ notice: ze,
157
+ vendor: {
158
+ ...M,
159
+ testId: i.vendorSection
160
+ },
161
+ values: A.values,
162
+ errors: A.errors,
163
+ onChange: A.onChange,
164
+ lineItems: {
165
+ items: A.lineItemRows,
166
+ glCodeOptions: G,
167
+ discount: A.discount,
168
+ onDiscountChange: A.onDiscountChange,
169
+ tax: A.tax,
170
+ onTaxChange: A.onTaxChange,
171
+ total: A.total,
172
+ onTotalChange: A.onTotalChange,
173
+ onAddLineItem: A.onAddLineItem,
174
+ errors: A.lineItemErrors,
175
+ testId: i.lineItems
176
+ },
177
+ documentPanel: /* @__PURE__ */ l(xe, {
178
+ payableId: T,
179
+ readOnly: m,
180
+ isDocumentPending: !!T && !k?.file && (E.isLoading || k?.ocr_status === "processing"),
181
+ file: k?.file ? {
182
+ id: k.file.id,
183
+ name: k.file.name,
184
+ url: k.file.url,
185
+ mimetype: k.file.mimetype
186
+ } : void 0,
187
+ staging: {
188
+ stagedFile: N.stagedFile,
189
+ onFileStaged: N.stageFile,
190
+ onClearStagedFile: N.clearStagedFile,
191
+ isSaving: P
192
+ }
193
+ }),
194
+ menuItems: W.menuItems,
195
+ readOnly: m,
196
+ detail: m ? {
197
+ view: Fe,
198
+ actions: Me,
199
+ scheduledSummary: R.hasScheduledPayment && R.scheduledDateLabel ? g.scheduledSummary(R.scheduledDateLabel) : void 0,
200
+ paymentInstructionsForm: j && H ? {
201
+ isOpen: B.isOpen,
202
+ values: B.values,
203
+ errors: B.errors,
204
+ isSaving: B.isSaving,
205
+ onOpen: B.open,
206
+ onCancel: B.close,
207
+ onChange: B.onChange,
208
+ onSave: B.save
209
+ } : void 0,
210
+ isLoading: E.isLoading || D.isResolving || O.isResolving,
211
+ isError: E.isError || D.isError || O.isError
212
+ } : void 0,
213
+ isLineItemsLoading: D.isResolving,
214
+ isSaving: P,
215
+ isSavingDraft: N.isSavingDraft,
216
+ isFinalizing: N.isFinalizing,
217
+ onCancel: Z,
218
+ onSaveDraft: N.saveDraft,
219
+ onFinalize: N.finalize,
220
+ testId: i.dialog
221
+ }),
222
+ /* @__PURE__ */ l(n, {
223
+ ...Ne,
224
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
225
+ testId: i.decisionDialog,
226
+ confirmTestId: i.decisionConfirm,
227
+ reasonTestId: i.decisionReason
228
+ }),
229
+ /* @__PURE__ */ l(n, {
230
+ ...W.dialog,
231
+ labels: { cancelButton: g.actions.decisionDialog.cancelButton },
232
+ testId: i.deleteDraftDialog,
233
+ confirmTestId: i.deleteDraftConfirm
234
+ }),
235
+ m && k ? /* @__PURE__ */ l(de, {
236
+ ref: L,
237
+ payable: k,
238
+ poweredByBankName: De,
239
+ labels: g.payBill
240
+ }) : null
241
+ ] });
242
+ }
243
+ //#endregion
244
+ export { d as BillCreateDialog, d as default };
@@ -1,29 +1,4 @@
1
- import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index52.js";
2
- import "../../ui/dist/index.js";
3
- import { APPROVAL_POLICY_RULE_COPY_EN as t } from "./index12.js";
4
- import { BILL_DETAIL_ACTIONS_LABELS_EN as n, SCHEDULED_SUMMARY_LABEL_EN as r } from "./index25.js";
5
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js
6
- var i = {
7
- subtitle: "Accounts payable",
8
- vendorRow: "Vendor",
9
- bankAccountRow: "ACH bank account",
10
- bankAccountValue: (e) => `Account ending in ${e}`,
11
- invoiceNumberRow: "Number",
12
- issueDateRow: "Issue date",
13
- dueDateRow: "Due date",
14
- poNumberRow: "PO number",
15
- notProvided: "Not provided",
16
- glCodeMissing: "GL code not specified",
17
- quantityValue: (e, t) => `${e} x ${t}`,
18
- subtotalRow: "Subtotal",
19
- discountsRow: "Discounts",
20
- taxRow: "Tax",
21
- totalRow: "Total",
22
- actionError: n.actionError,
23
- scheduledSummary: r,
24
- sheet: e,
25
- decisionDialog: n.decisionDialog,
26
- approvalPolicyCopy: t
27
- };
28
- //#endregion
29
- export { i as BILL_DETAILS_LABELS_EN };
1
+ import "./index28.js";
2
+ import "./index36.js";
3
+ import "./index38.js";
4
+ import "./index40.js";
@@ -1,83 +1,30 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveVendor as t, resolveVendorName as n } from "./index3.js";
3
- import { derivePayableStatus as r } from "./index21.js";
4
- import { formatBillMoney as i } from "./index22.js";
1
+ import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index52.js";
2
+ import "../../ui/dist/index.js";
3
+ import { APPROVAL_POLICY_RULE_COPY_EN as t } from "./index12.js";
4
+ import { BILL_DETAIL_ACTIONS_LABELS_EN as n, SCHEDULED_SUMMARY_LABEL_EN as r } from "./index26.js";
5
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
6
- function a({ payable: a, lineItems: o, ledgerAccounts: s, labels: c, hasScheduledPayment: l }) {
7
- let u = a.currency, d = (e) => i(e, u), f = r({
8
- apiStatus: a.status,
9
- dueDate: a.due_date,
10
- scheduledPaymentDate: a.scheduled_payment_date,
11
- hasScheduledPayment: l
12
- }), p = t(a), m = n(a), h = e(a.issued_at) || c.notProvided, g = e(a.due_date) || c.notProvided, _ = [{
13
- label: c.vendorRow,
14
- value: m || c.notProvided,
15
- secondaryValue: p?.email ?? void 0
16
- }], v = p?.bank_account?.account_number;
17
- v && _.push({
18
- label: c.bankAccountRow,
19
- value: c.bankAccountValue(v.slice(-4))
20
- });
21
- let y = [
22
- {
23
- label: c.invoiceNumberRow,
24
- value: a.document_id || c.notProvided
25
- },
26
- {
27
- label: c.issueDateRow,
28
- value: h
29
- },
30
- {
31
- label: c.dueDateRow,
32
- value: g
33
- },
34
- {
35
- label: c.poNumberRow,
36
- value: c.notProvided
37
- }
38
- ], b = new Map(s.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), x = o.map((e) => {
39
- let t = d(e.unit_price);
40
- return {
41
- id: e.id,
42
- description: e.name ?? e.description ?? "",
43
- glCodeLabel: (e.ledger_account_id ? b.get(e.ledger_account_id) : void 0) || c.glCodeMissing,
44
- quantityLabel: e.quantity != null && t ? c.quantityValue(String(e.quantity), t) : "",
45
- amountLabel: d(e.subtotal) ?? ""
46
- };
47
- }), S = [
48
- {
49
- label: c.subtotalRow,
50
- value: a.subtotal
51
- },
52
- {
53
- label: c.discountsRow,
54
- value: a.discount
55
- },
56
- {
57
- label: c.taxRow,
58
- value: a.tax_amount
59
- }
60
- ].map(({ label: e, value: t }) => ({
61
- label: e,
62
- value: d(t)
63
- })).filter((e) => !!e.value), C = d(a.total_amount);
64
- return C && S.push({
65
- label: c.totalRow,
66
- value: C,
67
- emphasis: !0
68
- }), {
69
- title: m,
70
- subtitle: c.subtitle,
71
- status: f.status,
72
- statusTone: f.tone,
73
- amountDueLabel: d(a.amount_due) ?? d(a.total_amount) ?? "",
74
- invoiceDateLabel: h,
75
- dueDateLabel: g,
76
- payToItems: _,
77
- invoiceItems: y,
78
- lineItems: x,
79
- totals: S
80
- };
81
- }
6
+ var i = {
7
+ subtitle: "Accounts payable",
8
+ vendorRow: "Vendor",
9
+ bankAccountRow: "ACH bank account",
10
+ bankAccountValue: (e) => `Account ending in ${e}`,
11
+ invoiceNumberRow: "Number",
12
+ issueDateRow: "Issue date",
13
+ dueDateRow: "Due date",
14
+ poNumberRow: "PO number",
15
+ notProvided: "Not provided",
16
+ glCodeMissing: "GL code not specified",
17
+ quantityValue: (e, t) => `${e} x ${t}`,
18
+ subtotalRow: "Subtotal",
19
+ discountsRow: "Discounts",
20
+ taxRow: "Tax",
21
+ totalRow: "Total",
22
+ actionError: n.actionError,
23
+ actionSuccess: n.actionSuccess,
24
+ scheduledSummary: r,
25
+ sheet: e,
26
+ decisionDialog: n.decisionDialog,
27
+ approvalPolicyCopy: t
28
+ };
82
29
  //#endregion
83
- export { a as mapPayableToBillDetails };
30
+ export { i as BILL_DETAILS_LABELS_EN };