@tesouro/embedded-components-react 0.5.226 → 0.5.227

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 (105) hide show
  1. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index3.js +41 -39
  2. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index12.js +2 -2
  3. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js +2 -2
  4. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +2 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +150 -147
  7. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +46 -51
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +130 -128
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +31 -32
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index19.js +2 -2
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +2 -2
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +2 -2
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +2 -2
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index3.js +2 -2
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index4.js +36 -37
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/data-access/dist/index2.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/feature/dist/index4.js +2 -2
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index2.js +6 -10
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index3.js +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index4.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index5.js +2 -2
  22. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index6.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index7.js +2 -2
  24. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index8.js +2 -2
  25. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js +154 -150
  26. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/data-access/dist/index7.js +2 -2
  27. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index2.js +2 -2
  28. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index3.js +2 -2
  29. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +151 -149
  30. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +4 -4
  31. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +4 -4
  32. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index15.js +2 -2
  33. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index17.js +2 -2
  34. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index18.js +2 -2
  35. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index19.js +2 -2
  36. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index2.js +2 -2
  37. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index3.js +2 -2
  38. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index4.js +2 -2
  39. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index5.js +2 -2
  40. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index6.js +2 -2
  41. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index8.js +2 -2
  42. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index9.js +2 -2
  43. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index24.js +1 -0
  44. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index27.js +89 -87
  45. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +133 -130
  46. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js +36 -34
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +12 -12
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -6
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +2 -2
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +40 -39
  51. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/data-access/dist/index4.js +2 -2
  52. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +209 -207
  53. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index4.js +10 -5
  54. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +10 -5
  55. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js +11 -6
  56. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +2 -2
  57. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +2 -2
  58. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js +2 -2
  59. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index12.js +2 -2
  60. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index13.js +2 -2
  61. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index14.js +30 -28
  62. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index17.js +28 -26
  63. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index18.js +37 -34
  64. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index21.js +28 -26
  65. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index22.js +37 -34
  66. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +294 -292
  67. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +58 -58
  68. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +47 -48
  69. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index3.js +4 -4
  70. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +2 -2
  71. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index7.js +4 -4
  72. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +39 -38
  73. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +14 -13
  74. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/allPages.js +1 -1
  75. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/applicationStatusQueryOptions.js +16 -15
  76. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js +7 -5
  77. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js +7 -5
  78. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js +2 -2
  79. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js +7 -5
  80. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +28 -29
  81. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/organizationStatus.js +10 -0
  82. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +26 -27
  83. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js +2 -2
  84. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js +31 -32
  85. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useRolePermissionsQueries.js +2 -2
  86. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useCurrentUserQuery.js +2 -2
  87. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useGetUserDataQuery.js +2 -2
  88. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMailboxAddress.js +2 -2
  89. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMyEntityQuery.js +2 -2
  90. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +33 -34
  91. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +33 -22
  92. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +2 -2
  93. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +43 -32
  94. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +138 -127
  95. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/deriveOrganizationStatus.js +6 -0
  96. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js +1 -1
  97. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  98. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +2 -2
  99. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js +2 -2
  100. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +2 -2
  101. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +2 -2
  102. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +2 -2
  103. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +2 -2
  104. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +60 -58
  105. package/package.json +1 -1
@@ -6,15 +6,17 @@ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoney
6
6
  import { normalizeAmountOutputCurrencyCode as t } from "../../../shared/util/dist/lib/normalizeAmountOutputCurrencyCode.js";
7
7
  import { parseAmountOutputMajorUnits as n } from "../../../shared/util/dist/lib/parseAmountOutputMajorUnits.js";
8
8
  import { sumAmountOutputsMajorUnits as r } from "../../../shared/util/dist/lib/sumAmountOutputsMajorUnits.js";
9
- import { Scope as i } from "../../../shared/data-access/dist/lib/scopes.js";
10
- import { useAllBankAccountsQuery as a } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
9
+ import { isOrganizationOnItsWay as i } from "../../../shared/data-access/dist/lib/organizationStatus.js";
10
+ import { useEmbedApi as a } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
11
+ import { Scope as o } from "../../../shared/data-access/dist/lib/scopes.js";
12
+ import { useAllBankAccountsQuery as s } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
11
13
  import "../../../shared/data-access/dist/index.js";
12
- import { useRefetchWidget as o, useWidgetConfig as s, useWidgetError as c, useWidgetLoading as l } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
14
+ import { useRefetchWidget as c, useWidgetConfig as l, useWidgetError as u, useWidgetLoading as d } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
15
  import "../../../shared/feature/dist/index.js";
14
- import { createContext as u, useCallback as d, useContext as f, useMemo as p } from "react";
15
- import { jsx as m } from "react/jsx-runtime";
16
+ import { createContext as f, useCallback as p, useContext as m, useMemo as h } from "react";
17
+ import { jsx as g } from "react/jsx-runtime";
16
18
  //#region ../../libs/tesouro-embedded-components-react/balances-widget/feature/dist/index3.js
17
- var h = u({
19
+ var _ = f({
18
20
  accountRows: [],
19
21
  isLoading: !1,
20
22
  isError: !1,
@@ -24,14 +26,14 @@ var h = u({
24
26
  shouldShowViewAllAccounts: !1,
25
27
  isRowClickable: !1,
26
28
  onViewAllAccountsClicked: () => {}
27
- }), g = () => f(h), _ = ({ children: u, maxAccounts: f, onBalanceRowClick: g, onViewAllAccountsClick: _ }) => {
28
- let { data: v, isLoading: y, isError: b, refetch: x, hasNextPage: S, isFetchingNextPage: C } = a(), { initResponse: w } = s(), T = l(), E = c(), D = o(), O = T && !w || y, k = !!E || b, A = d(() => {
29
- D(), E || x();
29
+ }), v = () => m(_), y = ({ children: f, maxAccounts: m, onBalanceRowClick: v, onViewAllAccountsClick: y }) => {
30
+ let { data: b, isLoading: x, isError: S, refetch: C, hasNextPage: w, isFetchingNextPage: T } = s(), { initResponse: E } = l(), D = d(), O = i(a().organizationStatus), k = u(), A = c(), j = D && !E || O && !b || x, M = !!k || S, N = p(() => {
31
+ A(), k || C();
30
32
  }, [
31
- D,
32
- x,
33
- E
34
- ]), j = v?.data ?? [], M = p(() => j.map((t) => {
33
+ A,
34
+ C,
35
+ k
36
+ ]), P = b?.data ?? [], F = h(() => P.map((t) => {
35
37
  let r = t.accountNumber.slice(-4), i = n(t.balance);
36
38
  return {
37
39
  accountId: t.id,
@@ -44,38 +46,38 @@ var h = u({
44
46
  })
45
47
  }
46
48
  };
47
- }), [j]), N = p(() => {
48
- let n = t(j[0]?.balance?.currencyCode), i = r(j.map((e) => e.balance), n);
49
+ }), [P]), I = h(() => {
50
+ let n = t(P[0]?.balance?.currencyCode), i = r(P.map((e) => e.balance), n);
49
51
  return e(i, {
50
52
  currencyCode: n,
51
53
  includeSpaceAfterCurrencySymbol: !1
52
54
  });
53
- }, [j]), P = p(() => j.length > 1 && (w?.scopes?.includes(i.BankAccountReadOrg) ?? !1) && !S && !C, [
54
- j.length,
55
- w?.scopes,
56
- S,
57
- C
58
- ]), F = p(() => j.length > f && !!_, [
59
- j.length,
60
- f,
61
- _
62
- ]), I = d(() => {
63
- _?.();
64
- }, [_]), L = p(() => !!g, [g]);
65
- return /* @__PURE__ */ m(h.Provider, {
55
+ }, [P]), L = h(() => P.length > 1 && (E?.scopes?.includes(o.BankAccountReadOrg) ?? !1) && !w && !T, [
56
+ P.length,
57
+ E?.scopes,
58
+ w,
59
+ T
60
+ ]), R = h(() => P.length > m && !!y, [
61
+ P.length,
62
+ m,
63
+ y
64
+ ]), z = p(() => {
65
+ y?.();
66
+ }, [y]), B = h(() => !!v, [v]);
67
+ return /* @__PURE__ */ g(_.Provider, {
66
68
  value: {
67
- accountRows: M,
68
- isLoading: O,
69
- isError: k,
70
- refetch: A,
71
- totalBalance: N,
72
- shouldTotalBalanceDisplay: P,
73
- shouldShowViewAllAccounts: F,
74
- isRowClickable: L,
75
- onViewAllAccountsClicked: I
69
+ accountRows: F,
70
+ isLoading: j,
71
+ isError: M,
72
+ refetch: N,
73
+ totalBalance: I,
74
+ shouldTotalBalanceDisplay: L,
75
+ shouldShowViewAllAccounts: R,
76
+ isRowClickable: B,
77
+ onViewAllAccountsClicked: z
76
78
  },
77
- children: u
79
+ children: f
78
80
  });
79
81
  };
80
82
  //#endregion
81
- export { _ as BalancesWidgetContextProvider, g as useBalancesWidgetContext };
83
+ export { y as BalancesWidgetContextProvider, v as useBalancesWidgetContext };
@@ -18,7 +18,7 @@ var c = (e, t) => (n, r) => {
18
18
  if (i !== void 0 && i.baseUrl === e && i.path?.id === t) return n;
19
19
  };
20
20
  function l(l, u) {
21
- let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationPending: h } = n();
21
+ let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationStatus: h } = n();
22
22
  i(l, u);
23
23
  let g = !!(p && l && u), _ = d.getConfig().baseUrl, v = o(() => c(_, l), [_, l]), y = s({
24
24
  ...t(e({
@@ -27,7 +27,7 @@ function l(l, u) {
27
27
  headers: r(f)
28
28
  }), {
29
29
  authEpoch: m,
30
- organizationPending: h
30
+ organizationStatus: h
31
31
  }),
32
32
  placeholderData: v,
33
33
  enabled: g,
@@ -10,7 +10,7 @@ import "../../../../shared/data-access/dist/index.js";
10
10
  import { useQuery as i } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js
12
12
  function a({ id: a, enabled: o }) {
13
- let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationPending: d } = n(), f = e({
13
+ let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = e({
14
14
  client: s,
15
15
  headers: r(c),
16
16
  path: { id: a ?? "" }
@@ -18,7 +18,7 @@ function a({ id: a, enabled: o }) {
18
18
  return i({
19
19
  ...t(f, {
20
20
  authEpoch: u,
21
- organizationPending: d
21
+ organizationStatus: d
22
22
  }),
23
23
  enabled: !!(a && c && l) && (o === !0 || o === void 0)
24
24
  });
@@ -10,7 +10,7 @@ import "../../../../shared/data-access/dist/index.js";
10
10
  import { keepPreviousData as i, useQuery as a } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js
12
12
  function o({ id: o, enabled: s, ...c }) {
13
- let { client: l, organizationId: u, widgetToken: d, authEpoch: f, organizationPending: p } = n(), m = e({
13
+ let { client: l, organizationId: u, widgetToken: d, authEpoch: f, organizationStatus: p } = n(), m = e({
14
14
  client: l,
15
15
  headers: r(u),
16
16
  path: { id: o ?? "" },
@@ -19,7 +19,7 @@ function o({ id: o, enabled: s, ...c }) {
19
19
  return a({
20
20
  ...t(m, {
21
21
  authEpoch: f,
22
- organizationPending: p
22
+ organizationStatus: p
23
23
  }),
24
24
  enabled: !!(o && u && d) && (s === !0 || s === void 0),
25
25
  placeholderData: i
@@ -10,7 +10,7 @@ import "../../../../shared/data-access/dist/index.js";
10
10
  import { useQuery as i } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js
12
12
  function a({ id: a, enabled: o, ...s }) {
13
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationPending: f } = n(), p = e({
13
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = e({
14
14
  client: c,
15
15
  headers: r(l),
16
16
  path: { id: a ?? "" },
@@ -19,7 +19,7 @@ function a({ id: a, enabled: o, ...s }) {
19
19
  return i({
20
20
  ...t(p, {
21
21
  authEpoch: d,
22
- organizationPending: f
22
+ organizationStatus: f
23
23
  }),
24
24
  enabled: !!(a && l && u) && (o === !0 || o === void 0)
25
25
  });
@@ -3,99 +3,102 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { isOrganizationOnItsWay as t } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
7
+ import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import "../../../../shared/data-access/dist/index.js";
6
9
  import "../../../../shared/ui/dist/index.js";
7
- import { useAnalyticsTrack as t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
8
- import { useWidgetConfig as n, useWidgetError as r, useWidgetLoading as ee } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import { useAnalyticsTrack as r } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
11
+ import { useWidgetConfig as ee, useWidgetError as te, useWidgetLoading as ne } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
12
  import "../../../../shared/feature/dist/index.js";
10
- import { AccountDetailsWidgetAnalyticsEvent as te } from "./index2.js";
11
- import { formatDateParam as i, getDefaultExportDateRange as ne, isExportRangeValid as a, startOfLocalDay as o, triggerCsvDownload as re, yesterdayLocal as s } from "./index3.js";
12
- import { copyTextToClipboard as ie, formatAmountLabel as c, formatSignedTransactionAmountLabel as ae, formatStatementPeriodLabel as oe, formatTransactionDateLabel as se, maskAccountNumber as ce } from "./index4.js";
13
- import { DEFAULT_FEATURE_LABELS as le } from "./index5.js";
14
- import { getBankAccountsPermissions as ue } from "./index6.js";
15
- import { getStatementsStartDate as de } from "./index7.js";
13
+ import { AccountDetailsWidgetAnalyticsEvent as i } from "./index2.js";
14
+ import { formatDateParam as re, getDefaultExportDateRange as ie, isExportRangeValid as a, startOfLocalDay as o, triggerCsvDownload as ae, yesterdayLocal as s } from "./index3.js";
15
+ import { copyTextToClipboard as oe, formatAmountLabel as c, formatSignedTransactionAmountLabel as se, formatStatementPeriodLabel as ce, formatTransactionDateLabel as le, maskAccountNumber as ue } from "./index4.js";
16
+ import { DEFAULT_FEATURE_LABELS as de } from "./index5.js";
17
+ import { getBankAccountsPermissions as fe } from "./index6.js";
18
+ import { getStatementsStartDate as pe } from "./index7.js";
16
19
  import { interpolateLabel as l } from "./index8.js";
17
- import { useBankAccountDetailsQuery as fe } from "../../data-access/dist/index2.js";
18
- import { useBankAccountStatementsQuery as pe } from "../../data-access/dist/index3.js";
19
- import { useBankAccountTransactionsQuery as me } from "../../data-access/dist/index4.js";
20
- import { useDownloadBankAccountTransactionsMutation as he } from "../../data-access/dist/index5.js";
21
- import { useRetrieveBankAccountStatementMutation as ge } from "../../data-access/dist/index6.js";
22
- import { useUpdateBankAccountMutation as _e } from "../../data-access/dist/index7.js";
20
+ import { useBankAccountDetailsQuery as me } from "../../data-access/dist/index2.js";
21
+ import { useBankAccountStatementsQuery as he } from "../../data-access/dist/index3.js";
22
+ import { useBankAccountTransactionsQuery as ge } from "../../data-access/dist/index4.js";
23
+ import { useDownloadBankAccountTransactionsMutation as _e } from "../../data-access/dist/index5.js";
24
+ import { useRetrieveBankAccountStatementMutation as ve } from "../../data-access/dist/index6.js";
25
+ import { useUpdateBankAccountMutation as ye } from "../../data-access/dist/index7.js";
23
26
  import "../../data-access/dist/index.js";
24
- import { DEFAULT_LABELS as ve } from "../../ui/dist/index7.js";
25
- import { AccountDetailsWidgetUi as ye } from "../../ui/dist/index8.js";
27
+ import { DEFAULT_LABELS as be } from "../../ui/dist/index7.js";
28
+ import { AccountDetailsWidgetUi as xe } from "../../ui/dist/index8.js";
26
29
  import "../../ui/dist/index.js";
27
- import { useCallback as u, useEffect as be, useMemo as d, useState as f } from "react";
28
- import { jsx as xe } from "react/jsx-runtime";
30
+ import { useCallback as u, useEffect as Se, useMemo as d, useState as f } from "react";
31
+ import { jsx as Ce } from "react/jsx-runtime";
29
32
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js
30
- var Se = 3e3, Ce = 5e3, we = [
33
+ var we = 3e3, Te = 5e3, Ee = [
31
34
  10,
32
35
  25,
33
36
  50
34
- ], Te = 10, Ee = 6e5, De = { nickname: "" };
35
- function p({ accountId: p, onBack: Oe, labels: ke, featureLabels: Ae, isBankingTaglineVisible: je = !0, bankLogoSrc: Me, bankLogoAlt: Ne, bankAddress: Pe, supportTeamUrl: Fe }) {
37
+ ], De = 10, Oe = 6e5, ke = { nickname: "" };
38
+ function p({ accountId: p, onBack: Ae, labels: je, featureLabels: Me, isBankingTaglineVisible: Ne = !0, bankLogoSrc: Pe, bankLogoAlt: Fe, bankAddress: Ie, supportTeamUrl: Le }) {
36
39
  let m = {
37
- ...ve,
38
- ...ke
40
+ ...be,
41
+ ...je
39
42
  }, h = {
40
- ...le,
41
- ...Ae
42
- }, g = t(), { organizationId: Ie, widgetToken: Le, initResponse: _ } = n(), Re = ee(), v = !!r(), y = !!(Ie && Le), b = d(() => ue(_?.scopes), [_?.scopes]), x = b.canRead && !!_, S = y && x, C = x && !y, [w, ze] = f("transactions"), [Be, T] = f(!1), [E, D] = f(De), [Ve, He] = f(!1), [Ue, O] = f(!1), [We, k] = f(!1), [Ge, Ke] = f(!1), [qe, A] = f(!1), [j, M] = f(), [N, P] = f(), [F, Je] = f(Te), [I, L] = f(() => ({
43
+ ...de,
44
+ ...Me
45
+ }, g = r(), { organizationId: Re, widgetToken: ze, initResponse: _ } = ee(), Be = ne(), Ve = t(n().organizationStatus), v = !!te(), y = !!(Re && ze), b = d(() => fe(_?.scopes), [_?.scopes]), x = b.canRead && !!_, S = y && x, C = x && !y, [w, He] = f("transactions"), [Ue, T] = f(!1), [E, D] = f(ke), [We, Ge] = f(!1), [Ke, qe] = f(!1), [Je, Ye] = f(!1), [Xe, Ze] = f(!1), [Qe, $e] = f(!1), [O, k] = f(), [A, j] = f(), [M, et] = f(De), [N, P] = f(() => ({
43
46
  accountId: p,
44
47
  token: void 0
45
48
  }));
46
- I.accountId !== p && L({
49
+ N.accountId !== p && P({
47
50
  accountId: p,
48
51
  token: void 0
49
52
  });
50
- let Ye = I.accountId === p ? I.token : void 0, R = u((e) => {
51
- L((t) => ({
53
+ let tt = N.accountId === p ? N.token : void 0, F = u((e) => {
54
+ P((t) => ({
52
55
  ...t,
53
56
  token: e
54
57
  }));
55
- }, []), [z, B] = f(() => /* @__PURE__ */ new Set());
56
- be(() => {
57
- g(te.Mounted);
58
+ }, []), [I, L] = f(() => /* @__PURE__ */ new Set());
59
+ Se(() => {
60
+ g(i.Mounted);
58
61
  }, [g]);
59
- let V = fe({
62
+ let R = me({
60
63
  id: p,
61
64
  enabled: S
62
- }), H = me({
65
+ }), z = ge({
63
66
  id: p,
64
67
  enabled: S && w === "transactions",
65
68
  limit: 25,
66
69
  sortBy: "DATE",
67
70
  sortOrder: "DESC"
68
- }), [Xe] = f(de), U = pe({
71
+ }), [nt] = f(pe), B = he({
69
72
  id: p,
70
- startDate: Xe,
73
+ startDate: nt,
71
74
  enabled: S && w === "statements",
72
- limit: F,
73
- pagination_token: Ye,
75
+ limit: M,
76
+ pagination_token: tt,
74
77
  category: "STATEMENTS"
75
- }), Ze = _e(), Qe = he(), $e = ge(), { mutate: et, isPending: tt, isError: W, reset: G } = Ze, { mutateAsync: K, isPending: nt } = Qe, { mutateAsync: q } = $e, J = x ? V.data : void 0, Y = _?.bankName?.trim() ?? "", rt = Pe?.trim() || void 0, X = { bankName: Y }, it = d(() => l(m.domesticWireIntro, X), [m.domesticWireIntro, Y]), at = d(() => l(m.domesticWireNote, X), [m.domesticWireNote, Y]), ot = d(() => l(m.thingsToKnowBody, X), [m.thingsToKnowBody, Y]), st = J?.nickname?.trim() || h.accountFallback, ct = c(J?.balance), lt = d(() => (H.data?.data ?? []).map((e, t) => ({
78
+ }), rt = ye(), it = _e(), at = ve(), { mutate: ot, isPending: st, isError: V, reset: H } = rt, { mutateAsync: U, isPending: ct } = it, { mutateAsync: W } = at, G = x ? R.data : void 0, K = _?.bankName?.trim() ?? "", q = Ie?.trim() || void 0, J = { bankName: K }, lt = d(() => l(m.domesticWireIntro, J), [m.domesticWireIntro, K]), ut = d(() => l(m.domesticWireNote, J), [m.domesticWireNote, K]), dt = d(() => l(m.thingsToKnowBody, J), [m.thingsToKnowBody, K]), ft = G?.nickname?.trim() || h.accountFallback, pt = c(G?.balance), Y = d(() => (z.data?.data ?? []).map((e, t) => ({
76
79
  key: `${e.date}-${t}`,
77
80
  descriptionLabel: e.description,
78
- dateLabel: se(e.date),
79
- amountLabel: ae(e.amount, e.direction),
81
+ dateLabel: le(e.date),
82
+ amountLabel: se(e.amount, e.direction),
80
83
  amountVariant: e.direction === "CREDIT" ? "positive" : "default",
81
84
  balanceLabel: c(e.runningBalance)
82
- })), [H.data?.data]), ut = b.canRead && lt.length > 0, dt = u((t) => {
85
+ })), [z.data?.data]), mt = b.canRead && Y.length > 0, X = u((t) => {
83
86
  if (!y || !b.canRead) return;
84
87
  let n = window.open("", "_blank");
85
88
  if (!n) {
86
89
  e.error(h.viewStatementErrorToast);
87
90
  return;
88
91
  }
89
- n.opener = null, B((e) => new Set(e).add(t)), q({
92
+ n.opener = null, L((e) => new Set(e).add(t)), W({
90
93
  id: p,
91
94
  statementId: t
92
95
  }).then((e) => {
93
96
  let t = URL.createObjectURL(e);
94
- n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Ee);
97
+ n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Oe);
95
98
  }).catch(() => {
96
99
  n.close(), e.error(h.viewStatementErrorToast);
97
100
  }).finally(() => {
98
- B((e) => {
101
+ L((e) => {
99
102
  if (!e.has(t)) return e;
100
103
  let n = new Set(e);
101
104
  return n.delete(t), n;
@@ -106,73 +109,73 @@ function p({ accountId: p, onBack: Oe, labels: ke, featureLabels: Ae, isBankingT
106
109
  h.viewStatementErrorToast,
107
110
  y,
108
111
  b.canRead,
109
- q
110
- ]), ft = d(() => (U.data?.data ?? []).map((e) => {
111
- let t = oe(e.statementDate);
112
+ W
113
+ ]), ht = d(() => (B.data?.data ?? []).map((e) => {
114
+ let t = ce(e.statementDate);
112
115
  return {
113
116
  key: e.statementId,
114
117
  label: t,
115
118
  viewButtonAriaLabel: l(m.viewStatementButtonAriaLabel, { date: t }),
116
- isViewDisabled: z.has(e.statementId),
117
- onView: () => dt(e.statementId)
119
+ isViewDisabled: I.has(e.statementId),
120
+ onView: () => X(e.statementId)
118
121
  };
119
122
  }), [
120
- U.data?.data,
123
+ B.data?.data,
121
124
  m.viewStatementButtonAriaLabel,
122
- z,
123
- dt
124
- ]), Z = U.data?.nextPaginationToken ?? void 0, Q = U.data?.prevPaginationToken ?? void 0, pt = S && w === "statements" && !!U.data && !U.isError, mt = S && w === "statements" && U.isLoading, ht = S && w === "statements" && U.isError, gt = u(() => {
125
- U.refetch();
126
- }, [U.refetch]), _t = u((e) => {
127
- Je(e), R(void 0);
128
- }, []), vt = u(() => {
129
- R(Q);
130
- }, [Q]), yt = u(() => {
131
- R(Z);
132
- }, [Z]), bt = C || !a(j, N), xt = d(() => {
125
+ I,
126
+ X
127
+ ]), Z = B.data?.nextPaginationToken ?? void 0, Q = B.data?.prevPaginationToken ?? void 0, gt = S && w === "statements" && !!B.data && !B.isError, _t = S && w === "statements" && B.isLoading, vt = S && w === "statements" && B.isError, yt = u(() => {
128
+ B.refetch();
129
+ }, [B.refetch]), bt = u((e) => {
130
+ et(e), F(void 0);
131
+ }, []), xt = u(() => {
132
+ F(Q);
133
+ }, [Q]), St = u(() => {
134
+ F(Z);
135
+ }, [Z]), Ct = C || !a(O, A), wt = d(() => {
133
136
  let e = [{ after: s() }];
134
- return N && e.push({ after: o(N) }), e;
135
- }, [N]), St = d(() => {
137
+ return A && e.push({ after: o(A) }), e;
138
+ }, [A]), Tt = d(() => {
136
139
  let e = [{ after: s() }];
137
- return j && e.push({ before: o(j) }), e;
138
- }, [j]), Ct = u((e) => {
140
+ return O && e.push({ before: o(O) }), e;
141
+ }, [O]), Et = u((e) => {
139
142
  if (e) {
140
- let { startDate: e, endDate: t } = ne();
141
- M(e), P(t);
143
+ let { startDate: e, endDate: t } = ie();
144
+ k(e), j(t);
142
145
  }
143
- A(e);
144
- }, []), wt = u(async () => {
145
- if (!y || !b.canRead || !j || !N || !a(j, N)) return;
146
- A(!1);
146
+ $e(e);
147
+ }, []), Dt = u(async () => {
148
+ if (!y || !b.canRead || !O || !A || !a(O, A)) return;
149
+ $e(!1);
147
150
  let t = e.loading(h.exportLoadingToast);
148
151
  try {
149
- let n = await K({
152
+ let n = await U({
150
153
  id: p,
151
- startDate: i(j),
152
- endDate: i(N)
154
+ startDate: re(O),
155
+ endDate: re(A)
153
156
  });
154
- re(n.csv, n.filename), e.success(h.exportSuccessToast, {
157
+ ae(n.csv, n.filename), e.success(h.exportSuccessToast, {
155
158
  id: t,
156
- duration: Se
159
+ duration: we
157
160
  });
158
161
  } catch {
159
162
  e.error(h.exportErrorToast, {
160
163
  id: t,
161
- duration: Ce
164
+ duration: Te
162
165
  });
163
166
  }
164
167
  }, [
165
168
  p,
166
- K,
167
- N,
168
- j,
169
+ U,
170
+ A,
171
+ O,
169
172
  h.exportErrorToast,
170
173
  h.exportLoadingToast,
171
174
  h.exportSuccessToast,
172
175
  y,
173
176
  b.canRead
174
177
  ]), $ = u(async (t, n) => {
175
- if (!await ie(t)) return;
178
+ if (!await oe(t)) return;
176
179
  let r = {
177
180
  account: h.copyAccountNumberToast,
178
181
  routing: h.copyRoutingNumberToast,
@@ -180,105 +183,105 @@ function p({ accountId: p, onBack: Oe, labels: ke, featureLabels: Ae, isBankingT
180
183
  bankAddress: h.copyBankAddressToast
181
184
  };
182
185
  if (e.success(r[n]), n === "account") {
183
- O(!0), window.setTimeout(() => O(!1), 2e3);
186
+ qe(!0), window.setTimeout(() => qe(!1), 2e3);
184
187
  return;
185
188
  }
186
- n === "routing" && (k(!0), window.setTimeout(() => k(!1), 2e3));
189
+ n === "routing" && (Ye(!0), window.setTimeout(() => Ye(!1), 2e3));
187
190
  }, [
188
191
  h.copyAccountNumberToast,
189
192
  h.copyBankAddressToast,
190
193
  h.copyBankNameToast,
191
194
  h.copyRoutingNumberToast
192
- ]), Tt = (e) => {
193
- e && (D({ nickname: J?.nickname?.trim() ?? "" }), G()), T(e);
195
+ ]), Ot = (e) => {
196
+ e && (D({ nickname: G?.nickname?.trim() ?? "" }), H()), T(e);
194
197
  };
195
- return /* @__PURE__ */ xe(ye, {
198
+ return /* @__PURE__ */ Ce(xe, {
196
199
  labels: m,
197
- title: st,
198
- bankDisplayName: Y,
199
- bankLogoSrc: Me,
200
- bankLogoAlt: Ne,
201
- balanceLabel: ct,
200
+ title: ft,
201
+ bankDisplayName: K,
202
+ bankLogoSrc: Pe,
203
+ bankLogoAlt: Fe,
204
+ balanceLabel: pt,
202
205
  balanceTestId: "bank-accounts-widget-detail-balance",
203
- isBankingTaglineVisible: je,
206
+ isBankingTaglineVisible: Ne,
204
207
  activeTab: w,
205
- transactionRows: lt,
206
- statementRows: ft,
207
- isStatementsLoading: mt,
208
- isStatementsError: ht,
209
- onStatementsRetry: gt,
210
- isStatementsPaginationVisible: pt,
211
- statementsPageSize: F,
212
- statementsPageSizeOptions: we,
208
+ transactionRows: Y,
209
+ statementRows: ht,
210
+ isStatementsLoading: _t,
211
+ isStatementsError: vt,
212
+ onStatementsRetry: yt,
213
+ isStatementsPaginationVisible: gt,
214
+ statementsPageSize: M,
215
+ statementsPageSizeOptions: Ee,
213
216
  isStatementsPreviousPageDisabled: !Q,
214
217
  isStatementsNextPageDisabled: !Z,
215
- onStatementsPageSizeChange: _t,
216
- onStatementsPreviousPageClick: vt,
217
- onStatementsNextPageClick: yt,
218
- showExport: ut,
219
- isExportOpen: qe,
220
- exportStartDate: j,
221
- exportEndDate: N,
222
- isExportDownloading: nt,
223
- isExportDownloadDisabled: bt,
224
- disabledExportStartDates: xt,
225
- disabledExportEndDates: St,
226
- accountNumberLabel: J?.accountNumber ?? "",
227
- maskedAccountNumberLabel: ce(J?.accountNumber ?? ""),
218
+ onStatementsPageSizeChange: bt,
219
+ onStatementsPreviousPageClick: xt,
220
+ onStatementsNextPageClick: St,
221
+ showExport: mt,
222
+ isExportOpen: Qe,
223
+ exportStartDate: O,
224
+ exportEndDate: A,
225
+ isExportDownloading: ct,
226
+ isExportDownloadDisabled: Ct,
227
+ disabledExportStartDates: wt,
228
+ disabledExportEndDates: Tt,
229
+ accountNumberLabel: G?.accountNumber ?? "",
230
+ maskedAccountNumberLabel: ue(G?.accountNumber ?? ""),
228
231
  accountNumberTestId: "bank-accounts-widget-detail-account-number",
229
- wireAccountNumberLabel: J?.accountNumber ?? "",
230
- routingNumberLabel: J?.routingNumber ?? "",
231
- bankAddressLabel: rt,
232
- domesticWireIntroLabel: it,
233
- domesticWireNoteLabel: at,
234
- thingsToKnowBodyLabel: ot,
235
- supportTeamHref: Fe,
236
- isAccountNumberVisible: Ve,
237
- isAccountNumberCopied: Ue,
238
- isRoutingNumberCopied: We,
239
- isDomesticWireExpanded: Ge,
240
- isLoading: !v && (!y && !J || Re && !_ || S && (V.isLoading || w === "transactions" && H.isLoading)),
241
- isError: v || S && (V.isError || w === "transactions" && H.isError),
242
- isEditOpen: Be,
232
+ wireAccountNumberLabel: G?.accountNumber ?? "",
233
+ routingNumberLabel: G?.routingNumber ?? "",
234
+ bankAddressLabel: q,
235
+ domesticWireIntroLabel: lt,
236
+ domesticWireNoteLabel: ut,
237
+ thingsToKnowBodyLabel: dt,
238
+ supportTeamHref: Le,
239
+ isAccountNumberVisible: We,
240
+ isAccountNumberCopied: Ke,
241
+ isRoutingNumberCopied: Je,
242
+ isDomesticWireExpanded: Xe,
243
+ isLoading: !v && (Ve && !G || Be && !_ || S && (R.isLoading || w === "transactions" && z.isLoading)),
244
+ isError: v || S && (R.isError || w === "transactions" && z.isError),
245
+ isEditOpen: Ue,
243
246
  isEditDisabled: !b.canWrite,
244
- isEditError: W,
245
- isSubmitting: tt,
247
+ isEditError: V,
248
+ isSubmitting: st,
246
249
  isEditSaveDisabled: C,
247
250
  editForm: E,
248
251
  canEdit: b.canWrite,
249
- onBack: Oe,
250
- onTabChange: ze,
251
- onToggleAccountNumberVisibility: () => He((e) => !e),
252
- onCopyAccountNumber: () => void $(J?.accountNumber ?? "", "account"),
253
- onCopyRoutingNumber: () => void $(J?.routingNumber ?? "", "routing"),
254
- onCopyBankName: () => void $(Y, "bankName"),
255
- onCopyBankAddress: () => void $(rt ?? "", "bankAddress"),
256
- onDomesticWireExpandedChange: Ke,
257
- onEditOpenChange: Tt,
252
+ onBack: Ae,
253
+ onTabChange: He,
254
+ onToggleAccountNumberVisibility: () => Ge((e) => !e),
255
+ onCopyAccountNumber: () => void $(G?.accountNumber ?? "", "account"),
256
+ onCopyRoutingNumber: () => void $(G?.routingNumber ?? "", "routing"),
257
+ onCopyBankName: () => void $(K, "bankName"),
258
+ onCopyBankAddress: () => void $(q ?? "", "bankAddress"),
259
+ onDomesticWireExpandedChange: Ze,
260
+ onEditOpenChange: Ot,
258
261
  onEditFormChange: (e) => {
259
- W && G(), D(e);
262
+ V && H(), D(e);
260
263
  },
261
264
  onEditSubmit: () => {
262
265
  if (!y || !b.canWrite) return;
263
266
  let t = E.nickname.trim();
264
- t && et({
267
+ t && ot({
265
268
  path: { id: p },
266
269
  body: { nickname: t }
267
270
  }, {
268
271
  onSuccess: () => {
269
- g(te.AccountUpdated, { accountId: p }), e.success(h.editSuccessToast), T(!1);
272
+ g(i.AccountUpdated, { accountId: p }), e.success(h.editSuccessToast), T(!1);
270
273
  },
271
274
  onError: () => {
272
275
  e.error(h.editErrorToast);
273
276
  }
274
277
  });
275
278
  },
276
- onEditNicknameClick: () => Tt(!0),
277
- onExportOpenChange: Ct,
278
- onExportStartDateChange: M,
279
- onExportEndDateChange: P,
279
+ onEditNicknameClick: () => Ot(!0),
280
+ onExportOpenChange: Et,
281
+ onExportStartDateChange: k,
282
+ onExportEndDateChange: j,
280
283
  onExportDownload: () => {
281
- wt();
284
+ Dt();
282
285
  }
283
286
  });
284
287
  }