@tesouro/embedded-components-react 0.5.3 → 0.5.5

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 (91) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -13
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +70 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +37 -64
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +110 -38
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +73 -104
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +7 -87
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +21 -7
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +22 -17
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +63 -23
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +2 -66
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +81 -2
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -78
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +39 -30
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +166 -37
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +39 -164
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -48
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +139 -18
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +16 -139
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +4 -24
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +41 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +14 -39
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +8 -16
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +91 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +86 -80
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -97
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +49 -3
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +135 -47
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -135
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +186 -33
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +75 -186
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +21 -75
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +25 -14
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +232 -22
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +210 -223
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +103 -202
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +13 -121
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +47 -12
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +31 -47
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +198 -27
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +31 -198
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +234 -31
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +19 -240
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +24 -25
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +427 -19
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -433
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +38 -4
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +220 -35
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -224
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +10 -6
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +57 -21
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +110 -10
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -112
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +46 -8
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -43
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -58
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +101 -239
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +202 -107
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -209
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +8 -4
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +113 -6
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -115
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +24 -0
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +4 -5
  87. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +1 -0
  88. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  89. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
@@ -1,191 +1,80 @@
1
- import { BILL_REJECTED_BANNER_LABELS_EN as e } from "../../ui/dist/index68.js";
2
- import { UNSAVED_BILL_DIALOG_LABELS_EN as t } from "../../ui/dist/index105.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAttachPayableFileMutation as e } from "../../data-access/dist/index13.js";
6
+ import "../../data-access/dist/index.js";
7
+ import { SourceDocumentPanel as t } from "../../ui/dist/index103.js";
3
8
  import "../../ui/dist/index.js";
4
- import { PAY_BILL_FLOW_LABELS_EN as n, mergePayBillFlowLabels as r } from "./index25.js";
5
- import { MARK_AS_PAID_FLOW_LABELS_EN as i, mergeMarkAsPaidFlowLabels as a } from "./index16.js";
6
- import "./index19.js";
7
- import { APPROVAL_POLICY_RULE_COPY_EN as o } from "./index29.js";
8
- import { BILL_DETAIL_ACTIONS_LABELS_EN as s, PAYMENT_HISTORY_LABELS_EN as c, SCHEDULED_SUMMARY_LABEL_EN as l, mergeBillDetailActionsLabels as u, mergePaymentHistoryMethodLabels as d } from "./index46.js";
9
- import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as f } from "./index47.js";
9
+ import { createSourceDocumentPreview as n } from "./index46.js";
10
+ import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index47.js";
11
+ import { useEffect as i, useState as a } from "react";
12
+ import { jsx as o } from "react/jsx-runtime";
10
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js
11
- var p = {
12
- unmappedValidationError: (e, t) => `${e}: ${t}`,
13
- unknownValidationField: "(unknown field)",
14
- requiredField: "This field is required.",
15
- saveFailed: "We could not save this bill. Try again.",
16
- discountTaxBlockedByLineItems: "Discount and Tax can't be saved on a bill with line items. Remove them, then save again.",
17
- finalizeFailed: "We could not submit this bill. Try again.",
18
- draftSaved: "Bill saved as a draft.",
19
- submittedSaved: "Bill updated.",
20
- submittedDemoted: "Bill updated. It moved back to Drafts because some required details are missing.",
21
- billFinalized: "Bill submitted for approval.",
22
- numbersOnly: "Enter numbers only.",
23
- unreadableMoney: "Enter a valid amount.",
24
- unusableQuantity: "Enter a quantity greater than 0.",
25
- lineItemsNeedAttention: "Check the highlighted line items before saving.",
26
- unreadableDiscount: "Enter a valid discount amount.",
27
- unreadableTax: "Enter a valid tax amount.",
28
- unreadableTotal: "Enter a valid total amount."
29
- }, m = {
30
- achMethod: "via ACH bank transfer",
31
- noMethod: "No payment method on file",
32
- accountHolder: "Account holder",
33
- routingNumber: "Routing number",
34
- accountNumber: "Account number",
35
- paymentMethodLoading: "Loading payment method...",
36
- paymentMethodUnavailable: "We could not load payment methods. Try again.",
37
- searchFailed: "We could not load vendors. Try again.",
38
- vendorDetailsFailed: "We could not load this vendor. Try again."
39
- }, h = {
40
- attachFailed: "We could not attach that file. Try again.",
41
- deleteFailed: "We could not remove that document. Try again.",
42
- noDocument: "No document attached to this bill.",
43
- pendingDeletionNotice: "This document will be removed when you save this bill.",
44
- preview: f
45
- }, g = {
46
- ...c,
47
- notProvided: "Not provided",
48
- paymentInstructionsValue: (e) => `Account ending in ${e}`,
49
- paymentInstructionsNotSet: "Not set",
50
- accountHolderFieldLabel: "Account holder",
51
- routingNumberFieldLabel: "Routing number",
52
- accountNumberFieldLabel: "Account number",
53
- invoiceDateRow: "Invoice date",
54
- dueDateRow: "Due date",
55
- invoiceNumberRow: "Invoice number",
56
- glCodeMissing: "GL code not specified",
57
- glCodeUnavailable: "GL code unavailable",
58
- qtyPriceValue: (e, t) => `${e} x ${t}`,
59
- subtotalRow: "Subtotal",
60
- taxRow: "Tax",
61
- discountRow: "Discounts",
62
- totalRow: "Total",
63
- paidOnLabel: (e) => `Paid on ${e}`,
64
- paymentInstructionsSaveError: "Couldn't save payment instructions. Try again.",
65
- paymentInstructionsLinkError: "Payment instructions were saved to the vendor, but couldn't be added to this bill. Try again.",
66
- rejectedByOn: (e, t) => `Rejected by ${e} on ${t}`,
67
- rejectedOn: (e) => `Rejected on ${e}`,
68
- rejectionMessage: (e) => `"${e}"`
69
- }, _ = {
70
- dateLabel: (e) => new Date(e).toLocaleString("en-US", {
71
- month: "short",
72
- day: "numeric",
73
- year: "numeric",
74
- hour: "numeric",
75
- minute: "2-digit"
76
- }),
77
- byActor: (e, t) => `${e} by ${t}`,
78
- billAdded: "Bill added",
79
- billUploaded: "Bill uploaded",
80
- billUpdated: "Bill updated",
81
- attachmentAdded: "Attachment added",
82
- submittedForApproval: "Submitted for approval",
83
- approvalRequested: "Approval requested",
84
- approved: "Approved",
85
- autoApproved: "Approved automatically",
86
- rejected: "Rejected",
87
- rejectedWithReason: (e) => `Rejected: ${e}`,
88
- reopened: "Reopened",
89
- markedAsPaid: "Marked as paid",
90
- markedAsPartiallyPaid: "Marked as partially paid",
91
- paymentReverted: "Payment reverted",
92
- statusChanged: (e) => `Status changed to ${e}`
93
- }, v = {
94
- newTitle: "New bill",
95
- extractedTitle: (e) => `Bill from ${e}`,
96
- viewTitle: (e) => `Bill from ${e}`,
97
- readOnlyTitle: "Bill details",
98
- addedOn: (e) => `Added on ${e}`,
99
- unsavedChanges: t,
100
- scheduledSummary: l,
101
- actions: s,
102
- detail: g,
103
- history: _,
104
- payBill: n,
105
- markAsPaid: i,
106
- approvalPolicyCopy: o,
107
- deleteDraft: {
108
- menuItem: "Delete draft",
109
- dialog: {
110
- title: "Delete this draft?",
111
- description: "The draft and anything entered on it are removed. This can't be undone.",
112
- confirmButton: "Delete draft"
113
- },
114
- error: "Couldn't delete this draft. Try again."
115
- },
116
- lineItemsGlCodeUnavailable: {
117
- loadError: "Couldn't load GL codes",
118
- noAccess: "You don't have access to GL codes",
119
- empty: "No GL codes set up yet"
120
- },
121
- rejectedBanner: e
122
- };
123
- function y(e) {
124
- return {
125
- ...v,
126
- ...e,
127
- actions: u(e?.actions),
128
- detail: {
129
- ...v.detail,
130
- ...e?.detail,
131
- paymentHistoryMethodLabels: d(e?.detail?.paymentHistoryMethodLabels)
132
- },
133
- history: {
134
- ...v.history,
135
- ...e?.history
136
- },
137
- payBill: r(e?.payBill),
138
- markAsPaid: a(e?.markAsPaid),
139
- lineItemsGlCodeUnavailable: {
140
- ...v.lineItemsGlCodeUnavailable,
141
- ...e?.lineItemsGlCodeUnavailable
142
- },
143
- unsavedChanges: {
144
- ...v.unsavedChanges,
145
- ...e?.unsavedChanges
146
- },
147
- rejectedBanner: {
148
- ...v.rejectedBanner,
149
- ...e?.rejectedBanner
150
- },
151
- approvalPolicyCopy: {
152
- ...v.approvalPolicyCopy,
153
- ...e?.approvalPolicyCopy
154
- },
155
- deleteDraft: {
156
- ...v.deleteDraft,
157
- ...e?.deleteDraft,
158
- dialog: (() => {
159
- let t = {
160
- ...v.deleteDraft.dialog,
161
- ...e?.deleteDraft?.dialog
162
- };
163
- return delete t.reason, t;
164
- })()
14
+ function s(e) {
15
+ let [t, n] = a();
16
+ return i(() => {
17
+ if (!e) {
18
+ n(void 0);
19
+ return;
165
20
  }
166
- };
21
+ let t = URL.createObjectURL(e);
22
+ return n(t), () => URL.revokeObjectURL(t);
23
+ }, [e]), t;
24
+ }
25
+ function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
26
+ let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
27
+ ...r,
28
+ ...p,
29
+ preview: {
30
+ ...r.preview,
31
+ ...p?.preview
32
+ }
33
+ }, w = e(), T = s(m), E = !!(a && !v || m);
34
+ if (!E && (c || w.isPending)) return /* @__PURE__ */ o(t, {
35
+ mode: "loading",
36
+ fileName: l
37
+ });
38
+ if (!E && u) return /* @__PURE__ */ o("div", {
39
+ className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
+ children: C.noDocument
41
+ });
42
+ if (!E) return /* @__PURE__ */ o(t, {
43
+ mode: "upload",
44
+ uploadStatus: w.isPending || x ? "uploading" : "idle",
45
+ uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
+ noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
47
+ onFilesSelected: (e) => {
48
+ let [t] = e;
49
+ if (t) {
50
+ if (i) {
51
+ let e = () => w.mutate({
52
+ path: { payable_id: i },
53
+ file: t
54
+ });
55
+ if (v && b) {
56
+ b().then(e, () => void 0);
57
+ return;
58
+ }
59
+ e();
60
+ } else h?.(t);
61
+ }
62
+ }
63
+ });
64
+ let D = a?.name ?? m?.name ?? "", O = n(a || {
65
+ name: D,
66
+ url: T ?? "",
67
+ mimetype: m?.type ?? ""
68
+ }, C.preview);
69
+ return /* @__PURE__ */ o(t, {
70
+ mode: "document",
71
+ fileName: D,
72
+ preview: O,
73
+ isDeleting: x,
74
+ deleteErrorMessage: S ? C.deleteFailed : void 0,
75
+ onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
+ onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
77
+ });
167
78
  }
168
- var b = {
169
- createTitle: "New vendor",
170
- editTitle: "Edit vendor",
171
- close: "Close the vendor form",
172
- nameLabel: "Name",
173
- addAddress: "Add address (optional)",
174
- paymentMethodsHeading: "Accepted payment methods",
175
- paymentMethodsDescription: "How and where will the money be sent. Don't have these yet? No problem. You can save this vendor and add their payment details later — you just won't be able to send payments until you do.",
176
- achTitle: "ACH bank transfer",
177
- achDescription: "Fast, direct deposit to the vendor's bank. Arrives in 1–3 business days.",
178
- addBankAccount: "Add bank account",
179
- accountHolderNameLabel: "Account holder name",
180
- routingNumberLabel: "Routing number",
181
- accountNumberLabel: "Account number",
182
- achHelp: "Ask your vendor for this — it's usually on their invoice, W-9, or a payment instructions email they send you.",
183
- cancel: "Cancel",
184
- save: "Save vendor",
185
- discardConfirmTitle: "Discard unsaved changes?",
186
- discardConfirmDescription: "You've made changes to this vendor that haven't been saved. If you leave now, they'll be lost.",
187
- keepEditingAction: "Keep editing",
188
- discardChangesAction: "Discard changes"
189
- };
190
79
  //#endregion
191
- export { p as BILL_CREATE_MESSAGE_LABELS_EN, v as BILL_CREATE_SCREEN_LABELS_EN, g as BILL_DETAIL_VIEW_LABELS_EN, _ as BILL_HISTORY_LABELS_EN, h as SOURCE_DOCUMENT_CONTAINER_LABELS_EN, b as VENDOR_INLINE_FORM_LABELS_EN, m as VENDOR_SECTION_PROPS_LABELS_EN, y as mergeBillCreateScreenCopy };
80
+ export { c as SourceDocumentContainer, c as default };
@@ -1,80 +1,26 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAttachPayableFileMutation as e } from "../../data-access/dist/index13.js";
6
- import "../../data-access/dist/index.js";
7
- import { SourceDocumentPanel as t } from "../../ui/dist/index103.js";
8
- import "../../ui/dist/index.js";
9
- import { createSourceDocumentPreview as n } from "./index47.js";
10
- import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index48.js";
11
- import { useEffect as i, useState as a } from "react";
12
- import { jsx as o } from "react/jsx-runtime";
13
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js
14
- function s(e) {
15
- let [t, n] = a();
16
- return i(() => {
17
- if (!e) {
18
- n(void 0);
19
- return;
20
- }
21
- let t = URL.createObjectURL(e);
22
- return n(t), () => URL.revokeObjectURL(t);
23
- }, [e]), t;
2
+ function e(e) {
3
+ return e?.trim() ?? "";
24
4
  }
25
- function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
26
- let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
27
- ...r,
28
- ...p,
29
- preview: {
30
- ...r.preview,
31
- ...p?.preview
32
- }
33
- }, w = e(), T = s(m), E = !!(a && !v || m);
34
- if (!E && (c || w.isPending)) return /* @__PURE__ */ o(t, {
35
- mode: "loading",
36
- fileName: l
37
- });
38
- if (!E && u) return /* @__PURE__ */ o("div", {
39
- className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
40
- children: C.noDocument
41
- });
42
- if (!E) return /* @__PURE__ */ o(t, {
43
- mode: "upload",
44
- uploadStatus: w.isPending || x ? "uploading" : "idle",
45
- uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
46
- noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
47
- onFilesSelected: (e) => {
48
- let [t] = e;
49
- if (t) {
50
- if (i) {
51
- let e = () => w.mutate({
52
- path: { payable_id: i },
53
- file: t
54
- });
55
- if (v && b) {
56
- b().then(e, () => void 0);
57
- return;
58
- }
59
- e();
60
- } else h?.(t);
61
- }
5
+ function t(t) {
6
+ let n = e(t);
7
+ return n.length === 2 ? n.toUpperCase() : "";
8
+ }
9
+ function n(n) {
10
+ if (!n) return;
11
+ let r = {
12
+ legalName: e(n.name),
13
+ email: e(n.email),
14
+ phone: e(n.phone),
15
+ address: {
16
+ line1: e(n.address?.line1),
17
+ line2: e(n.address?.line2),
18
+ city: e(n.address?.city),
19
+ state: t(n.address?.state),
20
+ postalCode: e(n.address?.postal_code)
62
21
  }
63
- });
64
- let D = a?.name ?? m?.name ?? "", O = n(a || {
65
- name: D,
66
- url: T ?? "",
67
- mimetype: m?.type ?? ""
68
- }, C.preview);
69
- return /* @__PURE__ */ o(t, {
70
- mode: "document",
71
- fileName: D,
72
- preview: O,
73
- isDeleting: x,
74
- deleteErrorMessage: S ? C.deleteFailed : void 0,
75
- onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
76
- onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
77
- });
22
+ };
23
+ return r.legalName || r.email || r.phone || Object.values(r.address).some(Boolean) ? r : void 0;
78
24
  }
79
25
  //#endregion
80
- export { c as SourceDocumentContainer, c as default };
26
+ export { n as buildVendorPrefill };
@@ -1,16 +1,27 @@
1
- import { useEffect as e, useReducer as t } from "react";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js
3
- var n = 1e4;
4
- function r(e) {
5
- return !e || e.approval_policy_id || e.status !== "approve_in_progress" || !e.updated_at ? !0 : Date.now() - new Date(e.updated_at).getTime() >= n;
6
- }
7
- function i(i) {
8
- let a = r(i), [, o] = t((e) => e + 1, 0);
9
- return e(() => {
10
- if (a || !i?.updated_at) return;
11
- let e = n - (Date.now() - new Date(i.updated_at).getTime()), t = setTimeout(o, Math.max(e, 0));
12
- return () => clearTimeout(t);
13
- }, [a, i?.updated_at]), a;
14
- }
2
+ var e = {
3
+ selectRow: ({ vendorLabel: e, invoiceNumberLabel: t, addedOnLabel: n }) => `Select bill — ${e}, invoice ${t}, added ${n}`,
4
+ openRow: ({ vendorLabel: e, invoiceNumberLabel: t, addedOnLabel: n }) => `View bill — ${e}, invoice ${t}, added ${n}`,
5
+ reviewGroup: ({ vendorLabel: e, count: t }) => `${e} — ${t} possible duplicate bills`,
6
+ selectGroup: ({ vendorLabel: e }) => `Select every bill from ${e}`,
7
+ deleteBillButton: "Remove this bill",
8
+ deleteConfirmTitle: "Remove duplicate bill?",
9
+ deleteConfirmDescription: "You can't undo this action.",
10
+ deleteConfirmButton: "Remove duplicate bill",
11
+ deleteConfirmBackButton: "Cancel",
12
+ cancelBillButton: "Cancel this bill",
13
+ confirmBillButton: "Confirm duplicate",
14
+ cancelConfirmTitle: "Cancel duplicate bill?",
15
+ cancelConfirmDescription: "You can't undo this action.",
16
+ cancelConfirmButton: "Cancel this bill",
17
+ cancelConfirmBackButton: "Back",
18
+ deletedToast: "Duplicate removed",
19
+ cancelledToast: "Duplicate cancelled",
20
+ confirmedToast: "Duplicate confirmed",
21
+ dismissedToast: "Marked as “not a duplicate”.",
22
+ removedToast: "Duplicate removed",
23
+ verdictFailedToast: "Couldn't update this duplicate. Try again.",
24
+ allResolvedToast: "All possible duplicates resolved"
25
+ };
15
26
  //#endregion
16
- export { r as isApprovalPolicyAssignmentSettled, i as useIsApprovalPolicyAssignmentSettled };
27
+ export { e as DUPLICATE_BILLS_LABELS_EN };
@@ -1,26 +1,236 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { getStateOptions as s } from "../../../shared/util/dist/lib/usStates.js";
7
+ import { AchFieldGroup as ee } from "../../../shared/counterpart-management/ui/dist/index5.js";
8
+ import { CounterpartFormFields as c, useFocusFirstInvalidField as l } from "../../../shared/counterpart-management/ui/dist/index9.js";
9
+ import { COUNTERPART_MESSAGE_LABELS_EN as u } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
10
+ import { useCounterpartForm as d } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
11
+ import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { VENDOR_INLINE_FORM_LABELS_EN as f } from "./index47.js";
13
+ import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
14
+ import { Fragment as te, jsx as v, jsxs as y } from "react/jsx-runtime";
15
+ import { Landmark as b, Plus as ne, X as x } from "lucide-react";
1
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js
2
- function e(e) {
3
- return e?.trim() ?? "";
4
- }
5
- function t(t) {
6
- let n = e(t);
7
- return n.length === 2 ? n.toUpperCase() : "";
8
- }
9
- function n(n) {
10
- if (!n) return;
11
- let r = {
12
- legalName: e(n.name),
13
- email: e(n.email),
14
- phone: e(n.phone),
15
- address: {
16
- line1: e(n.address?.line1),
17
- line2: e(n.address?.line2),
18
- city: e(n.address?.city),
19
- state: t(n.address?.state),
20
- postalCode: e(n.address?.postal_code)
17
+ function S({ mode: S, counterpart: C, primaryAddress: w, bankAccounts: T, isBankAccountsLoading: E, isBankAccountsError: D, initialName: O, initialValues: k, onSaved: A, onCancel: j, onDirtyChange: M, labels: N }) {
18
+ let P = {
19
+ ...f,
20
+ ...N
21
+ }, [F, I] = _("none"), [L, R] = _(C?.id), [z, B] = _(!1), [V, H] = _(!1), [U, W] = _(!1);
22
+ m(() => {
23
+ M?.(V);
24
+ }, [V, M]);
25
+ let G = h(() => s(), []), K = g(F), q = g(!1), J = d({
26
+ view: F,
27
+ setView: I,
28
+ selectedId: L,
29
+ setSelectedId: R,
30
+ messages: u,
31
+ counterpartType: "vendor",
32
+ counterpart: C,
33
+ primaryAddress: w,
34
+ bankAccounts: T,
35
+ isBankAccountsLoading: E,
36
+ isBankAccountsError: D
37
+ }), { openCreate: Y, openEdit: X, setValues: Z, expandAddress: Q } = J, re = l(J.errors);
38
+ m(() => {
39
+ S === "edit" ? X() : Y();
40
+ }, [
41
+ S,
42
+ Y,
43
+ X
44
+ ]), m(() => {
45
+ K.current !== "none" && F === "none" && L && A(L), K.current = F;
46
+ }, [
47
+ F,
48
+ L,
49
+ A
50
+ ]), m(() => {
51
+ S !== "create" || q.current || (q.current = !0, Z((e) => ({
52
+ ...e,
53
+ entityType: "organization",
54
+ legalName: O?.trim() || k?.legalName || e.legalName,
55
+ email: k?.email || e.email,
56
+ phone: k?.phone || e.phone,
57
+ address: k?.address ?? e.address
58
+ })), k?.address && Object.values(k.address).some(Boolean) && Q());
59
+ }, [
60
+ S,
61
+ O,
62
+ k,
63
+ Z,
64
+ Q
65
+ ]), m(() => {
66
+ S === "edit" && (J.values.bankAccount.routingNumber || J.values.bankAccount.accountNumber) && B(!0);
67
+ }, [
68
+ S,
69
+ J.values.bankAccount.accountNumber,
70
+ J.values.bankAccount.routingNumber
71
+ ]), m(() => {
72
+ J.sectionsToExpand.bankAccount && B(!0);
73
+ }, [J.sectionsToExpand.bankAccount]);
74
+ let $ = p(() => {
75
+ if (V) {
76
+ W(!0);
77
+ return;
21
78
  }
22
- };
23
- return r.legalName || r.email || r.phone || Object.values(r.address).some(Boolean) ? r : void 0;
79
+ j();
80
+ }, [V, j]), ie = p((e) => {
81
+ H(!0), Z((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
82
+ ...t,
83
+ ...e,
84
+ firstName: t.firstName || t.legalName,
85
+ legalName: t.legalName
86
+ } : e.entityType === "organization" && t.entityType !== "organization" ? {
87
+ ...t,
88
+ ...e,
89
+ legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
90
+ } : {
91
+ ...t,
92
+ ...e
93
+ });
94
+ }, [Z]);
95
+ return /* @__PURE__ */ y("div", {
96
+ ref: re,
97
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4",
98
+ children: [
99
+ /* @__PURE__ */ y("div", {
100
+ className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-2",
101
+ children: [/* @__PURE__ */ v("p", {
102
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
103
+ children: S === "edit" ? P.editTitle : P.createTitle
104
+ }), /* @__PURE__ */ v(o, {
105
+ type: "button",
106
+ variant: "ghost",
107
+ size: "icon",
108
+ "aria-label": P.close,
109
+ onClick: $,
110
+ children: /* @__PURE__ */ v(x, { className: "ttw:size-4" })
111
+ })]
112
+ }),
113
+ /* @__PURE__ */ v(c, {
114
+ mode: S,
115
+ counterpartMode: "vendor",
116
+ values: J.values,
117
+ errors: J.errors,
118
+ stateOptions: G,
119
+ onChange: ie,
120
+ onAddressChange: (e) => {
121
+ H(!0), Z((t) => ({
122
+ ...t,
123
+ address: {
124
+ ...t.address,
125
+ ...e
126
+ }
127
+ }));
128
+ },
129
+ sections: {
130
+ entityType: !0,
131
+ profileHeading: !1,
132
+ title: !1,
133
+ taxId: !1,
134
+ address: "collapsible",
135
+ bankAccount: !1
136
+ },
137
+ sectionsToExpand: J.sectionsToExpand,
138
+ onAddressExpand: J.expandAddress,
139
+ labels: { businessNameLabel: P.nameLabel }
140
+ }),
141
+ /* @__PURE__ */ y("div", {
142
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
143
+ children: [/* @__PURE__ */ v("p", {
144
+ className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
145
+ children: P.paymentMethodsHeading
146
+ }), /* @__PURE__ */ v("p", {
147
+ className: "ttw:text-sm ttw:text-muted-foreground",
148
+ children: P.paymentMethodsDescription
149
+ })]
150
+ }),
151
+ /* @__PURE__ */ y("div", {
152
+ className: "ttw:flex ttw:gap-3 ttw:rounded-lg ttw:border ttw:border-border ttw:p-3",
153
+ children: [/* @__PURE__ */ v("span", {
154
+ className: "ttw:flex ttw:size-8 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-md ttw:bg-primary",
155
+ children: /* @__PURE__ */ v(b, {
156
+ "aria-hidden": !0,
157
+ className: "ttw:size-4 ttw:text-white"
158
+ })
159
+ }), /* @__PURE__ */ y("div", {
160
+ className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-3",
161
+ children: [/* @__PURE__ */ y("div", {
162
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5",
163
+ children: [/* @__PURE__ */ v("p", {
164
+ className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
165
+ children: P.achTitle
166
+ }), /* @__PURE__ */ v("p", {
167
+ className: "ttw:text-sm ttw:text-muted-foreground",
168
+ children: P.achDescription
169
+ })]
170
+ }), z ? /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ v(ee, {
171
+ idPrefix: "vendor-inline-ach",
172
+ values: J.values.bankAccount,
173
+ errors: J.errors?.bankAccount,
174
+ onChange: (e) => {
175
+ H(!0), Z((t) => ({
176
+ ...t,
177
+ bankAccount: {
178
+ ...t.bankAccount,
179
+ ...e
180
+ }
181
+ }));
182
+ },
183
+ labels: {
184
+ accountHolderName: P.accountHolderNameLabel,
185
+ routingNumber: P.routingNumberLabel,
186
+ accountNumber: P.accountNumberLabel
187
+ }
188
+ }), /* @__PURE__ */ v("p", {
189
+ className: "ttw:text-sm ttw:text-muted-foreground",
190
+ children: P.achHelp
191
+ })] }) : /* @__PURE__ */ y(o, {
192
+ type: "button",
193
+ variant: "link",
194
+ className: "ttw:w-fit ttw:px-0",
195
+ onClick: () => B(!0),
196
+ children: [/* @__PURE__ */ v(ne, { className: "ttw:size-4" }), P.addBankAccount]
197
+ })]
198
+ })]
199
+ }),
200
+ /* @__PURE__ */ y("div", {
201
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
202
+ children: [/* @__PURE__ */ v(o, {
203
+ type: "button",
204
+ variant: "outline",
205
+ onClick: $,
206
+ children: P.cancel
207
+ }), /* @__PURE__ */ v(o, {
208
+ type: "button",
209
+ onClick: J.submit,
210
+ loading: J.isSubmitting,
211
+ disabled: J.isSubmitting,
212
+ children: P.save
213
+ })]
214
+ }),
215
+ /* @__PURE__ */ v(e, {
216
+ open: U,
217
+ onOpenChange: W,
218
+ children: /* @__PURE__ */ y(t, { children: [/* @__PURE__ */ y(i, { children: [/* @__PURE__ */ v(a, { children: P.discardConfirmTitle }), /* @__PURE__ */ v(n, { children: P.discardConfirmDescription })] }), /* @__PURE__ */ y(r, { children: [/* @__PURE__ */ v(o, {
219
+ type: "button",
220
+ variant: "outline",
221
+ onClick: () => W(!1),
222
+ children: P.keepEditingAction
223
+ }), /* @__PURE__ */ v(o, {
224
+ type: "button",
225
+ variant: "destructive",
226
+ onClick: () => {
227
+ W(!1), j();
228
+ },
229
+ children: P.discardChangesAction
230
+ })] })] })
231
+ })
232
+ ]
233
+ });
24
234
  }
25
235
  //#endregion
26
- export { n as buildVendorPrefill };
236
+ export { S as VendorInlineForm, S as default };