@tesouro/embedded-components-react 0.3.22 → 0.3.24

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 (94) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +10 -10
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +15 -15
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +31 -32
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +42 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +158 -43
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +33 -4
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -16
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +45 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +4 -64
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +13 -26
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +14 -62
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +56 -123
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +18 -3
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +15 -10
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +61 -40
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +130 -50
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +20 -4
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +38 -69
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -46
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +5 -93
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +71 -34
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +48 -139
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +91 -66
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +22 -5
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +34 -22
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +146 -210
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +72 -209
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +21 -103
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +209 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +211 -44
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +104 -30
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +12 -165
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -35
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +29 -99
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +64 -5
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +181 -12
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +34 -243
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +104 -4
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +12 -27
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +267 -81
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +4 -145
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -3
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +82 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +155 -37
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +2 -0
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +2 -6
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +2 -6
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +43 -9
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +1 -94
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -3
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -5
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -13
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -59
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +9 -3
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +19 -120
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +56 -8
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -32
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +3 -46
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +116 -15
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +8 -28
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +43 -83
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +19 -47
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +27 -249
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +82 -109
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +47 -206
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +253 -4
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +111 -6
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +6 -39
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +197 -102
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -0
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +6 -23
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +114 -0
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +1 -0
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +25 -0
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -24
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +3 -162
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +9 -6
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +10 -11
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +123 -8
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -170
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +18 -2
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +7 -11
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +163 -82
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +1 -1
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -0
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +108 -0
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +2 -0
  90. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  91. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +27 -27
  92. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  93. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  94. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import "./lib/AcceptDisclosuresWidget.js";
16
16
  import { BankAccountsWidget as C } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
17
17
  import "./lib/BankAccountsWidget.js";
18
18
  import { CounterpartsWidget as w } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
19
- import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js";
19
+ import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js";
20
20
  import "./lib/BillPayWidget.js";
21
21
  import { CardDetailsWidget as E } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js";
22
22
  import { CardFormatValue as D } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -4,7 +4,7 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { deleteFilesId as n, deletePayablesId as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentRecordsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
7
+ import { deletePayablesId as n, deletePayablesIdFile as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentRecordsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
8
  import "../../../shared/data-access/dist/index.js";
9
9
  import { invalidateDeletedPayableQueries as g, invalidatePayableQueries as _, reconcileCancelledPaymentQueries as v } from "./index4.js";
10
10
  import { useMutation as y } from "@tanstack/react-query";
@@ -52,11 +52,11 @@ function x() {
52
52
  });
53
53
  }
54
54
  function S() {
55
- let { client: n, organizationId: i } = e();
55
+ let { client: r, organizationId: i } = e();
56
56
  return y({
57
57
  mutationFn: async ({ path: e }) => {
58
- await r({
59
- client: n,
58
+ await n({
59
+ client: r,
60
60
  headers: t(i),
61
61
  path: e,
62
62
  throwOnError: !0
@@ -64,7 +64,7 @@ function S() {
64
64
  },
65
65
  onSuccess: async (e, t) => {
66
66
  await g({
67
- client: n,
67
+ client: r,
68
68
  organizationId: i,
69
69
  payableId: t.path.payable_id
70
70
  });
@@ -126,11 +126,11 @@ function w() {
126
126
  });
127
127
  }
128
128
  function T() {
129
- let { client: r, organizationId: i } = e();
129
+ let { client: n, organizationId: i } = e();
130
130
  return y({
131
131
  mutationFn: async ({ path: e }) => {
132
- await n({
133
- client: r,
132
+ await r({
133
+ client: n,
134
134
  headers: t(i),
135
135
  path: e,
136
136
  throwOnError: !0
@@ -138,9 +138,9 @@ function T() {
138
138
  },
139
139
  onSuccess: async (e, t) => {
140
140
  await _({
141
- client: r,
141
+ client: n,
142
142
  organizationId: i,
143
- payableId: t.payableId
143
+ payableId: t.path.payable_id
144
144
  });
145
145
  }
146
146
  });
@@ -1,27 +1,27 @@
1
- import "./index10.js";
2
- import "./index11.js";
3
- import "./index22.js";
4
- import "./index28.js";
5
- import "./index37.js";
6
- import "./index39.js";
7
- import "./index41.js";
1
+ import "./index13.js";
2
+ import "./index14.js";
3
+ import "./index25.js";
4
+ import "./index31.js";
5
+ import "./index40.js";
8
6
  import "./index42.js";
9
- import "./index43.js";
10
7
  import "./index44.js";
11
8
  import "./index45.js";
12
9
  import "./index46.js";
13
- import "./index50.js";
14
- import "./index51.js";
15
- import "./index52.js";
10
+ import "./index47.js";
11
+ import "./index48.js";
12
+ import "./index49.js";
16
13
  import "./index53.js";
17
14
  import "./index54.js";
18
15
  import "./index55.js";
19
16
  import "./index56.js";
20
17
  import "./index57.js";
21
18
  import "./index58.js";
19
+ import "./index59.js";
22
20
  import "./index60.js";
23
- import "./index66.js";
24
- import "./index67.js";
25
- import "./index68.js";
26
- import { BillPayWidget as e } from "./index72.js";
21
+ import "./index61.js";
22
+ import "./index63.js";
23
+ import "./index69.js";
24
+ import "./index70.js";
25
+ import "./index71.js";
26
+ import { BillPayWidget as e } from "./index75.js";
27
27
  export { e as BillPayWidget };
@@ -1,36 +1,35 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { resolveAmountDueMinorUnits as e } from "./index2.js";
6
- import { resolveVendor as t } from "./index3.js";
7
- import { payBillFlowTestIds as n } from "./index4.js";
8
- import { ReviewTransactionDialog as r } from "../../ui/dist/index80.js";
9
- import { SchedulePaymentDialog as i } from "../../ui/dist/index84.js";
10
- import "../../ui/dist/index.js";
11
- import { usePayBillFlow as a } from "./index9.js";
12
- import { useImperativeHandle as o } from "react";
13
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
1
+ import { coerceAmountValueToMinorUnits as e } from "../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
2
+ import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
14
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
15
- function u({ ref: u, payable: d, poweredByBankName: f, labels: p }) {
16
- let m = t(d), h = a({
17
- payableId: d.id,
18
- amountDueMinorUnits: e(d) ?? 0,
19
- currencyCode: d.currency ?? void 0,
20
- dueDate: d.due_date,
21
- vendorName: m?.name ?? void 0,
22
- vendorEmail: m?.email ?? void 0,
23
- vendorBankAccount: m?.bank_account ?? void 0,
24
- poweredByBankName: f,
25
- labels: p
4
+ var n = {
5
+ unnamedSourceAccount: "Bank account",
6
+ availableBalancePrefix: (e) => `Available balance: ${e}`,
7
+ futureInsufficientFunds: "Not enough funds right now. Add funds before the payment date.",
8
+ todayInsufficientFunds: "Not enough funds to pay today. Choose a different account or a later date."
9
+ };
10
+ function r(e) {
11
+ return e.slice(-4);
12
+ }
13
+ function i(i, a = n) {
14
+ return i.filter((e) => e.status === "ACTIVE").map((n) => {
15
+ let i = e(n.balance.value), o = n.balance.currencyCode;
16
+ return {
17
+ id: n.id,
18
+ primaryLabel: `${n.nickname || a.unnamedSourceAccount} - ${r(n.accountNumber)}`,
19
+ secondaryLabel: a.availableBalancePrefix(t(i / 100, { currencyCode: o })),
20
+ balanceMinorUnits: i
21
+ };
26
22
  });
27
- return o(u, () => ({ open: h.open }), [h.open]), /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(i, {
28
- ...h.dialogProps,
29
- testId: n.scheduleDialog
30
- }), /* @__PURE__ */ c(r, {
31
- ...h.reviewProps,
32
- testId: n.reviewDialog
33
- })] });
23
+ }
24
+ function a({ selectedAccount: e, amountDueMinorUnits: t, isToday: r, labels: i = n }) {
25
+ let a = e?.balanceMinorUnits;
26
+ return a === void 0 ? { state: "warning" } : a >= t ? { state: "sufficient" } : r ? {
27
+ state: "error",
28
+ message: i.todayInsufficientFunds
29
+ } : {
30
+ state: "warning",
31
+ message: i.futureInsufficientFunds
32
+ };
34
33
  }
35
34
  //#endregion
36
- export { u as PayBillFlow, u as default };
35
+ export { n as SOURCE_ACCOUNT_LABELS_EN, a as deriveSourceAccountFunds, i as mapSourceAccountOptions };
@@ -1 +1,42 @@
1
- import "./index10.js";
1
+ import { SOURCE_ACCOUNT_LABELS_EN as e } from "./index10.js";
2
+ import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/index79.js";
3
+ import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/index85.js";
4
+ import "../../ui/dist/index.js";
5
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
6
+ var r = {
7
+ amountDue: "Amount due",
8
+ paymentAmount: "Payment amount",
9
+ dueDateSuffix: (e) => `by ${e}`,
10
+ paymentDate: "Payment date",
11
+ sourceAccount: "Pay from",
12
+ accountHolder: "Account holder name",
13
+ routingNumber: "Routing number",
14
+ accountNumber: "Account number",
15
+ achMethod: "Pay by ACH bank transfer",
16
+ scheduledToast: "Payment scheduled",
17
+ submitError: "Couldn't schedule this payment. Try again.",
18
+ selectAccountError: "Select a source account.",
19
+ selectDateError: "Select a payment date.",
20
+ staleDateError: "That date has passed. Choose a new payment date.",
21
+ missingPaymentInstructionsError: "This vendor does not have ACH payment instructions on file.",
22
+ missingVendorName: "Not provided",
23
+ ...e,
24
+ scheduleDialog: n,
25
+ reviewDialog: t
26
+ };
27
+ function i(e) {
28
+ return {
29
+ ...r,
30
+ ...e,
31
+ scheduleDialog: {
32
+ ...r.scheduleDialog,
33
+ ...e?.scheduleDialog
34
+ },
35
+ reviewDialog: {
36
+ ...r.reviewDialog,
37
+ ...e?.reviewDialog
38
+ }
39
+ };
40
+ }
41
+ //#endregion
42
+ export { r as PAY_BILL_FLOW_LABELS_EN, i as mergePayBillFlowLabels };
@@ -1,50 +1,165 @@
1
- import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../shared/approval-policy/feature/dist/lib/labels.js";
2
- import { parseApprovalPolicyScript as t } from "../../../shared/approval-policy/util/dist/lib/policyScript.js";
3
- import { parseApprovalPolicyTrigger as n } from "../../../shared/approval-policy/util/dist/lib/policyTrigger.js";
4
- import { buildPolicySentence as r, buildPolicyTitle as i } from "../../../shared/approval-policy/feature/dist/lib/policyViewModel.js";
5
- import "../../../shared/approval-policy/feature/dist/index.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import "../../../shared/ui/dist/index.js";
9
+ import { useAnalyticsCaptureException as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
+ import { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
+ import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
+ import { extractApiErrorMessage as a } from "../../../shared/util/dist/lib/apiErrors.js";
13
+ import "../../../shared/feature/dist/index.js";
14
+ import { dateToCalendarKey as o, getDefaultPaymentDate as s, isPastEasternDate as c, isTodayInEastern as l } from "./index3.js";
15
+ import { maskAccountNumber as u } from "./index9.js";
16
+ import { deriveSourceAccountFunds as d, mapSourceAccountOptions as f } from "./index10.js";
17
+ import { mergePayBillFlowLabels as p } from "./index11.js";
18
+ import { useSchedulePaymentMutation as m } from "../../data-access/dist/index9.js";
19
+ import "../../data-access/dist/index.js";
20
+ import { useMemo as h, useState as g } from "react";
6
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
7
- var a = {
8
- ruleTitleRange: e.ruleTitleRange,
9
- ruleTitleUpTo: e.ruleTitleUpTo,
10
- ruleTitleFrom: e.ruleTitleFrom,
11
- ruleTitleAny: e.ruleTitleAny,
12
- ruleSentenceRange: e.ruleSentenceRange,
13
- ruleSentenceUpTo: e.ruleSentenceUpTo,
14
- ruleSentenceFrom: e.ruleSentenceFrom,
15
- ruleSentenceAny: e.ruleSentenceAny
16
- };
17
- function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
- let u = t(a.script);
19
- if (!u.groups.length || !u.isSupported) return;
20
- let d = [];
21
- for (let [e, t] of u.groups.entries()) {
22
- let n = [];
23
- for (let e of [...t.roleIds, ...t.userIds]) {
24
- let t = o.get(e);
25
- t && n.push({
26
- id: e,
27
- label: t.label,
28
- approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
- });
22
+ function _(e) {
23
+ return !!(e?.account_holder_name && e.routing_number && e.account_number);
24
+ }
25
+ function v({ selectedDate: e, selectedAccount: t, amountDueMinorUnits: n, labels: r }) {
26
+ if (!e) return {
27
+ ok: !1,
28
+ error: r.selectDateError
29
+ };
30
+ if (c(e)) return {
31
+ ok: !1,
32
+ error: r.staleDateError
33
+ };
34
+ if (!t) return {
35
+ ok: !1,
36
+ error: r.selectAccountError
37
+ };
38
+ let i = d({
39
+ selectedAccount: t,
40
+ amountDueMinorUnits: n,
41
+ isToday: l(e),
42
+ labels: r
43
+ });
44
+ return i.state === "error" ? {
45
+ ok: !1,
46
+ error: i.message ?? r.todayInsufficientFunds
47
+ } : {
48
+ ok: !0,
49
+ date: e,
50
+ account: t
51
+ };
52
+ }
53
+ function y({ payableId: c, amountDueMinorUnits: y, currencyCode: b = "USD", dueDate: x, vendorName: S, vendorEmail: C, vendorBankAccount: w, poweredByBankName: T, labels: E }) {
54
+ let D = h(() => p(E), [E]), O = S ?? D.missingVendorName, [k, A] = g(!1), [j, M] = g(!1), [N, P] = g(() => s()), [F, I] = g(), L = t({ enabled: k || j }), R = m(), z = n(), B = h(() => f(L.data?.data ?? [], D), [L.data?.data, D]), V = B.find((e) => e.id === F), H = N ? l(N) : !1, U = { before: s() }, W = d({
55
+ selectedAccount: V,
56
+ amountDueMinorUnits: y,
57
+ isToday: H,
58
+ labels: D
59
+ }), G = i(y / 100, { currencyCode: b }), K = N ? r(o(N)) : void 0, q = x ? D.dueDateSuffix(r(x)) : void 0, J = () => v({
60
+ selectedDate: N,
61
+ selectedAccount: V,
62
+ amountDueMinorUnits: y,
63
+ labels: D
64
+ }), Y = () => {
65
+ if (!_(w)) {
66
+ e.error(D.missingPaymentInstructionsError);
67
+ return;
30
68
  }
31
- n.length && d.push({
32
- id: `group-${e + 1}`,
33
- chips: n
34
- });
35
- }
36
- if (!d.length) return;
37
- let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
- if (!p) return;
39
- let m = {
40
- ...e,
41
- ...l
69
+ A(!0);
70
+ }, X = () => {
71
+ M(!1), A(!1);
42
72
  };
43
73
  return {
44
- title: i(f, m),
45
- sentence: r(f, m),
46
- steps: d
74
+ open: Y,
75
+ dialogProps: {
76
+ open: k,
77
+ onOpenChange: A,
78
+ amountDueLabel: D.amountDue,
79
+ amountDue: G,
80
+ dueDateSuffix: q,
81
+ paymentAmountLabel: D.paymentAmount,
82
+ paymentAmount: G,
83
+ selectedDate: N,
84
+ selectedDateLabel: K,
85
+ calendarDisabled: U,
86
+ isToday: H,
87
+ selectedAccountId: F,
88
+ accounts: B,
89
+ poweredByBankName: T,
90
+ funds: W,
91
+ isAccountsLoading: L.isLoading,
92
+ isAccountsError: L.isError,
93
+ isSubmitting: R.isPending,
94
+ onDateChange: P,
95
+ onAccountChange: I,
96
+ onReview: () => {
97
+ let t = J();
98
+ if (!t.ok) {
99
+ e.error(t.error);
100
+ return;
101
+ }
102
+ A(!1), M(!0);
103
+ },
104
+ onCancel: X,
105
+ labels: D.scheduleDialog
106
+ },
107
+ reviewProps: {
108
+ open: j,
109
+ onOpenChange: M,
110
+ amountLabel: D.paymentAmount,
111
+ amount: G,
112
+ rows: [{
113
+ label: D.sourceAccount,
114
+ value: V?.primaryLabel ?? ""
115
+ }, {
116
+ label: D.paymentDate,
117
+ value: K ?? ""
118
+ }],
119
+ payTo: {
120
+ name: O,
121
+ email: C,
122
+ methodLabel: D.achMethod,
123
+ fields: _(w) ? [
124
+ {
125
+ label: D.routingNumber,
126
+ value: w.routing_number
127
+ },
128
+ {
129
+ label: D.accountNumber,
130
+ value: w.account_number,
131
+ maskedValue: u(w.account_number)
132
+ },
133
+ {
134
+ label: D.accountHolder,
135
+ value: w.account_holder_name
136
+ }
137
+ ] : []
138
+ },
139
+ isSubmitting: R.isPending,
140
+ onBack: () => {
141
+ M(!1), A(!0);
142
+ },
143
+ onCancel: X,
144
+ onSubmit: async () => {
145
+ let t = J();
146
+ if (!t.ok) {
147
+ M(!1), e.error(t.error), A(!0);
148
+ return;
149
+ }
150
+ try {
151
+ await R.mutateAsync({
152
+ payableId: c,
153
+ paymentDate: o(t.date),
154
+ sourceBankAccountId: t.account.id
155
+ }), X(), e.success(D.scheduledToast);
156
+ } catch (t) {
157
+ z(t, { payable_id: c }), e.error(a(t) ?? D.submitError);
158
+ }
159
+ },
160
+ labels: D.reviewDialog
161
+ }
47
162
  };
48
163
  }
49
164
  //#endregion
50
- export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
165
+ export { y as usePayBillFlow };
@@ -1,7 +1,36 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { resolveAmountDueMinorUnits as e } from "./index6.js";
6
+ import { resolveVendor as t } from "./index7.js";
7
+ import { payBillFlowTestIds as n } from "./index8.js";
8
+ import { ReviewTransactionDialog as r } from "../../ui/dist/index80.js";
9
+ import { SchedulePaymentDialog as i } from "../../ui/dist/index87.js";
10
+ import "../../ui/dist/index.js";
11
+ import { usePayBillFlow as a } from "./index12.js";
12
+ import { useImperativeHandle as o } from "react";
13
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
1
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
2
- function e(e, t) {
3
- let n = e ?? [];
4
- return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
15
+ function u({ ref: u, payable: d, poweredByBankName: f, labels: p }) {
16
+ let m = t(d), h = a({
17
+ payableId: d.id,
18
+ amountDueMinorUnits: e(d) ?? 0,
19
+ currencyCode: d.currency ?? void 0,
20
+ dueDate: d.due_date,
21
+ vendorName: m?.name ?? void 0,
22
+ vendorEmail: m?.email ?? void 0,
23
+ vendorBankAccount: m?.bank_account ?? void 0,
24
+ poweredByBankName: f,
25
+ labels: p
26
+ });
27
+ return o(u, () => ({ open: h.open }), [h.open]), /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(i, {
28
+ ...h.dialogProps,
29
+ testId: n.scheduleDialog
30
+ }), /* @__PURE__ */ c(r, {
31
+ ...h.reviewProps,
32
+ testId: n.reviewDialog
33
+ })] });
5
34
  }
6
35
  //#endregion
7
- export { e as currentApprovalRound };
36
+ export { u as PayBillFlow, u as default };
@@ -1,16 +1 @@
1
- import { currentApprovalRound as e } from "./index13.js";
2
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
3
- function t({ requestsNewestFirst: t, roundStartedAt: n, lookup: r }) {
4
- let i = e(t, n), a = [];
5
- for (let e of i) {
6
- if (e.status !== "waiting") continue;
7
- let t = [...e.role_ids ?? [], ...e.user_ids ?? []].map((e) => r.get(e)?.label).filter((e) => !!e);
8
- t.length && a.push({
9
- id: e.id,
10
- names: t
11
- });
12
- }
13
- return a;
14
- }
15
- //#endregion
16
- export { t as buildPendingApproverGroups };
1
+ import "./index13.js";
@@ -1,17 +1,50 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index6.js";
6
- import "../../data-access/dist/index.js";
1
+ import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../shared/approval-policy/feature/dist/lib/labels.js";
2
+ import { parseApprovalPolicyScript as t } from "../../../shared/approval-policy/util/dist/lib/policyScript.js";
3
+ import { parseApprovalPolicyTrigger as n } from "../../../shared/approval-policy/util/dist/lib/policyTrigger.js";
4
+ import { buildPolicySentence as r, buildPolicyTitle as i } from "../../../shared/approval-policy/feature/dist/lib/policyViewModel.js";
5
+ import "../../../shared/approval-policy/feature/dist/index.js";
7
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
8
- var t = "submitted_for_approval";
9
- function n({ payableId: n, enabled: r = !0 }) {
10
- let i = e(n, { enabled: r });
7
+ var a = {
8
+ ruleTitleRange: e.ruleTitleRange,
9
+ ruleTitleUpTo: e.ruleTitleUpTo,
10
+ ruleTitleFrom: e.ruleTitleFrom,
11
+ ruleTitleAny: e.ruleTitleAny,
12
+ ruleSentenceRange: e.ruleSentenceRange,
13
+ ruleSentenceUpTo: e.ruleSentenceUpTo,
14
+ ruleSentenceFrom: e.ruleSentenceFrom,
15
+ ruleSentenceAny: e.ruleSentenceAny
16
+ };
17
+ function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
+ let u = t(a.script);
19
+ if (!u.groups.length || !u.isSupported) return;
20
+ let d = [];
21
+ for (let [e, t] of u.groups.entries()) {
22
+ let n = [];
23
+ for (let e of [...t.roleIds, ...t.userIds]) {
24
+ let t = o.get(e);
25
+ t && n.push({
26
+ id: e,
27
+ label: t.label,
28
+ approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
+ });
30
+ }
31
+ n.length && d.push({
32
+ id: `group-${e + 1}`,
33
+ chips: n
34
+ });
35
+ }
36
+ if (!d.length) return;
37
+ let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
+ if (!p) return;
39
+ let m = {
40
+ ...e,
41
+ ...l
42
+ };
11
43
  return {
12
- roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
- isLoading: i.isLoading
44
+ title: i(f, m),
45
+ sentence: r(f, m),
46
+ steps: d
14
47
  };
15
48
  }
16
49
  //#endregion
17
- export { n as usePayableApprovalRoundStart };
50
+ export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
@@ -1,67 +1,7 @@
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 { useAllOrganizationRolesQuery as n } from "../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
8
- import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
- import "../../../shared/data-access/dist/index.js";
10
- import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index5.js";
13
- import "../../data-access/dist/index.js";
14
- import { useGetApprovalPoliciesQuery as o } from "../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
15
- import "../../../shared/approval-policy/data-access/dist/index.js";
16
- import { buildApprovalPolicyCardView as s } from "./index12.js";
17
- import { currentApprovalRound as c } from "./index13.js";
18
- import { buildPendingApproverGroups as l } from "./index14.js";
19
- import { usePayableApprovalRoundStart as u } from "./index15.js";
20
- import { useMemo as d } from "react";
21
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
22
- function f({ payableId: f, approvalPolicyId: p, enabled: m = !0, copy: h }) {
23
- let g = m && !!p, { initResponse: _ } = i(), v = e(_?.scopes, [t.ApprovalPolicyReadOrg]), y = e(_?.scopes, [t.ApprovalRequestReadOrg]), b = e(_?.scopes, [t.RoleReadOrg]), x = e(_?.scopes, [t.UserReadOrg]), S = o({ enabled: g && v }), C = n({ enabled: g && b }), w = r({ enabled: g && x }), T = a(f, { enabled: g && y }), { roundStartedAt: E } = u({
24
- payableId: f,
25
- enabled: g && y
26
- }), D = d(() => {
27
- let e = /* @__PURE__ */ new Map();
28
- for (let t of C.data?.data ?? []) e.set(t.id, {
29
- label: t.name,
30
- kind: "role"
31
- });
32
- for (let t of w.data?.data ?? []) e.set(t.id, {
33
- label: t.name,
34
- kind: "user"
35
- });
36
- return e;
37
- }, [C.data, w.data]), O = d(() => c(T.data?.data, E), [T.data, E]), k = d(() => new Set(O.flatMap((e) => e.approved_by ?? [])), [O]), A = d(() => new Set(O.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [O]), j = d(() => p ? S.data?.data.find((e) => e.id === p) : void 0, [S.data, p]);
38
- return {
39
- view: d(() => g && j ? s({
40
- policy: j,
41
- lookup: D,
42
- approvedUserIds: k,
43
- approvedRoleIds: A,
44
- copy: h
45
- }) : void 0, [
46
- g,
47
- j,
48
- D,
49
- k,
50
- A,
51
- h
52
- ]),
53
- pendingApprovers: d(() => g ? l({
54
- requestsNewestFirst: T.data?.data,
55
- roundStartedAt: E,
56
- lookup: D
57
- }) : [], [
58
- g,
59
- T.data,
60
- E,
61
- D
62
- ]),
63
- isLoading: g && (S.isResolving || C.isResolving || w.isResolving || T.isLoading)
64
- };
2
+ function e(e, t) {
3
+ let n = e ?? [];
4
+ return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
65
5
  }
66
6
  //#endregion
67
- export { f as useApprovalPolicyCardView };
7
+ export { e as currentApprovalRound };