@vtex/faststore-plugin-buyer-portal 1.1.116-poc-9 → 1.2.1

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 (41) hide show
  1. package/package.json +42 -42
  2. package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +0 -1
  3. package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +0 -1
  4. package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +0 -1
  5. package/src/features/collections/layouts/CollectionsLayout/CollectionsLayout.tsx +0 -1
  6. package/src/features/contracts/hooks/index.ts +0 -2
  7. package/src/features/contracts/services/get-contract-details.service.ts +0 -4
  8. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +0 -1
  9. package/src/features/custom-fields/layouts/CustomFieldsLayout/CustomFieldsLayout.tsx +0 -1
  10. package/src/features/org-units/clients/OrgUnitClient.ts +15 -2
  11. package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbLink.tsx +0 -1
  12. package/src/features/org-units/hooks/index.ts +0 -1
  13. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +29 -32
  14. package/src/features/org-units/services/get-org-unit-basic-data.service.ts +0 -4
  15. package/src/features/org-units/services/get-org-unit-by-user-id.service.ts +0 -4
  16. package/src/features/org-units/types/OrgUnitSummaryData.ts +0 -18
  17. package/src/features/org-units/types/index.ts +0 -2
  18. package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +0 -1
  19. package/src/features/profile/layouts/ProfileLayout/ProfileLayout.tsx +16 -46
  20. package/src/features/shared/components/Error/Error.tsx +13 -12
  21. package/src/features/shared/components/index.ts +0 -1
  22. package/src/features/shared/components/withErrorBoundary/withErrorBoundary.tsx +1 -0
  23. package/src/features/shared/hooks/index.ts +0 -2
  24. package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +9 -14
  25. package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +0 -1
  26. package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +27 -6
  27. package/src/features/shared/utils/withAuthLoader.ts +1 -1
  28. package/src/features/shared/utils/withAuthProvider.tsx +0 -1
  29. package/src/features/shared/utils/withProviders.tsx +2 -1
  30. package/src/features/users/services/get-user-by-id.service.ts +0 -4
  31. package/src/pages/org-unit-details.tsx +62 -42
  32. package/src/pages/profile.tsx +64 -48
  33. package/src/themes/index.scss +0 -1
  34. package/src/features/contracts/hooks/useContractDetails.ts +0 -22
  35. package/src/features/contracts/hooks/useContractsByOrgUnitId.ts +0 -20
  36. package/src/features/org-units/hooks/useOrgUnitBasicData.ts +0 -20
  37. package/src/features/shared/components/PageLoader/PageLoader.tsx +0 -47
  38. package/src/features/shared/components/PageLoader/index.ts +0 -1
  39. package/src/features/shared/components/PageLoader/page-loader.scss +0 -22
  40. package/src/features/shared/hooks/useAuth.ts +0 -50
  41. package/src/features/shared/hooks/useCookieMonitor.ts +0 -73
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
1
  {
2
- "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.1.116-poc-9",
4
- "description": "A plugin for faststore with buyer portal",
5
- "main": "index.js",
6
- "scripts": {
7
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
8
- "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
9
- "prepare": "husky"
10
- },
11
- "lint-staged": {
12
- "*.{js,jsx,ts,tsx}": [
13
- "eslint --fix"
14
- ]
15
- },
16
- "dependencies": {
17
- "@types/react-dom": "^19.0.3",
18
- "react-dom": "^19.0.0"
19
- },
20
- "devDependencies": {
21
- "@eslint/js": "^9.29.0",
22
- "@faststore/core": "^3.41.5",
23
- "@faststore/ui": "^3.41.5",
24
- "@types/react": "^18.2.42",
25
- "cypress": "13",
26
- "eslint": "^9.29.0",
27
- "eslint-config-prettier": "^10.1.5",
28
- "eslint-plugin-import": "^2.32.0",
29
- "eslint-plugin-prettier": "^5.5.1",
30
- "eslint-plugin-react": "^7.37.5",
31
- "globals": "^16.2.0",
32
- "husky": "^9.1.7",
33
- "lint-staged": "^16.1.2",
34
- "next": "13.5.7",
35
- "typescript": "4.7.3",
36
- "typescript-eslint": "^8.35.0"
37
- },
38
- "peerDependencies": {
39
- "react": "^18.2.0",
40
- "react-dom": "^18.2.0"
41
- },
42
- "license": "MIT",
43
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
2
+ "name": "@vtex/faststore-plugin-buyer-portal",
3
+ "version": "1.2.1",
4
+ "description": "A plugin for faststore with buyer portal",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
8
+ "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
9
+ "prepare": "husky"
10
+ },
11
+ "lint-staged": {
12
+ "*.{js,jsx,ts,tsx}": [
13
+ "eslint --fix"
14
+ ]
15
+ },
16
+ "dependencies": {
17
+ "@types/react-dom": "^19.0.3",
18
+ "react-dom": "^19.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@eslint/js": "^9.29.0",
22
+ "@faststore/core": "^3.41.5",
23
+ "@faststore/ui": "^3.41.5",
24
+ "@types/react": "^18.2.42",
25
+ "cypress": "13",
26
+ "eslint": "^9.29.0",
27
+ "eslint-config-prettier": "^10.1.5",
28
+ "eslint-plugin-import": "^2.32.0",
29
+ "eslint-plugin-prettier": "^5.5.1",
30
+ "eslint-plugin-react": "^7.37.5",
31
+ "globals": "^16.2.0",
32
+ "husky": "^9.1.7",
33
+ "lint-staged": "^16.1.2",
34
+ "next": "13.5.7",
35
+ "typescript": "4.7.3",
36
+ "typescript-eslint": "^8.35.0"
37
+ },
38
+ "peerDependencies": {
39
+ "react": "^18.2.0",
40
+ "react-dom": "^18.2.0"
41
+ },
42
+ "license": "MIT",
43
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
44
44
  }
@@ -124,7 +124,6 @@ export const AddressDetailsLayout = ({
124
124
  image: undefined,
125
125
  name: user?.name ?? "",
126
126
  role: user?.role ?? "",
127
- id: user?.id ?? "",
128
127
  }}
129
128
  >
130
129
  <section data-fs-address-details-section>
@@ -114,7 +114,6 @@ export const AddressLayout = ({
114
114
  image: undefined,
115
115
  name: user?.name ?? "",
116
116
  role: user?.role ?? "",
117
- id: user?.id ?? "",
118
117
  }}
119
118
  >
120
119
  <section data-fs-addresses-section>
@@ -151,7 +151,6 @@ export const BudgetsDetailsLayout = ({ budget }: BudgetsDetailsLayoutProps) => {
151
151
  image: undefined,
152
152
  name: user?.name ?? "",
153
153
  role: user?.role ?? "",
154
- id: user?.id ?? "",
155
154
  }}
156
155
  >
157
156
  <div data-fs-bp-budgets-details-layout>
@@ -72,7 +72,6 @@ export const CollectionsLayout = ({
72
72
  image: undefined,
73
73
  name: user?.name ?? "",
74
74
  role: user?.role ?? "",
75
- id: user?.id ?? "",
76
75
  }}
77
76
  >
78
77
  <section data-fs-bp-collections-container>
@@ -1,3 +1 @@
1
1
  export { useUpdateContractStatus } from "./useUpdateContractStatus";
2
- export { useContractsByOrgUnitId } from "./useContractsByOrgUnitId";
3
- export { useContractDetails } from "./useContractDetails";
@@ -15,10 +15,6 @@ const getContractDetailsFunction = async ({
15
15
  cookie,
16
16
  unitId,
17
17
  }: GetContractDetailsServiceProps) => {
18
- if (!unitId || !contractId) {
19
- return null;
20
- }
21
-
22
18
  const { contract } = await contractsClient.getContractDetails(
23
19
  unitId,
24
20
  contractId,
@@ -126,7 +126,6 @@ export const CreditCardLayout = ({ data }: CreditCardsLayoutProps) => {
126
126
  image: undefined,
127
127
  name: user?.name ?? "",
128
128
  role: user?.role ?? "",
129
- id: user?.id ?? "",
130
129
  }}
131
130
  >
132
131
  <section data-fs-credit-card-section>
@@ -214,7 +214,6 @@ export const CustomFieldsLayout = ({
214
214
  image: undefined,
215
215
  name: user?.name ?? "",
216
216
  role: user?.role ?? "",
217
- id: user?.id ?? "",
218
217
  }}
219
218
  >
220
219
  <section data-fs-bp-custom-field-container>
@@ -6,7 +6,6 @@ import type {
6
6
  OrgUnitSummaryData,
7
7
  OrgUnitSearchParams,
8
8
  OrgUnitSearchResponse,
9
- OrgUnitUserData,
10
9
  } from "../types";
11
10
 
12
11
  export class OrgUnitClient extends Client {
@@ -31,7 +30,21 @@ export class OrgUnitClient extends Client {
31
30
  }
32
31
 
33
32
  getOrgUnitByUserId(userId: string, cookie: string) {
34
- return this.get<OrgUnitUserData>(`users/${userId}/units`, {
33
+ return this.get<{
34
+ orgUnit: {
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ name: string;
38
+ path: {
39
+ ids: string;
40
+ names: string;
41
+ };
42
+ id: string;
43
+ customerGroup: {
44
+ customerIds: string[];
45
+ };
46
+ };
47
+ }>(`users/${userId}/units`, {
35
48
  headers: {
36
49
  Cookie: cookie,
37
50
  },
@@ -38,7 +38,6 @@ export const OrgUnitBreadcrumbLink = ({
38
38
  ref={linkRef as React.RefObject<HTMLAnchorElement>}
39
39
  data-fs-bp-breadcrumb-text
40
40
  href={item}
41
- data-fs-bp-breadcrumb-link
42
41
  >
43
42
  {name}
44
43
  </Link>
@@ -5,4 +5,3 @@ export { useUpdateOrgUnit } from "./useUpdateOrgUnit";
5
5
  export { useChildrenOrgUnits } from "./useChildrenOrgUnits";
6
6
  export { useOrgUnitByUser } from "./useOrgUnitByUser";
7
7
  export { useSearchOrgUnits } from "./useSearchOrgUnits";
8
- export { useOrgUnitBasicData } from "./useOrgUnitBasicData";
@@ -5,7 +5,6 @@ import {
5
5
  Skeleton,
6
6
  } from "@faststore/ui";
7
7
 
8
- import { useContractsByOrgUnitId } from "../../../contracts/hooks";
9
8
  import {
10
9
  BasicCard,
11
10
  BasicDropdownMenu,
@@ -22,14 +21,13 @@ import {
22
21
  getOrganizationSettingsLinks,
23
22
  } from "../../../shared/utils";
24
23
  import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
25
- import { useGetUserById } from "../../../users/hooks";
26
24
  import {
27
25
  AddAllToOrgUnitDropdown,
28
26
  OrgUnitBreadcrumb,
29
27
  OrgUnitDetailsNavbar,
30
28
  OrgUnitsDropdownMenu,
31
29
  } from "../../components";
32
- import { useOrgUnitBasicData, useOrgUnitByUser } from "../../hooks";
30
+ import { useOrgUnitByUser } from "../../hooks";
33
31
 
34
32
  import {
35
33
  MAX_DESKTOP_BREADCRUMB_ITEMS,
@@ -37,29 +35,28 @@ import {
37
35
  QUERY_TABLET,
38
36
  } from "./utils";
39
37
 
38
+ import type { ContractData } from "../../../contracts/types";
39
+ import type { UserData } from "../../../users/types";
40
+ import type { OrgUnitBasicData } from "../../types";
41
+
40
42
  export type OrgUnitsDetailsLayoutProps = {
41
- orgUnitId: string;
42
- userId: string;
43
+ data: {
44
+ orgUnit: OrgUnitBasicData;
45
+ contracts: ContractData[];
46
+ user: UserData | null;
47
+ };
43
48
  loading?: boolean;
44
49
  };
45
50
 
46
51
  export const OrgUnitsDetailsLayout = ({
47
- orgUnitId,
48
- userId,
49
- loading = true,
52
+ data: { orgUnit, contracts, user },
53
+ loading = false,
50
54
  }: OrgUnitsDetailsLayoutProps) => {
51
- const { orgUnit, isOrgUnitLoading } = useOrgUnitBasicData(orgUnitId);
52
-
53
- const { contracts, isContractsLoading } = useContractsByOrgUnitId(orgUnitId);
54
-
55
- const { user, isUserLoading } = useGetUserById({ orgUnitId, userId });
56
-
57
- loading = isOrgUnitLoading || isContractsLoading || isUserLoading;
58
55
  const isMobile = useMediaQuery(QUERY_TABLET);
59
56
 
60
- const isSingleContract = !contracts ? true : contracts.length <= 1;
57
+ const isSingleContract = contracts.length <= 1;
61
58
 
62
- const { orgUnit: userUnit } = useOrgUnitByUser(userId);
59
+ const { orgUnit: userUnit } = useOrgUnitByUser(user?.id ?? "");
63
60
 
64
61
  const orgUnitList = orgUnit?.path.ids.split("/").slice(1) ?? [];
65
62
 
@@ -70,7 +67,7 @@ export const OrgUnitsDetailsLayout = ({
70
67
  const breadcrumbList = orgUnitList.map((orgUnitId, index) => ({
71
68
  unitId: orgUnitId,
72
69
  item: buyerPortalRoutes.orgUnitDetails({ orgUnitId }),
73
- name: orgUnit?.path.names.split("/")[index] ?? "",
70
+ name: orgUnit.path.names.split("/")[index],
74
71
  position: index + 1,
75
72
  enabled: index >= userUnitIndex,
76
73
  }));
@@ -79,7 +76,7 @@ export const OrgUnitsDetailsLayout = ({
79
76
  <GlobalLayout>
80
77
  {/* TODO: Add person here */}
81
78
  <OrgUnitDetailsNavbar
82
- orgName={orgUnit?.name ?? ""}
79
+ orgName={orgUnit.name}
83
80
  person={{
84
81
  name: user?.name ?? "",
85
82
  role: user?.roles?.[0] ?? "",
@@ -110,8 +107,8 @@ export const OrgUnitsDetailsLayout = ({
110
107
  <BasicDropdownMenu.Trigger />
111
108
  <OrgUnitsDropdownMenu
112
109
  isComplete={false}
113
- id={orgUnitId}
114
- name={orgUnit?.name ?? ""}
110
+ id={orgUnit.id}
111
+ name={orgUnit.name}
115
112
  />
116
113
  </Dropdown>
117
114
  <Dropdown>
@@ -121,8 +118,8 @@ export const OrgUnitsDetailsLayout = ({
121
118
  <AddAllToOrgUnitDropdown
122
119
  isSingleContract={isSingleContract}
123
120
  contractId={contracts[0]?.id}
124
- unitId={orgUnitId}
125
- unitName={orgUnit?.name ?? ""}
121
+ unitId={orgUnit?.id}
122
+ unitName={orgUnit?.name}
126
123
  />
127
124
  </Dropdown>
128
125
  </HeaderInside>
@@ -132,13 +129,13 @@ export const OrgUnitsDetailsLayout = ({
132
129
  data-fs-bp-contracts-settings-card
133
130
  footerMessage="Manage contract settings"
134
131
  footerLink={buyerPortalRoutes.profileDetails({
135
- orgUnitId: orgUnitId,
132
+ orgUnitId: orgUnit.id,
136
133
  contractId: contracts[0]?.id ?? "",
137
134
  })}
138
135
  enableFooter
139
136
  >
140
- <LetterHighlight letter={orgUnit?.name?.[0] ?? ""} />
141
- <VerticalNav.Menu title={orgUnit?.name ?? ""} loading={loading}>
137
+ <LetterHighlight letter={orgUnit.name[0]} />
138
+ <VerticalNav.Menu title={orgUnit.name} loading={loading}>
142
139
  {loading
143
140
  ? Array(8)
144
141
  .fill(null)
@@ -153,7 +150,7 @@ export const OrgUnitsDetailsLayout = ({
153
150
  </li>
154
151
  ))
155
152
  : getContractSettingsLinks({
156
- orgUnitId: orgUnitId,
153
+ orgUnitId: orgUnit.id,
157
154
  contractId: contracts[0]?.id ?? "",
158
155
  }).map(({ name, link }) => (
159
156
  <VerticalNav.Link key={name} link={link}>
@@ -180,7 +177,7 @@ export const OrgUnitsDetailsLayout = ({
180
177
  />
181
178
  }
182
179
  href={buyerPortalRoutes.profileDetails({
183
- orgUnitId: orgUnitId,
180
+ orgUnitId: orgUnit.id,
184
181
  contractId: contract.id,
185
182
  })}
186
183
  menu={
@@ -199,12 +196,12 @@ export const OrgUnitsDetailsLayout = ({
199
196
  data-fs-bp-organizations-settings-card
200
197
  footerMessage="Manage organization settings"
201
198
  footerLink={buyerPortalRoutes.users({
202
- orgUnitId: orgUnitId,
199
+ orgUnitId: orgUnit.id,
203
200
  })}
204
201
  enableFooter
205
202
  >
206
203
  <VerticalNav.Menu title="Organization">
207
- {getOrganizationSettingsLinks(orgUnitId).map((option) => (
204
+ {getOrganizationSettingsLinks(orgUnit.id).map((option) => (
208
205
  <VerticalNav.Link key={option.name} link={option.link}>
209
206
  {option.name}
210
207
  </VerticalNav.Link>
@@ -215,14 +212,14 @@ export const OrgUnitsDetailsLayout = ({
215
212
  data-fs-bp-compliance-settings-card
216
213
  footerMessage="Manage finance and compliance settings"
217
214
  footerLink={buyerPortalRoutes.buyingPolicies({
218
- orgUnitId: orgUnitId,
215
+ orgUnitId: orgUnit.id,
219
216
  contractId: contracts[0]?.id,
220
217
  })}
221
218
  enableFooter
222
219
  >
223
220
  <VerticalNav.Menu title="Finance and Compliance">
224
221
  {getFinanceSettingsLinks({
225
- orgUnitId: orgUnitId,
222
+ orgUnitId: orgUnit.id,
226
223
  contractId: contracts[0]?.id ?? "",
227
224
  }).map((option) => (
228
225
  <VerticalNav.Link key={option.name} link={option.link}>
@@ -7,9 +7,5 @@ export const getOrgUnitBasicDataService = async ({
7
7
  id: string;
8
8
  cookie: string;
9
9
  }) => {
10
- if (!id) {
11
- return null;
12
- }
13
-
14
10
  return orgUnitClient.getOrgUnitBasicData(id, cookie);
15
11
  };
@@ -8,10 +8,6 @@ export const getOrgUnitByUserIdService = async ({
8
8
  cookie: string;
9
9
  }) => {
10
10
  try {
11
- if (!userId) {
12
- return null;
13
- }
14
-
15
11
  const { orgUnit } = await orgUnitClient.getOrgUnitByUserId(userId, cookie);
16
12
  return orgUnit;
17
13
  } catch {
@@ -25,21 +25,3 @@ export type OrgUnitBasicData = Pick<OrgUnitSummaryData, "id" | "name"> & {
25
25
  ids: string;
26
26
  };
27
27
  };
28
-
29
- export type UserOrgUnit = {
30
- createdAt: string;
31
- updatedAt: string;
32
- name: string;
33
- path: {
34
- ids: string;
35
- names: string;
36
- };
37
- id: string;
38
- customerGroup: {
39
- customerIds: string[];
40
- };
41
- };
42
-
43
- export type OrgUnitUserData = {
44
- orgUnit: UserOrgUnit;
45
- };
@@ -1,8 +1,6 @@
1
1
  export type {
2
2
  OrgUnitBasicData,
3
3
  OrgUnitSummaryData,
4
- OrgUnitUserData,
5
- UserOrgUnit,
6
4
  } from "./OrgUnitSummaryData";
7
5
  export type { OrgUnitData, OrgUnitHierarchyData } from "./OrgUnitsData";
8
6
  export type { OrganizationData } from "./OrganizationData";
@@ -168,7 +168,6 @@ export const PaymentMethodsLayout = ({
168
168
  image: undefined,
169
169
  name: user?.name ?? "",
170
170
  role: user?.role ?? "",
171
- id: user?.id ?? "",
172
171
  }}
173
172
  >
174
173
  <section data-fs-payment-methods-section>
@@ -1,37 +1,18 @@
1
- import { Skeleton } from "@faststore/ui";
2
-
3
- import { useContractDetails } from "../../../contracts/hooks";
4
- import { useOrgUnitBasicData } from "../../../org-units/hooks";
5
1
  import { HeaderInside } from "../../../shared/components";
2
+ import { useBuyerPortal } from "../../../shared/hooks";
6
3
  import { GlobalLayout, ContractTabsLayout } from "../../../shared/layouts";
7
- import { useGetUserById } from "../../../users/hooks";
4
+
5
+ import type { ContractData } from "../../../contracts/types";
8
6
 
9
7
  export type ProfileLayoutProps = {
10
- orgUnitId: string;
11
- contractId: string;
12
- userId: string;
13
- loading?: boolean;
8
+ data: ContractData | null;
14
9
  };
15
10
 
16
- export const ProfileLayout = ({
17
- orgUnitId,
18
- contractId,
19
- userId,
20
- loading = true,
21
- }: ProfileLayoutProps) => {
22
- const { orgUnit, isOrgUnitLoading } = useOrgUnitBasicData(orgUnitId);
23
-
24
- const { contract, isContractLoading } = useContractDetails(
25
- contractId,
26
- orgUnitId
27
- );
28
-
29
- const { user, isUserLoading } = useGetUserById({ orgUnitId, userId });
30
-
31
- loading = isContractLoading || isOrgUnitLoading || isUserLoading;
11
+ export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
12
+ const { currentOrgUnit: orgUnit, currentUser: user } = useBuyerPortal();
32
13
 
33
- const creationDate = contract
34
- ? new Date(contract.creationDate).toLocaleDateString("en-US", {
14
+ const creationDate = data
15
+ ? new Date(data.creationDate).toLocaleDateString("en-US", {
35
16
  year: "numeric",
36
17
  month: "long",
37
18
  day: "numeric",
@@ -42,41 +23,30 @@ export const ProfileLayout = ({
42
23
  <GlobalLayout>
43
24
  <ContractTabsLayout
44
25
  orgUnitName={orgUnit?.name ?? ""}
45
- orgUnitId={orgUnitId}
46
- contractName={contract?.name ?? ""}
47
- contractId={contract?.id ?? ""}
26
+ orgUnitId={orgUnit?.id ?? ""}
27
+ contractName={data?.name ?? ""}
28
+ contractId={data?.id ?? ""}
48
29
  pageName="Contract"
49
30
  person={{
50
31
  image: undefined,
51
32
  name: user?.name ?? "",
52
- role: user?.roles?.[0] ?? "",
53
- id: userId,
33
+ role: user?.role ?? "",
54
34
  }}
55
- loading={loading}
56
35
  >
57
36
  <section data-fs-bp-profile>
58
37
  <HeaderInside title="Profile" />
59
38
 
60
- {loading && !contract && (
61
- <Skeleton
62
- size={{
63
- width: "100%",
64
- height: "8rem",
65
- }}
66
- />
67
- )}
68
-
69
- {contract && (
39
+ {data && (
70
40
  <div data-fs-bp-profile-details>
71
41
  <span data-fs-bp-profile-details-title>Details</span>
72
42
 
73
- {!!contract.name && (
43
+ {!!data.name && (
74
44
  <>
75
45
  <hr data-fs-bp-profile-divider />
76
46
  <div data-fs-bp-profile-details-row>
77
47
  <span data-fs-bp-profile-details-row-label>Name</span>
78
48
  <span data-fs-bp-profile-details-row-value>
79
- {contract.name}
49
+ {data.name}
80
50
  </span>
81
51
  </div>
82
52
  </>
@@ -87,7 +57,7 @@ export const ProfileLayout = ({
87
57
  <div data-fs-bp-profile-details-row>
88
58
  <span data-fs-bp-profile-details-row-label>Email</span>
89
59
  <span data-fs-bp-profile-details-row-value>
90
- <a href={`mailto:${contract.email}`}>{contract.email}</a>
60
+ <a href={`mailto:${data.email}`}>{data.email}</a>
91
61
  </span>
92
62
  </div>
93
63
 
@@ -1,4 +1,4 @@
1
- import { isDevelopment } from "../../utils/environment";
1
+ // import { isDevelopment } from "../../utils/environment";
2
2
  import { Icon } from "../Icon";
3
3
 
4
4
  export type ErrorProps = {
@@ -20,17 +20,18 @@ export default function Error({ error }: ErrorProps) {
20
20
  <button data-fs-bp-error-button onClick={() => window.location.reload()}>
21
21
  Try again
22
22
  </button>
23
- {isDevelopment() ? (
24
- <div data-fs-bp-error-details>
25
- <span data-fs-bp-error-details-type>{error?.tags?.errorType}</span>
26
- <h2 data-fs-bp-error-details-title>Error Details</h2>
27
- <p data-fs-bp-error-details-message>{error?.error.message}</p>
28
- <p data-fs-bp-error-details-stack>Stack: {error?.error.stack}</p>
29
- <p data-fs-bp-error-details-component>
30
- Component: {error?.tags?.component}
31
- </p>
32
- </div>
33
- ) : null}
23
+ <div data-fs-bp-error-details>
24
+ <span data-fs-bp-error-details-type>{error?.tags?.errorType}</span>
25
+ <h2 data-fs-bp-error-details-title>Error Details</h2>
26
+ <p data-fs-bp-error-details-message>{error?.error.message}</p>
27
+ <p data-fs-bp-error-details-stack>Stack: {error?.error.stack}</p>
28
+ <p data-fs-bp-error-details-component>
29
+ Component: {error?.tags?.component}
30
+ </p>
31
+ <p data-fs-bp-error-details-query>
32
+ Query: {JSON.stringify(error?.query)}
33
+ </p>
34
+ </div>
34
35
  </div>
35
36
  );
36
37
  }
@@ -76,4 +76,3 @@ export { ErrorBoundary } from "./ErrorBoundary/ErrorBoundary";
76
76
  export { withErrorBoundary } from "./withErrorBoundary/withErrorBoundary";
77
77
  export { default as Error } from "./Error/Error";
78
78
  export { IconBookmarked } from "./IconBookmarked/IconBookmarked";
79
- export { PageLoader } from "./PageLoader";
@@ -15,6 +15,7 @@ type WithErrorBoundaryOptions = {
15
15
 
16
16
  export function withErrorBoundary<P extends Record<string, unknown>>(
17
17
  WrappedComponent: React.ComponentType<P>,
18
+
18
19
  options: WithErrorBoundaryOptions = {}
19
20
  ) {
20
21
  const { onError, tags } = options;
@@ -1,5 +1,4 @@
1
1
  export { useBuyerPortal } from "./useBuyerPortal";
2
- export { useCookieMonitor } from "./useCookieMonitor";
3
2
  export { useDrawerProps, type DrawerProps } from "./useDrawerProps";
4
3
  export {
5
4
  useMutation,
@@ -13,4 +12,3 @@ export { useAddToScope } from "./useAddToScope";
13
12
  export { useRemoveFromScope } from "./useRemoveFromScope";
14
13
  export { usePageItems, type UsePageItemsProps } from "./usePageItems";
15
14
  export { useRouterLoading } from "./useRouterLoading";
16
- export { useAuth, type UseAuthResult } from "./useAuth";