@tesouro/embedded-components-react 0.2.281 → 0.2.283

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 (52) hide show
  1. package/dist/index.css +17 -6
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -41
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -112
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
  45. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +4 -4
  46. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +13 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  51. package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
  52. package/package.json +1 -1
@@ -1,114 +1,9 @@
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 "./index20.js";
18
- import { BillsTab as l } from "./index21.js";
19
- import "./index22.js";
20
- import { useBillUploadQueue as u } from "./index25.js";
21
- import "./index26.js";
22
- import { BillPayWidgetAnalyticsEvent as d, WIDGET_NAME as f } from "./index14.js";
23
- import { DEFAULT_TABS_LABELS as p } from "./index27.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
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.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
- }
2
+ var e = {
3
+ uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
+ completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
+ readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
+ failedCaption: (e) => `${e} failed to upload`
7
+ };
113
8
  //#endregion
114
- export { T as BillPayWidgetNative, T as default };
9
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1 +1,85 @@
1
- import "./index28.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { useUploadPayableFromFileMutation as t } from "../../data-access/dist/index7.js";
7
+ import { usePayableOcrQueries as n } from "../../data-access/dist/index9.js";
8
+ import "../../data-access/dist/index.js";
9
+ import { billPayUploadQueueKey as r } from "./index27.js";
10
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as i } from "./index28.js";
11
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
12
+ import { useQuery as l, useQueryClient as u } from "@tanstack/react-query";
13
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js
14
+ function d({ onOpenBill: d, labels: f } = {}) {
15
+ let p = {
16
+ ...i,
17
+ ...f
18
+ }, { organizationId: m } = e(), h = u(), g = s(() => r(m), [m]), _ = t(), [v, y] = c(!1), { data: b = [] } = l({
19
+ queryKey: g,
20
+ queryFn: () => h.getQueryData(g) ?? [],
21
+ staleTime: Infinity,
22
+ gcTime: Infinity,
23
+ initialData: []
24
+ }), x = a((e, t) => {
25
+ h.setQueryData(g, (n) => (n ?? []).map((n) => n.localId === e ? {
26
+ ...n,
27
+ ...t
28
+ } : n));
29
+ }, [h, g]), S = a((e) => {
30
+ y(!1);
31
+ for (let t of e) {
32
+ let e = crypto.randomUUID();
33
+ h.setQueryData(g, (n) => [...n ?? [], {
34
+ localId: e,
35
+ fileName: t.name,
36
+ status: "uploading"
37
+ }]), _.mutateAsync({ file: t }).then((t) => x(e, { payableId: t?.id })).catch(() => x(e, { status: "failed" }));
38
+ }
39
+ }, [
40
+ x,
41
+ h,
42
+ g,
43
+ _
44
+ ]), C = n({ payableIds: b.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
45
+ o(() => {
46
+ for (let { payableId: e, ocrStatus: t, isError: n } of C) {
47
+ let r = b.find((t) => t.payableId === e && t.status === "uploading");
48
+ r && (t === "success" ? x(r.localId, { status: "ready" }) : (n || t === "error" || t === "canceled") && x(r.localId, { status: "failed" }));
49
+ }
50
+ }, [
51
+ b,
52
+ C,
53
+ x
54
+ ]);
55
+ let w = b.filter((e) => e.status === "uploading"), T = b.filter((e) => e.status === "ready"), E = b.filter((e) => e.status === "failed"), D = (e) => ({
56
+ id: e.localId,
57
+ fileName: e.fileName,
58
+ status: e.status,
59
+ onOpen: e.status === "ready" && e.payableId && d ? () => d(e.payableId) : void 0
60
+ }), O = w.length ? [{
61
+ id: "in-progress",
62
+ items: b.map(D)
63
+ }] : [...T.length ? [{
64
+ id: "ready",
65
+ caption: p.readyCaption(T.length),
66
+ items: T.map(D)
67
+ }] : [], ...E.length ? [{
68
+ id: "failed",
69
+ caption: p.failedCaption(E.length),
70
+ items: E.map(D)
71
+ }] : []], k = w.length ? p.uploadingSummary(b.length) : T.length ? p.completeSummary(T.length) : p.failedCaption(E.length), A = a(() => {
72
+ h.setQueryData(g, []);
73
+ }, [h, g]);
74
+ return {
75
+ enqueue: S,
76
+ sections: O,
77
+ summaryLabel: k,
78
+ collapsed: v,
79
+ onToggleCollapsed: a(() => y((e) => !e), []),
80
+ onClose: A,
81
+ isVisible: b.length > 0
82
+ };
83
+ }
84
+ //#endregion
85
+ export { d as useBillUploadQueue };
@@ -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, labels: l }) {
13
- let u = {
12
+ function a({ payableId: a, file: o, isDocumentPending: s, pendingFileName: c, readOnly: l, labels: u }) {
13
+ let d = {
14
14
  ...e,
15
- ...l
16
- }, d = t(), f = n();
17
- if (!o && (s || d.isPending)) return /* @__PURE__ */ i(r, {
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: u.saveBeforeAttaching
27
+ children: d.saveBeforeAttaching
24
28
  });
25
29
  if (!o) return /* @__PURE__ */ i(r, {
26
30
  mode: "upload",
27
- uploadStatus: d.isPending ? "uploading" : "idle",
28
- uploadErrorMessage: d.isError ? u.attachFailed : void 0,
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 || d.mutate({
35
+ !t || !a || f.mutate({
32
36
  path: { payable_id: a },
33
37
  file: t
34
38
  });
35
39
  }
36
40
  });
37
- let p = o.mimetype === "application/pdf" ? /* @__PURE__ */ i("iframe", {
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: p,
54
+ preview: m,
51
55
  onDownload: () => window.open(o.url, "_blank", "noopener,noreferrer"),
52
- onDelete: a ? () => f.mutate({
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
- "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 "./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,8 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js
2
+ var e = {
3
+ bills: "Bills",
4
+ vendors: "Vendors",
5
+ settings: "Settings"
6
+ };
7
+ //#endregion
8
+ export { e as DEFAULT_TABS_LABELS };
@@ -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,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 = 25, p = 300;
17
- function m({ payableId: m, counterpartId: h, payableCounterpartId: g, onCounterpartChange: _, labels: v }) {
18
- let y = {
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
- ...v
21
- }, [b, x] = u(""), [S, C] = u(""), [w, T] = u(), [E, D] = u(!1), O = s((e) => {
22
- D(!0), _(e);
23
- }, [_]), k = t(m, { enabled: !!m && !h && !g }).data?.suggested_counterpart?.id;
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
- !E && !h && !g && k && O(k);
25
+ !D && !h && !g && A && k(A);
26
26
  }, [
27
27
  h,
28
28
  g,
29
- E,
30
- k,
31
- O
29
+ D,
30
+ A,
31
+ k
32
32
  ]), c(() => {
33
33
  let e = setTimeout(() => {
34
- C(b.trim());
34
+ w(x.trim());
35
35
  }, p);
36
36
  return () => clearTimeout(e);
37
- }, [b]);
38
- let A = i({
37
+ }, [x]);
38
+ let j = i({
39
39
  sort: "counterpart_name",
40
40
  order: "asc",
41
41
  limit: f,
42
- counterpart_name__icontains: S || void 0,
43
- is_vendor: !0
44
- }), j = a({ selectedId: h }), M = l(() => {
45
- let e = j.counterpart;
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 = j.bankAccounts?.find((e) => e.is_default_for_currency);
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 ? y.achMethod : y.noMethod,
52
+ methodLabel: t ? b.achMethod : b.noMethod,
52
53
  fields: t ? [
53
54
  {
54
- label: y.accountHolder,
55
+ label: b.accountHolder,
55
56
  value: t.account_holder_name ?? ""
56
57
  },
57
58
  {
58
- label: y.routingNumber,
59
+ label: b.routingNumber,
59
60
  value: t.routing_number ?? ""
60
61
  },
61
62
  {
62
- label: y.accountNumber,
63
+ label: b.accountNumber,
63
64
  value: "",
64
65
  maskedValue: t.account_number ?? ""
65
66
  }
66
67
  ] : []
67
68
  };
68
69
  }, [
69
- j.bankAccounts,
70
- j.counterpart,
71
- y
72
- ]), N = l(() => (A.data?.data ?? []).map((e) => ({
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: () => O(e.id)
76
- })), [A.data, O]), P = s(() => T(void 0), []), F = s((e) => {
77
- T(void 0), O(e);
78
- }, [O]);
79
- return w ? {
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: w,
83
- counterpart: w === "edit" ? j.counterpart : void 0,
84
- primaryAddress: w === "edit" ? j.primaryAddress : void 0,
85
- initialName: w === "create" ? b : void 0,
86
- onSaved: F,
87
- onCancel: P
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: P
90
- } : M ? {
90
+ onClear: F
91
+ } : N ? {
91
92
  mode: "resolved",
92
- summary: M,
93
- onEdit: () => T("edit"),
94
- onClear: () => O(void 0)
93
+ summary: N,
94
+ onEdit: () => E("edit"),
95
+ onClear: () => k(void 0)
95
96
  } : {
96
97
  mode: "selecting",
97
- error: A.isError ? y.searchFailed : j.isError ? y.vendorDetailsFailed : void 0,
98
+ error: j.isError ? b.searchFailed : M.isError ? b.vendorDetailsFailed : v,
98
99
  search: {
99
- query: b,
100
- onQueryChange: x,
101
- isLoading: A.isLoading,
102
- onAddVendor: () => T("create"),
103
- results: N
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 { parseMoneyToMinorUnits as t, parseQuantity as n } from "./index6.js";
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 r = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
5
- function i(e) {
6
- let n = e.trim();
7
- return !n || t(n) !== null ? !0 : r.test(n) ? Number(n.replaceAll(",", "")) === 0 : !1;
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 a(r, i = e) {
9
+ function o(t, i = e) {
10
10
  let a = {};
11
- for (let e of r) {
12
- let r = t(e.price), o = t(e.amount), s = {};
13
- e.price.trim() && r === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (r !== null || o !== null) && n(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
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 o(t, n, r, a = e) {
18
- return !i(t) || !i(n) || r !== void 0 && (!r.trim() || !i(r)) ? { form: a.totalsNeedAttention } : void 0;
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 { o as validateBillTotals, a as validateLineItems };
34
+ export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };