@tesouro/embedded-components-react 0.7.70 → 0.7.73

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 (46) hide show
  1. package/README.md +15 -12
  2. package/dist/index.css +24 -6
  3. package/dist/index.d.ts +76 -8
  4. package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
  5. package/dist/lib/ProductsWidget.d.ts +12 -6
  6. package/dist/lib/ReceivablesWidget.d.ts +1 -5
  7. package/dist/lib/TransfersWidget.d.ts +55 -2
  8. package/dist/lib/WidgetSuite.d.ts +63 -1
  9. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +6 -4
  10. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +199 -182
  11. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +23 -24
  12. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/constants.js +6 -2
  13. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsTable.js +112 -51
  14. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +80 -56
  15. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index.js +6 -5
  16. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +15 -6
  17. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +170 -135
  18. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +49 -150
  19. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +152 -24
  20. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +28 -0
  21. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +13 -12
  23. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +2 -2
  24. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +41 -27
  26. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +70 -52
  27. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +7 -6
  28. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +19 -8
  29. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +171 -218
  30. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +52 -180
  31. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +188 -46
  32. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +47 -124
  33. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +128 -0
  34. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js +4 -3
  35. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -108
  36. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -0
  37. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +135 -0
  38. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +140 -153
  39. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +15 -0
  40. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +111 -0
  41. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +18 -0
  42. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +181 -126
  43. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +33 -0
  44. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +16 -8
  45. package/dist/packages/shared-ui-shadcn/dist/index.js +328 -327
  46. package/package.json +1 -1
@@ -7,43 +7,44 @@ import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as t, emitWidget
7
7
  import { extractApiErrorMessage as ee } from "../../../../shared/util/dist/lib/apiErrors.js";
8
8
  import { OrganizationStatus as te, isOrganizationOnItsWay as ne } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
9
9
  import { useEmbedApi as re } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
- import { Scope as ie } from "../../../../shared/data-access/dist/lib/scopes.js";
11
- import { useOrganizationQuery as ae } from "../../../../shared/data-access/dist/lib/organization/useOrganizationQuery.js";
12
- import { useAllOrganizationRolesQuery as oe } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
13
- import { useAllOrganizationUsersQuery as se } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
10
+ import { Scope as r } from "../../../../shared/data-access/dist/lib/scopes.js";
11
+ import { useOrganizationQuery as ie } from "../../../../shared/data-access/dist/lib/organization/useOrganizationQuery.js";
12
+ import { useAllOrganizationRolesQuery as ae } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
13
+ import { useAllOrganizationUsersQuery as oe } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
14
14
  import "../../../../shared/data-access/dist/index.js";
15
15
  import "../../../../shared/ui/dist/index.js";
16
- import { useAnalyticsTrack as ce } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
17
- import { useWidgetConfig as le, useWidgetError as ue, useWidgetLoading as de } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
+ import { useAnalyticsTrack as se } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
17
+ import { useWidgetConfig as ce, useWidgetError as le, useWidgetLoading as ue } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
18
18
  import "../../../../shared/feature/dist/index.js";
19
- import { filterRolesForOrganization as fe } from "../../../../../shared/util-validation/dist/index6.js";
20
- import { filterUsersForOrganization as pe } from "../../../../../shared/util-validation/dist/index7.js";
21
- import { DEFAULT_FEATURE_LABELS as me } from "./labels.js";
22
- import { LinkedAccountsWidgetAnalyticsEvent as r } from "./analytics/events.js";
23
- import { EMPTY_CONNECT_FORM as he, EMPTY_EDIT_FORM as ge, EMPTY_VERIFY_FORM as i, isConnectStep1Valid as a, isRoutingNumberValid as _e, isVerifyAmountInRange as ve, isVerifyFormValid as ye, parseVerifyAmountToMinorUnits as be, sanitizeRoutingNumberInput as xe, toEditForm as Se, toUpdateBody as Ce } from "./forms.js";
24
- import { getLinkedAccountsPermissions as we } from "./permissions.js";
25
- import { toAccountRows as Te } from "./rows.js";
26
- import { fromApiAccountHolderType as Ee, toApiAccountHolderType as De, toSummaryTypeLabel as Oe, toTextParts as o } from "./summary.js";
27
- import { useConnectExternalBankAccountMutation as ke } from "../../../data-access/dist/index3.js";
28
- import { useExternalBankAccountsQuery as Ae } from "../../../data-access/dist/index4.js";
29
- import { useGrantExternalBankAccountAccessMutation as je } from "../../../data-access/dist/index5.js";
30
- import { useLinkExternalBankAccountMutation as Me } from "../../../data-access/dist/index6.js";
31
- import { useUnlinkExternalBankAccountMutation as Ne } from "../../../data-access/dist/index9.js";
32
- import { useUpdateExternalBankAccountMutation as Pe } from "../../../data-access/dist/index10.js";
33
- import { useValidateExternalBankAccountMutation as Fe } from "../../../data-access/dist/index11.js";
19
+ import { filterRolesForOrganization as de } from "../../../../../shared/util-validation/dist/index6.js";
20
+ import { filterUsersForOrganization as fe } from "../../../../../shared/util-validation/dist/index7.js";
21
+ import { DEFAULT_FEATURE_LABELS as pe } from "./labels.js";
22
+ import { LinkedAccountsWidgetAnalyticsEvent as i } from "./analytics/events.js";
23
+ import { EMPTY_CONNECT_FORM as me, EMPTY_EDIT_FORM as he, EMPTY_VERIFY_FORM as ge, isConnectStep1Valid as _e, isRoutingNumberValid as ve, isVerifyAmountInRange as ye, isVerifyFormValid as be, parseVerifyAmountToMinorUnits as xe, sanitizeRoutingNumberInput as Se, toEditForm as Ce, toUpdateBody as we } from "./forms.js";
24
+ import { getLinkedAccountsPermissions as Te } from "./permissions.js";
25
+ import { toAccountRows as Ee } from "./rows.js";
26
+ import { fromApiAccountHolderType as De, toApiAccountHolderType as Oe, toSummaryTypeLabel as ke, toTextParts as a } from "./summary.js";
27
+ import { useConnectExternalBankAccountMutation as Ae } from "../../../data-access/dist/index3.js";
28
+ import { useExternalBankAccountsQuery as je } from "../../../data-access/dist/index4.js";
29
+ import { useGrantExternalBankAccountAccessMutation as Me } from "../../../data-access/dist/index5.js";
30
+ import { useLinkExternalBankAccountMutation as Ne } from "../../../data-access/dist/index6.js";
31
+ import { useUnlinkExternalBankAccountMutation as Pe } from "../../../data-access/dist/index9.js";
32
+ import { useUpdateExternalBankAccountMutation as Fe } from "../../../data-access/dist/index10.js";
33
+ import { useValidateExternalBankAccountMutation as Ie } from "../../../data-access/dist/index11.js";
34
34
  import "../../../data-access/dist/index.js";
35
- import { useAdminEligibleUserIds as Ie } from "./useAdminEligibleUserIds.js";
36
- import { toAccessRows as Le, toOrganizationRoleOptions as Re, toTeamMembers as ze } from "./teamMembers.js";
37
- import { DEFAULT_LABELS as Be } from "../../../ui/dist/index15.js";
35
+ import { useAdminEligibleUserIds as Le } from "./useAdminEligibleUserIds.js";
36
+ import { toAccessRows as Re, toOrganizationRoleOptions as ze, toTeamMembers as Be } from "./teamMembers.js";
37
+ import { DEFAULT_LABELS as Ve } from "../../../ui/dist/index15.js";
38
38
  import "../../../ui/dist/index.js";
39
- import { useCallback as Ve, useEffect as He, useMemo as s, useState as c } from "react";
39
+ import { useCallback as He, useEffect as o, useMemo as s, useState as c } from "react";
40
+ import { useControllableState as Ue } from "@radix-ui/react-use-controllable-state";
40
41
  //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js
41
- function Ue(e) {
42
+ function We(e) {
42
43
  let t = e;
43
44
  return typeof e == "object" && !!e && "verificationStatus" in e && t.verificationStatus === "VERIFIED";
44
45
  }
45
46
  var l = "tesouro.linkedAccounts.locallySentMicroDepositAccountIds.v1";
46
- function We() {
47
+ function Ge() {
47
48
  if (typeof window > "u") return /* @__PURE__ */ new Set();
48
49
  try {
49
50
  let e = window.sessionStorage.getItem(l), t = e ? JSON.parse(e) : [];
@@ -60,86 +61,91 @@ function d(e) {
60
61
  window.sessionStorage.setItem(l, JSON.stringify([...e]));
61
62
  } catch {}
62
63
  }
63
- function Ge(e, t) {
64
+ function f(e, t) {
64
65
  let n = new Set(e).add(t);
65
66
  return d(n), n;
66
67
  }
67
- var Ke = ie.ExternalBankAccountWriteOrg;
68
- function f({ labels: ie, featureLabels: l }) {
69
- let u = {
70
- ...Be,
71
- ...ie
72
- }, d = {
73
- ...me,
68
+ var Ke = r.ExternalBankAccountWriteOrg;
69
+ function p({ labels: r, featureLabels: l, isLinkAccountOpen: u, onLinkAccountOpenChange: d }) {
70
+ let p = {
71
+ ...Ve,
72
+ ...r
73
+ }, m = {
74
+ ...pe,
74
75
  ...l
75
- }, f = ce(), { organizationId: p, widgetToken: qe, initResponse: m } = le(), Je = de(), { organizationStatus: Ye } = re(), Xe = ne(Ye), Ze = !!ue(), h = !!(p && qe), Qe = h || !!qe && Ye === te.Rotating, g = s(() => we(m?.scopes), [m?.scopes]), _ = Qe && g.canRead && !!m, [v, $e] = c(), [y, et] = c(!1), [b, x] = c(1), [S, tt] = c([]), [C, nt] = c(), [rt, w] = c(), [T, it] = c(We), [at, E] = c(!1), [ot, st] = c(!1), [ct, D] = c(!1), [lt, O] = c(!1), [k, A] = c(), [j, ut] = c(he), [M, N] = c(!1), [P, F] = c(ge), [I, L] = c(i);
76
- He(() => {
77
- f(r.Mounted);
78
- }, [f]);
79
- let R = Ae({
76
+ }, h = se(), { organizationId: g, widgetToken: _, initResponse: v } = ce(), qe = ue(), { organizationStatus: y } = re(), Je = ne(y), Ye = !!le(), b = !!(g && _), Xe = b || !!_ && y === te.Rotating, x = s(() => Te(v?.scopes), [v?.scopes]), S = Xe && x.canRead && !!v, [C, Ze] = c(), [Qe, $e] = Ue({
77
+ prop: u,
78
+ defaultProp: !1,
79
+ onChange: d,
80
+ caller: "LinkedAccountsWidget"
81
+ }), et = b && x.canWrite, w = Qe && et, [T, E] = c(1), [D, tt] = c([]), [O, nt] = c(), [rt, k] = c(), [A, it] = c(Ge), [at, j] = c(!1), [ot, st] = c(!1), [ct, M] = c(!1), [lt, N] = c(!1), [P, F] = c(), [I, ut] = c(me), [dt, ft] = c(!1), [pt, mt] = c(he), [L, ht] = c(ge);
82
+ o(() => {
83
+ h(i.Mounted);
84
+ }, [h]);
85
+ let R = je({
80
86
  limit: 100,
81
- enabled: _
82
- }), z = ke(), B = je(), V = Pe(), H = Ne(), U = Me(), W = Fe(), G = y && b >= 2, K = se({ enabled: G }), q = oe({ enabled: G }), dt = ae({ enabled: y && g.canReadOrganization }).data?.legalName ?? "", J = s(() => M ? j : {
83
- ...j,
84
- nameOnAccount: dt
87
+ enabled: S
88
+ }), z = Ae(), B = Me(), V = Fe(), H = Pe(), U = Ne(), W = Ie(), G = w && T >= 2, K = oe({ enabled: G }), q = ae({ enabled: G }), gt = ie({ enabled: w && x.canReadOrganization }).data?.legalName ?? "", J = s(() => dt ? I : {
89
+ ...I,
90
+ nameOnAccount: gt
85
91
  }, [
86
- M,
87
- j,
88
- dt
89
- ]), { userIds: ft, isResolving: pt, isError: mt } = Ie({
92
+ dt,
93
+ I,
94
+ gt
95
+ ]), { userIds: _t, isResolving: vt, isError: yt } = Le({
90
96
  enabled: G,
91
97
  permissionKey: Ke,
92
- organizationId: p
98
+ organizationId: g
93
99
  }), Y = s(() => {
94
- let e = q.data?.data ?? [], t = p ? fe(e, {
95
- organizationId: p,
96
- organizationTypes: m?.organizationTypes ?? []
97
- }) : e, n = pe(K.data?.data ?? [], p);
98
- return ze(n, Re(t), ft);
100
+ let e = q.data?.data ?? [], t = g ? de(e, {
101
+ organizationId: g,
102
+ organizationTypes: v?.organizationTypes ?? []
103
+ }) : e, n = fe(K.data?.data ?? [], g);
104
+ return Be(n, ze(t), _t);
99
105
  }, [
100
- ft,
106
+ _t,
101
107
  q.data?.data,
102
108
  K.data?.data,
103
- p,
104
- m?.organizationTypes
105
- ]), ht = K.isLoading || K.isFetchingNextPage || !!K.hasNextPage || q.isResolving || pt, gt = !ht && !K.isError && !mt, X = _ ? R.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && T.has(e.id) ? {
109
+ g,
110
+ v?.organizationTypes
111
+ ]), bt = K.isLoading || K.isFetchingNextPage || !!K.hasNextPage || q.isResolving || vt, xt = !bt && !K.isError && !yt, X = S ? R.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && A.has(e.id) ? {
106
112
  ...e,
107
113
  verificationStatus: "VERIFICATION_SENT"
108
- } : e), [X, T]), _t = [.../* @__PURE__ */ new Set([...Y.filter((e) => e.locked).map((e) => e.id), ...S])], vt = Ve((e) => {
109
- z.reset(), B.reset(), U.reset(), e.nameOnAccount !== J.nameOnAccount && N(!0), ut({
114
+ } : e), [X, A]), St = [.../* @__PURE__ */ new Set([...Y.filter((e) => e.locked).map((e) => e.id), ...D])], Ct = He((e) => {
115
+ z.reset(), B.reset(), U.reset(), e.nameOnAccount !== J.nameOnAccount && ft(!0), ut({
110
116
  ...e,
111
- routingNumber: xe(e.routingNumber)
117
+ routingNumber: Se(e.routingNumber)
112
118
  });
113
119
  }, [
114
120
  J.nameOnAccount,
115
121
  z,
116
122
  B,
117
123
  U
118
- ]), Q = () => {
119
- x(3), n(t);
120
- }, yt = (e) => {
121
- if (!g.canMicroDeposit) {
122
- Q();
124
+ ]), wt = () => {
125
+ E(3), n(t);
126
+ }, Tt = (e) => {
127
+ if (!x.canMicroDeposit) {
128
+ wt();
123
129
  return;
124
130
  }
125
- w("connect"), U.mutate({ path: { id: e } }, { onSuccess: () => {
126
- w(void 0), it((t) => Ge(t, e)), f(r.AccountLinked, { accountId: e }), Q();
131
+ k("connect"), U.mutate({ path: { id: e } }, { onSuccess: () => {
132
+ k(void 0), it((t) => f(t, e)), h(i.AccountLinked, { accountId: e }), wt();
127
133
  } });
128
- }, bt = (e) => {
134
+ }, Et = (e) => {
129
135
  B.mutate({
130
136
  path: { id: e },
131
- body: { userIds: _t }
132
- }, { onSuccess: () => yt(e) });
133
- }, xt = () => {
134
- if (h && g.canWrite) {
135
- if (b === 1) {
136
- if (!a(J)) return;
137
- x(2);
137
+ body: { userIds: St }
138
+ }, { onSuccess: () => Tt(e) });
139
+ }, Dt = () => {
140
+ if (b && x.canWrite) {
141
+ if (T === 1) {
142
+ if (!_e(J)) return;
143
+ E(2);
138
144
  return;
139
145
  }
140
- if (b === 2 && gt) {
141
- if (C) {
142
- bt(C.id);
146
+ if (T === 2 && xt) {
147
+ if (O) {
148
+ Et(O.id);
143
149
  return;
144
150
  }
145
151
  z.mutate({ body: {
@@ -148,78 +154,89 @@ function f({ labels: ie, featureLabels: l }) {
148
154
  routingNumber: J.routingNumber.trim(),
149
155
  nameOnAccount: J.nameOnAccount.trim(),
150
156
  type: J.type,
151
- accountHolderType: De(J.accountHolderType)
157
+ accountHolderType: Oe(J.accountHolderType)
152
158
  } }, { onSuccess: (e) => {
153
- f(r.AccountConnected, { accountId: e?.id }), nt(e), e?.id && bt(e.id);
159
+ h(i.AccountConnected, { accountId: e?.id }), nt(e), e?.id && Et(e.id);
154
160
  } });
155
161
  }
156
162
  }
157
- }, St = () => {
158
- b === 2 && x(1);
159
- }, Ct = (e, t) => {
163
+ }, Ot = () => {
164
+ T === 2 && E(1);
165
+ }, kt = (e, t) => {
160
166
  Y.find((t) => t.id === e)?.locked || tt((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
161
- }, wt = (e) => {
162
- (!e || h) && (!e || g.canWrite) && (e && (x(1), ut(he), N(!1), tt([]), nt(void 0), w(void 0), z.reset(), B.reset(), U.reset()), et(e));
163
- }, Tt = (e) => {
164
- if (!h || !g.canWrite) return;
167
+ }, [At, jt] = c(w);
168
+ w !== At && (jt(w), w && (E(1), ut(me), ft(!1), tt([]), nt(void 0), k(void 0)));
169
+ let { reset: Mt } = z, { reset: Nt } = B, { reset: Q } = U;
170
+ o(() => {
171
+ w && (Mt(), Nt(), Q());
172
+ }, [
173
+ w,
174
+ Mt,
175
+ Nt,
176
+ Q
177
+ ]);
178
+ let Pt = (e) => {
179
+ (!e || et) && $e(e);
180
+ }, Ft = (e) => {
181
+ if (!b || !x.canWrite) return;
165
182
  let t = X.find((t) => t.id === e);
166
- $e(e), F(Se(t)), E(!0);
167
- }, Et = (e) => {
168
- (!e || h) && (!e || g.canWrite) && E(e);
169
- }, Dt = () => {
170
- if (!h || !g.canWrite || !v) return;
171
- let t = X.find((e) => e.id === v), n = Ce(P, t);
183
+ Ze(e), mt(Ce(t)), j(!0);
184
+ }, It = (e) => {
185
+ (!e || b) && (!e || x.canWrite) && j(e);
186
+ }, Lt = () => {
187
+ if (!b || !x.canWrite || !C) return;
188
+ let t = X.find((e) => e.id === C), n = we(pt, t);
172
189
  Object.keys(n).length !== 0 && V.mutate({
173
- path: { id: v },
190
+ path: { id: C },
174
191
  body: n
175
192
  }, { onSuccess: () => {
176
- f(r.AccountUpdated, { accountId: v }), e.success(d.editSuccessToast), E(!1);
193
+ h(i.AccountUpdated, { accountId: C }), e.success(m.editSuccessToast), j(!1);
177
194
  } });
178
- }, Ot = (e) => {
179
- h && g.canWrite && ($e(e), L(i), O(!1), D(!1), st(!0));
180
- }, kt = (e) => {
181
- (!e || h) && (!e || g.canWrite) && (e || (O(!1), D(!1)), st(e));
182
- }, At = (e) => {
183
- W.reset(), O(!1), L(e);
184
- }, jt = () => {
185
- if (!h || !g.canWrite || !v || !ye(I)) return;
186
- let e = be(I.firstAmount), t = be(I.secondAmount);
187
- e !== null && t !== null && (O(!1), W.mutate({
188
- path: { id: v },
195
+ }, Rt = (e) => {
196
+ b && x.canWrite && (Ze(e), ht(ge), N(!1), M(!1), st(!0));
197
+ }, zt = (e) => {
198
+ (!e || b) && (!e || x.canWrite) && (e || (N(!1), M(!1)), st(e));
199
+ }, Bt = (e) => {
200
+ W.reset(), N(!1), ht(e);
201
+ }, Vt = () => {
202
+ if (!b || !x.canWrite || !C || !be(L)) return;
203
+ let e = xe(L.firstAmount), t = xe(L.secondAmount);
204
+ e !== null && t !== null && (N(!1), W.mutate({
205
+ path: { id: C },
189
206
  body: {
190
207
  firstAmount: e,
191
208
  secondAmount: t
192
209
  }
193
210
  }, { onSuccess: (e) => {
194
- if (!Ue(e)) {
195
- O(!0);
211
+ if (!We(e)) {
212
+ N(!0);
196
213
  return;
197
214
  }
198
- f(r.AccountVerified, { accountId: v }), n("tesouro-new-external-bank-account-linked-success"), D(!0);
215
+ h(i.AccountVerified, { accountId: C }), n("tesouro-new-external-bank-account-linked-success"), M(!0);
199
216
  } }));
200
- }, Mt = (e) => {
201
- h && g.canMicroDeposit && (w("row"), U.mutate({ path: { id: e } }, { onSuccess: () => {
202
- w(void 0), it((t) => Ge(t, e)), f(r.AccountLinked, { accountId: e });
217
+ }, Ht = (e) => {
218
+ b && x.canMicroDeposit && (k("row"), U.mutate({ path: { id: e } }, { onSuccess: () => {
219
+ k(void 0), it((t) => f(t, e)), h(i.AccountLinked, { accountId: e });
203
220
  } }));
204
- }, Nt = (e) => {
205
- h && g.canWrite && A(e);
206
- }, Pt = (e) => {
207
- e || A(void 0);
208
- }, Ft = () => {
209
- if (!h || !g.canWrite || !k) return;
210
- let t = k;
221
+ }, Ut = (e) => {
222
+ b && x.canWrite && F(e);
223
+ }, Wt = (e) => {
224
+ e || F(void 0);
225
+ }, Gt = () => {
226
+ if (!b || !x.canWrite || !P) return;
227
+ let t = P;
211
228
  H.mutate({ path: { id: t } }, { onSuccess: () => {
212
- f(r.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), A(void 0);
229
+ h(i.AccountUnlinked, { accountId: t }), e.success(m.unlinkSuccessToast), F(void 0);
213
230
  } });
214
- }, It = z.isPending || B.isPending || V.isPending || W.isPending || H.isPending || U.isPending, Lt = g.canWrite, Rt = !h || It, $ = U.isError && rt === "connect", zt = Le(Y, {
215
- selectedUserIds: S,
216
- disabled: Rt || !Lt,
217
- fallbackTooltip: u.teamMemberAccessTooltip,
218
- onUserToggle: Ct
219
- }), Bt = Y.filter((e) => e.locked).length + S.length, Vt = C ? ((e) => {
231
+ }, Kt = z.isPending || B.isPending || V.isPending || W.isPending || H.isPending || U.isPending, qt = x.canWrite, Jt = !b || Kt, $ = U.isError && rt === "connect", Yt = Re(Y, {
232
+ selectedUserIds: D,
233
+ disabled: Jt || !qt,
234
+ fallbackTooltip: p.teamMemberAccessTooltip,
235
+ onUserToggle: kt
236
+ }), Xt = Y.filter((e) => e.locked).length + D.length, Zt = O ? ((e) => {
220
237
  let t = e.accountNumber.slice(-4), n = {
221
238
  type: {
222
- text: Oe(e.accountHolderType ? Ee(e.accountHolderType) : J.accountHolderType, e.type ?? J.type, d),
239
+ text: ke(e.accountHolderType ? De(e.accountHolderType) : J.accountHolderType, e.type ?? J.type, m),
223
240
  emphasized: !1
224
241
  },
225
242
  last4: {
@@ -227,33 +244,33 @@ function f({ labels: ie, featureLabels: l }) {
227
244
  emphasized: !0
228
245
  }
229
246
  };
230
- return T.has(e.id) ? {
247
+ return A.has(e.id) ? {
231
248
  variant: "deposits-sent",
232
- description: o(d.summaryDescription, n),
249
+ description: a(m.summaryDescription, n),
233
250
  nextSteps: [{
234
251
  key: "check-bank",
235
- title: d.summaryCheckBankTitle.replaceAll("{last4}", t),
236
- description: o(d.summaryCheckBankDescription, n)
252
+ title: m.summaryCheckBankTitle.replaceAll("{last4}", t),
253
+ description: a(m.summaryCheckBankDescription, n)
237
254
  }, {
238
255
  key: "verify",
239
- title: d.summaryVerifyTitle,
240
- description: o(d.summaryVerifyDescription, n)
256
+ title: m.summaryVerifyTitle,
257
+ description: a(m.summaryVerifyDescription, n)
241
258
  }]
242
259
  } : {
243
260
  variant: "account-added",
244
- description: o(d.summaryAccountAddedDescription, n),
261
+ description: a(m.summaryAccountAddedDescription, n),
245
262
  nextSteps: []
246
263
  };
247
- })(C) : void 0, Ht = Te(Z, d, g, {
248
- labels: u,
249
- onEditSelect: Tt,
250
- onVerifySelect: Ot,
251
- onLinkSelect: Mt,
252
- onUnlinkSelect: Nt
253
- }), Ut = s(() => {
264
+ })(O) : void 0, Qt = Ee(Z, m, x, {
265
+ labels: p,
266
+ onEditSelect: Ft,
267
+ onVerifySelect: Rt,
268
+ onLinkSelect: Ht,
269
+ onUnlinkSelect: Ut
270
+ }), $t = s(() => {
254
271
  if (!z.isError && !B.isError && !$) return;
255
272
  let e = z.error ?? B.error ?? ($ ? U.error : void 0);
256
- return ee(e) ?? u.actionErrorTitle;
273
+ return ee(e) ?? p.actionErrorTitle;
257
274
  }, [
258
275
  z.error,
259
276
  z.isError,
@@ -261,55 +278,55 @@ function f({ labels: ie, featureLabels: l }) {
261
278
  B.isError,
262
279
  $,
263
280
  U.error,
264
- u.actionErrorTitle
281
+ p.actionErrorTitle
265
282
  ]);
266
283
  return {
267
- rows: Ht,
268
- isLoading: !Ze && (Xe && !R.data || Je && !m || _ && R.isLoading),
269
- isError: Ze || _ && R.isError,
270
- isConnectOpen: y,
284
+ rows: Qt,
285
+ isLoading: !Ye && (Je && !R.data || qe && !v || S && R.isLoading),
286
+ isError: Ye || S && R.isError,
287
+ isConnectOpen: w,
271
288
  isEditOpen: at,
272
289
  isVerifyOpen: ot,
273
290
  isVerifySuccess: ct,
274
- verifyAccountName: Z.find((e) => e.id === v)?.nickname,
275
- verifyAccountNumber: Z.find((e) => e.id === v)?.accountNumber,
276
- isUnlinkOpen: !!k,
277
- unlinkAccountNumber: Z.find((e) => e.id === k)?.accountNumber,
278
- connectStep: b,
279
- accessRows: zt,
280
- accessGrantedCount: Bt,
281
- connectSummary: Vt,
282
- isTeamMembersLoading: ht,
283
- isTeamMembersError: K.isError || mt,
284
- isConnectNextDisabled: b === 1 ? !a(J) : b === 2 && !gt,
285
- isConnectRoutingNumberInvalid: J.routingNumber.trim() !== "" && !_e(J.routingNumber),
286
- connectErrorMessage: Ut,
287
- isVerifyFirstAmountInvalid: I.firstAmount.trim() !== "" && !ve(I.firstAmount),
288
- isVerifySecondAmountInvalid: I.secondAmount.trim() !== "" && !ve(I.secondAmount),
289
- isVerifySubmitDisabled: !ye(I),
290
- isActionDisabled: Rt,
291
- canConnect: Lt,
292
- isSubmitting: It,
291
+ verifyAccountName: Z.find((e) => e.id === C)?.nickname,
292
+ verifyAccountNumber: Z.find((e) => e.id === C)?.accountNumber,
293
+ isUnlinkOpen: !!P,
294
+ unlinkAccountNumber: Z.find((e) => e.id === P)?.accountNumber,
295
+ connectStep: T,
296
+ accessRows: Yt,
297
+ accessGrantedCount: Xt,
298
+ connectSummary: Zt,
299
+ isTeamMembersLoading: bt,
300
+ isTeamMembersError: K.isError || yt,
301
+ isConnectNextDisabled: T === 1 ? !_e(J) : T === 2 && !xt,
302
+ isConnectRoutingNumberInvalid: J.routingNumber.trim() !== "" && !ve(J.routingNumber),
303
+ connectErrorMessage: $t,
304
+ isVerifyFirstAmountInvalid: L.firstAmount.trim() !== "" && !ye(L.firstAmount),
305
+ isVerifySecondAmountInvalid: L.secondAmount.trim() !== "" && !ye(L.secondAmount),
306
+ isVerifySubmitDisabled: !be(L),
307
+ isActionDisabled: Jt,
308
+ canConnect: qt,
309
+ isSubmitting: Kt,
293
310
  isActionError: U.isError || H.isError || z.isError || B.isError || V.isError || W.isError || lt,
294
311
  isConnectError: z.isError || B.isError || $,
295
312
  isEditError: V.isError,
296
313
  isVerifyError: W.isError || lt,
297
314
  connectForm: J,
298
- editForm: P,
299
- verifyForm: I,
300
- onConnectOpenChange: wt,
301
- onEditOpenChange: Et,
302
- onVerifyOpenChange: kt,
303
- onUnlinkOpenChange: Pt,
304
- onConnectFormChange: vt,
305
- onEditFormChange: F,
306
- onVerifyFormChange: At,
307
- onConnectNext: xt,
308
- onConnectBack: St,
309
- onEditSubmit: Dt,
310
- onVerifySubmit: jt,
311
- onUnlinkConfirm: Ft
315
+ editForm: pt,
316
+ verifyForm: L,
317
+ onConnectOpenChange: Pt,
318
+ onEditOpenChange: It,
319
+ onVerifyOpenChange: zt,
320
+ onUnlinkOpenChange: Wt,
321
+ onConnectFormChange: Ct,
322
+ onEditFormChange: mt,
323
+ onVerifyFormChange: Bt,
324
+ onConnectNext: Dt,
325
+ onConnectBack: Ot,
326
+ onEditSubmit: Lt,
327
+ onVerifySubmit: Vt,
328
+ onUnlinkConfirm: Gt
312
329
  };
313
330
  }
314
331
  //#endregion
315
- export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY, f as useLinkedAccountsWidget };
332
+ export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY, p as useLinkedAccountsWidget };
@@ -7,17 +7,17 @@ import "../../../../../shared/ui/dist/index.js";
7
7
  import { useAnalyticsTrack as t } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
8
8
  import { WidgetProvider as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
9
9
  import "../../../../../shared/feature/dist/index.js";
10
- import { ProductFormSheet as r } from "../../../../../shared/product-catalog/ui/dist/index3.js";
10
+ import { ProductFormSheet as r } from "../../../../../shared/product-catalog/ui/dist/index4.js";
11
11
  import { MeasureUnitsManagerContainer as i } from "../../../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
12
12
  import "../../../../../shared/product-catalog/feature/dist/index.js";
13
13
  import { ProductsWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "../analytics/events.js";
14
14
  import { PAGE_SIZE_OPTIONS as s } from "./constants.js";
15
15
  import { productsWidgetTestIds as c } from "./testIds.js";
16
- import { useProductsWidget as l } from "./useProductsWidget.js";
17
- import { ProductsScreen as u } from "../../../../ui/dist/index4.js";
18
- import { ProductDetailsSheet as d } from "../../../../ui/dist/index5.js";
19
- import { ProductDeleteDialog as f } from "../../../../ui/dist/index6.js";
16
+ import { ProductsScreen as l } from "../../../../ui/dist/index4.js";
17
+ import { ProductDetailsSheet as u } from "../../../../ui/dist/index6.js";
18
+ import { ProductDeleteDialog as d } from "../../../../ui/dist/index7.js";
20
19
  import "../../../../ui/dist/index.js";
20
+ import { useProductsWidget as f } from "./useProductsWidget.js";
21
21
  import { useEffect as p } from "react";
22
22
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
23
23
  //#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js
@@ -26,10 +26,14 @@ function _({ pageSizeOptions: n = s, screenLabels: o, formLabels: _, detailsLabe
26
26
  p(() => {
27
27
  C(a.Mounted);
28
28
  }, [C]);
29
- let { view: w, units: T, table: E, details: D, form: O, del: k, permissions: A, isPermissionLoading: j, isTableLoading: M, hasInitError: N, refetchWidgetInit: P, measureUnitsOpen: F, actionsSuspended: I, handleRowClick: L, openMeasureUnits: R, closeMeasureUnits: z, submitForm: B, confirmDelete: V } = l({ messageLabels: S });
29
+ let { view: w, units: T, table: E, details: D, form: O, del: k, permissions: A, isPermissionLoading: j, isTableLoading: M, hasInitError: N, refetchWidgetInit: P, measureUnitsOpen: F, actionsSuspended: I, editForm: L, handleRowClick: R, openMeasureUnits: z, closeMeasureUnits: B, submitForm: V, confirmDelete: H } = f({
30
+ messageLabels: S,
31
+ screenLabels: o,
32
+ formLabels: _
33
+ });
30
34
  return /* @__PURE__ */ g(m, { children: [
31
35
  /* @__PURE__ */ h(e, {}),
32
- /* @__PURE__ */ h(u, {
36
+ /* @__PURE__ */ h(l, {
33
37
  products: E.rows,
34
38
  isLoading: M,
35
39
  isError: N || E.isError,
@@ -42,20 +46,14 @@ function _({ pageSizeOptions: n = s, screenLabels: o, formLabels: _, detailsLabe
42
46
  hasPrevPage: E.hasPrevPage,
43
47
  onNextPage: E.onNextPage,
44
48
  onPrevPage: E.onPrevPage,
45
- searchValue: E.searchValue,
46
- onSearchChange: E.onSearchChange,
47
- typeFilter: E.typeFilter,
48
- onTypeFilterChange: E.onTypeFilterChange,
49
- unitFilter: E.unitFilter,
50
- onUnitFilterChange: E.onUnitFilterChange,
51
- unitOptions: T.unitOptions,
49
+ filters: E.filters,
52
50
  isFiltering: E.isFiltering,
53
51
  canCreate: A.canCreate,
54
52
  canManageUnits: A.canCreate,
55
53
  isAccessRestricted: !j && !N && !A.canRead,
56
54
  onCreateClick: O.openCreate,
57
- onManageUnitsClick: R,
58
- onRowClick: L,
55
+ onManageUnitsClick: z,
56
+ onRowClick: R,
59
57
  onRetry: N ? P : E.onRetry,
60
58
  labels: o,
61
59
  testIds: {
@@ -64,25 +62,25 @@ function _({ pageSizeOptions: n = s, screenLabels: o, formLabels: _, detailsLabe
64
62
  }
65
63
  }),
66
64
  /* @__PURE__ */ h(r, {
67
- open: w === "create" || w === "edit",
65
+ open: w === "create",
68
66
  onOpenChange: (e) => {
69
67
  e || O.close();
70
68
  },
71
- mode: w === "edit" ? "edit" : "create",
72
69
  values: O.values,
73
70
  errors: O.errors,
74
71
  unitOptions: T.unitOptions,
72
+ pricePrefix: O.pricePrefix,
75
73
  inProgress: O.isSubmitting || I,
76
74
  onChange: (e) => O.setValues((t) => ({
77
75
  ...t,
78
76
  ...e
79
77
  })),
80
- onSubmit: B,
78
+ onSubmit: V,
81
79
  onCancel: O.close,
82
80
  labels: _
83
81
  }),
84
- /* @__PURE__ */ h(d, {
85
- open: w === "details",
82
+ /* @__PURE__ */ h(u, {
83
+ open: w === "details" || w === "edit",
86
84
  onOpenChange: (e) => {
87
85
  e || O.close();
88
86
  },
@@ -93,20 +91,21 @@ function _({ pageSizeOptions: n = s, screenLabels: o, formLabels: _, detailsLabe
93
91
  onDelete: k.requestDelete,
94
92
  canEdit: A.canUpdate,
95
93
  canDelete: A.canDelete,
94
+ editForm: L,
96
95
  labels: v
97
96
  }),
98
- /* @__PURE__ */ h(f, {
97
+ /* @__PURE__ */ h(d, {
99
98
  open: k.open,
100
99
  onOpenChange: k.onOpenChange,
101
100
  productName: D.productName,
102
101
  isDeleting: k.isDeleting || I,
103
- onConfirm: V,
102
+ onConfirm: H,
104
103
  onCancel: k.cancel,
105
104
  labels: y
106
105
  }),
107
106
  /* @__PURE__ */ h(i, {
108
107
  open: F,
109
- onClose: z,
108
+ onClose: B,
110
109
  suspended: I,
111
110
  managerLabels: b,
112
111
  deleteLabels: x,
@@ -4,6 +4,10 @@ var e = [
4
4
  25,
5
5
  50,
6
6
  100
7
- ];
7
+ ], t = ["product", "service"], n = {
8
+ Type: "type",
9
+ Unit: "unit",
10
+ Search: "search"
11
+ };
8
12
  //#endregion
9
- export { e as PAGE_SIZE_OPTIONS };
13
+ export { e as PAGE_SIZE_OPTIONS, n as ProductsFilterKey, t as TYPE_FILTER_OPTIONS };