@vtex/faststore-plugin-buyer-portal 1.3.5 → 1.3.7
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/CHANGELOG.md +25 -1
- package/cypress/constants.ts +2 -0
- package/cypress/integration/organizational-units.test.ts +1 -1
- package/cypress/integration/{collections.test.ts → product-assortment.test.ts} +54 -50
- package/cypress/integration/profile.test.ts +1 -1
- package/cypress/integration/users.test.ts +9 -0
- package/package.json +1 -1
- package/plugin.config.js +2 -2
- package/src/features/{collections/clients/CollectionsClient.ts → product-assortment/clients/ProductAssortmentClient.ts} +18 -20
- package/src/features/product-assortment/components/AddProductAssortmentDrawer/AddProductAssortmentDrawer.tsx +144 -0
- package/src/features/{collections/components/AddCollectionsDrawer/add-collections-drawer.scss → product-assortment/components/AddProductAssortmentDrawer/add-product-assortment-drawer.scss} +9 -10
- package/src/features/product-assortment/components/ProductAssortmentTable/ProductAssortmentTable.tsx +99 -0
- package/src/features/product-assortment/components/ProductAssortmentTable/product-assortment-table.scss +45 -0
- package/src/features/{collections/components/RemoveCollectionDrawer/RemoveCollectionDrawer.tsx → product-assortment/components/RemoveProductAssortmentDrawer/RemoveProductAssortmentDrawer.tsx} +21 -20
- package/src/features/product-assortment/components/RemoveProductAssortmentDrawer/remove-product-assortment-drawer.scss +9 -0
- package/src/features/product-assortment/components/index.tsx +2 -0
- package/src/features/{collections/components/table/AddCollectionsDrawerTable.tsx → product-assortment/components/table/AddProductAssortmentDrawerTable.tsx} +9 -9
- package/src/features/product-assortment/components/table/add-product-assortment-drawer-table.scss +14 -0
- package/src/features/product-assortment/hooks/useAddProductAssortmentToScope.ts +25 -0
- package/src/features/product-assortment/hooks/useRemoveProductAssortmentFromScope.ts +26 -0
- package/src/features/{collections/layouts/CollectionsLayout/CollectionsLayout.tsx → product-assortment/layouts/ProductAssortmentLayout/ProductAssortmentLayout.tsx} +43 -49
- package/src/features/{collections/layouts/CollectionsLayout/collections-layout.scss → product-assortment/layouts/ProductAssortmentLayout/product-assortment-layout.scss} +7 -7
- package/src/features/product-assortment/layouts/index.ts +1 -0
- package/src/features/product-assortment/services/add-product-assortment-to-scope.service.ts +16 -0
- package/src/features/product-assortment/services/get-product-assortment-from-contract.service.ts +13 -0
- package/src/features/product-assortment/services/get-product-assortment-from-scope.service.ts +28 -0
- package/src/features/product-assortment/services/remove-product-assortment-from-scope.ts +9 -0
- package/src/features/product-assortment/types/index.ts +80 -0
- package/src/features/profile/layouts/ProfileLayout/profile-layout.scss +8 -5
- package/src/features/roles/layout/RoleDetailsLayout/RoleDetailsLayout.tsx +17 -36
- package/src/features/roles/layout/RoleDetailsLayout/role-details-layout.scss +40 -0
- package/src/features/roles/layout/RolesLayout/roles-layout.scss +8 -8
- package/src/features/shared/utils/buyerPortalRoutes.ts +5 -2
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/shared/utils/getContractSettingsLinks.ts +2 -2
- package/src/features/shared/utils/routeLayoutMapping.ts +2 -2
- package/src/features/users/clients/UsersClient.ts +2 -0
- package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +19 -2
- package/src/features/users/components/UpdateUserDrawer/UpdateUserDrawer.tsx +31 -5
- package/src/features/users/components/UserDropdownMenu/UserDropdownMenu.tsx +1 -1
- package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +8 -0
- package/src/features/users/services/add-user-to-org-unit.service.ts +1 -0
- package/src/features/users/services/get-user-by-id.service.ts +2 -1
- package/src/features/users/services/update-user.service.ts +3 -0
- package/src/features/users/types/UserData.ts +1 -0
- package/src/features/users/types/UserDataService.ts +1 -0
- package/src/pages/{collections.tsx → productAssortment.tsx} +30 -51
- package/src/themes/layouts.scss +2 -2
- package/src/features/collections/components/AddCollectionsDrawer/AddCollectionsDrawer.tsx +0 -146
- package/src/features/collections/components/CollectionsTable/CollectionsTable.tsx +0 -94
- package/src/features/collections/components/CollectionsTable/collections-table.scss +0 -140
- package/src/features/collections/components/RemoveCollectionDrawer/remove-collection-drawer.scss +0 -15
- package/src/features/collections/components/index.tsx +0 -5
- package/src/features/collections/components/table/add-collections-drawer-table.scss +0 -71
- package/src/features/collections/hooks/useAddCollectionsToScope.ts +0 -23
- package/src/features/collections/hooks/useGetCollectionsFromContract.ts +0 -26
- package/src/features/collections/hooks/useGetCollectionsFromScope.ts +0 -27
- package/src/features/collections/hooks/useRemoveCollectionsFromScope.ts +0 -26
- package/src/features/collections/layouts/index.ts +0 -4
- package/src/features/collections/services/add-collections-to-scope.service.ts +0 -15
- package/src/features/collections/services/get-collections-from-contract.service.ts +0 -9
- package/src/features/collections/services/get-collections-from-scope.service.ts +0 -24
- package/src/features/collections/services/remove-collections-from-scope.ts +0 -7
- package/src/features/collections/types/index.ts +0 -20
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { QueryOptions, useQuery } from "../../shared/hooks";
|
|
2
|
-
import { getCollectionsFromScopeService } from "../services/get-collections-from-scope.service";
|
|
3
|
-
|
|
4
|
-
export const useGetCollectionsFromScope = (
|
|
5
|
-
params: { unitId: string; contractId: string; page: number; name?: string },
|
|
6
|
-
options?: QueryOptions<AwaitedType<typeof getCollectionsFromScopeService>>
|
|
7
|
-
) => {
|
|
8
|
-
const { data, error, isLoading, refetch } = useQuery(
|
|
9
|
-
`collections/${params.unitId}/${params.contractId}/${params.name}`,
|
|
10
|
-
({ cookie }) => {
|
|
11
|
-
return getCollectionsFromScopeService({
|
|
12
|
-
...params,
|
|
13
|
-
cookie,
|
|
14
|
-
filterByScope: false,
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
options
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
collections: data ?? [],
|
|
22
|
-
total: data?.length ?? 0,
|
|
23
|
-
hasCollectionsError: error,
|
|
24
|
-
isCollectionsLoading: isLoading,
|
|
25
|
-
refetchCollections: refetch,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { MutationOptions, useMutation } from "../../shared/hooks";
|
|
2
|
-
import { removeCollectionFromScopeService } from "../services/remove-collections-from-scope";
|
|
3
|
-
|
|
4
|
-
export const useRemoveCollectionsFromScope = (
|
|
5
|
-
options?: MutationOptions<
|
|
6
|
-
AwaitedType<typeof removeCollectionFromScopeService>
|
|
7
|
-
>
|
|
8
|
-
) => {
|
|
9
|
-
const mutation = useMutation<
|
|
10
|
-
AwaitedType<typeof removeCollectionFromScopeService>,
|
|
11
|
-
Omit<
|
|
12
|
-
Parameters<typeof removeCollectionFromScopeService>[0],
|
|
13
|
-
"cookie" | "customerId"
|
|
14
|
-
>
|
|
15
|
-
>(
|
|
16
|
-
(variables, clientContext) =>
|
|
17
|
-
removeCollectionFromScopeService({
|
|
18
|
-
...variables,
|
|
19
|
-
|
|
20
|
-
cookie: clientContext.cookie,
|
|
21
|
-
}),
|
|
22
|
-
options
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return mutation;
|
|
26
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddCollectionsPayload,
|
|
3
|
-
collectionsClient,
|
|
4
|
-
} from "../clients/CollectionsClient";
|
|
5
|
-
|
|
6
|
-
export const addCollectionsToScopeService = async (params: {
|
|
7
|
-
contractId: string;
|
|
8
|
-
cookie: string;
|
|
9
|
-
unitId: string;
|
|
10
|
-
data: AddCollectionsPayload;
|
|
11
|
-
}) => {
|
|
12
|
-
const response = await collectionsClient.addCollectionsToScope(params);
|
|
13
|
-
|
|
14
|
-
return response;
|
|
15
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { collectionsClient } from "../clients/CollectionsClient";
|
|
2
|
-
|
|
3
|
-
export const getCollectionsFromContractService = async (
|
|
4
|
-
params: Parameters<typeof collectionsClient.getCollectionFromContract>[0]
|
|
5
|
-
) => {
|
|
6
|
-
const data = await collectionsClient.getCollectionFromContract(params);
|
|
7
|
-
|
|
8
|
-
return data;
|
|
9
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { isRightFormat } from "../../shared/utils/isRightFormat";
|
|
2
|
-
import { collectionsClient } from "../clients/CollectionsClient";
|
|
3
|
-
|
|
4
|
-
export const getCollectionsFromScopeService = async (
|
|
5
|
-
args: Parameters<typeof collectionsClient.getCollectionsListInScope>[0]
|
|
6
|
-
) => {
|
|
7
|
-
try {
|
|
8
|
-
const data = await collectionsClient.getCollectionsListInScope(args);
|
|
9
|
-
|
|
10
|
-
return data;
|
|
11
|
-
} catch (error) {
|
|
12
|
-
if (error instanceof Error) {
|
|
13
|
-
const err = JSON.parse(error.message) as unknown;
|
|
14
|
-
if (
|
|
15
|
-
isRightFormat(err) &&
|
|
16
|
-
err.message.startsWith("No Collection found for the name")
|
|
17
|
-
) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { collectionsClient } from "../clients/CollectionsClient";
|
|
2
|
-
|
|
3
|
-
export const removeCollectionFromScopeService = async (
|
|
4
|
-
params: Parameters<typeof collectionsClient.removeCollectionFromScope>[0]
|
|
5
|
-
) => {
|
|
6
|
-
await collectionsClient.removeCollectionFromScope(params);
|
|
7
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type CollectionsSummary = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export type ContractCollection = CollectionsSummary & { isEnabled: boolean };
|
|
7
|
-
export type ScopeCollection = CollectionsSummary & { isEnabled: boolean };
|
|
8
|
-
|
|
9
|
-
export type GetCollectionsFromContractResponse = {
|
|
10
|
-
collections: Array<ContractCollection>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type GetCollectionsFromScopeResponse = {
|
|
14
|
-
collections: Array<ScopeCollection>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type AddCollectionResponse = {
|
|
18
|
-
message: string;
|
|
19
|
-
addedCollections: string[];
|
|
20
|
-
};
|