@vtex/faststore-plugin-buyer-portal 1.1.91 → 1.1.93
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/package.json +1 -1
- package/public/buyer-portal-icons.svg +1 -1
- package/src/features/addresses/services/get-addresses-by-unit-id.service.ts +13 -1
- package/src/features/addresses/services/get-addresses.service.ts +15 -2
- package/src/features/buying-policies/services/get-buying-policies.service.ts +19 -21
- package/src/features/contracts/services/get-contract-details.service.ts +13 -1
- package/src/features/contracts/services/get-contracts-org-by-unit-id.service.ts +18 -11
- package/src/features/contracts/services/update-contract-status.service.ts +18 -11
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +3 -1
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumb.tsx +2 -0
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbPath.tsx +12 -12
- package/src/features/org-units/components/OrgUnitBreadcrumb/org-unit-breadcrumb.scss +47 -36
- package/src/features/org-units/types/OrgUnitBreadcrumbTypes.ts +2 -0
- package/src/features/profile/layouts/ProfileLayout/profile-layout.scss +1 -0
- package/src/features/shared/clients/Client.ts +84 -8
- package/src/features/shared/components/BuyerPortalProvider/BuyerPortalProvider.tsx +4 -1
- package/src/features/shared/components/Error/Error.tsx +31 -0
- package/src/features/shared/components/Error/error.scss +71 -0
- package/src/features/shared/components/ErrorBoundary/ErrorBoundary.tsx +63 -0
- package/src/features/shared/components/ErrorBoundary/types.ts +14 -0
- package/src/features/shared/components/index.ts +3 -0
- package/src/features/shared/components/withErrorBoundary/withErrorBoundary.tsx +35 -0
- package/src/features/shared/layouts/BaseTabsLayout/Navbar.tsx +1 -1
- package/src/features/shared/layouts/BaseTabsLayout/SidebarMenu.tsx +9 -2
- package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +9 -6
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +4 -2
- package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +119 -0
- package/src/features/shared/layouts/ErrorTabsLayout/error-tabs-layout.scss +1 -0
- package/src/features/shared/utils/environment.ts +41 -0
- package/src/features/shared/utils/extractErrorMessage.ts +22 -0
- package/src/features/shared/utils/getHome.tsx +5 -0
- package/src/features/shared/utils/index.ts +2 -0
- package/src/features/shared/utils/withClientErrorBoundary.ts +61 -0
- package/src/features/shared/utils/withLoaderErrorBoundary.ts +46 -0
- package/src/features/users/clients/UsersClient.ts +0 -1
- package/src/pages/address-details.tsx +38 -11
- package/src/pages/addresses.tsx +35 -6
- package/src/pages/budgets-details.tsx +38 -8
- package/src/pages/budgets.tsx +33 -8
- package/src/pages/buying-policies.tsx +36 -12
- package/src/pages/buying-policy-details.tsx +38 -8
- package/src/pages/collections.tsx +36 -12
- package/src/pages/cost-centers.tsx +38 -8
- package/src/pages/credit-cards.tsx +38 -8
- package/src/pages/home.tsx +22 -5
- package/src/pages/org-unit-details.tsx +43 -7
- package/src/pages/org-units.tsx +39 -8
- package/src/pages/payment-methods.tsx +38 -8
- package/src/pages/po-numbers.tsx +38 -8
- package/src/pages/profile.tsx +31 -6
- package/src/pages/releases.tsx +33 -8
- package/src/pages/role-details.tsx +39 -7
- package/src/pages/roles.tsx +28 -7
- package/src/pages/user-details.tsx +39 -8
- package/src/pages/users.tsx +25 -7
package/src/pages/home.tsx
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { useRouter } from "next/router";
|
|
2
2
|
|
|
3
3
|
import { getOrgUnitByUserIdService } from "../features/org-units/services";
|
|
4
|
-
import {
|
|
4
|
+
import { withErrorBoundary } from "../features/shared/components";
|
|
5
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
6
|
+
import {
|
|
7
|
+
getClientContext,
|
|
8
|
+
withLoaderErrorBoundary,
|
|
9
|
+
} from "../features/shared/utils";
|
|
5
10
|
import { buyerPortalRoutes } from "../features/shared/utils/buyerPortalRoutes";
|
|
6
11
|
|
|
7
12
|
import type { LoaderData } from "../features/shared/types";
|
|
8
13
|
|
|
9
14
|
export type HomePageData = {
|
|
10
15
|
redirected: boolean;
|
|
16
|
+
hasError?: boolean;
|
|
17
|
+
error?: ErrorBoundaryProps;
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
type HomePageQuery = {
|
|
14
21
|
contractMode?: string[];
|
|
15
22
|
};
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
const loaderFunction = async (
|
|
18
25
|
data: LoaderData<HomePageQuery>
|
|
19
|
-
): Promise<HomePageData> {
|
|
26
|
+
): Promise<HomePageData> => {
|
|
20
27
|
const { userId, cookie } = await getClientContext(data);
|
|
21
28
|
|
|
22
29
|
const userOrgUnit = await getOrgUnitByUserIdService({ userId, cookie });
|
|
@@ -38,11 +45,21 @@ export async function loader(
|
|
|
38
45
|
return {
|
|
39
46
|
redirected: true,
|
|
40
47
|
};
|
|
41
|
-
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
51
|
+
componentName: "HomePage",
|
|
52
|
+
redirectToError: true,
|
|
53
|
+
});
|
|
42
54
|
|
|
43
55
|
const HomePage = () => {
|
|
44
56
|
useRouter().reload();
|
|
45
57
|
return null;
|
|
46
58
|
};
|
|
47
59
|
|
|
48
|
-
export default HomePage
|
|
60
|
+
export default withErrorBoundary(HomePage, {
|
|
61
|
+
tags: {
|
|
62
|
+
component: "HomePage",
|
|
63
|
+
errorType: "home_error",
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { getContractsByOrgUnitIdService } from "../features/contracts/services";
|
|
2
2
|
import { OrgUnitsDetailsLayout } from "../features/org-units/layouts";
|
|
3
3
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
BuyerPortalProvider,
|
|
6
|
+
withErrorBoundary,
|
|
7
|
+
} from "../features/shared/components";
|
|
8
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
9
|
+
import {
|
|
10
|
+
type ClientContext,
|
|
11
|
+
getClientContext,
|
|
12
|
+
withLoaderErrorBoundary,
|
|
13
|
+
} from "../features/shared/utils";
|
|
6
14
|
import { getUserByIdService } from "../features/users/services";
|
|
7
15
|
|
|
8
16
|
import type { ContractData } from "../features/contracts/types";
|
|
@@ -17,15 +25,27 @@ export type OrgUnitDetailsPageData = {
|
|
|
17
25
|
user: UserData | null;
|
|
18
26
|
};
|
|
19
27
|
clientContext: ClientContext;
|
|
28
|
+
hasError?: boolean;
|
|
29
|
+
error?: {
|
|
30
|
+
error: {
|
|
31
|
+
message: string;
|
|
32
|
+
name: string;
|
|
33
|
+
stack?: string;
|
|
34
|
+
};
|
|
35
|
+
tags: {
|
|
36
|
+
component: string;
|
|
37
|
+
errorType: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
20
40
|
};
|
|
21
41
|
|
|
22
42
|
type OrgUnitDetailsPageQuery = {
|
|
23
43
|
orgUnitId: string;
|
|
24
44
|
};
|
|
25
45
|
|
|
26
|
-
|
|
46
|
+
const loaderFunction = async (
|
|
27
47
|
data: LoaderData<OrgUnitDetailsPageQuery>
|
|
28
|
-
): Promise<OrgUnitDetailsPageData> {
|
|
48
|
+
): Promise<OrgUnitDetailsPageData> => {
|
|
29
49
|
const { orgUnitId } = data.query;
|
|
30
50
|
|
|
31
51
|
const { cookie, userId, ...clientContext } = await getClientContext(data);
|
|
@@ -50,17 +70,33 @@ export async function loader(
|
|
|
50
70
|
},
|
|
51
71
|
clientContext: { cookie, userId, ...clientContext },
|
|
52
72
|
};
|
|
53
|
-
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
76
|
+
componentName: "OrgUnitDetailsPage",
|
|
77
|
+
redirectToError: true,
|
|
78
|
+
});
|
|
54
79
|
|
|
55
80
|
const OrgUnitDetailsPage = ({
|
|
56
81
|
data,
|
|
57
82
|
clientContext,
|
|
83
|
+
hasError,
|
|
84
|
+
error,
|
|
58
85
|
}: OrgUnitDetailsPageData) => {
|
|
59
86
|
return (
|
|
60
87
|
<BuyerPortalProvider clientContext={clientContext}>
|
|
61
|
-
|
|
88
|
+
{hasError ? (
|
|
89
|
+
<ErrorTabsLayout error={error} />
|
|
90
|
+
) : (
|
|
91
|
+
<OrgUnitsDetailsLayout data={data} />
|
|
92
|
+
)}
|
|
62
93
|
</BuyerPortalProvider>
|
|
63
94
|
);
|
|
64
95
|
};
|
|
65
96
|
|
|
66
|
-
export default OrgUnitDetailsPage
|
|
97
|
+
export default withErrorBoundary(OrgUnitDetailsPage, {
|
|
98
|
+
tags: {
|
|
99
|
+
component: "OrgUnitDetailsPage",
|
|
100
|
+
errorType: "org_unit_details_error",
|
|
101
|
+
},
|
|
102
|
+
});
|
package/src/pages/org-units.tsx
CHANGED
|
@@ -5,8 +5,17 @@ import {
|
|
|
5
5
|
getOrgUnitByIdService,
|
|
6
6
|
searchOrgUnitsByNameService,
|
|
7
7
|
} from "../features/org-units/services";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BuyerPortalProvider,
|
|
10
|
+
withErrorBoundary,
|
|
11
|
+
} from "../features/shared/components";
|
|
12
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
13
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
14
|
+
import {
|
|
15
|
+
type ClientContext,
|
|
16
|
+
getClientContext,
|
|
17
|
+
withLoaderErrorBoundary,
|
|
18
|
+
} from "../features/shared/utils";
|
|
10
19
|
import { getUserByIdService } from "../features/users/services";
|
|
11
20
|
|
|
12
21
|
import type {
|
|
@@ -24,6 +33,8 @@ export type OrgUnitsPageData = {
|
|
|
24
33
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
25
34
|
currentUser: UserData | null;
|
|
26
35
|
};
|
|
36
|
+
hasError?: boolean;
|
|
37
|
+
error?: ErrorBoundaryProps;
|
|
27
38
|
};
|
|
28
39
|
|
|
29
40
|
type OrgUnitsPageQuery = {
|
|
@@ -31,9 +42,9 @@ type OrgUnitsPageQuery = {
|
|
|
31
42
|
search?: string;
|
|
32
43
|
};
|
|
33
44
|
|
|
34
|
-
|
|
45
|
+
const loaderFunction = async (
|
|
35
46
|
data: LoaderData<OrgUnitsPageQuery>
|
|
36
|
-
): Promise<OrgUnitsPageData> {
|
|
47
|
+
): Promise<OrgUnitsPageData> => {
|
|
37
48
|
const { cookie, customerId, userId, ...restClientContext } =
|
|
38
49
|
await getClientContext(data);
|
|
39
50
|
|
|
@@ -107,14 +118,34 @@ export async function loader(
|
|
|
107
118
|
currentUser: user,
|
|
108
119
|
},
|
|
109
120
|
};
|
|
110
|
-
}
|
|
121
|
+
};
|
|
111
122
|
|
|
112
|
-
const
|
|
123
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
124
|
+
componentName: "OrgUnitsPage",
|
|
125
|
+
redirectToError: true,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const OrgUnitsPage = ({
|
|
129
|
+
data,
|
|
130
|
+
search,
|
|
131
|
+
context,
|
|
132
|
+
hasError,
|
|
133
|
+
error,
|
|
134
|
+
}: OrgUnitsPageData) => {
|
|
113
135
|
return (
|
|
114
136
|
<BuyerPortalProvider {...context}>
|
|
115
|
-
|
|
137
|
+
{hasError ? (
|
|
138
|
+
<ErrorTabsLayout error={error} />
|
|
139
|
+
) : (
|
|
140
|
+
<OrgUnitsLayout data={data} search={search} />
|
|
141
|
+
)}
|
|
116
142
|
</BuyerPortalProvider>
|
|
117
143
|
);
|
|
118
144
|
};
|
|
119
145
|
|
|
120
|
-
export default OrgUnitsPage
|
|
146
|
+
export default withErrorBoundary(OrgUnitsPage, {
|
|
147
|
+
tags: {
|
|
148
|
+
component: "OrgUnitsPage",
|
|
149
|
+
errorType: "org_units_error",
|
|
150
|
+
},
|
|
151
|
+
});
|
|
@@ -5,8 +5,17 @@ import {
|
|
|
5
5
|
getPaymentMethodsByUnitIdService,
|
|
6
6
|
GetPaymentMethodsByUnitIdServiceProps,
|
|
7
7
|
} from "../features/payment-methods/services";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BuyerPortalProvider,
|
|
10
|
+
withErrorBoundary,
|
|
11
|
+
} from "../features/shared/components";
|
|
12
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
13
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
14
|
+
import {
|
|
15
|
+
type ClientContext,
|
|
16
|
+
getClientContext,
|
|
17
|
+
withLoaderErrorBoundary,
|
|
18
|
+
} from "../features/shared/utils";
|
|
10
19
|
import { getUserByIdService } from "../features/users/services";
|
|
11
20
|
|
|
12
21
|
import type { ContractData } from "../features/contracts/types";
|
|
@@ -24,6 +33,8 @@ export type PaymentMethodsPageData = {
|
|
|
24
33
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
25
34
|
currentUser: UserData | null;
|
|
26
35
|
};
|
|
36
|
+
hasError?: boolean;
|
|
37
|
+
error?: ErrorBoundaryProps;
|
|
27
38
|
};
|
|
28
39
|
|
|
29
40
|
export type PaymentMethodsPageQuery = GetPaymentMethodsByUnitIdServiceProps & {
|
|
@@ -31,9 +42,9 @@ export type PaymentMethodsPageQuery = GetPaymentMethodsByUnitIdServiceProps & {
|
|
|
31
42
|
contractId: string;
|
|
32
43
|
};
|
|
33
44
|
|
|
34
|
-
|
|
45
|
+
const loaderFunction = async (
|
|
35
46
|
data: LoaderData<PaymentMethodsPageQuery>
|
|
36
|
-
): Promise<PaymentMethodsPageData> {
|
|
47
|
+
): Promise<PaymentMethodsPageData> => {
|
|
37
48
|
const { contractId, orgUnitId, search } = data.query;
|
|
38
49
|
|
|
39
50
|
const { cookie, userId, ...clientContext } = await getClientContext(data);
|
|
@@ -67,12 +78,31 @@ export async function loader(
|
|
|
67
78
|
currentContract: contract,
|
|
68
79
|
},
|
|
69
80
|
};
|
|
70
|
-
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
84
|
+
componentName: "PaymentMethodsPage",
|
|
85
|
+
redirectToError: true,
|
|
86
|
+
});
|
|
71
87
|
|
|
72
|
-
const PaymentMethodsPage = ({
|
|
88
|
+
const PaymentMethodsPage = ({
|
|
89
|
+
data,
|
|
90
|
+
context,
|
|
91
|
+
hasError,
|
|
92
|
+
error,
|
|
93
|
+
}: PaymentMethodsPageData) => (
|
|
73
94
|
<BuyerPortalProvider {...context}>
|
|
74
|
-
|
|
95
|
+
{hasError ? (
|
|
96
|
+
<ErrorTabsLayout error={error} />
|
|
97
|
+
) : (
|
|
98
|
+
<PaymentMethodsLayout data={data} />
|
|
99
|
+
)}
|
|
75
100
|
</BuyerPortalProvider>
|
|
76
101
|
);
|
|
77
102
|
|
|
78
|
-
export default PaymentMethodsPage
|
|
103
|
+
export default withErrorBoundary(PaymentMethodsPage, {
|
|
104
|
+
tags: {
|
|
105
|
+
component: "PaymentMethodsPage",
|
|
106
|
+
errorType: "payment_methods_error",
|
|
107
|
+
},
|
|
108
|
+
});
|
package/src/pages/po-numbers.tsx
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { getContractDetailsService } from "../features/contracts/services";
|
|
2
2
|
import { CustomFieldsLayout } from "../features/custom-fields/layouts";
|
|
3
3
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
BuyerPortalProvider,
|
|
6
|
+
withErrorBoundary,
|
|
7
|
+
} from "../features/shared/components";
|
|
8
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
9
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
10
|
+
import {
|
|
11
|
+
ClientContext,
|
|
12
|
+
getClientContext,
|
|
13
|
+
withLoaderErrorBoundary,
|
|
14
|
+
} from "../features/shared/utils";
|
|
6
15
|
import { getUserByIdService } from "../features/users/services";
|
|
7
16
|
|
|
8
17
|
import type { ContractData } from "../features/contracts/types";
|
|
@@ -19,6 +28,8 @@ export type PONumbersPageData = {
|
|
|
19
28
|
currentUser: UserData | null;
|
|
20
29
|
search: string;
|
|
21
30
|
};
|
|
31
|
+
hasError?: boolean;
|
|
32
|
+
error?: ErrorBoundaryProps;
|
|
22
33
|
};
|
|
23
34
|
|
|
24
35
|
type OrgUnitsPageQuery = {
|
|
@@ -27,9 +38,9 @@ type OrgUnitsPageQuery = {
|
|
|
27
38
|
search?: string;
|
|
28
39
|
};
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
const loaderFunction = async (
|
|
31
42
|
data: LoaderData<OrgUnitsPageQuery>
|
|
32
|
-
): Promise<PONumbersPageData> {
|
|
43
|
+
): Promise<PONumbersPageData> => {
|
|
33
44
|
const { customerId, cookie, userId, ...clientContext } =
|
|
34
45
|
await getClientContext(data);
|
|
35
46
|
|
|
@@ -58,14 +69,33 @@ export async function loader(
|
|
|
58
69
|
currentUser: user,
|
|
59
70
|
},
|
|
60
71
|
};
|
|
61
|
-
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
75
|
+
componentName: "PONumbersPage",
|
|
76
|
+
redirectToError: true,
|
|
77
|
+
});
|
|
62
78
|
|
|
63
|
-
const PONumbersPage = ({
|
|
79
|
+
const PONumbersPage = ({
|
|
80
|
+
data,
|
|
81
|
+
context,
|
|
82
|
+
hasError,
|
|
83
|
+
error,
|
|
84
|
+
}: PONumbersPageData) => {
|
|
64
85
|
return (
|
|
65
86
|
<BuyerPortalProvider {...context}>
|
|
66
|
-
|
|
87
|
+
{hasError ? (
|
|
88
|
+
<ErrorTabsLayout error={error} />
|
|
89
|
+
) : (
|
|
90
|
+
<CustomFieldsLayout data={data} customFieldsLabel="PO Number" />
|
|
91
|
+
)}
|
|
67
92
|
</BuyerPortalProvider>
|
|
68
93
|
);
|
|
69
94
|
};
|
|
70
95
|
|
|
71
|
-
export default PONumbersPage
|
|
96
|
+
export default withErrorBoundary(PONumbersPage, {
|
|
97
|
+
tags: {
|
|
98
|
+
component: "PONumbersPage",
|
|
99
|
+
errorType: "po_numbers_error",
|
|
100
|
+
},
|
|
101
|
+
});
|
package/src/pages/profile.tsx
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { getContractDetailsService } from "../features/contracts/services";
|
|
2
2
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
3
3
|
import { ProfileLayout } from "../features/profile/layouts";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
BuyerPortalProvider,
|
|
6
|
+
withErrorBoundary,
|
|
7
|
+
} from "../features/shared/components";
|
|
8
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
9
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
10
|
+
import {
|
|
11
|
+
type ClientContext,
|
|
12
|
+
getClientContext,
|
|
13
|
+
withLoaderErrorBoundary,
|
|
14
|
+
} from "../features/shared/utils";
|
|
6
15
|
import { getUserByIdService } from "../features/users/services";
|
|
7
16
|
|
|
8
17
|
import type { ContractData } from "../features/contracts/types";
|
|
@@ -18,6 +27,8 @@ export type ProfilePageData = {
|
|
|
18
27
|
currentContract: ContractData | null;
|
|
19
28
|
currentUser: UserData | null;
|
|
20
29
|
};
|
|
30
|
+
hasError?: boolean;
|
|
31
|
+
error?: ErrorBoundaryProps;
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
export type ProfilePageQuery = {
|
|
@@ -25,7 +36,7 @@ export type ProfilePageQuery = {
|
|
|
25
36
|
orgUnitId: string;
|
|
26
37
|
};
|
|
27
38
|
|
|
28
|
-
export async function
|
|
39
|
+
export async function loaderFunction(
|
|
29
40
|
data: LoaderData<ProfilePageQuery>
|
|
30
41
|
): Promise<ProfilePageData> {
|
|
31
42
|
const { customerId, cookie, userId, ...clientContext } =
|
|
@@ -57,10 +68,24 @@ export async function loader(
|
|
|
57
68
|
};
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
const
|
|
71
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
72
|
+
componentName: "ProfilePage",
|
|
73
|
+
redirectToError: true,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const ProfilePage = ({ data, context, hasError, error }: ProfilePageData) => (
|
|
61
77
|
<BuyerPortalProvider {...context}>
|
|
62
|
-
|
|
78
|
+
{hasError ? (
|
|
79
|
+
<ErrorTabsLayout error={error} />
|
|
80
|
+
) : (
|
|
81
|
+
<ProfileLayout data={data} />
|
|
82
|
+
)}
|
|
63
83
|
</BuyerPortalProvider>
|
|
64
84
|
);
|
|
65
85
|
|
|
66
|
-
export default
|
|
86
|
+
export default withErrorBoundary(ProfilePage, {
|
|
87
|
+
tags: {
|
|
88
|
+
component: "ProfilePage",
|
|
89
|
+
errorType: "profile_error",
|
|
90
|
+
},
|
|
91
|
+
});
|
package/src/pages/releases.tsx
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { getContractDetailsService } from "../features/contracts/services";
|
|
2
2
|
import { CustomFieldsLayout } from "../features/custom-fields/layouts";
|
|
3
3
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
BuyerPortalProvider,
|
|
6
|
+
withErrorBoundary,
|
|
7
|
+
} from "../features/shared/components";
|
|
8
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
9
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
10
|
+
import {
|
|
11
|
+
ClientContext,
|
|
12
|
+
getClientContext,
|
|
13
|
+
withLoaderErrorBoundary,
|
|
14
|
+
} from "../features/shared/utils";
|
|
6
15
|
import { getUserByIdService } from "../features/users/services";
|
|
7
16
|
|
|
8
17
|
import type { ContractData } from "../features/contracts/types";
|
|
@@ -19,6 +28,8 @@ export type ReleasesPageData = {
|
|
|
19
28
|
currentUser: UserData | null;
|
|
20
29
|
search: string;
|
|
21
30
|
};
|
|
31
|
+
hasError?: boolean;
|
|
32
|
+
error?: ErrorBoundaryProps;
|
|
22
33
|
};
|
|
23
34
|
|
|
24
35
|
type OrgUnitsPageQuery = {
|
|
@@ -27,9 +38,9 @@ type OrgUnitsPageQuery = {
|
|
|
27
38
|
search?: string;
|
|
28
39
|
};
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
const loaderFunction = async (
|
|
31
42
|
data: LoaderData<OrgUnitsPageQuery>
|
|
32
|
-
): Promise<ReleasesPageData> {
|
|
43
|
+
): Promise<ReleasesPageData> => {
|
|
33
44
|
const { customerId, cookie, userId, ...clientContext } =
|
|
34
45
|
await getClientContext(data);
|
|
35
46
|
|
|
@@ -58,14 +69,28 @@ export async function loader(
|
|
|
58
69
|
currentUser: user,
|
|
59
70
|
},
|
|
60
71
|
};
|
|
61
|
-
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
75
|
+
componentName: "ReleasesPage",
|
|
76
|
+
redirectToError: true,
|
|
77
|
+
});
|
|
62
78
|
|
|
63
|
-
const ReleasesPage = ({ data, context }: ReleasesPageData) => {
|
|
79
|
+
const ReleasesPage = ({ data, context, hasError, error }: ReleasesPageData) => {
|
|
64
80
|
return (
|
|
65
81
|
<BuyerPortalProvider {...context}>
|
|
66
|
-
|
|
82
|
+
{hasError ? (
|
|
83
|
+
<ErrorTabsLayout error={error} />
|
|
84
|
+
) : (
|
|
85
|
+
<CustomFieldsLayout data={data} customFieldsLabel="Release" />
|
|
86
|
+
)}
|
|
67
87
|
</BuyerPortalProvider>
|
|
68
88
|
);
|
|
69
89
|
};
|
|
70
90
|
|
|
71
|
-
export default ReleasesPage
|
|
91
|
+
export default withErrorBoundary(ReleasesPage, {
|
|
92
|
+
tags: {
|
|
93
|
+
component: "ReleasesPage",
|
|
94
|
+
errorType: "releases_error",
|
|
95
|
+
},
|
|
96
|
+
});
|
|
@@ -2,8 +2,17 @@ import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
|
2
2
|
import { RoleDetailsLayout } from "../features/roles/layout";
|
|
3
3
|
import { getRolesAndPermissionsService } from "../features/roles/services";
|
|
4
4
|
import { RolePermission } from "../features/roles/types";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
BuyerPortalProvider,
|
|
7
|
+
withErrorBoundary,
|
|
8
|
+
} from "../features/shared/components";
|
|
9
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
10
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
11
|
+
import {
|
|
12
|
+
type ClientContext,
|
|
13
|
+
getClientContext,
|
|
14
|
+
withLoaderErrorBoundary,
|
|
15
|
+
} from "../features/shared/utils";
|
|
7
16
|
import { getUserByIdService } from "../features/users/services";
|
|
8
17
|
|
|
9
18
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
@@ -20,9 +29,13 @@ export type RoleDetailsPageData = {
|
|
|
20
29
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
21
30
|
currentUser: UserData | null;
|
|
22
31
|
};
|
|
32
|
+
hasError?: boolean;
|
|
33
|
+
error?: ErrorBoundaryProps;
|
|
23
34
|
};
|
|
24
35
|
|
|
25
|
-
|
|
36
|
+
const loaderFunction = async (
|
|
37
|
+
data: LoaderData
|
|
38
|
+
): Promise<RoleDetailsPageData> => {
|
|
26
39
|
const { cookie, userId, ...clientContext } = await getClientContext(data);
|
|
27
40
|
|
|
28
41
|
const { orgUnitId, roleName } = data.query;
|
|
@@ -74,12 +87,31 @@ export async function loader(data: LoaderData): Promise<RoleDetailsPageData> {
|
|
|
74
87
|
currentUser: user,
|
|
75
88
|
},
|
|
76
89
|
};
|
|
77
|
-
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
93
|
+
componentName: "RoleDetailsPage",
|
|
94
|
+
redirectToError: true,
|
|
95
|
+
});
|
|
78
96
|
|
|
79
|
-
const
|
|
97
|
+
const RoleDetailsPage = ({
|
|
98
|
+
data,
|
|
99
|
+
context,
|
|
100
|
+
hasError,
|
|
101
|
+
error,
|
|
102
|
+
}: RoleDetailsPageData) => (
|
|
80
103
|
<BuyerPortalProvider {...context}>
|
|
81
|
-
|
|
104
|
+
{hasError ? (
|
|
105
|
+
<ErrorTabsLayout error={error} />
|
|
106
|
+
) : (
|
|
107
|
+
<RoleDetailsLayout data={data} />
|
|
108
|
+
)}
|
|
82
109
|
</BuyerPortalProvider>
|
|
83
110
|
);
|
|
84
111
|
|
|
85
|
-
export default
|
|
112
|
+
export default withErrorBoundary(RoleDetailsPage, {
|
|
113
|
+
tags: {
|
|
114
|
+
component: "RoleDetailsPage",
|
|
115
|
+
errorType: "role_details_error",
|
|
116
|
+
},
|
|
117
|
+
});
|
package/src/pages/roles.tsx
CHANGED
|
@@ -2,8 +2,17 @@ import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
|
2
2
|
import { RolesLayout } from "../features/roles/layout";
|
|
3
3
|
import { getRolesAndPermissionsService } from "../features/roles/services";
|
|
4
4
|
import { RolePermission } from "../features/roles/types";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
BuyerPortalProvider,
|
|
7
|
+
withErrorBoundary,
|
|
8
|
+
} from "../features/shared/components";
|
|
9
|
+
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
10
|
+
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
11
|
+
import {
|
|
12
|
+
type ClientContext,
|
|
13
|
+
getClientContext,
|
|
14
|
+
withLoaderErrorBoundary,
|
|
15
|
+
} from "../features/shared/utils";
|
|
7
16
|
import { getUserByIdService } from "../features/users/services";
|
|
8
17
|
|
|
9
18
|
import type { OrgUnitBasicData } from "../features/org-units/types";
|
|
@@ -19,9 +28,11 @@ export type RolesPageData = {
|
|
|
19
28
|
currentOrgUnit: OrgUnitBasicData | null;
|
|
20
29
|
currentUser: UserData | null;
|
|
21
30
|
};
|
|
31
|
+
hasError?: boolean;
|
|
32
|
+
error?: ErrorBoundaryProps;
|
|
22
33
|
};
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
const loaderFunction = async (data: LoaderData): Promise<RolesPageData> => {
|
|
25
36
|
const { cookie, userId, ...clientContext } = await getClientContext(data);
|
|
26
37
|
const { orgUnitId } = data.query;
|
|
27
38
|
|
|
@@ -48,12 +59,22 @@ export async function loader(data: LoaderData): Promise<RolesPageData> {
|
|
|
48
59
|
currentUser: user,
|
|
49
60
|
},
|
|
50
61
|
};
|
|
51
|
-
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
65
|
+
componentName: "RolesPage",
|
|
66
|
+
redirectToError: true,
|
|
67
|
+
});
|
|
52
68
|
|
|
53
|
-
const
|
|
69
|
+
const RolesPage = ({ data, context, hasError, error }: RolesPageData) => (
|
|
54
70
|
<BuyerPortalProvider {...context}>
|
|
55
|
-
<RolesLayout data={data} />
|
|
71
|
+
{hasError ? <ErrorTabsLayout error={error} /> : <RolesLayout data={data} />}
|
|
56
72
|
</BuyerPortalProvider>
|
|
57
73
|
);
|
|
58
74
|
|
|
59
|
-
export default
|
|
75
|
+
export default withErrorBoundary(RolesPage, {
|
|
76
|
+
tags: {
|
|
77
|
+
component: "RolesPage",
|
|
78
|
+
errorType: "roles_error",
|
|
79
|
+
},
|
|
80
|
+
});
|