@tesouro/embedded-components-react 0.2.266 → 0.2.269

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 (97) hide show
  1. package/README.md +15 -12
  2. package/dist/experimental/WidgetSuite.d.ts +25 -1
  3. package/dist/experimental/index.d.ts +25 -1
  4. package/dist/index.css +45 -9
  5. package/dist/index.d.ts +46 -22
  6. package/dist/index.js +1 -1
  7. package/dist/lib/AcceptDisclosuresWidget.d.ts +25 -1
  8. package/dist/lib/BalancesWidget.d.ts +24 -0
  9. package/dist/lib/BankAccountOnboardingWidget.d.ts +25 -1
  10. package/dist/lib/BankAccountsWidget.d.ts +25 -1
  11. package/dist/lib/BillPayWidget.d.ts +24 -0
  12. package/dist/lib/BillPayWidget.js +1 -1
  13. package/dist/lib/CardDetailsWidget.d.ts +25 -1
  14. package/dist/lib/CardsWidget.d.ts +25 -1
  15. package/dist/lib/ChartOfAccountsWidget.d.ts +25 -1
  16. package/dist/lib/CounterpartsWidget.d.ts +25 -1
  17. package/dist/lib/CreateCardWidget.d.ts +25 -1
  18. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +25 -1
  19. package/dist/lib/ExpenseManagementWidget.d.ts +25 -1
  20. package/dist/lib/ExpenseRequirementsWidget.d.ts +25 -1
  21. package/dist/lib/HelpWidget.d.ts +25 -1
  22. package/dist/lib/InsightsWidget.d.ts +24 -0
  23. package/dist/lib/InvoicingWidget.d.ts +25 -1
  24. package/dist/lib/LinkedAccountsWidget.d.ts +25 -1
  25. package/dist/lib/ProductsWidget.d.ts +25 -1
  26. package/dist/lib/ProfileWidget.d.ts +25 -1
  27. package/dist/lib/ReceiptMatchWidget.d.ts +25 -1
  28. package/dist/lib/ReceivablesWidget.d.ts +25 -1
  29. package/dist/lib/SettingsWidget.d.ts +25 -1
  30. package/dist/lib/TagsWidget.d.ts +25 -1
  31. package/dist/lib/TeamWidget.d.ts +25 -1
  32. package/dist/lib/TransfersWidget.d.ts +24 -0
  33. package/dist/lib/WidgetProvider.d.ts +25 -1
  34. package/dist/lib/WidgetProviderPublic.d.ts +24 -0
  35. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +9 -8
  36. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +122 -121
  37. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +9 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +6 -6
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +99 -7
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -97
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +99 -4
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -4
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -41
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +44 -1
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +1 -50
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +48 -6
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +9 -5
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +8 -91
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +6 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -3
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +100 -6
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +3 -9
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +6 -83
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +9 -3
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +83 -6
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +2 -111
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +8 -1
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +104 -16
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +25 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +37 -27
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +15 -116
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +126 -31
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +32 -69
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +0 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +34 -69
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +4 -0
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +261 -181
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +32 -33
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +2 -2
  71. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +9 -8
  72. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +9 -8
  73. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +9 -8
  74. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +94 -93
  75. package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +7 -6
  76. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +9 -8
  77. package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +12 -11
  78. package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +7 -6
  79. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +9 -8
  80. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +9 -8
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +9 -8
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +10 -9
  83. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +9 -8
  84. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +9 -8
  85. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +9 -8
  86. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +10 -9
  87. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +22 -21
  88. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/widgetGatewayHosts.js +14 -0
  89. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +76 -67
  90. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +107 -101
  91. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  92. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js +12 -4
  93. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +9 -8
  94. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +106 -105
  95. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  96. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +9 -8
  97. package/package.json +1 -1
@@ -1,85 +1,8 @@
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 "./index21.js";
10
- import { BILL_UPLOAD_QUEUE_LABELS_EN as i } from "./index22.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
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.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
- }
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
6
+ ];
84
7
  //#endregion
85
- export { d as useBillUploadQueue };
8
+ export { e as billPayUploadQueueKey };
@@ -1,3 +1,9 @@
1
- import "./index21.js";
2
- import "./index22.js";
3
- import "./index23.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
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
+ };
8
+ //#endregion
9
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1,8 +1,85 @@
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 "./index23.js";
10
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as i } from "./index24.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";
1
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
2
- var e = {
3
- bills: "Bills",
4
- vendors: "Vendors",
5
- settings: "Settings"
6
- };
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
+ }
7
84
  //#endregion
8
- export { e as DEFAULT_TABS_LABELS };
85
+ export { d as useBillUploadQueue };
@@ -1,112 +1,3 @@
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 "./index18.js";
18
- import { BillsTab as l } from "./index19.js";
19
- import "./index20.js";
20
- import { useBillUploadQueue as u } from "./index23.js";
1
+ import "./index23.js";
21
2
  import "./index24.js";
22
- import { BillPayWidgetAnalyticsEvent as d, WIDGET_NAME as f } from "./index13.js";
23
- import { DEFAULT_TABS_LABELS as p } from "./index25.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/index26.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, linkComponent: a, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, ...d }) {
96
- return /* @__PURE__ */ b(i, {
97
- widgetName: f,
98
- baseUrl: e,
99
- widgetToken: t,
100
- organizationId: n,
101
- configClient: r,
102
- linkComponent: a,
103
- implementation: o,
104
- uiFramework: s,
105
- errorFallback: c,
106
- onError: l,
107
- analytics: u,
108
- children: /* @__PURE__ */ b(w, { ...d })
109
- });
110
- }
111
- //#endregion
112
- export { T as BillPayWidgetNative, T as default };
3
+ import "./index25.js";
@@ -1 +1,8 @@
1
- import "./index26.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
2
+ var e = {
3
+ bills: "Bills",
4
+ vendors: "Vendors",
5
+ settings: "Settings"
6
+ };
7
+ //#endregion
8
+ export { e as DEFAULT_TABS_LABELS };
@@ -2,24 +2,112 @@
2
2
  "use client";
3
3
  "use client";
4
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";
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";
7
13
  import "../../../shared/feature/dist/index.js";
8
- import { BillPayWidgetMonite as n } from "./index14.js";
9
- import "./index15.js";
10
- import { BillPayWidgetNative as r } from "./index26.js";
11
- import "./index27.js";
12
- import { jsx as i } from "react/jsx-runtime";
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";
13
30
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.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
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, ...p }) {
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
+ children: /* @__PURE__ */ b(w, { ...p })
22
110
  });
23
111
  }
24
112
  //#endregion
25
- export { a as BillPayWidget, a as default };
113
+ 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 "./index15.js";
9
+ import "./index16.js";
10
+ import { BillPayWidgetNative as r } from "./index28.js";
11
+ 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 };
@@ -1,40 +1,50 @@
1
- import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
- import { parseDecimalAmountToMinorUnits as t } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
1
+ import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
3
2
  import "../../data-access/dist/index.js";
4
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js
5
- var n = "USD";
4
+ var t = "USD";
5
+ function n(n) {
6
+ return e(n, t);
7
+ }
6
8
  function r(e) {
7
- return t(e, n) ?? 0;
9
+ let t = e.trim();
10
+ if (!t) return null;
11
+ let n = Number(t);
12
+ return Number.isFinite(n) && n > 0 ? n : null;
8
13
  }
9
14
  function i(e) {
15
+ return !!(e.description.trim() || n(e.price) !== null || n(e.amount) !== null);
16
+ }
17
+ function a(e) {
18
+ return n(e) ?? 0;
19
+ }
20
+ function o(e) {
10
21
  let t = Number.parseFloat(e);
11
22
  return Number.isFinite(t) ? t : 0;
12
23
  }
13
- function a({ values: e, paymentTerm: t, counterpartId: r }) {
14
- let i = { currency: n };
15
- return r && (i.counterpart_id = r), e.invoiceNumber && (i.document_id = e.invoiceNumber), e.invoiceDate && (i.issued_at = e.invoiceDate), e.dueDate && (i.due_date = e.dueDate), t?.term_final && t.name && (i.payment_terms = {
16
- name: t.name,
17
- ...t.description ? { description: t.description } : {},
18
- ...t.term_1 ? { term_1: t.term_1 } : {},
19
- ...t.term_2 ? { term_2: t.term_2 } : {},
20
- term_final: t.term_final
21
- }), i;
24
+ function s(e) {
25
+ return (e / 100).toFixed(2);
22
26
  }
23
- function o(e) {
24
- return e.filter((e) => e.description || e.price).map((e) => ({
25
- name: e.description,
26
- quantity: i(e.quantity),
27
- unit_price: r(e.price),
28
- ...e.glCode ? { ledger_account_id: e.glCode } : {}
29
- }));
27
+ function c({ values: e, counterpartId: r, editedTotals: i }) {
28
+ let a = { currency: t };
29
+ return r && (a.counterpart_id = r), e.invoiceNumber && (a.document_id = e.invoiceNumber), e.invoiceDate && (a.issued_at = e.invoiceDate), e.dueDate && (a.due_date = e.dueDate), i && (a.discount = n(i.discount) ?? 0, a.tax_amount = n(i.tax) ?? 0, i.total !== void 0 && (a.total_amount = n(i.total) ?? 0)), a;
30
+ }
31
+ function l(e) {
32
+ return e.filter(i).map((e) => {
33
+ let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
34
+ return {
35
+ name: e.description,
36
+ quantity: i,
37
+ unit_price: a,
38
+ ...t !== null && t !== o ? { subtotal: t } : {},
39
+ ...e.glCode ? { ledger_account_id: e.glCode } : {}
40
+ };
41
+ });
30
42
  }
31
- function s(t, a) {
32
- let o = Math.round(i(t) * r(a));
33
- return e(o / 100, { currencyCode: n });
43
+ function u(e, t) {
44
+ return s(Math.round(o(e) * a(t)));
34
45
  }
35
- function c(t) {
36
- let a = t.reduce((e, t) => e + Math.round(i(t.quantity) * r(t.price)), 0);
37
- return e(a / 100, { currencyCode: n });
46
+ function d(e, t, n) {
47
+ return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
38
48
  }
39
49
  //#endregion
40
- export { s as displayLineAmount, c as displayTotal, a as mapBillFormToPayload, o as mapLineItemsToPayload };
50
+ export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };