@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
@@ -3,19 +3,22 @@
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 { useWidgetConfig as t, useWidgetLoading as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import { useWidgetConfig as r, useWidgetLoading as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
11
  import "../../../shared/feature/dist/index.js";
9
- import { ReceiptMatchLabels as r } from "../../ui/dist/lib/ReceiptMatchWidget/lib/labels.js";
12
+ import { ReceiptMatchLabels as a } from "../../ui/dist/lib/ReceiptMatchWidget/lib/labels.js";
10
13
  import "../../ui/dist/index.js";
11
- import { useGetReceiptsQuery as i } from "../../data-access/dist/index2.js";
12
- import { useGetTransactionsQuery as a } from "../../data-access/dist/index3.js";
13
- import { usePatchReceiptMutation as o } from "../../data-access/dist/index11.js";
14
- import { useDeleteReceiptMutation as ee } from "../../data-access/dist/index12.js";
14
+ import { useGetReceiptsQuery as ee } from "../../data-access/dist/index2.js";
15
+ import { useGetTransactionsQuery as o } from "../../data-access/dist/index3.js";
16
+ import { usePatchReceiptMutation as te } from "../../data-access/dist/index11.js";
17
+ import { useDeleteReceiptMutation as s } from "../../data-access/dist/index12.js";
15
18
  import "../../data-access/dist/index.js";
16
- import { useCallback as s, useEffect as te, useMemo as c, useState as l } from "react";
19
+ import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
17
20
  //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js
18
- function u(e, t) {
21
+ function f(e, t) {
19
22
  if (typeof e == "object" && e) {
20
23
  let t = e.error;
21
24
  if (typeof t == "object" && t) {
@@ -25,7 +28,7 @@ function u(e, t) {
25
28
  }
26
29
  return e instanceof Error && e.message ? e.message : t;
27
30
  }
28
- function d(e, t) {
31
+ function p(e, t) {
29
32
  let n = e / 100;
30
33
  try {
31
34
  return new Intl.NumberFormat("en-US", {
@@ -36,7 +39,7 @@ function d(e, t) {
36
39
  return `${t} ${n.toFixed(2)}`;
37
40
  }
38
41
  }
39
- function f(e) {
42
+ function m(e) {
40
43
  if (!e) return "";
41
44
  let t = new Date(e);
42
45
  return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
@@ -54,7 +57,7 @@ function ne(e) {
54
57
  year: "numeric"
55
58
  });
56
59
  }
57
- function p(e) {
60
+ function re(e) {
58
61
  if (!e) return "";
59
62
  let t = new Date(e);
60
63
  return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-US", {
@@ -64,201 +67,201 @@ function p(e) {
64
67
  hour12: !0
65
68
  });
66
69
  }
67
- function re(e) {
70
+ function h(e) {
68
71
  let t = e.ocr_status === "processing";
69
72
  return {
70
73
  id: e.id,
71
- primaryText: t ? r.ReceiptScanningTitle : e.merchant_name?.trim() || r.ReceiptScanningTitle,
72
- secondaryText: t ? r.ReceiptScanningSubtitle : f(e.issued_at),
74
+ primaryText: t ? a.ReceiptScanningTitle : e.merchant_name?.trim() || a.ReceiptScanningTitle,
75
+ secondaryText: t ? a.ReceiptScanningSubtitle : m(e.issued_at),
73
76
  thumbnailUrl: e.file_url ?? void 0
74
77
  };
75
78
  }
76
- function ie(e) {
79
+ function g(e) {
77
80
  return {
78
81
  id: e.id,
79
82
  merchantName: e.merchant_name,
80
- date: f(e.started_at),
81
- formattedAmount: d(e.amount, e.currency)
83
+ date: m(e.started_at),
84
+ formattedAmount: p(e.amount, e.currency)
82
85
  };
83
86
  }
84
- var m = .5, h = 3, g = .25, _ = 5e3, v = !1;
85
- function y({ preSelectedIds: f, onClose: y, targetTransactionId: b, onSingleTransactionUpdate: x, enabled: ae = !0 }) {
86
- let { initResponse: S } = t(), C = n(), w = S?.userId ?? void 0, oe = ae && !!w && !C, [T, E] = l(1), [D, O] = l(0), [k, A] = l([]), [j, M] = l(() => f), [N, P] = l(""), [F, I] = l([]), L = c(() => F.map((e) => e.id), [F]), [R, z] = l(1), B = i({
87
+ var _ = .5, v = 3, y = .25, ie = 5e3, ae = !1;
88
+ function b({ preSelectedIds: m, onClose: b, targetTransactionId: x, onSingleTransactionUpdate: S, enabled: oe = !0 }) {
89
+ let { initResponse: C } = r(), w = i(), se = t(n().organizationStatus), T = C?.userId ?? void 0, ce = oe && !!T && !w, [E, D] = d(1), [O, k] = d(0), [A, j] = d([]), [M, N] = d(() => m), [P, F] = d(""), [I, L] = d([]), le = u(() => I.map((e) => e.id), [I]), [R, z] = d(1), B = ee({
87
90
  has_transaction: !1,
88
- created_by_entity_user_id: w,
89
- enabled: oe
90
- }), V = a({
91
- merchant_name__icontains: N || void 0,
91
+ created_by_entity_user_id: T,
92
+ enabled: ce
93
+ }), V = o({
94
+ merchant_name__icontains: P || void 0,
92
95
  has_receipt: !1,
93
- enabled: T === 2
94
- }), H = o(), U = ee(), W = B.data?.data ?? [], G = c(() => w ? W.filter((e) => e.created_by_entity_user_id == null || e.created_by_entity_user_id === w) : [], [W, w]);
95
- te(() => {
96
+ enabled: E === 2
97
+ }), H = te(), U = s(), W = B.data?.data ?? [], G = u(() => T ? W.filter((e) => e.created_by_entity_user_id == null || e.created_by_entity_user_id === T) : [], [W, T]);
98
+ l(() => {
96
99
  if (!G.some((e) => e.ocr_status === "processing")) return;
97
100
  let e = window.setInterval(() => {
98
101
  B.isFetching || B.refetch();
99
- }, _);
102
+ }, ie);
100
103
  return () => window.clearInterval(e);
101
104
  }, [
102
105
  B.isFetching,
103
106
  B.refetch,
104
107
  G
105
108
  ]);
106
- let K = c(() => G.map(re), [G]), q = c(() => new Set(k.flatMap((e) => e.transactionIds)), [k]), se = c(() => (V.data?.data ?? []).filter((e) => !q.has(e.id)).map(ie), [V.data, q]), J = V.data?.data ?? [], Y = j[D], X = c(() => G.find((e) => e.id === Y), [G, Y]), ce = X?.file_url ?? void 0, le = X?.file_name ?? void 0, ue = c(() => {
107
- if (b) return "Attach";
108
- if (!(j.length <= 1)) return `Review (${D + 1}/${j.length})`;
109
+ let K = u(() => G.map(h), [G]), q = u(() => new Set(A.flatMap((e) => e.transactionIds)), [A]), J = u(() => (V.data?.data ?? []).filter((e) => !q.has(e.id)).map(g), [V.data, q]), Y = V.data?.data ?? [], X = M[O], Z = u(() => G.find((e) => e.id === X), [G, X]), ue = Z?.file_url ?? void 0, de = Z?.file_name ?? void 0, fe = u(() => {
110
+ if (x) return "Attach";
111
+ if (!(M.length <= 1)) return `Review (${O + 1}/${M.length})`;
109
112
  }, [
110
- b,
111
- j.length,
112
- D
113
- ]), de = c(() => k.filter((e) => e.receiptId === Y).flatMap((e) => e.transactionDetails), [k, Y]), fe = D >= j.length - 1 ? r.Done : r.ReviewNextReceipt(D + 2, j.length), Z = s(() => {
114
- P(""), I([]), z(1);
115
- }, []), pe = s((e) => {
116
- if (b) {
117
- M((t) => t.includes(e) ? [] : [e]);
113
+ x,
114
+ M.length,
115
+ O
116
+ ]), pe = u(() => A.filter((e) => e.receiptId === X).flatMap((e) => e.transactionDetails), [A, X]), me = O >= M.length - 1 ? a.Done : a.ReviewNextReceipt(O + 2, M.length), Q = c(() => {
117
+ F(""), L([]), z(1);
118
+ }, []), he = c((e) => {
119
+ if (x) {
120
+ N((t) => t.includes(e) ? [] : [e]);
118
121
  return;
119
122
  }
120
- M((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
121
- }, [b]), me = s(() => {
122
- M(K.map((e) => e.id));
123
- }, [K]), he = s(() => {
124
- M([]);
125
- }, []), ge = s((e) => {
123
+ N((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
124
+ }, [x]), ge = c(() => {
125
+ N(K.map((e) => e.id));
126
+ }, [K]), _e = c(() => {
127
+ N([]);
128
+ }, []), ve = c((e) => {
126
129
  let t = G.find((t) => t.id === e);
127
130
  t?.file_url && window.open(t.file_url, "_blank", "noopener,noreferrer");
128
- }, [G]), Q = s(async (t) => {
131
+ }, [G]), ye = c(async (t) => {
129
132
  try {
130
133
  await U.mutateAsync({ path: { receipt_id: t } });
131
134
  } catch (t) {
132
- e.error(u(t, "Failed to delete receipt"));
135
+ e.error(f(t, "Failed to delete receipt"));
133
136
  return;
134
137
  }
135
- M((e) => e.filter((e) => e !== t));
136
- }, [U]), _e = s(async () => {
137
- if (j.length !== 0) {
138
- if (b) {
138
+ N((e) => e.filter((e) => e !== t));
139
+ }, [U]), be = c(async () => {
140
+ if (M.length !== 0) {
141
+ if (x) {
139
142
  try {
140
143
  await H.mutateAsync({
141
- path: { receipt_id: j[0] },
142
- body: { transaction_id: b }
143
- }), x?.(), y();
144
+ path: { receipt_id: M[0] },
145
+ body: { transaction_id: x }
146
+ }), S?.(), b();
144
147
  } catch (t) {
145
- e.error(u(t, "Failed to attach receipt"));
148
+ e.error(f(t, "Failed to attach receipt"));
146
149
  }
147
150
  return;
148
151
  }
149
- O(0), A([]), Z(), E(2);
152
+ k(0), j([]), Q(), D(2);
150
153
  }
151
154
  }, [
152
- j,
153
- b,
154
- H,
155
+ M,
155
156
  x,
156
- y,
157
- Z
158
- ]), ve = s(() => {
157
+ H,
158
+ S,
159
+ b,
160
+ Q
161
+ ]), xe = c(() => {
159
162
  B.refetch();
160
- }, [B.refetch]), ye = s((e) => {
161
- P(e);
162
- }, []), be = s((e) => {
163
- I((t) => {
164
- let n = t.find((t) => t.id === e), r = J.find((t) => t.id === e);
163
+ }, [B.refetch]), Se = c((e) => {
164
+ F(e);
165
+ }, []), Ce = c((e) => {
166
+ L((t) => {
167
+ let n = t.find((t) => t.id === e), r = Y.find((t) => t.id === e);
165
168
  return n ? [] : r ? [r] : [];
166
169
  });
167
- }, [J]), xe = s(async () => {
168
- if (F.length === 0 || !Y) return;
169
- let t = F, n = (e) => ({
170
+ }, [Y]), we = c(async () => {
171
+ if (I.length === 0 || !X) return;
172
+ let t = I, n = (e) => ({
170
173
  merchant: e.merchant_name,
171
174
  location: e.merchant_location,
172
175
  date: ne(e.started_at),
173
- time: p(e.started_at),
174
- formattedAmount: d(e.amount, e.currency)
176
+ time: re(e.started_at),
177
+ formattedAmount: p(e.amount, e.currency)
175
178
  }), r = [], i = [];
176
179
  for (let a of t) try {
177
180
  await H.mutateAsync({
178
- path: { receipt_id: Y },
181
+ path: { receipt_id: X },
179
182
  body: { transaction_id: a.id }
180
183
  }), r.push(a.id), i.push(n(a));
181
184
  } catch (t) {
182
- r.length > 0 && A((e) => [...e, {
183
- receiptId: Y,
185
+ r.length > 0 && j((e) => [...e, {
186
+ receiptId: X,
184
187
  transactionIds: r,
185
188
  transactionDetails: i
186
- }]), I((e) => e.filter((e) => !r.includes(e.id))), e.error(u(t, "Failed to match receipt"));
189
+ }]), L((e) => e.filter((e) => !r.includes(e.id))), e.error(f(t, "Failed to match receipt"));
187
190
  return;
188
191
  }
189
- A((e) => [...e, {
190
- receiptId: Y,
192
+ j((e) => [...e, {
193
+ receiptId: X,
191
194
  transactionIds: r,
192
195
  transactionDetails: i
193
- }]), E(3);
196
+ }]), D(3);
194
197
  }, [
195
- F,
196
- Y,
198
+ I,
199
+ X,
197
200
  H
198
- ]), Se = s(() => {
201
+ ]), Te = c(() => {
199
202
  V.refetch();
200
- }, [V.refetch]), Ce = s(() => {
201
- z((e) => Math.min(e + g, h));
202
- }, []), we = s(() => {
203
- z((e) => Math.max(e - g, m));
204
- }, []), $ = s(() => {
205
- if (k.length > 0) {
206
- let e = new Set(k.map((e) => e.receiptId));
207
- M((t) => t.filter((t) => !e.has(t)));
203
+ }, [V.refetch]), Ee = c(() => {
204
+ z((e) => Math.min(e + y, v));
205
+ }, []), De = c(() => {
206
+ z((e) => Math.max(e - y, _));
207
+ }, []), $ = c(() => {
208
+ if (A.length > 0) {
209
+ let e = new Set(A.map((e) => e.receiptId));
210
+ N((t) => t.filter((t) => !e.has(t)));
208
211
  }
209
- Z(), O(0), A([]), E(1);
210
- }, [Z, k]), Te = s(() => {
211
- let e = D + 1;
212
- if (e < j.length) {
213
- O(e), Z(), E(2);
212
+ Q(), k(0), j([]), D(1);
213
+ }, [Q, A]), Oe = c(() => {
214
+ let e = O + 1;
215
+ if (e < M.length) {
216
+ k(e), Q(), D(2);
214
217
  return;
215
218
  }
216
- $(), y();
219
+ $(), b();
217
220
  }, [
218
- D,
219
- j.length,
220
- Z,
221
+ O,
222
+ M.length,
223
+ Q,
221
224
  $,
222
- y
225
+ b
223
226
  ]);
224
227
  return {
225
- step: T,
228
+ step: E,
226
229
  receipts: K,
227
- selectedReceiptIds: j,
228
- onSelectAll: me,
229
- onReset: he,
230
- onReceiptToggle: pe,
231
- onViewAttachment: ge,
232
- onDeleteReceipt: Q,
233
- onReview: _e,
234
- isReceiptsLoading: B.isLoading || C && !S,
230
+ selectedReceiptIds: M,
231
+ onSelectAll: ge,
232
+ onReset: _e,
233
+ onReceiptToggle: he,
234
+ onViewAttachment: ve,
235
+ onDeleteReceipt: ye,
236
+ onReview: be,
237
+ isReceiptsLoading: B.isLoading || w && !C || se && !B.data,
235
238
  isReceiptsError: B.isError,
236
- onRetryReceipts: ve,
237
- showSelectAllButton: !b,
238
- receiptPreviewUrl: ce,
239
- receiptFileName: le,
240
- transactions: se,
239
+ onRetryReceipts: xe,
240
+ showSelectAllButton: !x,
241
+ receiptPreviewUrl: ue,
242
+ receiptFileName: de,
243
+ transactions: J,
241
244
  isTransactionsLoading: V.isLoading,
242
245
  isTransactionsError: V.isError,
243
- onRetryTransactions: Se,
244
- selectedTransactionIds: L,
245
- allowMultipleTransactions: v,
246
- searchValue: N,
247
- onSearchChange: ye,
248
- onTransactionSelect: be,
249
- onConfirmMatch: xe,
246
+ onRetryTransactions: Te,
247
+ selectedTransactionIds: le,
248
+ allowMultipleTransactions: ae,
249
+ searchValue: P,
250
+ onSearchChange: Se,
251
+ onTransactionSelect: Ce,
252
+ onConfirmMatch: we,
250
253
  isConfirming: H.isPending,
251
254
  zoom: R,
252
- onZoomIn: Ce,
253
- onZoomOut: we,
254
- canZoomIn: R < h,
255
- canZoomOut: R > m,
256
- matchedTransactions: de,
257
- primaryLabel: fe,
258
- onPrimary: Te,
255
+ onZoomIn: Ee,
256
+ onZoomOut: De,
257
+ canZoomIn: R < v,
258
+ canZoomOut: R > _,
259
+ matchedTransactions: pe,
260
+ primaryLabel: me,
261
+ onPrimary: Oe,
259
262
  onCancel: $,
260
- reviewLabel: ue
263
+ reviewLabel: fe
261
264
  };
262
265
  }
263
266
  //#endregion
264
- export { y as useReceiptMatch };
267
+ export { b as useReceiptMatch };
@@ -2,19 +2,21 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
6
- import { useAllExternalBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
5
+ import { OrganizationStatus as e } from "../../../shared/data-access/dist/lib/organizationStatus.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import { useAllBankAccountsQuery as n } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
8
+ import { useAllExternalBankAccountsQuery as r } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
7
9
  import "../../../shared/data-access/dist/index.js";
8
- import { useRefetchWidget as n, useWidgetConfig as r, useWidgetError as i, useWidgetLoading as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetLoading as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
11
  import "../../../shared/feature/dist/index.js";
10
- import { INSIGHTS_FEATURE_LABELS_EN as o } from "./index3.js";
11
- import { useDismissedInsightIds as s } from "./index5.js";
12
- import { shouldShowRoutingOnboardingInsight as c } from "./index6.js";
13
- import { getInsightsPermissions as l } from "./index7.js";
14
- import { createContext as u, useCallback as d, useContext as f, useMemo as p, useState as m } from "react";
15
- import { jsx as h } from "react/jsx-runtime";
12
+ import { INSIGHTS_FEATURE_LABELS_EN as c } from "./index3.js";
13
+ import { useDismissedInsightIds as l } from "./index5.js";
14
+ import { shouldShowRoutingOnboardingInsight as u } from "./index6.js";
15
+ import { getInsightsPermissions as d } from "./index7.js";
16
+ import { createContext as f, useCallback as p, useContext as m, useMemo as h, useState as g } from "react";
17
+ import { jsx as ee } from "react/jsx-runtime";
16
18
  //#region ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js
17
- var g = u({
19
+ var _ = f({
18
20
  activeFilter: "active",
19
21
  setActiveFilter: () => {},
20
22
  filteredInsights: [],
@@ -22,13 +24,13 @@ var g = u({
22
24
  isError: !1,
23
25
  refetch: async () => void 0,
24
26
  onDismissClick: () => {},
25
- featureLabels: o,
27
+ featureLabels: c,
26
28
  createdDateLabel: ""
27
- }), _ = () => f(g), v = ({ children: u, routingEnabled: f = !1, onRoutingToggleChange: _, onLinkExternalAccountClick: v, featureLabels: y }) => {
28
- let { initResponse: b } = r(), x = a(), S = i(), C = n(), w = p(() => c(b?.scopes), [b?.scopes]), { canReadBankAccounts: T, canReadExternalBankAccounts: E } = p(() => l(b?.scopes), [b?.scopes]), D = p(() => ({
29
- ...o,
30
- ...y
31
- }), [y]), [O, k] = m("active"), [A, j] = m(!1), M = _ !== void 0, N = M ? f : A, P = M ? _ : j, { dismissedIds: F, isLoading: I, refetch: L, dismissInsight: R } = s(), { data: z, isLoading: B, isError: V, refetch: H } = e({ enabled: T }), { data: U, isLoading: W, isError: G, refetch: K } = t({ enabled: E }), q = z?.data, J = U?.data, Y = x || B || W || I || (!!T && q === void 0 && !V || !!E && J === void 0 && !G) && !S, X = !!S || (T || E) && !(T && !V) && !(E && !G), Z = d(() => (C(), Promise.all([
29
+ }), v = () => m(_), y = ({ children: f, routingEnabled: m = !1, onRoutingToggleChange: v, onLinkExternalAccountClick: y, featureLabels: b }) => {
30
+ let { initResponse: x } = a(), te = s(), { organizationStatus: ne } = t(), S = o(), C = i(), w = h(() => u(x?.scopes), [x?.scopes]), { canReadBankAccounts: T, canReadExternalBankAccounts: E } = h(() => d(x?.scopes), [x?.scopes]), D = h(() => ({
31
+ ...c,
32
+ ...b
33
+ }), [b]), [O, k] = g("active"), [A, j] = g(!1), M = v !== void 0, N = M ? m : A, P = M ? v : j, { dismissedIds: F, isLoading: I, refetch: L, dismissInsight: R } = l(), { data: z, isLoading: B, isError: V, refetch: H } = n({ enabled: T }), { data: U, isLoading: W, isError: G, refetch: K } = r({ enabled: E }), q = z?.data, J = U?.data, Y = !T || q !== void 0 || V, X = !E || J !== void 0 || G, re = ne === e.None, Z = te || B || W || I || !(Y && X) && !S && !re, Q = !!S || (T || E) && !(T && !V) && !(E && !G), ie = p(() => (C(), Promise.all([
32
34
  T ? H() : void 0,
33
35
  E ? K() : void 0,
34
36
  L()
@@ -39,8 +41,8 @@ var g = u({
39
41
  L,
40
42
  T,
41
43
  E
42
- ]), Q = p(() => (/* @__PURE__ */ new Date()).toLocaleDateString(), []), $ = p(() => {
43
- if (Y || X) return [];
44
+ ]), ae = h(() => (/* @__PURE__ */ new Date()).toLocaleDateString(), []), $ = h(() => {
45
+ if (Z || Q) return [];
44
46
  let e = [];
45
47
  if (w && e.push({
46
48
  id: "insight-routing-onboarding",
@@ -63,8 +65,8 @@ var g = u({
63
65
  canDismiss: !0,
64
66
  showToggle: !1,
65
67
  displayText: D.connectExternalText,
66
- actionText: v ? D.linkAccountAction : void 0,
67
- onActionClick: v
68
+ actionText: y ? D.linkAccountAction : void 0,
69
+ onActionClick: y
68
70
  }), J !== void 0) {
69
71
  for (let t of J) if (t.verificationStatus !== "VERIFIED") {
70
72
  let n = `insight-verify-external-${t.id}`;
@@ -81,35 +83,35 @@ var g = u({
81
83
  }, [
82
84
  q,
83
85
  J,
84
- Y,
85
- X,
86
+ Z,
87
+ Q,
86
88
  F,
87
89
  w,
88
90
  N,
89
91
  P,
90
- v,
92
+ y,
91
93
  D
92
- ]), ee = d((e) => {
94
+ ]), oe = p((e) => {
93
95
  R(e);
94
- }, [R]), te = p(() => O === "dismissed" ? $.filter((e) => F.includes(e.id)) : $.filter((e) => !F.includes(e.id)), [
96
+ }, [R]), se = h(() => O === "dismissed" ? $.filter((e) => F.includes(e.id)) : $.filter((e) => !F.includes(e.id)), [
95
97
  $,
96
98
  O,
97
99
  F
98
100
  ]);
99
- return /* @__PURE__ */ h(g.Provider, {
101
+ return /* @__PURE__ */ ee(_.Provider, {
100
102
  value: {
101
103
  activeFilter: O,
102
104
  setActiveFilter: k,
103
- filteredInsights: te,
104
- isLoading: Y,
105
- isError: X,
106
- refetch: Z,
107
- onDismissClick: ee,
105
+ filteredInsights: se,
106
+ isLoading: Z,
107
+ isError: Q,
108
+ refetch: ie,
109
+ onDismissClick: oe,
108
110
  featureLabels: D,
109
- createdDateLabel: Q
111
+ createdDateLabel: ae
110
112
  },
111
- children: u
113
+ children: f
112
114
  });
113
115
  };
114
116
  //#endregion
115
- export { v as InsightsWidgetContextProvider, _ as useInsightsWidgetContext };
117
+ export { y as InsightsWidgetContextProvider, v as useInsightsWidgetContext };
@@ -10,7 +10,7 @@ import "../../../shared/data-access/dist/index.js";
10
10
  import { useQuery as l } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js
12
12
  function u({ enabled: e, ...t } = {}) {
13
- let { client: n, organizationId: r, widgetToken: a, authEpoch: u, organizationPending: d } = s(), f = !!(r && a) && (e === !0 || e === void 0), p = i({
13
+ let { client: n, organizationId: r, widgetToken: a, authEpoch: u, organizationStatus: d } = s(), f = !!(r && a) && (e === !0 || e === void 0), p = i({
14
14
  client: n,
15
15
  headers: c(r),
16
16
  query: t
@@ -18,13 +18,13 @@ function u({ enabled: e, ...t } = {}) {
18
18
  return l({
19
19
  ...o(p, {
20
20
  authEpoch: u,
21
- organizationPending: d
21
+ organizationStatus: d
22
22
  }, { carryWithinOrg: !0 }),
23
23
  enabled: f
24
24
  });
25
25
  }
26
26
  function d(e, { enabled: t = !0 } = {}) {
27
- let { client: r, organizationId: i, widgetToken: a, authEpoch: u, organizationPending: d } = s(), f = !!(i && a && e) && t, p = n({
27
+ let { client: r, organizationId: i, widgetToken: a, authEpoch: u, organizationStatus: d } = s(), f = !!(i && a && e) && t, p = n({
28
28
  client: r,
29
29
  headers: c(i),
30
30
  path: { receivable_id: e ?? "" }
@@ -32,13 +32,13 @@ function d(e, { enabled: t = !0 } = {}) {
32
32
  return l({
33
33
  ...o(p, {
34
34
  authEpoch: u,
35
- organizationPending: d
35
+ organizationStatus: d
36
36
  }),
37
37
  enabled: f
38
38
  });
39
39
  }
40
40
  function f({ enabled: e, ...t } = {}) {
41
- let { client: n, organizationId: r, widgetToken: i, authEpoch: u, organizationPending: d } = s(), f = !!(r && i) && (e === !0 || e === void 0), p = a({
41
+ let { client: n, organizationId: r, widgetToken: i, authEpoch: u, organizationStatus: d } = s(), f = !!(r && i) && (e === !0 || e === void 0), p = a({
42
42
  client: n,
43
43
  headers: c(r),
44
44
  query: t
@@ -46,13 +46,13 @@ function f({ enabled: e, ...t } = {}) {
46
46
  return l({
47
47
  ...o(p, {
48
48
  authEpoch: u,
49
- organizationPending: d
49
+ organizationStatus: d
50
50
  }),
51
51
  enabled: f
52
52
  });
53
53
  }
54
54
  function p(t, { enabled: n, ...r } = {}) {
55
- let { client: i, organizationId: a, widgetToken: u, authEpoch: d, organizationPending: f } = s(), p = !!(a && u && t) && (n === !0 || n === void 0), m = e({
55
+ let { client: i, organizationId: a, widgetToken: u, authEpoch: d, organizationStatus: f } = s(), p = !!(a && u && t) && (n === !0 || n === void 0), m = e({
56
56
  client: i,
57
57
  headers: c(a),
58
58
  path: { receivable_id: t ?? "" },
@@ -61,13 +61,13 @@ function p(t, { enabled: n, ...r } = {}) {
61
61
  return l({
62
62
  ...o(m, {
63
63
  authEpoch: d,
64
- organizationPending: f
64
+ organizationStatus: f
65
65
  }),
66
66
  enabled: p
67
67
  });
68
68
  }
69
69
  function m(e, { enabled: n, ...r } = {}) {
70
- let { client: i, organizationId: a, widgetToken: u, authEpoch: d, organizationPending: f } = s(), p = !!(a && u && e) && (n === !0 || n === void 0), m = t({
70
+ let { client: i, organizationId: a, widgetToken: u, authEpoch: d, organizationStatus: f } = s(), p = !!(a && u && e) && (n === !0 || n === void 0), m = t({
71
71
  client: i,
72
72
  headers: c(a),
73
73
  path: { receivable_id: e ?? "" },
@@ -76,13 +76,13 @@ function m(e, { enabled: n, ...r } = {}) {
76
76
  return l({
77
77
  ...o(m, {
78
78
  authEpoch: d,
79
- organizationPending: f
79
+ organizationStatus: f
80
80
  }),
81
81
  enabled: p
82
82
  });
83
83
  }
84
84
  function h(e, { enabled: t = !0 } = {}) {
85
- let { client: n, organizationId: i, widgetToken: a, authEpoch: u, organizationPending: d } = s(), f = !!(i && a && e) && t, p = r({
85
+ let { client: n, organizationId: i, widgetToken: a, authEpoch: u, organizationStatus: d } = s(), f = !!(i && a && e) && t, p = r({
86
86
  client: n,
87
87
  headers: c(i),
88
88
  path: { receivable_id: e ?? "" }
@@ -90,7 +90,7 @@ function h(e, { enabled: t = !0 } = {}) {
90
90
  return l({
91
91
  ...o(p, {
92
92
  authEpoch: u,
93
- organizationPending: d
93
+ organizationStatus: d
94
94
  }),
95
95
  enabled: f
96
96
  });
@@ -21,27 +21,27 @@ function v() {
21
21
  };
22
22
  }
23
23
  function y({ enabled: e = !0 } = {}) {
24
- let { client: t, organizationId: n, authEpoch: r, organizationPending: i, isEnabled: o } = v(), c = a({
24
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: o } = v(), c = a({
25
25
  client: t,
26
26
  headers: u(n)
27
27
  });
28
28
  return _({
29
29
  ...s(c, {
30
30
  authEpoch: r,
31
- organizationPending: i
31
+ organizationStatus: i
32
32
  }),
33
33
  enabled: o && e
34
34
  });
35
35
  }
36
36
  function b({ enabled: e = !0 } = {}) {
37
- let { client: t, organizationId: n, authEpoch: r, organizationPending: a, isEnabled: o } = v(), c = i({
37
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: a, isEnabled: o } = v(), c = i({
38
38
  client: t,
39
39
  headers: u(n)
40
40
  });
41
41
  return _({
42
42
  ...s(c, {
43
43
  authEpoch: r,
44
- organizationPending: a
44
+ organizationStatus: a
45
45
  }),
46
46
  enabled: o && e
47
47
  });
@@ -105,7 +105,7 @@ async function C({ client: e, organizationId: t, recurrenceId: n, receivableId:
105
105
  ]);
106
106
  }
107
107
  function w(e) {
108
- let { client: t, organizationId: n, authEpoch: r, organizationPending: i, isEnabled: a } = v(), c = o({
108
+ let { client: t, organizationId: n, authEpoch: r, organizationStatus: i, isEnabled: a } = v(), c = o({
109
109
  client: t,
110
110
  headers: u(n),
111
111
  path: { recurrence_id: e ?? "" }
@@ -113,7 +113,7 @@ function w(e) {
113
113
  return _({
114
114
  ...s(c, {
115
115
  authEpoch: r,
116
- organizationPending: i
116
+ organizationStatus: i
117
117
  }),
118
118
  enabled: a && !!e
119
119
  });