@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,49 +1,26 @@
|
|
|
1
|
-
import { CollectionsLayout } from "../features/collections/layouts";
|
|
2
|
-
import { getCollectionsFromContractService } from "../features/collections/services/get-collections-from-contract.service";
|
|
3
|
-
import { getCollectionsFromScopeService } from "../features/collections/services/get-collections-from-scope.service";
|
|
4
|
-
import { ScopeCollection } from "../features/collections/types";
|
|
5
1
|
import { getContractDetailsService } from "../features/contracts/services";
|
|
6
|
-
import { ContractData } from "../features/contracts/types";
|
|
7
2
|
import { getOrgUnitBasicDataService } from "../features/org-units/services";
|
|
3
|
+
import { ProductAssortmentLayout } from "../features/product-assortment/layouts";
|
|
4
|
+
import { getProductAssortmentFromContractService } from "../features/product-assortment/services/get-product-assortment-from-contract.service";
|
|
5
|
+
import { getProductAssortmentFromScopeService } from "../features/product-assortment/services/get-product-assortment-from-scope.service";
|
|
8
6
|
import { withErrorBoundary } from "../features/shared/components";
|
|
9
|
-
import { ErrorBoundaryProps } from "../features/shared/components/ErrorBoundary/types";
|
|
10
7
|
import { ErrorTabsLayout } from "../features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout";
|
|
11
8
|
import {
|
|
12
|
-
type ClientContext,
|
|
13
9
|
getValidPage,
|
|
14
10
|
withLoaderErrorBoundary,
|
|
15
11
|
withAuthLoader,
|
|
16
12
|
withProviders,
|
|
17
13
|
} from "../features/shared/utils";
|
|
18
14
|
|
|
19
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
ProductAssortmentData,
|
|
17
|
+
ProductAssortmentQuery,
|
|
18
|
+
} from "../features/product-assortment/types";
|
|
20
19
|
import type { AuthRouteProps, LoaderData } from "../features/shared/types";
|
|
21
20
|
|
|
22
|
-
export type CollectionsData = {
|
|
23
|
-
collections: ScopeCollection[];
|
|
24
|
-
drawerCollections: ScopeCollection[];
|
|
25
|
-
isContractEmpty: boolean;
|
|
26
|
-
search: string;
|
|
27
|
-
page: number;
|
|
28
|
-
context: {
|
|
29
|
-
clientContext: ClientContext;
|
|
30
|
-
currentOrgUnit: OrgUnitBasicData;
|
|
31
|
-
currentContract: ContractData | null;
|
|
32
|
-
};
|
|
33
|
-
hasError?: boolean;
|
|
34
|
-
error?: ErrorBoundaryProps;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type CollectionsQuery = {
|
|
38
|
-
orgUnitId: string;
|
|
39
|
-
contractId: string;
|
|
40
|
-
search: string;
|
|
41
|
-
page: string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
21
|
const loaderFunction = async (
|
|
45
|
-
data: LoaderData<
|
|
46
|
-
): Promise<AuthRouteProps<
|
|
22
|
+
data: LoaderData<ProductAssortmentQuery>
|
|
23
|
+
): Promise<AuthRouteProps<ProductAssortmentData>> => {
|
|
47
24
|
const { contractId, orgUnitId, search = "", page: pageString } = data.query;
|
|
48
25
|
|
|
49
26
|
const page = getValidPage(pageString);
|
|
@@ -54,9 +31,9 @@ const loaderFunction = async (
|
|
|
54
31
|
getContractDetailsService({ contractId, cookie, unitId: orgUnitId }),
|
|
55
32
|
]);
|
|
56
33
|
|
|
57
|
-
const [
|
|
34
|
+
const [enabledAssortment, allAssortment, contractAssortment] =
|
|
58
35
|
await Promise.all([
|
|
59
|
-
|
|
36
|
+
getProductAssortmentFromScopeService({
|
|
60
37
|
cookie,
|
|
61
38
|
contractId,
|
|
62
39
|
unitId: orgUnitId,
|
|
@@ -64,14 +41,14 @@ const loaderFunction = async (
|
|
|
64
41
|
name: search,
|
|
65
42
|
page,
|
|
66
43
|
}),
|
|
67
|
-
|
|
44
|
+
getProductAssortmentFromScopeService({
|
|
68
45
|
cookie,
|
|
69
46
|
contractId,
|
|
70
47
|
unitId: orgUnitId,
|
|
71
48
|
filterByScope: false,
|
|
72
49
|
page: 1,
|
|
73
50
|
}),
|
|
74
|
-
|
|
51
|
+
getProductAssortmentFromContractService({
|
|
75
52
|
contractId,
|
|
76
53
|
cookie,
|
|
77
54
|
unitId: orgUnitId,
|
|
@@ -79,12 +56,14 @@ const loaderFunction = async (
|
|
|
79
56
|
]);
|
|
80
57
|
|
|
81
58
|
const isContractEmpty =
|
|
82
|
-
!Array.isArray(
|
|
83
|
-
const
|
|
59
|
+
!Array.isArray(contractAssortment) || contractAssortment?.length === 0;
|
|
60
|
+
const drawerProductAssortment = allAssortment.filter(
|
|
61
|
+
(col) => !col.isEnabled
|
|
62
|
+
);
|
|
84
63
|
|
|
85
64
|
return {
|
|
86
|
-
|
|
87
|
-
|
|
65
|
+
productAssortment: enabledAssortment,
|
|
66
|
+
drawerProductAssortment,
|
|
88
67
|
isContractEmpty,
|
|
89
68
|
search,
|
|
90
69
|
page,
|
|
@@ -98,28 +77,28 @@ const loaderFunction = async (
|
|
|
98
77
|
};
|
|
99
78
|
|
|
100
79
|
export const loader = withLoaderErrorBoundary(loaderFunction, {
|
|
101
|
-
componentName: "
|
|
80
|
+
componentName: "ProductAssortmentPage",
|
|
102
81
|
redirectToError: true,
|
|
103
82
|
});
|
|
104
83
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
const ProductAssortmentPage = ({
|
|
85
|
+
productAssortment,
|
|
86
|
+
drawerProductAssortment,
|
|
108
87
|
isContractEmpty,
|
|
109
88
|
page,
|
|
110
89
|
search,
|
|
111
90
|
hasError,
|
|
112
91
|
error,
|
|
113
|
-
}:
|
|
92
|
+
}: ProductAssortmentData) => (
|
|
114
93
|
<>
|
|
115
94
|
{hasError ? (
|
|
116
95
|
<ErrorTabsLayout error={error} />
|
|
117
96
|
) : (
|
|
118
|
-
<
|
|
97
|
+
<ProductAssortmentLayout
|
|
119
98
|
page={page}
|
|
120
99
|
search={search}
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
initialProductAssortment={productAssortment}
|
|
101
|
+
drawerProductAssortment={drawerProductAssortment}
|
|
123
102
|
isContractEmpty={isContractEmpty}
|
|
124
103
|
/>
|
|
125
104
|
)}
|
|
@@ -127,10 +106,10 @@ const CollectionsPage = ({
|
|
|
127
106
|
);
|
|
128
107
|
|
|
129
108
|
export default withProviders(
|
|
130
|
-
withErrorBoundary(
|
|
109
|
+
withErrorBoundary(ProductAssortmentPage, {
|
|
131
110
|
tags: {
|
|
132
|
-
component: "
|
|
133
|
-
errorType: "
|
|
111
|
+
component: "ProductAssortmentPage",
|
|
112
|
+
errorType: "product_assortment_error",
|
|
134
113
|
},
|
|
135
114
|
})
|
|
136
115
|
);
|
package/src/themes/layouts.scss
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
@import "../features/org-units/layouts/OrgUnitsLayout/org-units-layout.scss";
|
|
23
23
|
@import "../features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss";
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
@import "../features/
|
|
25
|
+
// Product Assortment
|
|
26
|
+
@import "../features/product-assortment/layouts/ProductAssortmentLayout/product-assortment-layout.scss";
|
|
27
27
|
|
|
28
28
|
// Credit Cards
|
|
29
29
|
@import "../features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss";
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { useRouter } from "next/router";
|
|
4
|
-
|
|
5
|
-
import { Link, useUI } from "@faststore/ui";
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type BasicDrawerProps,
|
|
9
|
-
BasicDrawer,
|
|
10
|
-
Icon,
|
|
11
|
-
InternalSearch,
|
|
12
|
-
Paginator,
|
|
13
|
-
} from "../../../shared/components";
|
|
14
|
-
import { useBuyerPortal } from "../../../shared/hooks";
|
|
15
|
-
import { useAddCollectionsToScope } from "../../hooks/useAddCollectionsToScope";
|
|
16
|
-
import { AddCollectionsDrawerTable } from "../table/AddCollectionsDrawerTable";
|
|
17
|
-
|
|
18
|
-
import type { CollectionsSummary, ScopeCollection } from "../../types";
|
|
19
|
-
|
|
20
|
-
export type AddCollectionsDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
21
|
-
collections: ScopeCollection[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const PAGE_SIZE = 10;
|
|
25
|
-
|
|
26
|
-
export const AddCollectionsDrawer = ({
|
|
27
|
-
close,
|
|
28
|
-
collections,
|
|
29
|
-
...props
|
|
30
|
-
}: AddCollectionsDrawerProps) => {
|
|
31
|
-
const { pushToast } = useUI();
|
|
32
|
-
const [drawerSearch, setDrawerSearch] = useState("");
|
|
33
|
-
const { currentOrgUnit, currentContract } = useBuyerPortal();
|
|
34
|
-
const { reload } = useRouter();
|
|
35
|
-
|
|
36
|
-
const unitId = currentOrgUnit?.id;
|
|
37
|
-
const contractId = currentContract?.id;
|
|
38
|
-
const isLoading = false;
|
|
39
|
-
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
setDrawerSearch("");
|
|
42
|
-
}, [props.isOpen]);
|
|
43
|
-
|
|
44
|
-
const drawerCollections = useMemo(() => {
|
|
45
|
-
return collections.filter((c) =>
|
|
46
|
-
c.name.toLowerCase().includes(drawerSearch.toLowerCase())
|
|
47
|
-
);
|
|
48
|
-
}, [collections, drawerSearch]);
|
|
49
|
-
|
|
50
|
-
const addColectionMutation = useAddCollectionsToScope();
|
|
51
|
-
|
|
52
|
-
const [selectedCollections, setSelectedCollections] = useState<
|
|
53
|
-
CollectionsSummary[]
|
|
54
|
-
>([]);
|
|
55
|
-
|
|
56
|
-
const handleSuccess = async () => {
|
|
57
|
-
await addColectionMutation.mutate({
|
|
58
|
-
unitId: unitId ?? "",
|
|
59
|
-
contractId: contractId ?? "",
|
|
60
|
-
data: selectedCollections.map((s) => ({ name: s.name })),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
pushToast({
|
|
64
|
-
message: "Collections added successfully",
|
|
65
|
-
status: "INFO",
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
close();
|
|
69
|
-
reload();
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<BasicDrawer
|
|
74
|
-
data-fs-bp-add-collections-drawer
|
|
75
|
-
id="basicDrawer"
|
|
76
|
-
close={close}
|
|
77
|
-
{...props}
|
|
78
|
-
>
|
|
79
|
-
<BasicDrawer.Heading title="Add collections" onClose={close} />
|
|
80
|
-
|
|
81
|
-
<BasicDrawer.Body>
|
|
82
|
-
<span data-fs-bp-add-collections-text-drawer>
|
|
83
|
-
Add colections to <Link href="#">{currentOrgUnit?.name}</Link>
|
|
84
|
-
</span>
|
|
85
|
-
|
|
86
|
-
<div data-fs-bp-add-collections-wrapper>
|
|
87
|
-
<InternalSearch
|
|
88
|
-
textSearch={(searchTerm) => {
|
|
89
|
-
setDrawerSearch(searchTerm);
|
|
90
|
-
}}
|
|
91
|
-
/>
|
|
92
|
-
|
|
93
|
-
<Paginator.Counter
|
|
94
|
-
total={drawerCollections.length}
|
|
95
|
-
itemsLength={drawerCollections.length}
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
<section>
|
|
99
|
-
{drawerCollections.length ? (
|
|
100
|
-
<div>
|
|
101
|
-
<AddCollectionsDrawerTable
|
|
102
|
-
data={drawerCollections}
|
|
103
|
-
onChange={setSelectedCollections}
|
|
104
|
-
/>
|
|
105
|
-
{drawerCollections.length > 0 && (
|
|
106
|
-
<div data-fs-bp-drawer-collections-paginator>
|
|
107
|
-
{drawerCollections.length > 0 ? (
|
|
108
|
-
<Paginator.NextPageButton>
|
|
109
|
-
{isLoading ? "Loading" : "Load More"}
|
|
110
|
-
</Paginator.NextPageButton>
|
|
111
|
-
) : (
|
|
112
|
-
<span />
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
<Paginator.Counter
|
|
116
|
-
total={drawerCollections.length}
|
|
117
|
-
itemsLength={drawerCollections.length}
|
|
118
|
-
/>
|
|
119
|
-
</div>
|
|
120
|
-
)}
|
|
121
|
-
</div>
|
|
122
|
-
) : (
|
|
123
|
-
<div data-fs-bp-add-collections-drawer-empty-state>
|
|
124
|
-
<Icon name="Shapes" />
|
|
125
|
-
<p>No collections found</p>
|
|
126
|
-
</div>
|
|
127
|
-
)}
|
|
128
|
-
</section>
|
|
129
|
-
</BasicDrawer.Body>
|
|
130
|
-
<BasicDrawer.Footer data-fs-bp-add-collections-drawer-footer>
|
|
131
|
-
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
132
|
-
Cancel
|
|
133
|
-
</BasicDrawer.Button>
|
|
134
|
-
<BasicDrawer.Button
|
|
135
|
-
variant="confirm"
|
|
136
|
-
disabled={selectedCollections.length === 0}
|
|
137
|
-
onClick={handleSuccess}
|
|
138
|
-
isLoading={addColectionMutation.isLoading}
|
|
139
|
-
>
|
|
140
|
-
Add
|
|
141
|
-
{selectedCollections.length > 0 && `(${selectedCollections.length})`}
|
|
142
|
-
</BasicDrawer.Button>
|
|
143
|
-
</BasicDrawer.Footer>
|
|
144
|
-
</BasicDrawer>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { useSearchParams } from "next/navigation";
|
|
4
|
-
|
|
5
|
-
import { IconButton, Tooltip } from "@faststore/ui";
|
|
6
|
-
|
|
7
|
-
import { Icon, Table } from "../../../shared/components";
|
|
8
|
-
import { getTableColumns } from "../../../shared/components/Table/utils/tableColumns";
|
|
9
|
-
import { useDrawerProps } from "../../../shared/hooks";
|
|
10
|
-
import { CollectionSelectedProps } from "../../layouts/CollectionsLayout/CollectionsLayout";
|
|
11
|
-
import { ScopeCollection } from "../../types";
|
|
12
|
-
import { RemoveCollectionDrawer } from "../RemoveCollectionDrawer/RemoveCollectionDrawer";
|
|
13
|
-
|
|
14
|
-
export function CollectionsTable({
|
|
15
|
-
collections,
|
|
16
|
-
}: {
|
|
17
|
-
collections: ScopeCollection[];
|
|
18
|
-
}) {
|
|
19
|
-
const [collectionSelected, setCollectionSelected] =
|
|
20
|
-
useState<CollectionSelectedProps | null>();
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
open: openRemoveCollectionDrawer,
|
|
24
|
-
isOpen: isRemoveCollectionDrawerOpen,
|
|
25
|
-
...removeCollectionDrawerProps
|
|
26
|
-
} = useDrawerProps();
|
|
27
|
-
|
|
28
|
-
const searchParams = useSearchParams();
|
|
29
|
-
|
|
30
|
-
const searchTerm = searchParams.get("search");
|
|
31
|
-
|
|
32
|
-
const enabledCollections = collections.filter(
|
|
33
|
-
(c) =>
|
|
34
|
-
c.isEnabled &&
|
|
35
|
-
(!searchTerm ||
|
|
36
|
-
(searchTerm && c.name.toLowerCase().includes(searchTerm.toString())))
|
|
37
|
-
);
|
|
38
|
-
const removeDisabled = enabledCollections.length === 1;
|
|
39
|
-
const removeTooltipContent = removeDisabled
|
|
40
|
-
? "This collection can’t be removed. Each unit must have at least one active collection. Add another one to proceed with the removal."
|
|
41
|
-
: "Remove from unit";
|
|
42
|
-
|
|
43
|
-
function handleRemoveSelectedCollection(collection: CollectionSelectedProps) {
|
|
44
|
-
setCollectionSelected(collection);
|
|
45
|
-
openRemoveCollectionDrawer();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const columns = getTableColumns({ actionsLength: 1 });
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div data-fs-bp-collection-table>
|
|
52
|
-
<Table layoutFixed>
|
|
53
|
-
<Table.Head columns={columns} />
|
|
54
|
-
<Table.Body>
|
|
55
|
-
{collections.map((item) => (
|
|
56
|
-
<Table.Row
|
|
57
|
-
iconName="Shapes"
|
|
58
|
-
title={item.name}
|
|
59
|
-
key={item.id}
|
|
60
|
-
iconSize={24}
|
|
61
|
-
searchTerm={searchTerm ?? undefined}
|
|
62
|
-
actionIcons={
|
|
63
|
-
<Tooltip
|
|
64
|
-
content={removeTooltipContent}
|
|
65
|
-
placement={"left-center"}
|
|
66
|
-
>
|
|
67
|
-
<IconButton
|
|
68
|
-
data-fs-collections-row-action-button
|
|
69
|
-
icon={<Icon name={"MinusCircle"} width={20} height={20} />}
|
|
70
|
-
aria-label="Remove collections"
|
|
71
|
-
disabled={removeDisabled}
|
|
72
|
-
onClick={() =>
|
|
73
|
-
handleRemoveSelectedCollection({
|
|
74
|
-
id: item.id,
|
|
75
|
-
name: item.name,
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
/>
|
|
79
|
-
</Tooltip>
|
|
80
|
-
}
|
|
81
|
-
/>
|
|
82
|
-
))}
|
|
83
|
-
</Table.Body>
|
|
84
|
-
</Table>
|
|
85
|
-
{collectionSelected && (
|
|
86
|
-
<RemoveCollectionDrawer
|
|
87
|
-
isOpen={isRemoveCollectionDrawerOpen}
|
|
88
|
-
collection={collectionSelected}
|
|
89
|
-
{...removeCollectionDrawerProps}
|
|
90
|
-
/>
|
|
91
|
-
)}
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
[data-fs-bp-collection-table] {
|
|
2
|
-
@import "@faststore/ui/src/components/molecules/Tooltip/styles.scss";
|
|
3
|
-
@import "../AddCollectionsDrawer/add-collections-drawer.scss";
|
|
4
|
-
@import "../../../shared/components/Table/table.scss";
|
|
5
|
-
|
|
6
|
-
width: 100%;
|
|
7
|
-
|
|
8
|
-
[data-fs-table] {
|
|
9
|
-
overflow-x: visible;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
[data-fs-bp-head-row] {
|
|
13
|
-
border-bottom: var(--fs-table-bordered-border-width) solid
|
|
14
|
-
var(--fs-table-bordered-border-color);
|
|
15
|
-
|
|
16
|
-
color: #5c5c5c;
|
|
17
|
-
height: var(--fs-spacing-8);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[data-fs-table-head="true"] {
|
|
21
|
-
[data-fs-bp-head-row="true"] {
|
|
22
|
-
&:hover {
|
|
23
|
-
background-color: initial;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[data-fs-tooltip] {
|
|
29
|
-
--fs-tooltip-background: #1f1f1f;
|
|
30
|
-
border-bottom: none;
|
|
31
|
-
text-wrap: balance;
|
|
32
|
-
text-align: justify;
|
|
33
|
-
|
|
34
|
-
[data-fs-tooltip-placement="left-center"] {
|
|
35
|
-
[data-fs-tooltip-indicator="true"] {
|
|
36
|
-
margin-left: -0.1%;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
[data-fs-tooltip-placement="top-center"] {
|
|
40
|
-
[data-fs-tooltip-indicator="true"] {
|
|
41
|
-
margin-top: -1%;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
[data-fs-collections-row-action-button] {
|
|
47
|
-
width: var(--fs-spacing-6);
|
|
48
|
-
height: var(--fs-spacing-6);
|
|
49
|
-
display: inline-flex;
|
|
50
|
-
border-radius: var(--fs-border-radius-pill);
|
|
51
|
-
justify-content: center;
|
|
52
|
-
align-items: center;
|
|
53
|
-
|
|
54
|
-
&:hover:not(:disabled) {
|
|
55
|
-
background-color: #ebebeb;
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[data-fs-button-icon] {
|
|
60
|
-
display: block;
|
|
61
|
-
width: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
62
|
-
height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
[data-fs-bp-table-row-options] {
|
|
67
|
-
[data-fs-collections-row-action-button] {
|
|
68
|
-
margin: 0 var(--fs-spacing-1);
|
|
69
|
-
border-radius: var(--fs-border-radius-pill);
|
|
70
|
-
width: var(--fs-spacing-5);
|
|
71
|
-
aspect-ratio: 1;
|
|
72
|
-
display: flex;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
align-items: center;
|
|
75
|
-
cursor: pointer;
|
|
76
|
-
|
|
77
|
-
&:disabled {
|
|
78
|
-
cursor: not-allowed;
|
|
79
|
-
|
|
80
|
-
[data-fs-icon] {
|
|
81
|
-
color: #adadad;
|
|
82
|
-
|
|
83
|
-
&[data-fs-icon-loading="true"] {
|
|
84
|
-
@keyframes rotate {
|
|
85
|
-
from {
|
|
86
|
-
transform: rotate(0deg);
|
|
87
|
-
}
|
|
88
|
-
to {
|
|
89
|
-
transform: rotate(360deg);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
animation: rotate 2s linear infinite;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&:hover {
|
|
98
|
-
background-color: #e0e0e0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&:active {
|
|
102
|
-
opacity: 0.8;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[data-fs-icon] {
|
|
106
|
-
color: #000;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[data-fs-table-row] {
|
|
112
|
-
height: var(--fs-spacing-8);
|
|
113
|
-
|
|
114
|
-
&:hover {
|
|
115
|
-
background-color: var(--fs-color-neutral-bkg);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
[data-fs-table-cell="header"] {
|
|
119
|
-
display: flex;
|
|
120
|
-
height: var(--fs-spacing-8);
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
[data-fs-bp-table-row-options] {
|
|
125
|
-
width: 3rem;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[data-fs-table-cell="data"] {
|
|
129
|
-
padding: var(--fs-spacing-0);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
[data-fs-bp-text-medium] {
|
|
134
|
-
font-family: Inter;
|
|
135
|
-
font-weight: var(--fs-text-weight-medium);
|
|
136
|
-
font-size: var(--fs-text-size-1);
|
|
137
|
-
line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
138
|
-
letter-spacing: -1%;
|
|
139
|
-
}
|
|
140
|
-
}
|
package/src/features/collections/components/RemoveCollectionDrawer/remove-collection-drawer.scss
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
[data-fs-bp-remove-collections-drawer] {
|
|
2
|
-
@import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
|
|
3
|
-
|
|
4
|
-
span {
|
|
5
|
-
display: block;
|
|
6
|
-
color: var(--fs-color-neutral-7);
|
|
7
|
-
margin-bottom: 1.25rem;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
[data-fs-bp-remove-collections-checkbox-wrapper] {
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
gap: var(--fs-spacing-1);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
[data-fs-bp-add-collections-drawer-table] {
|
|
2
|
-
@import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
|
|
3
|
-
@import "../../../shared/components/Table/table.scss";
|
|
4
|
-
|
|
5
|
-
margin-top: 1.25rem;
|
|
6
|
-
[data-fs-table-content] {
|
|
7
|
-
table-layout: initial;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
[data-fs-table-head="true"] {
|
|
11
|
-
[data-fs-table-row="true"] {
|
|
12
|
-
border-bottom: 1px solid #d6d6d6;
|
|
13
|
-
|
|
14
|
-
[data-fs-table-cell="header"] {
|
|
15
|
-
height: 2.5rem;
|
|
16
|
-
padding: 0 0.875rem;
|
|
17
|
-
|
|
18
|
-
font-weight: var(--fs-text-weight-regular);
|
|
19
|
-
color: #5c5c5c;
|
|
20
|
-
font-size: var(--fs-text-size-1);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[data-fs-table-body="true"] {
|
|
26
|
-
[data-fs-table-row="true"] {
|
|
27
|
-
&[data-selected="true"] {
|
|
28
|
-
background-color: #f1f8fe;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&:last-child {
|
|
32
|
-
border-bottom: 1px solid #d6d6d6;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-fs-table-cell] {
|
|
36
|
-
height: 3.5rem;
|
|
37
|
-
font-weight: var(--fs-text-weight-medium);
|
|
38
|
-
color: #1f1f1f;
|
|
39
|
-
font-size: var(--fs-text-size-1);
|
|
40
|
-
padding: 0 0.875rem;
|
|
41
|
-
text-align: left;
|
|
42
|
-
|
|
43
|
-
[data-fs-bp-add-collections-drawer-cell-span] {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&:first-child {
|
|
49
|
-
width: 2.5rem;
|
|
50
|
-
text-align: center;
|
|
51
|
-
|
|
52
|
-
> svg {
|
|
53
|
-
margin: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
[data-fs-skeleton] {
|
|
61
|
-
display: inline-block;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
[data-fs-tooltip] {
|
|
65
|
-
--fs-tooltip-background: #1f1f1f;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
[data-fs-bp-collections-checkbox] {
|
|
69
|
-
margin: 0 auto;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MutationOptions, useMutation } from "../../shared/hooks";
|
|
2
|
-
import { addCollectionsToScopeService } from "../services/add-collections-to-scope.service";
|
|
3
|
-
|
|
4
|
-
export const useAddCollectionsToScope = (
|
|
5
|
-
options?: MutationOptions<AwaitedType<typeof addCollectionsToScopeService>>
|
|
6
|
-
) => {
|
|
7
|
-
const mutation = useMutation<
|
|
8
|
-
AwaitedType<typeof addCollectionsToScopeService>,
|
|
9
|
-
Omit<
|
|
10
|
-
Parameters<typeof addCollectionsToScopeService>[0],
|
|
11
|
-
"cookie" | "customerId"
|
|
12
|
-
>
|
|
13
|
-
>(
|
|
14
|
-
(variables, clientContext) =>
|
|
15
|
-
addCollectionsToScopeService({
|
|
16
|
-
...variables,
|
|
17
|
-
cookie: clientContext.cookie,
|
|
18
|
-
}),
|
|
19
|
-
options
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return mutation;
|
|
23
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { QueryOptions, useQuery } from "../../shared/hooks";
|
|
2
|
-
import { getCollectionsFromContractService } from "../services/get-collections-from-contract.service";
|
|
3
|
-
|
|
4
|
-
export const useGetCollectionsFromContract = (
|
|
5
|
-
unitId: string,
|
|
6
|
-
contractId: string,
|
|
7
|
-
options?: QueryOptions<AwaitedType<typeof getCollectionsFromContractService>>
|
|
8
|
-
) => {
|
|
9
|
-
const { data, error, isLoading, refetch } = useQuery(
|
|
10
|
-
`collections/get-collections-from-contract`,
|
|
11
|
-
({ cookie }) =>
|
|
12
|
-
getCollectionsFromContractService({
|
|
13
|
-
unitId,
|
|
14
|
-
contractId,
|
|
15
|
-
cookie,
|
|
16
|
-
}),
|
|
17
|
-
options
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
collections: data ?? [],
|
|
22
|
-
hasCollectionsError: error,
|
|
23
|
-
isCollectionsLoading: isLoading,
|
|
24
|
-
refetchCollections: refetch,
|
|
25
|
-
};
|
|
26
|
-
};
|