@tesouro/embedded-components-react 0.2.280 → 0.2.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/dist/experimental/WidgetSuite.d.ts +9 -1
- package/dist/experimental/index.d.ts +9 -1
- package/dist/index.css +20 -6
- package/dist/index.d.ts +46 -23
- package/dist/index.js +54 -53
- package/dist/lib/AcceptDisclosuresWidget.d.ts +9 -1
- package/dist/lib/BalancesWidget.d.ts +8 -0
- package/dist/lib/BankAccountOnboardingWidget.d.ts +9 -1
- package/dist/lib/BankAccountsWidget.d.ts +9 -1
- package/dist/lib/BillPayWidget.d.ts +8 -0
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/lib/CardDetailsWidget.d.ts +9 -1
- package/dist/lib/CardsWidget.d.ts +9 -1
- package/dist/lib/ChartOfAccountsWidget.d.ts +9 -1
- package/dist/lib/CounterpartsWidget.d.ts +9 -1
- package/dist/lib/CreateCardWidget.d.ts +9 -1
- package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +9 -1
- package/dist/lib/ExpenseManagementWidget.d.ts +9 -1
- package/dist/lib/ExpenseRequirementsWidget.d.ts +9 -1
- package/dist/lib/HelpWidget.d.ts +9 -1
- package/dist/lib/InsightsWidget.d.ts +8 -0
- package/dist/lib/InvoicingWidget.d.ts +9 -1
- package/dist/lib/LinkedAccountsWidget.d.ts +9 -1
- package/dist/lib/ProductsWidget.d.ts +9 -1
- package/dist/lib/ProfileWidget.d.ts +9 -1
- package/dist/lib/ReceiptMatchWidget.d.ts +9 -1
- package/dist/lib/ReceivablesWidget.d.ts +9 -1
- package/dist/lib/SettingsWidget.d.ts +9 -1
- package/dist/lib/TagsWidget.d.ts +9 -1
- package/dist/lib/TeamWidget.d.ts +9 -1
- package/dist/lib/TransfersWidget.d.ts +8 -0
- package/dist/lib/WidgetProvider.d.ts +25 -2
- package/dist/lib/WidgetProvider.js +8 -7
- package/dist/lib/WidgetProviderPublic.d.ts +8 -0
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +54 -53
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +30 -29
- package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +69 -67
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +158 -132
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/labels.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/ErrorState/ErrorState.js +19 -18
- package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +3 -2
- package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
- package/package.json +1 -1
|
@@ -9,32 +9,36 @@ import { SourceDocumentPanel as r } from "../../ui/dist/index48.js";
|
|
|
9
9
|
import "../../ui/dist/index.js";
|
|
10
10
|
import { jsx as i } from "react/jsx-runtime";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js
|
|
12
|
-
function a({ payableId: a, file: o, isDocumentPending: s, pendingFileName: c,
|
|
13
|
-
let
|
|
12
|
+
function a({ payableId: a, file: o, isDocumentPending: s, pendingFileName: c, readOnly: l, labels: u }) {
|
|
13
|
+
let d = {
|
|
14
14
|
...e,
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
-
if (!o && (s ||
|
|
15
|
+
...u
|
|
16
|
+
}, f = t(), p = n();
|
|
17
|
+
if (!o && (s || f.isPending)) return /* @__PURE__ */ i(r, {
|
|
18
18
|
mode: "loading",
|
|
19
19
|
fileName: c
|
|
20
20
|
});
|
|
21
|
+
if (!o && l) return /* @__PURE__ */ i("div", {
|
|
22
|
+
className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
|
|
23
|
+
children: d.noDocument
|
|
24
|
+
});
|
|
21
25
|
if (!o && !a) return /* @__PURE__ */ i("div", {
|
|
22
26
|
className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
|
|
23
|
-
children:
|
|
27
|
+
children: d.saveBeforeAttaching
|
|
24
28
|
});
|
|
25
29
|
if (!o) return /* @__PURE__ */ i(r, {
|
|
26
30
|
mode: "upload",
|
|
27
|
-
uploadStatus:
|
|
28
|
-
uploadErrorMessage:
|
|
31
|
+
uploadStatus: f.isPending ? "uploading" : "idle",
|
|
32
|
+
uploadErrorMessage: f.isError ? d.attachFailed : void 0,
|
|
29
33
|
onFilesSelected: (e) => {
|
|
30
34
|
let [t] = e;
|
|
31
|
-
!t || !a ||
|
|
35
|
+
!t || !a || f.mutate({
|
|
32
36
|
path: { payable_id: a },
|
|
33
37
|
file: t
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
40
|
});
|
|
37
|
-
let
|
|
41
|
+
let m = o.mimetype === "application/pdf" ? /* @__PURE__ */ i("iframe", {
|
|
38
42
|
src: `${o.url}#toolbar=0&navpanes=0`,
|
|
39
43
|
title: o.name,
|
|
40
44
|
referrerPolicy: "no-referrer",
|
|
@@ -47,9 +51,9 @@ function a({ payableId: a, file: o, isDocumentPending: s, pendingFileName: c, la
|
|
|
47
51
|
return /* @__PURE__ */ i(r, {
|
|
48
52
|
mode: "document",
|
|
49
53
|
fileName: o.name,
|
|
50
|
-
preview:
|
|
54
|
+
preview: m,
|
|
51
55
|
onDownload: () => window.open(o.url, "_blank", "noopener,noreferrer"),
|
|
52
|
-
onDelete: a ? () =>
|
|
56
|
+
onDelete: a && !l ? () => p.mutate({
|
|
53
57
|
path: { file_id: o.id },
|
|
54
58
|
payableId: a
|
|
55
59
|
}) : void 0
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { Implementation as e } from "../../../shared/feature/dist/lib/WidgetProvider/types.js";
|
|
6
|
-
import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
7
|
-
import "../../../shared/feature/dist/index.js";
|
|
8
|
-
import { BillPayWidgetMonite as n } from "./index15.js";
|
|
9
|
-
import "./index16.js";
|
|
10
|
-
import { BillPayWidgetNative as r } from "./index28.js";
|
|
1
|
+
import "./index27.js";
|
|
2
|
+
import "./index28.js";
|
|
11
3
|
import "./index29.js";
|
|
12
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
13
|
-
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js
|
|
14
|
-
function a({ implementation: a, ...o }) {
|
|
15
|
-
let s = t().implementation, c = a ?? s ?? e.Monite;
|
|
16
|
-
return c === e.Native ? /* @__PURE__ */ i(r, {
|
|
17
|
-
implementation: c,
|
|
18
|
-
...o
|
|
19
|
-
}) : /* @__PURE__ */ i(n, {
|
|
20
|
-
implementation: c,
|
|
21
|
-
...o
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
export { a as BillPayWidget, a as default };
|
|
@@ -0,0 +1,114 @@
|
|
|
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 "../../../shared/data-access/dist/index.js";
|
|
8
|
+
import { EmbeddedToaster as n } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
9
|
+
import "../../../shared/ui/dist/index.js";
|
|
10
|
+
import { useAnalyticsTrack as r } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
11
|
+
import { WidgetProvider as i } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
12
|
+
import { useWidgetConfig as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
13
|
+
import "../../../shared/feature/dist/index.js";
|
|
14
|
+
import { BillPayWidgetUi as o } from "../../ui/dist/index31.js";
|
|
15
|
+
import { BillUploadStatusTray as s } from "../../ui/dist/index41.js";
|
|
16
|
+
import "../../ui/dist/index.js";
|
|
17
|
+
import { billsTabTestIds as c } from "./index24.js";
|
|
18
|
+
import { BillsTab as l } from "./index25.js";
|
|
19
|
+
import "./index26.js";
|
|
20
|
+
import { useBillUploadQueue as u } from "./index29.js";
|
|
21
|
+
import "./index30.js";
|
|
22
|
+
import { BillPayWidgetAnalyticsEvent as d, WIDGET_NAME as f } from "./index19.js";
|
|
23
|
+
import { DEFAULT_TABS_LABELS as p } from "./index31.js";
|
|
24
|
+
import { ApprovalPoliciesSettings as m } from "../../../shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js";
|
|
25
|
+
import "../../../shared/approval-policy/feature/dist/index.js";
|
|
26
|
+
import { CounterpartsWidget as h } from "../../../counterparts-widget/feature/dist/index8.js";
|
|
27
|
+
import "../../../counterparts-widget/feature/dist/index.js";
|
|
28
|
+
import { useCallback as g, useEffect as _, useState as v } from "react";
|
|
29
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
30
|
+
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
|
|
31
|
+
var S = {
|
|
32
|
+
Bills: "bills",
|
|
33
|
+
Vendors: "vendors",
|
|
34
|
+
Settings: "settings"
|
|
35
|
+
}, C = [
|
|
36
|
+
S.Bills,
|
|
37
|
+
S.Vendors,
|
|
38
|
+
S.Settings
|
|
39
|
+
];
|
|
40
|
+
function w({ labels: i, tabsLabels: f, approvalPolicyLabels: w, approvalPolicyComponentLabels: T, vendorLabels: E }) {
|
|
41
|
+
let D = r();
|
|
42
|
+
_(() => {
|
|
43
|
+
D(d.Mounted);
|
|
44
|
+
}, [D]);
|
|
45
|
+
let O = {
|
|
46
|
+
...p,
|
|
47
|
+
...f
|
|
48
|
+
}, { initResponse: k } = a(), A = e(k?.scopes, [t.ApprovalPolicyWriteOrg]), j = !k || A, [M, N] = v(S.Bills), [P, F] = v(), I = g((e) => {
|
|
49
|
+
N(S.Bills), F(e);
|
|
50
|
+
}, []), L = u({ onOpenBill: I }), R = [{
|
|
51
|
+
id: S.Bills,
|
|
52
|
+
label: O.bills,
|
|
53
|
+
content: /* @__PURE__ */ b(l, {
|
|
54
|
+
onEnqueueFiles: L.enqueue,
|
|
55
|
+
openPayableId: P,
|
|
56
|
+
onOpenPayableHandled: () => F(void 0)
|
|
57
|
+
})
|
|
58
|
+
}, {
|
|
59
|
+
id: S.Vendors,
|
|
60
|
+
label: O.vendors,
|
|
61
|
+
content: /* @__PURE__ */ b(h, {
|
|
62
|
+
...E,
|
|
63
|
+
counterpartType: "vendor",
|
|
64
|
+
showTitle: !1,
|
|
65
|
+
onViewAllDocuments: () => N(S.Bills)
|
|
66
|
+
})
|
|
67
|
+
}];
|
|
68
|
+
j && R.push({
|
|
69
|
+
id: S.Settings,
|
|
70
|
+
label: O.settings,
|
|
71
|
+
content: /* @__PURE__ */ b(m, {
|
|
72
|
+
labels: w,
|
|
73
|
+
componentLabels: T
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
let z = R.some((e) => e.id === M) ? M : C.find((e) => R.some((t) => t.id === e)) ?? R[0]?.id ?? "";
|
|
77
|
+
return /* @__PURE__ */ x(y, { children: [
|
|
78
|
+
/* @__PURE__ */ b(n, {}),
|
|
79
|
+
/* @__PURE__ */ b(o, {
|
|
80
|
+
labels: i,
|
|
81
|
+
tabs: R,
|
|
82
|
+
selectedTabId: z,
|
|
83
|
+
onTabChange: N
|
|
84
|
+
}),
|
|
85
|
+
L.isVisible ? /* @__PURE__ */ b(s, {
|
|
86
|
+
sections: L.sections,
|
|
87
|
+
summaryLabel: L.summaryLabel,
|
|
88
|
+
collapsed: L.collapsed,
|
|
89
|
+
onToggleCollapsed: L.onToggleCollapsed,
|
|
90
|
+
onClose: L.onClose,
|
|
91
|
+
testId: c.uploadTray
|
|
92
|
+
}) : null
|
|
93
|
+
] });
|
|
94
|
+
}
|
|
95
|
+
function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: p, ...m }) {
|
|
96
|
+
return /* @__PURE__ */ b(i, {
|
|
97
|
+
widgetName: f,
|
|
98
|
+
baseUrl: e,
|
|
99
|
+
widgetToken: t,
|
|
100
|
+
organizationId: n,
|
|
101
|
+
configClient: r,
|
|
102
|
+
gatewayRouting: a,
|
|
103
|
+
linkComponent: o,
|
|
104
|
+
implementation: s,
|
|
105
|
+
uiFramework: c,
|
|
106
|
+
errorFallback: l,
|
|
107
|
+
onError: u,
|
|
108
|
+
analytics: d,
|
|
109
|
+
disclosuresAcceptance: p,
|
|
110
|
+
children: /* @__PURE__ */ b(w, { ...m })
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { T as BillPayWidgetNative, T as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index32.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { Implementation as e } from "../../../shared/feature/dist/lib/WidgetProvider/types.js";
|
|
6
|
+
import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
7
|
+
import "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { BillPayWidgetMonite as n } from "./index20.js";
|
|
9
|
+
import "./index21.js";
|
|
10
|
+
import { BillPayWidgetNative as r } from "./index32.js";
|
|
11
|
+
import "./index33.js";
|
|
12
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
13
|
+
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js
|
|
14
|
+
function a({ implementation: a, ...o }) {
|
|
15
|
+
let s = t().implementation, c = a ?? s ?? e.Monite;
|
|
16
|
+
return c === e.Native ? /* @__PURE__ */ i(r, {
|
|
17
|
+
implementation: c,
|
|
18
|
+
...o
|
|
19
|
+
}) : /* @__PURE__ */ i(n, {
|
|
20
|
+
implementation: c,
|
|
21
|
+
...o
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as BillPayWidget, a as default };
|
|
@@ -13,94 +13,95 @@ import { VendorInlineForm as o } from "./index4.js";
|
|
|
13
13
|
import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
14
14
|
import { jsx as d } from "react/jsx-runtime";
|
|
15
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js
|
|
16
|
-
var f =
|
|
17
|
-
function m({ payableId: m, counterpartId: h, payableCounterpartId: g, onCounterpartChange: _,
|
|
18
|
-
let
|
|
16
|
+
var f = 10, p = 300;
|
|
17
|
+
function m({ payableId: m, counterpartId: h, payableCounterpartId: g, onCounterpartChange: _, requiredError: v, labels: y }) {
|
|
18
|
+
let b = {
|
|
19
19
|
...e,
|
|
20
|
-
...
|
|
21
|
-
}, [
|
|
22
|
-
|
|
23
|
-
}, [_]),
|
|
20
|
+
...y
|
|
21
|
+
}, [x, S] = u(""), [C, w] = u(""), [T, E] = u(), [D, O] = u(!1), k = s((e) => {
|
|
22
|
+
O(!0), _(e);
|
|
23
|
+
}, [_]), A = t(m, { enabled: !!m && !h && !g }).data?.suggested_counterpart?.id;
|
|
24
24
|
c(() => {
|
|
25
|
-
!
|
|
25
|
+
!D && !h && !g && A && k(A);
|
|
26
26
|
}, [
|
|
27
27
|
h,
|
|
28
28
|
g,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
D,
|
|
30
|
+
A,
|
|
31
|
+
k
|
|
32
32
|
]), c(() => {
|
|
33
33
|
let e = setTimeout(() => {
|
|
34
|
-
|
|
34
|
+
w(x.trim());
|
|
35
35
|
}, p);
|
|
36
36
|
return () => clearTimeout(e);
|
|
37
|
-
}, [
|
|
38
|
-
let
|
|
37
|
+
}, [x]);
|
|
38
|
+
let j = i({
|
|
39
39
|
sort: "counterpart_name",
|
|
40
40
|
order: "asc",
|
|
41
41
|
limit: f,
|
|
42
|
-
counterpart_name__icontains:
|
|
43
|
-
is_vendor: !0
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
counterpart_name__icontains: C || void 0,
|
|
43
|
+
is_vendor: !0,
|
|
44
|
+
enabled: !!C
|
|
45
|
+
}), M = a({ selectedId: h }), N = l(() => {
|
|
46
|
+
let e = M.counterpart;
|
|
46
47
|
if (!e) return;
|
|
47
|
-
let t =
|
|
48
|
+
let t = M.bankAccounts?.find((e) => e.is_default_for_currency);
|
|
48
49
|
return {
|
|
49
50
|
name: r(e),
|
|
50
51
|
email: n(e),
|
|
51
|
-
methodLabel: t ?
|
|
52
|
+
methodLabel: t ? b.achMethod : b.noMethod,
|
|
52
53
|
fields: t ? [
|
|
53
54
|
{
|
|
54
|
-
label:
|
|
55
|
+
label: b.accountHolder,
|
|
55
56
|
value: t.account_holder_name ?? ""
|
|
56
57
|
},
|
|
57
58
|
{
|
|
58
|
-
label:
|
|
59
|
+
label: b.routingNumber,
|
|
59
60
|
value: t.routing_number ?? ""
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
|
-
label:
|
|
63
|
+
label: b.accountNumber,
|
|
63
64
|
value: "",
|
|
64
65
|
maskedValue: t.account_number ?? ""
|
|
65
66
|
}
|
|
66
67
|
] : []
|
|
67
68
|
};
|
|
68
69
|
}, [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
70
|
+
M.bankAccounts,
|
|
71
|
+
M.counterpart,
|
|
72
|
+
b
|
|
73
|
+
]), P = l(() => (j.data?.data ?? []).map((e) => ({
|
|
73
74
|
name: r(e),
|
|
74
75
|
email: n(e),
|
|
75
|
-
onSelect: () =>
|
|
76
|
-
})), [
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
return
|
|
76
|
+
onSelect: () => k(e.id)
|
|
77
|
+
})), [j.data, k]), F = s(() => E(void 0), []), I = s((e) => {
|
|
78
|
+
E(void 0), k(e);
|
|
79
|
+
}, [k]);
|
|
80
|
+
return T ? {
|
|
80
81
|
mode: "creating",
|
|
81
82
|
newVendorForm: /* @__PURE__ */ d(o, {
|
|
82
|
-
mode:
|
|
83
|
-
counterpart:
|
|
84
|
-
primaryAddress:
|
|
85
|
-
initialName:
|
|
86
|
-
onSaved:
|
|
87
|
-
onCancel:
|
|
83
|
+
mode: T,
|
|
84
|
+
counterpart: T === "edit" ? M.counterpart : void 0,
|
|
85
|
+
primaryAddress: T === "edit" ? M.primaryAddress : void 0,
|
|
86
|
+
initialName: T === "create" ? x : void 0,
|
|
87
|
+
onSaved: I,
|
|
88
|
+
onCancel: F
|
|
88
89
|
}),
|
|
89
|
-
onClear:
|
|
90
|
-
} :
|
|
90
|
+
onClear: F
|
|
91
|
+
} : N ? {
|
|
91
92
|
mode: "resolved",
|
|
92
|
-
summary:
|
|
93
|
-
onEdit: () =>
|
|
94
|
-
onClear: () =>
|
|
93
|
+
summary: N,
|
|
94
|
+
onEdit: () => E("edit"),
|
|
95
|
+
onClear: () => k(void 0)
|
|
95
96
|
} : {
|
|
96
97
|
mode: "selecting",
|
|
97
|
-
error:
|
|
98
|
+
error: j.isError ? b.searchFailed : M.isError ? b.vendorDetailsFailed : v,
|
|
98
99
|
search: {
|
|
99
|
-
query:
|
|
100
|
-
onQueryChange:
|
|
101
|
-
isLoading:
|
|
102
|
-
onAddVendor: () =>
|
|
103
|
-
results:
|
|
100
|
+
query: x,
|
|
101
|
+
onQueryChange: S,
|
|
102
|
+
isLoading: j.isLoading,
|
|
103
|
+
onAddVendor: () => E("create"),
|
|
104
|
+
results: P
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
107
|
}
|
|
@@ -12,7 +12,7 @@ function r(e) {
|
|
|
12
12
|
return Number.isFinite(n) && n > 0 ? n : null;
|
|
13
13
|
}
|
|
14
14
|
function i(e) {
|
|
15
|
-
return !!(e.description.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
15
|
+
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
16
16
|
}
|
|
17
17
|
function a(e) {
|
|
18
18
|
return n(e) ?? 0;
|
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index2.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index6.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
return !
|
|
4
|
+
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
|
|
5
|
+
function a(e) {
|
|
6
|
+
let t = e.trim();
|
|
7
|
+
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function o(t, i = e) {
|
|
10
10
|
let a = {};
|
|
11
|
-
for (let e of
|
|
12
|
-
let
|
|
13
|
-
e.price.trim() &&
|
|
11
|
+
for (let e of t) {
|
|
12
|
+
let t = n(e.price), o = n(e.amount), s = {};
|
|
13
|
+
e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (t !== null || o !== null) && r(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
|
|
14
14
|
}
|
|
15
15
|
return Object.keys(a).length ? a : void 0;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function s(i, a, o, s = e) {
|
|
18
|
+
let c = {};
|
|
19
|
+
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
|
|
20
|
+
let l = {};
|
|
21
|
+
return o.forEach((e, i) => {
|
|
22
|
+
if (i > 0 && !t(e)) return;
|
|
23
|
+
let a = {};
|
|
24
|
+
e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
|
|
25
|
+
}), {
|
|
26
|
+
formErrors: Object.keys(c).length ? c : void 0,
|
|
27
|
+
lineItemErrors: Object.keys(l).length ? l : void 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function c(t, r, i, o = e) {
|
|
31
|
+
return !a(t) || !a(r) || i !== void 0 && n(i) === null ? { form: o.totalsNeedAttention } : void 0;
|
|
19
32
|
}
|
|
20
33
|
//#endregion
|
|
21
|
-
export {
|
|
34
|
+
export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };
|
|
@@ -9,126 +9,143 @@ import { useReplacePayableLineItemsMutation as n } from "../../data-access/dist/
|
|
|
9
9
|
import { useCreatePayableMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index7.js";
|
|
10
10
|
import "../../data-access/dist/index.js";
|
|
11
11
|
import { mapBillFormToPayload as s, mapLineItemsToPayload as c } from "./index6.js";
|
|
12
|
-
import {
|
|
13
|
-
import { useCallback as
|
|
12
|
+
import { validateBillCompleteness as l, validateBillTotals as u, validateLineItems as d } from "./index7.js";
|
|
13
|
+
import { useCallback as f, useRef as p, useState as m } from "react";
|
|
14
14
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js
|
|
15
|
-
var
|
|
15
|
+
var h = {
|
|
16
16
|
document_id: "invoiceNumber",
|
|
17
17
|
issued_at: "invoiceDate",
|
|
18
|
-
due_date: "dueDate"
|
|
18
|
+
due_date: "dueDate",
|
|
19
|
+
counterpart_id: "vendor"
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
+
function g(e) {
|
|
21
22
|
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function _(e, n = t) {
|
|
24
25
|
let r = {}, i = [];
|
|
25
26
|
for (let t of e) {
|
|
26
|
-
let e = t.loc[0] ?? n.unknownValidationField, a =
|
|
27
|
+
let e = t.loc[0] ?? n.unknownValidationField, a = h[e], o = g(t) ? n.requiredField : t.msg;
|
|
27
28
|
a ? r[a] = o : i.push(n.unmappedValidationError(e, o));
|
|
28
29
|
}
|
|
29
30
|
return i.length && (r.form = i.join(" ")), r;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
32
|
+
function v(e, t) {
|
|
33
|
+
if (!e && !t) return;
|
|
34
|
+
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
35
|
+
for (let i of r) n[i] = {
|
|
36
|
+
...e?.[i],
|
|
37
|
+
...t?.[i]
|
|
38
|
+
};
|
|
39
|
+
return n;
|
|
40
|
+
}
|
|
41
|
+
function y({ payableId: h, form: g, counterpartId: y, onSaved: b, onPayableCreated: x, onDraftSaved: S, onFinalized: C, labels: w }) {
|
|
42
|
+
let T = {
|
|
33
43
|
...t,
|
|
34
|
-
...
|
|
35
|
-
}, [
|
|
36
|
-
let
|
|
37
|
-
return
|
|
38
|
-
}, [
|
|
44
|
+
...w
|
|
45
|
+
}, [E, D] = m(), O = h ?? E, [k, A] = m(), j = p(!1), M = r(), N = a(), P = n(), F = o(), I = i(), L = f(() => {
|
|
46
|
+
let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T);
|
|
47
|
+
return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(T.lineItemsNeedAttention)) : g.setErrors(n), !1);
|
|
48
|
+
}, [g, T]), R = f(async () => {
|
|
39
49
|
let e = s({
|
|
40
|
-
values:
|
|
41
|
-
counterpartId:
|
|
42
|
-
editedTotals:
|
|
43
|
-
discount:
|
|
44
|
-
tax:
|
|
45
|
-
total:
|
|
50
|
+
values: g.values,
|
|
51
|
+
counterpartId: y,
|
|
52
|
+
editedTotals: g.isTotalsDirty ? {
|
|
53
|
+
discount: g.discount,
|
|
54
|
+
tax: g.tax,
|
|
55
|
+
total: g.totalOverride
|
|
46
56
|
} : void 0
|
|
47
|
-
}), t =
|
|
48
|
-
if (t ? await
|
|
57
|
+
}), t = O;
|
|
58
|
+
if (t ? await N.mutateAsync({
|
|
49
59
|
path: { payable_id: t },
|
|
50
60
|
body: e
|
|
51
|
-
}) : (t = (await
|
|
52
|
-
return await
|
|
61
|
+
}) : (t = (await M.mutateAsync({ body: e }))?.id, t && (D(t), x?.(t))), !t) throw Error("Payable was created without an id");
|
|
62
|
+
return await P.mutateAsync({
|
|
53
63
|
path: { payable_id: t },
|
|
54
|
-
body: { data: c(
|
|
64
|
+
body: { data: c(g.lineItems) }
|
|
55
65
|
}), t;
|
|
56
66
|
}, [
|
|
57
|
-
_,
|
|
58
|
-
A,
|
|
59
|
-
h.discount,
|
|
60
|
-
h.isTotalsDirty,
|
|
61
|
-
h.lineItems,
|
|
62
|
-
h.tax,
|
|
63
|
-
h.totalOverride,
|
|
64
|
-
h.values,
|
|
65
67
|
y,
|
|
66
|
-
E,
|
|
67
68
|
M,
|
|
68
|
-
|
|
69
|
+
g.discount,
|
|
70
|
+
g.isTotalsDirty,
|
|
71
|
+
g.lineItems,
|
|
72
|
+
g.tax,
|
|
73
|
+
g.totalOverride,
|
|
74
|
+
g.values,
|
|
75
|
+
x,
|
|
76
|
+
O,
|
|
77
|
+
P,
|
|
78
|
+
N
|
|
69
79
|
]);
|
|
70
80
|
return {
|
|
71
|
-
saveDraft:
|
|
72
|
-
if (!
|
|
73
|
-
|
|
81
|
+
saveDraft: f(async () => {
|
|
82
|
+
if (!j.current && L()) {
|
|
83
|
+
j.current = !0, A("draft");
|
|
74
84
|
try {
|
|
75
|
-
let t = await
|
|
76
|
-
|
|
85
|
+
let t = await R();
|
|
86
|
+
g.setErrors(void 0), b?.(t), S?.(t), e.success(T.draftSaved);
|
|
77
87
|
} catch {
|
|
78
|
-
|
|
88
|
+
g.setErrors({ form: T.saveFailed });
|
|
79
89
|
} finally {
|
|
80
|
-
|
|
90
|
+
A(void 0), j.current = !1;
|
|
81
91
|
}
|
|
82
92
|
}
|
|
83
93
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
g,
|
|
95
|
+
L,
|
|
96
|
+
T.draftSaved,
|
|
97
|
+
T.saveFailed,
|
|
98
|
+
S,
|
|
88
99
|
b,
|
|
89
|
-
|
|
90
|
-
I
|
|
100
|
+
R
|
|
91
101
|
]),
|
|
92
|
-
finalize:
|
|
93
|
-
if (
|
|
94
|
-
|
|
102
|
+
finalize: f(async () => {
|
|
103
|
+
if (j.current) return;
|
|
104
|
+
let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, T), a = v(i, t);
|
|
105
|
+
g.setLineItemErrors(a);
|
|
106
|
+
let o = {
|
|
107
|
+
...r,
|
|
108
|
+
...n
|
|
109
|
+
};
|
|
110
|
+
if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(T.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
|
|
111
|
+
j.current = !0, A("finalize");
|
|
95
112
|
try {
|
|
96
113
|
let t;
|
|
97
114
|
try {
|
|
98
|
-
t = await
|
|
115
|
+
t = await R();
|
|
99
116
|
} catch {
|
|
100
|
-
|
|
117
|
+
g.setErrors({ form: T.saveFailed });
|
|
101
118
|
return;
|
|
102
119
|
}
|
|
103
|
-
|
|
120
|
+
b?.(t);
|
|
104
121
|
try {
|
|
105
|
-
let n = await
|
|
122
|
+
let n = await F.mutateAsync({ path: { payable_id: t } });
|
|
106
123
|
if (n.validation_errors.length) {
|
|
107
|
-
|
|
124
|
+
g.setErrors(_(n.validation_errors, T));
|
|
108
125
|
return;
|
|
109
126
|
}
|
|
110
|
-
await
|
|
127
|
+
await I.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), C?.(t), e.success(T.billFinalized);
|
|
111
128
|
} catch {
|
|
112
|
-
|
|
129
|
+
g.setErrors({ form: T.finalizeFailed });
|
|
113
130
|
}
|
|
114
131
|
} finally {
|
|
115
|
-
|
|
132
|
+
A(void 0), j.current = !1;
|
|
116
133
|
}
|
|
117
134
|
}
|
|
118
135
|
}, [
|
|
119
|
-
|
|
120
|
-
|
|
136
|
+
y,
|
|
137
|
+
g,
|
|
138
|
+
T,
|
|
121
139
|
C,
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
b,
|
|
141
|
+
R,
|
|
124
142
|
I,
|
|
125
|
-
|
|
126
|
-
N
|
|
143
|
+
F
|
|
127
144
|
]),
|
|
128
|
-
payableId:
|
|
129
|
-
isSavingDraft:
|
|
130
|
-
isFinalizing:
|
|
145
|
+
payableId: O,
|
|
146
|
+
isSavingDraft: k === "draft",
|
|
147
|
+
isFinalizing: k === "finalize"
|
|
131
148
|
};
|
|
132
149
|
}
|
|
133
150
|
//#endregion
|
|
134
|
-
export {
|
|
151
|
+
export { _ as mapValidationErrorsToForm, y as useBillCreateController };
|