@tesouro/embedded-components-react 0.5.260 → 0.5.262

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.
package/README.md CHANGED
@@ -491,9 +491,9 @@ Manages an organization's products and services: a filterable, sortable table wi
491
491
  | Prop | Type | Default | Description |
492
492
  | ------------------------- | ---------------------------------------- | ------------------- | --------------------------------------------------- |
493
493
  | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices. |
494
- | `screenLabels` | `Partial<ProductsScreenLabels>` | English labels | Table/header/filter/empty/error copy. |
494
+ | `screenLabels` | `PartialDeep<ProductsScreenLabels>` | English labels | Table/header/filter/empty/error copy. |
495
495
  | `formLabels` | `Partial<ProductFormSheetLabels>` | English labels | Create/edit form copy. |
496
- | `detailsLabels` | `Partial<ProductDetailsSheetLabels>` | English labels | Details sheet copy. |
496
+ | `detailsLabels` | `PartialDeep<ProductDetailsSheetLabels>` | English labels | Details sheet copy. |
497
497
  | `deleteLabels` | `Partial<ProductDeleteDialogLabels>` | English labels | Product delete confirmation copy. |
498
498
  | `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-units manager copy. |
499
499
  | `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy. |
package/dist/index.d.ts CHANGED
@@ -5899,11 +5899,6 @@ type MarketingWidgetProps = WidgetProviderProps & InnerProps;
5899
5899
  */
5900
5900
  declare function MarketingWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: MarketingWidgetProps): React.JSX.Element;
5901
5901
 
5902
- /**
5903
- * Co-located user-facing strings for the products widget UI. Each component
5904
- * takes a `labels?: Partial<…Labels>` prop merged over the matching
5905
- * `*_LABELS_EN` default.
5906
- */
5907
5902
  interface ProductTypeBadgeLabels {
5908
5903
  product: string;
5909
5904
  service: string;
@@ -5980,9 +5975,9 @@ interface ProductDeleteDialogLabels {
5980
5975
 
5981
5976
  interface ProductsWidgetOwnProps {
5982
5977
  pageSizeOptions?: number[];
5983
- screenLabels?: Partial<ProductsScreenLabels>;
5978
+ screenLabels?: PartialDeep<ProductsScreenLabels>;
5984
5979
  formLabels?: Partial<ProductFormSheetLabels>;
5985
- detailsLabels?: Partial<ProductDetailsSheetLabels>;
5980
+ detailsLabels?: PartialDeep<ProductDetailsSheetLabels>;
5986
5981
  deleteLabels?: Partial<ProductDeleteDialogLabels>;
5987
5982
  measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
5988
5983
  measureUnitDeleteLabels?: Partial<MeasureUnitDeleteDialogLabels>;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
3
+ import { PartialDeep } from 'type-fest';
3
4
  import { FallbackProps } from 'react-error-boundary';
4
5
 
5
6
  type AuthToken = string | undefined;
@@ -716,11 +717,6 @@ interface ProductMessageLabels {
716
717
  updateMeasureUnitError: string;
717
718
  }
718
719
 
719
- /**
720
- * Co-located user-facing strings for the products widget UI. Each component
721
- * takes a `labels?: Partial<…Labels>` prop merged over the matching
722
- * `*_LABELS_EN` default.
723
- */
724
720
  interface ProductTypeBadgeLabels {
725
721
  product: string;
726
722
  service: string;
@@ -797,9 +793,9 @@ interface ProductDeleteDialogLabels {
797
793
 
798
794
  interface ProductsWidgetOwnProps {
799
795
  pageSizeOptions?: number[];
800
- screenLabels?: Partial<ProductsScreenLabels>;
796
+ screenLabels?: PartialDeep<ProductsScreenLabels>;
801
797
  formLabels?: Partial<ProductFormSheetLabels>;
802
- detailsLabels?: Partial<ProductDetailsSheetLabels>;
798
+ detailsLabels?: PartialDeep<ProductDetailsSheetLabels>;
803
799
  deleteLabels?: Partial<ProductDeleteDialogLabels>;
804
800
  measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
805
801
  measureUnitDeleteLabels?: Partial<MeasureUnitDeleteDialogLabels>;
@@ -73,7 +73,11 @@ function w({ labels: e, searchValue: t, onSearchChange: u, typeFilter: d, onType
73
73
  function T({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange: o, pageSize: s, onPageSizeChange: c, pageSizeOptions: l = S, hasNextPage: x, hasPrevPage: C, onNextPage: T, onPrevPage: E, searchValue: D, onSearchChange: O, typeFilter: k, onTypeFilterChange: A, unitFilter: j, onUnitFilterChange: M, unitOptions: N, isFiltering: P, onCreateClick: F, onManageUnitsClick: I, onRowClick: L, onRetry: R, canCreate: z = !0, canManageUnits: B = !0, isAccessRestricted: V, labels: H, testIds: U }) {
74
74
  let W = {
75
75
  ...f,
76
- ...H
76
+ ...H,
77
+ typeBadge: {
78
+ ...f.typeBadge,
79
+ ...H?.typeBadge
80
+ }
77
81
  }, G = [
78
82
  {
79
83
  accessorKey: "name",
@@ -25,7 +25,11 @@ function C({ label: e, value: t, isLast: n, emptyValue: r = "—" }) {
25
25
  function w({ open: S, onOpenChange: w, product: T, isLoading: E, isError: D, onEdit: O, onDelete: k, canEdit: A = !0, canDelete: j = !0, labels: M }) {
26
26
  let N = {
27
27
  ...h,
28
- ...M
28
+ ...M,
29
+ typeBadge: {
30
+ ...h.typeBadge,
31
+ ...M?.typeBadge
32
+ }
29
33
  }, P = T?.type !== "service", F = P ? N.typeBadge.product : N.typeBadge.service, I = T ? N.subtitle.replace("{type}", F).replace("{createdAt}", T.createdAtLabel) : N.hiddenDescription;
30
34
  return /* @__PURE__ */ _(a, {
31
35
  open: S,
@@ -6,7 +6,7 @@ var e = { scenarios: {
6
6
  },
7
7
  profile: {
8
8
  label: "Profile",
9
- blurb: "The Profile section: the signed-in user’s name, phone and email, and on the Business tab the company’s legal name, address, phone and email. The line under the card names the bank from init and links to the host’s contact page."
9
+ blurb: "The Profile section: the signed-in user’s name, phone and email, and on the Business tab the company’s legal name, address and phone. The line under the card names the bank from init and links to the host’s contact page."
10
10
  },
11
11
  legal: {
12
12
  label: "Legal",
@@ -1,56 +1,66 @@
1
1
  import { Scope as e } from "../../../../shared/data-access/dist/lib/scopes.js";
2
2
  import "../../../../shared/data-access/dist/index.js";
3
- import { AN_ENTITY as t, AN_ENTITY_USER as n, AN_ORGANIZATION_ROLE as r, A_DISCLOSURES_SET as i } from "../../../../shared/data-access-mocks/dist/lib/fixtures.js";
3
+ import { AN_ORGANIZATION as t, AN_ORGANIZATION_ROLE as n, AN_ORGANIZATION_USER as r, A_DISCLOSURES_SET as i } from "../../../../shared/data-access-mocks/dist/lib/fixtures.js";
4
4
  import { EMPLOYEE_ROLE as a, ENGINEERING as o, HEADQUARTERS as s, REMOTE as c, SALES as l, SAM as u, TEAM as d, teamId as f } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/team.js";
5
- import { FINOPS as p, IDENTITY as m, bodyOf as h, endpoint as g, initRoute as _, json as v, noContent as y, problem as b, wait as x } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/scenario.js";
6
- import { offsetPage as S } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/worlds.js";
7
- import { SETTINGS_LABELS as C } from "./labels.js";
5
+ import { IDENTITY as p, bodyOf as m, endpoint as h, initRoute as g, json as _, noContent as v, problem as y, wait as b } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/scenario.js";
6
+ import { offsetPage as x } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/worlds.js";
7
+ import { SETTINGS_LABELS as S } from "./labels.js";
8
8
  //#region ../../libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/settings.js
9
- var w = "Example Bank", T = "https://example.test/support", E = [r, a], D = {
10
- ...n,
11
- phone: "+12175550142"
9
+ var C = "Example Bank", w = "https://example.test/support", T = n, E = [T, a], D = {
10
+ id: r.id,
11
+ organizationId: t.id,
12
+ name: r.name,
13
+ email: r.email,
14
+ phoneNumber: "+12175550142",
15
+ isAuthorizedSigner: !0,
16
+ permissions: [],
17
+ role: T.key,
18
+ status: "ACTIVE"
12
19
  }, O = {
20
+ ...t,
21
+ phoneNumber: "+12175550100"
22
+ }, k = {
13
23
  ...i,
14
24
  accepted: !0,
15
25
  disclosures: (i.disclosures ?? []).map((e) => ({
16
26
  ...e,
17
27
  accepted: !0
18
28
  }))
19
- }, k = {
29
+ }, A = {
20
30
  tokenParam: "PaginationToken",
21
31
  next: "nextPaginationToken",
22
32
  prev: "prevPaginationToken"
23
33
  };
24
- function A(e, t) {
34
+ function j(e, t) {
25
35
  let n = t.has("paginationToken") ? {
26
- ...k,
36
+ ...A,
27
37
  tokenParam: "paginationToken"
28
- } : k;
29
- return S(e, t, {
38
+ } : A;
39
+ return x(e, t, {
30
40
  paging: n,
31
41
  defaultLimit: 100
32
42
  });
33
43
  }
34
- var j = (e) => `${m}${e}`, M = 500;
35
- function N({ canWrite: e }) {
36
- let n = d.map((e) => ({ ...e })), r = {
44
+ var M = (e) => `${p}${e}`, N = 500;
45
+ function P({ canWrite: e }) {
46
+ let t = d.map((e) => ({ ...e })), n = {
37
47
  departments: [o, l].map((e) => ({ ...e })),
38
48
  locations: [s, c].map((e) => ({ ...e }))
39
- }, i = 0, a = {
49
+ }, r = 0, i = {
40
50
  departments: "department",
41
51
  locations: "location"
42
- }, m = (e, t) => n.filter((n) => n[a[e]]?.id === t), _ = (e) => (t) => ({
52
+ }, a = (e, n) => t.filter((t) => t[i[e]]?.id === n), p = (e) => (t) => ({
43
53
  ...t,
44
- memberCount: m(e, t.id).length
45
- }), S = () => b(403, "Forbidden", "This token cannot change the team."), C = (t, n, r) => g(t, j(n), async (t, n) => e ? (await x(M), r(t, n)) : S()), w = (e) => !e || e === "ALL" ? n : n.filter((t) => t.status === e), T = (e) => {
46
- let t = `/${e}`;
54
+ memberCount: a(e, t.id).length
55
+ }), g = () => y(403, "Forbidden", "This token cannot change the team."), x = (t, n, r) => h(t, M(n), async (t, n) => e ? (await b(N), r(t, n)) : g()), S = (e) => !e || e === "ALL" ? t : t.filter((t) => t.status === e), C = (e) => {
56
+ let s = `/${e}`;
47
57
  return [
48
- g("GET", j(t), ({ query: t }) => v(A(r[e].map(_(e)), t))),
49
- g("GET", j(`${t}/:id`), ({ query: t }, { id: n }) => {
50
- let i = r[e].find((e) => e.id === n);
51
- return i ? v({
58
+ h("GET", M(s), ({ query: t }) => _(j(n[e].map(p(e)), t))),
59
+ h("GET", M(`${s}/:id`), ({ query: t }, { id: r }) => {
60
+ let i = n[e].find((e) => e.id === r);
61
+ return i ? _({
52
62
  ...i,
53
- members: A(m(e, n).map((e) => ({
63
+ members: j(a(e, r).map((e) => ({
54
64
  id: e.id,
55
65
  name: e.name,
56
66
  email: e.email,
@@ -59,26 +69,26 @@ function N({ canWrite: e }) {
59
69
  createdDateTime: e.createdDateTime,
60
70
  lastLoggedInDateTime: e.lastLoggedInDateTime
61
71
  })), t)
62
- }) : b(404, "Not Found", "No such group.");
72
+ }) : y(404, "Not Found", "No such group.");
63
73
  }),
64
- C("POST", t, (t) => {
65
- i += 1;
66
- let n = {
74
+ x("POST", s, (t) => {
75
+ r += 1;
76
+ let i = {
67
77
  ...o,
68
- id: f(20 + i),
69
- name: h(t)?.name ?? "New group",
78
+ id: f(20 + r),
79
+ name: m(t)?.name ?? "New group",
70
80
  memberCount: 0
71
81
  };
72
- return r[e] = [...r[e], n], v(n, 201);
82
+ return n[e] = [...n[e], i], _(i, 201);
73
83
  }),
74
- C("PUT", `${t}/:id`, (t, { id: n }) => k(e, t, n)),
75
- C("DELETE", `${t}/:id`, (t, { id: i }) => (r[e] = r[e].filter((e) => e.id !== i), n = n.map((t) => t[a[e]]?.id === i ? {
84
+ x("PUT", `${s}/:id`, (t, { id: n }) => w(e, t, n)),
85
+ x("DELETE", `${s}/:id`, (r, { id: a }) => (n[e] = n[e].filter((e) => e.id !== a), t = t.map((t) => t[i[e]]?.id === a ? {
76
86
  ...t,
77
- [a[e]]: null
78
- } : t), y())),
79
- C("POST", `${t}/:id/members`, (t, { id: i }) => {
80
- let o = r[e].find((e) => e.id === i), s = h(t);
81
- return !o || !s?.userIds || (n = n.map((t) => {
87
+ [i[e]]: null
88
+ } : t), v())),
89
+ x("POST", `${s}/:id/members`, (r, { id: a }) => {
90
+ let o = n[e].find((e) => e.id === a), s = m(r);
91
+ return !o || !s?.userIds || (t = t.map((t) => {
82
92
  if (!s.userIds?.includes(t.id)) return t;
83
93
  let n = s.type === "REMOVE" ? null : {
84
94
  id: o.id,
@@ -86,45 +96,45 @@ function N({ canWrite: e }) {
86
96
  };
87
97
  return {
88
98
  ...t,
89
- [a[e]]: n
99
+ [i[e]]: n
90
100
  };
91
- })), y();
101
+ })), v();
92
102
  })
93
103
  ];
94
- }, k = (e, t, i) => {
95
- let o = h(t)?.name;
96
- r[e] = r[e].map((e) => e.id === i && o ? {
104
+ }, w = (e, r, a) => {
105
+ let o = m(r)?.name;
106
+ n[e] = n[e].map((e) => e.id === a && o ? {
97
107
  ...e,
98
108
  name: o
99
- } : e), n = n.map((t) => t[a[e]]?.id === i && o ? {
109
+ } : e), t = t.map((t) => t[i[e]]?.id === a && o ? {
100
110
  ...t,
101
- [a[e]]: {
102
- id: i,
111
+ [i[e]]: {
112
+ id: a,
103
113
  name: o
104
114
  }
105
115
  } : t);
106
- let s = r[e].find((e) => e.id === i);
107
- return s ? v(_(e)(s)) : b(404, "Not Found", "");
116
+ let s = n[e].find((e) => e.id === a);
117
+ return s ? _(p(e)(s)) : y(404, "Not Found", "");
108
118
  };
109
119
  return [
110
- g("GET", `${p}/entity-users/me`, () => v(D)),
111
- g("GET", `${p}/entity-users/my-entity`, () => v(t)),
112
- g("GET", j("/disclosures"), () => v(O)),
113
- g("GET", j("/users"), ({ query: e }) => v(A(w(e.get("Status")), e))),
114
- g("GET", j("/roles"), ({ query: e }) => v(A(E, e))),
115
- g("GET", j("/roles/:id/permissions"), () => v({ data: [] })),
116
- C("POST", "/users", (e) => {
117
- let t = h(e), r = n.find((e) => e.email === t.email), a = r ?? {
120
+ h("GET", M("/users/me"), () => _(D)),
121
+ h("GET", M("/organizations/:id"), () => _(O)),
122
+ h("GET", M("/disclosures"), () => _(k)),
123
+ h("GET", M("/users"), ({ query: e }) => _(j(S(e.get("Status")), e))),
124
+ h("GET", M("/roles"), ({ query: e }) => _(j(E, e))),
125
+ h("GET", M("/roles/:id/permissions"), () => _({ data: [] })),
126
+ x("POST", "/users", (e) => {
127
+ let n = m(e), i = t.find((e) => e.email === n.email), a = i ?? {
118
128
  ...u,
119
- id: f(30 + (i += 1)),
120
- name: t.name || "New member",
121
- email: t.email || "new.member@example.test",
122
- jobTitle: t.jobTitle ?? null,
123
- reportingManagerUserId: t.reportingManagerUserId ?? null,
129
+ id: f(30 + (r += 1)),
130
+ name: n.name || "New member",
131
+ email: n.email || "new.member@example.test",
132
+ jobTitle: n.jobTitle ?? null,
133
+ reportingManagerUserId: n.reportingManagerUserId ?? null,
124
134
  role: null,
125
135
  createdDateTime: (/* @__PURE__ */ new Date()).toISOString()
126
136
  };
127
- return r || (n = [...n, a]), v({
137
+ return i || (t = [...t, a]), _({
128
138
  id: a.id,
129
139
  createdAt: a.createdDateTime,
130
140
  email: a.email,
@@ -135,56 +145,57 @@ function N({ canWrite: e }) {
135
145
  status: a.status
136
146
  }, 201);
137
147
  }),
138
- C("PATCH", "/users/:id", (e, { id: t }) => {
139
- let r = h(e);
140
- n = n.map((e) => e.id === t ? {
148
+ x("PATCH", "/users/:id", (e, { id: n }) => {
149
+ let r = m(e);
150
+ t = t.map((e) => e.id === n ? {
141
151
  ...e,
142
152
  ...r,
143
- id: t
153
+ id: n
144
154
  } : e);
145
- let i = n.find((e) => e.id === t);
146
- return i ? v(i) : b(404, "Not Found", "No such user.");
155
+ let i = t.find((e) => e.id === n);
156
+ return i ? _(i) : y(404, "Not Found", "No such user.");
147
157
  }),
148
- C("POST", "/users/:id/disable", (e, { id: t }) => (n = n.map((e) => e.id === t ? {
158
+ x("POST", "/users/:id/disable", (e, { id: n }) => (t = t.map((e) => e.id === n ? {
149
159
  ...e,
150
160
  status: "INACTIVE"
151
- } : e), v({
152
- userId: t,
161
+ } : e), _({
162
+ userId: n,
153
163
  isEnabled: !1
154
164
  }))),
155
- C("POST", "/roles/:id/members", (e, { id: t }) => {
156
- let r = E.find((e) => e.id === t), i = h(e);
157
- return r && i?.userIds && (n = n.map((e) => i.userIds?.includes(e.id) ? {
165
+ x("POST", "/roles/:id/members", (e, { id: n }) => {
166
+ let r = E.find((e) => e.id === n), i = m(e);
167
+ return r && i?.userIds && (t = t.map((e) => i.userIds?.includes(e.id) ? {
158
168
  ...e,
159
169
  role: i.type === "REMOVE" ? null : r.key
160
- } : e)), y();
170
+ } : e)), v();
161
171
  }),
162
- ...T("departments"),
163
- ...T("locations")
172
+ ...C("departments"),
173
+ ...C("locations")
164
174
  ];
165
175
  }
166
- var P = [
176
+ var F = [
167
177
  e.UserReadOrg,
168
178
  e.RoleReadOrg,
169
- e.UserWriteOrg
170
- ], F = [e.UserReadOrg, e.RoleReadOrg], I = (t, n, r) => ({
179
+ e.UserWriteOrg,
180
+ e.OrganizationReadOrg
181
+ ], I = [e.UserReadOrg, e.RoleReadOrg], L = (t, n, r) => ({
171
182
  key: t,
172
- ...C.scenarios[t],
173
- routes: () => [_(n, { bankName: w }), ...N({ canWrite: n.includes(e.UserWriteOrg) })],
183
+ ...S.scenarios[t],
184
+ routes: () => [g(n, { bankName: C }), ...P({ canWrite: n.includes(e.UserWriteOrg) })],
174
185
  props: {
175
- profileContactUrl: T,
186
+ profileContactUrl: w,
176
187
  ...r
177
188
  }
178
- }), L = [
179
- I("team", P, { defaultSelectedSection: "team" }),
180
- I("profile", P, { defaultSelectedSection: "profile" }),
181
- I("legal", P, { defaultSelectedSection: "legal" }),
182
- I("help", P, {
189
+ }), R = [
190
+ L("team", F, { defaultSelectedSection: "team" }),
191
+ L("profile", F, { defaultSelectedSection: "profile" }),
192
+ L("legal", F, { defaultSelectedSection: "legal" }),
193
+ L("help", F, {
183
194
  defaultSelectedSection: "help",
184
- helpContactUrl: T
195
+ helpContactUrl: w
185
196
  }),
186
- I("read-only-team", F, { defaultSelectedSection: "team" }),
187
- I("no-team", [], { defaultSelectedSection: "team" })
197
+ L("read-only-team", I, { defaultSelectedSection: "team" }),
198
+ L("no-team", [], { defaultSelectedSection: "team" })
188
199
  ];
189
200
  //#endregion
190
- export { L as settingsScenarios };
201
+ export { R as settingsScenarios };
@@ -2,27 +2,33 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { getEntityUsersMyEntityOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
- import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
- import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
9
- import { useCurrentUserQuery as i } from "../../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
5
+ import { getMeOptions as e, getOrganizationOptions as t } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as n } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { useEmbedApi as r } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as i } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
10
9
  import "../../../../shared/data-access/dist/index.js";
11
10
  import { useQuery as a } from "@tanstack/react-query";
12
11
  //#region ../../libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js
13
- function o({ enabled: o } = {}) {
14
- let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = !!(c && l) && (o === !0 || o === void 0);
12
+ function o({ enabled: o, readOrganization: s = !0 } = {}) {
13
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = r(), p = !!(l && u) && (o === !0 || o === void 0), m = i(l), h = {
14
+ authEpoch: d,
15
+ organizationStatus: f
16
+ };
15
17
  return {
16
- userQuery: i({ enabled: f }),
17
- entityQuery: a({
18
- ...t(e({
19
- client: s,
20
- headers: r(c)
21
- }), {
22
- authEpoch: u,
23
- organizationStatus: d
24
- }),
25
- enabled: f
18
+ userQuery: a({
19
+ ...n(e({
20
+ client: c,
21
+ headers: m
22
+ }), h),
23
+ enabled: p
24
+ }),
25
+ organizationQuery: a({
26
+ ...n(t({
27
+ client: c,
28
+ path: { organizationId: l ?? "" },
29
+ headers: m
30
+ }), h),
31
+ enabled: p && s
26
32
  })
27
33
  };
28
34
  }
@@ -9,7 +9,6 @@ var e = {
9
9
  legalNameLabel: "Legal name",
10
10
  companyAddressLabel: "Company address",
11
11
  companyPhoneLabel: "Company phone",
12
- companyEmailLabel: "Company email",
13
12
  emptyValue: "-"
14
13
  };
15
14
  //#endregion
@@ -3,120 +3,113 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { formatPhoneDisplay as e } from "../../../../shared/util/dist/lib/formatPhoneDisplay.js";
6
- import { useAnalyticsTrack as t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
7
- import { WidgetProvider as n } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
8
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
6
+ import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
7
+ import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
8
+ import "../../../../shared/data-access/dist/index.js";
9
+ import { useAnalyticsTrack as r } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
10
+ import { WidgetProvider as i } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
11
+ import { useWidgetConfig as a } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
12
  import "../../../../shared/feature/dist/index.js";
10
- import { DEFAULT_FEATURE_LABELS as i } from "./index3.js";
11
- import { ProfileWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "./index2.js";
12
- import { useProfileQuery as s } from "../../data-access/dist/index2.js";
13
+ import { DEFAULT_FEATURE_LABELS as o } from "./index3.js";
14
+ import { ProfileWidgetAnalyticsEvent as s, WIDGET_NAME as c } from "./index2.js";
15
+ import { useProfileQuery as l } from "../../data-access/dist/index2.js";
13
16
  import "../../data-access/dist/index.js";
14
- import { ProfileCard as c } from "../../ui/dist/index3.js";
17
+ import { ProfileCard as u } from "../../ui/dist/index3.js";
15
18
  import "../../ui/dist/index.js";
16
- import { useCallback as l, useEffect as u, useState as d } from "react";
17
- import { jsx as f } from "react/jsx-runtime";
19
+ import { useCallback as d, useEffect as f, useState as p } from "react";
20
+ import { jsx as m } from "react/jsx-runtime";
18
21
  //#region ../../libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js
19
- var p = {
22
+ var h = {
20
23
  Personal: "personal",
21
24
  Business: "business"
22
25
  };
23
- function m(e, t) {
26
+ function g(e, t) {
24
27
  return e?.trim() ? e : t;
25
28
  }
26
- function h(e) {
27
- return [e?.first_name, e?.last_name].filter((e) => !!e?.trim()).join(" ");
28
- }
29
- function g(e) {
29
+ function _(e) {
30
30
  if (!e) return "";
31
- let t = [e.line1, e.line2].filter((e) => !!e?.trim()).join(" "), n = [e.state, e.postal_code].filter((e) => !!e?.trim()).join(" ");
31
+ let t = [e.address1, e.address2].filter((e) => !!e?.trim()).join(" "), n = [e.stateOrProvince, e.postalCode].filter((e) => !!e?.trim()).join(" ");
32
32
  return [
33
33
  t,
34
34
  e.city,
35
35
  n
36
36
  ].filter((e) => !!e?.trim()).join(", ");
37
37
  }
38
- function _(e) {
39
- return e ? e.type === "organization" ? e.organization.legal_name : [e.individual.first_name, e.individual.last_name].filter((e) => !!e?.trim()).join(" ") : "";
40
- }
41
- function v({ labels: n, featureLabels: o, contactUrl: v }) {
38
+ function v({ labels: i, featureLabels: c, contactUrl: v }) {
42
39
  let y = {
43
- ...i,
44
- ...o
45
- }, b = t();
46
- u(() => {
47
- b(a.Mounted);
40
+ ...o,
41
+ ...c
42
+ }, b = r();
43
+ f(() => {
44
+ b(s.Mounted);
48
45
  }, [b]);
49
- let [x, S] = d(p.Personal), C = l((e) => {
50
- (e === p.Personal || e === p.Business) && S(e);
51
- }, []), { initResponse: w } = r(), T = w?.bankName ?? void 0, { userQuery: E, entityQuery: D } = s(), O = E.isLoading || D.isLoading, k = E.isError || D.isError, A = E.data, j = D.data, M = x === p.Personal, N = h(A), P = y.emptyValue, F = m(_(j), P), I = M ? [
46
+ let [x, S] = p(h.Personal), C = d((e) => {
47
+ (e === h.Personal || e === h.Business) && S(e);
48
+ }, []), { initResponse: w } = a(), T = w?.bankName ?? void 0, E = t(w?.scopes, [n.OrganizationReadOrg]), { userQuery: D, organizationQuery: O } = l({ readOrganization: E }), k = D.data, A = O.data, j = !E || x === h.Personal, M = j ? D : O, N = M.isLoading, P = M.isError, F = y.emptyValue, I = g(k?.name, F), L = g(A?.legalName, F), R = j ? [
52
49
  {
53
50
  label: y.nameLabel,
54
- value: m(N, P)
51
+ value: I
55
52
  },
56
53
  {
57
54
  label: y.phoneLabel,
58
- value: e(A?.phone, P)
55
+ value: e(k?.phoneNumber, F)
59
56
  },
60
57
  {
61
58
  label: y.emailLabel,
62
- value: m(A?.email, P)
59
+ value: g(k?.email, F)
63
60
  }
64
61
  ] : [
65
62
  {
66
63
  label: y.legalNameLabel,
67
- value: F
64
+ value: L
68
65
  },
69
66
  {
70
67
  label: y.companyAddressLabel,
71
- value: m(g(j?.address), P)
68
+ value: g(_(A?.address), F)
72
69
  },
73
70
  {
74
71
  label: y.companyPhoneLabel,
75
- value: e(j?.phone, P)
76
- },
77
- {
78
- label: y.companyEmailLabel,
79
- value: m(j?.email, P)
72
+ value: e(A?.phoneNumber, F)
80
73
  }
81
74
  ];
82
- return /* @__PURE__ */ f(c, {
83
- labels: n,
75
+ return /* @__PURE__ */ m(u, {
76
+ labels: i,
84
77
  tabs: [{
85
- id: p.Personal,
78
+ id: h.Personal,
86
79
  label: y.personalTab
87
- }, {
88
- id: p.Business,
80
+ }, ...E ? [{
81
+ id: h.Business,
89
82
  label: y.businessTab
90
- }],
91
- activeTabId: x,
83
+ }] : []],
84
+ activeTabId: j ? h.Personal : h.Business,
92
85
  onTabChange: C,
93
- bannerTone: M ? "primary" : "secondary",
94
- title: M ? m(N, P) : F,
86
+ bannerTone: j ? "primary" : "secondary",
87
+ title: j ? I : L,
95
88
  subtitle: y.subtitle,
96
89
  bankName: T,
97
90
  contactUrl: v,
98
- fields: I,
99
- isLoading: O,
100
- isError: k
91
+ fields: R,
92
+ isLoading: N,
93
+ isError: P
101
94
  });
102
95
  }
103
- function y({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: p, disclosuresAcceptance: m, providerLabels: h, ...g }) {
104
- return /* @__PURE__ */ f(n, {
105
- widgetName: o,
96
+ function y({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: h, ...g }) {
97
+ return /* @__PURE__ */ m(i, {
98
+ widgetName: c,
106
99
  baseUrl: e,
107
100
  widgetToken: t,
108
- organizationId: r,
109
- configClient: i,
101
+ organizationId: n,
102
+ configClient: r,
110
103
  gatewayRouting: a,
111
- linkComponent: s,
112
- implementation: c,
104
+ linkComponent: o,
105
+ implementation: s,
113
106
  uiFramework: l,
114
107
  errorFallback: u,
115
108
  onError: d,
116
- analytics: p,
117
- disclosuresAcceptance: m,
109
+ analytics: f,
110
+ disclosuresAcceptance: p,
118
111
  providerLabels: h,
119
- children: /* @__PURE__ */ f(v, { ...g })
112
+ children: /* @__PURE__ */ m(v, { ...g })
120
113
  });
121
114
  }
122
115
  //#endregion