@vtex/faststore-plugin-buyer-portal 1.1.72 → 1.1.73
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 +7 -0
- package/src/features/org-units/components/CreateOrgUnitDrawer/CreateOrgUnitDrawer.tsx +1 -0
- package/src/features/org-units/components/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +2 -1
- package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +0 -3
- package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +48 -8
- package/src/features/org-units/layouts/OrgUnitsLayout/org-units-layout.scss +10 -1
package/package.json
CHANGED
|
@@ -490,4 +490,11 @@
|
|
|
490
490
|
fill="currentColor"
|
|
491
491
|
/>
|
|
492
492
|
</symbol>
|
|
493
|
+
|
|
494
|
+
<symbol id="Group" viewBox="0 0 38 27" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
495
|
+
<path
|
|
496
|
+
d="M0.583252 26.333V22.4163C0.583252 21.4441 0.833252 20.5622 1.33325 19.7705C1.83325 18.9788 2.5277 18.3886 3.41659 17.9997C5.44436 17.1108 7.27075 16.4719 8.89575 16.083C10.5208 15.6941 12.1944 15.4997 13.9166 15.4997C15.6388 15.4997 17.3055 15.6941 18.9166 16.083C20.5277 16.4719 22.3471 17.1108 24.3749 17.9997C25.2638 18.3886 25.9652 18.9788 26.4791 19.7705C26.993 20.5622 27.2499 21.4441 27.2499 22.4163V26.333H0.583252ZM29.7499 26.333V22.4163C29.7499 20.6663 29.3055 19.2288 28.4166 18.1038C27.5277 16.9788 26.361 16.0691 24.9166 15.3747C26.8333 15.5969 28.6388 15.9233 30.3333 16.3538C32.0277 16.7844 33.4027 17.2775 34.4583 17.833C35.3749 18.3608 36.0971 19.0136 36.6249 19.7913C37.1527 20.5691 37.4166 21.4441 37.4166 22.4163V26.333H29.7499ZM13.9166 12.958C12.0833 12.958 10.5833 12.3747 9.41659 11.208C8.24992 10.0413 7.66659 8.54134 7.66659 6.70801C7.66659 4.87467 8.24992 3.37467 9.41659 2.20801C10.5833 1.04134 12.0833 0.458008 13.9166 0.458008C15.7499 0.458008 17.2499 1.04134 18.4166 2.20801C19.5833 3.37467 20.1666 4.87467 20.1666 6.70801C20.1666 8.54134 19.5833 10.0413 18.4166 11.208C17.2499 12.3747 15.7499 12.958 13.9166 12.958ZM28.9166 6.70801C28.9166 8.54134 28.3333 10.0413 27.1666 11.208C25.9999 12.3747 24.4999 12.958 22.6666 12.958C22.361 12.958 22.0208 12.9372 21.6458 12.8955C21.2708 12.8538 20.9305 12.7775 20.6249 12.6663C21.2916 11.9719 21.7985 11.1177 22.1458 10.1038C22.493 9.08995 22.6666 7.95801 22.6666 6.70801C22.6666 5.45801 22.493 4.35384 22.1458 3.39551C21.7985 2.43717 21.2916 1.55523 20.6249 0.749674C20.9305 0.666341 21.2708 0.596897 21.6458 0.541341C22.0208 0.485786 22.361 0.458008 22.6666 0.458008C24.4999 0.458008 25.9999 1.04134 27.1666 2.20801C28.3333 3.37467 28.9166 4.87467 28.9166 6.70801ZM3.08325 23.833H24.7499V22.4163C24.7499 21.9719 24.618 21.5413 24.3541 21.1247C24.0902 20.708 23.7638 20.4163 23.3749 20.2497C21.3749 19.3608 19.6944 18.7636 18.3333 18.458C16.9721 18.1525 15.4999 17.9997 13.9166 17.9997C12.3333 17.9997 10.8541 18.1525 9.47909 18.458C8.10409 18.7636 6.41659 19.3608 4.41659 20.2497C4.0277 20.4163 3.70825 20.708 3.45825 21.1247C3.20825 21.5413 3.08325 21.9719 3.08325 22.4163V23.833ZM13.9166 10.458C14.9999 10.458 15.8958 10.1038 16.6041 9.39551C17.3124 8.68717 17.6666 7.79134 17.6666 6.70801C17.6666 5.62467 17.3124 4.72884 16.6041 4.02051C15.8958 3.31217 14.9999 2.95801 13.9166 2.95801C12.8333 2.95801 11.9374 3.31217 11.2291 4.02051C10.5208 4.72884 10.1666 5.62467 10.1666 6.70801C10.1666 7.79134 10.5208 8.68717 11.2291 9.39551C11.9374 10.1038 12.8333 10.458 13.9166 10.458Z"
|
|
497
|
+
fill="currentColor"
|
|
498
|
+
/>
|
|
499
|
+
</symbol>
|
|
493
500
|
</svg>
|
|
@@ -45,8 +45,9 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
45
45
|
if (router.asPath === `/org-unit/${id}`) {
|
|
46
46
|
router.replace("/org-units/${id}");
|
|
47
47
|
return;
|
|
48
|
+
} else {
|
|
49
|
+
router.reload();
|
|
48
50
|
}
|
|
49
|
-
router.replace(router.asPath);
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
const { deleteOrgUnit, isDeleteOrgUnitLoading } = useDeleteOrgUnit({
|
|
@@ -13,7 +13,6 @@ import { CreateUserDrawer } from "../../../users/components";
|
|
|
13
13
|
export type OrgUnitsDropdownMenuProps = {
|
|
14
14
|
id: string;
|
|
15
15
|
name: string;
|
|
16
|
-
onUpdate?: () => void;
|
|
17
16
|
onCreate?: () => void;
|
|
18
17
|
isComplete?: boolean;
|
|
19
18
|
};
|
|
@@ -21,7 +20,6 @@ export type OrgUnitsDropdownMenuProps = {
|
|
|
21
20
|
export const OrgUnitsDropdownMenu = ({
|
|
22
21
|
id,
|
|
23
22
|
name,
|
|
24
|
-
onUpdate,
|
|
25
23
|
onCreate,
|
|
26
24
|
isComplete = true,
|
|
27
25
|
}: OrgUnitsDropdownMenuProps) => {
|
|
@@ -108,7 +106,6 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
108
106
|
readonly
|
|
109
107
|
id={id}
|
|
110
108
|
name={name}
|
|
111
|
-
onSuccess={onUpdate}
|
|
112
109
|
{...updateDrawerProps}
|
|
113
110
|
isOpen={isUpdateDrawerOpen}
|
|
114
111
|
/>
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
EmptyState,
|
|
5
|
+
HeaderInside,
|
|
6
|
+
InternalSearch,
|
|
7
|
+
} from "../../../shared/components";
|
|
2
8
|
import {
|
|
3
9
|
useBuyerPortal,
|
|
4
10
|
useDrawerProps,
|
|
11
|
+
usePageItems,
|
|
5
12
|
useQueryParams,
|
|
6
13
|
} from "../../../shared/hooks";
|
|
7
14
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
8
15
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
9
16
|
import { CreateOrgUnitDrawer, OrgUnitsHierarchyTree } from "../../components";
|
|
17
|
+
import { useChildrenOrgUnits } from "../../hooks";
|
|
10
18
|
|
|
11
19
|
import type { OrgUnitHierarchyData } from "../../types";
|
|
12
20
|
|
|
@@ -21,6 +29,29 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
21
29
|
|
|
22
30
|
const { open, ...drawerProps } = useDrawerProps();
|
|
23
31
|
|
|
32
|
+
const { items: childrenOrgUnits, updateItemsFromRefetch } =
|
|
33
|
+
usePageItems<OrgUnitHierarchyData>({
|
|
34
|
+
initialItems: data?.organizationalUnits ?? [],
|
|
35
|
+
search,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const { childrenOrgUnits: childrenOrgUnitsData, refetchChildrenOrgUnits } =
|
|
39
|
+
useChildrenOrgUnits(
|
|
40
|
+
currentOrgUnit?.id as string,
|
|
41
|
+
currentOrgUnit?.name as string,
|
|
42
|
+
{ lazy: true }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (childrenOrgUnitsData?.nodes) {
|
|
47
|
+
updateItemsFromRefetch(childrenOrgUnitsData.nodes);
|
|
48
|
+
}
|
|
49
|
+
}, [childrenOrgUnitsData]);
|
|
50
|
+
|
|
51
|
+
const handleRefetchChildrenOrgUnits = () => {
|
|
52
|
+
refetchChildrenOrgUnits();
|
|
53
|
+
};
|
|
54
|
+
|
|
24
55
|
return (
|
|
25
56
|
<GlobalLayout>
|
|
26
57
|
<OrgUnitTabsLayout pageName="Organization">
|
|
@@ -45,20 +76,29 @@ export const OrgUnitsLayout = ({ data, search }: OrgUnitsLayoutProps) => {
|
|
|
45
76
|
</div>
|
|
46
77
|
|
|
47
78
|
<section data-fs-hierarchy-tree-wrapper>
|
|
48
|
-
{
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
orgUnitHierarchyData={orgUnit}
|
|
79
|
+
{childrenOrgUnits?.length === 0 ? (
|
|
80
|
+
<EmptyState
|
|
81
|
+
title="No organizational units yet"
|
|
82
|
+
iconName="Group"
|
|
53
83
|
/>
|
|
54
|
-
)
|
|
84
|
+
) : (
|
|
85
|
+
<>
|
|
86
|
+
{childrenOrgUnits?.map((orgUnit) => (
|
|
87
|
+
<OrgUnitsHierarchyTree
|
|
88
|
+
enableChildren={!search}
|
|
89
|
+
key={orgUnit.id}
|
|
90
|
+
orgUnitHierarchyData={orgUnit}
|
|
91
|
+
/>
|
|
92
|
+
))}
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
55
95
|
</section>
|
|
56
96
|
|
|
57
97
|
{data && (
|
|
58
98
|
<CreateOrgUnitDrawer
|
|
59
99
|
readonly
|
|
60
|
-
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
61
100
|
initialParentOrgUnit={currentOrgUnit!}
|
|
101
|
+
onCreate={handleRefetchChildrenOrgUnits}
|
|
62
102
|
{...drawerProps}
|
|
63
103
|
/>
|
|
64
104
|
)}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[data-fs-org-units-section] {
|
|
11
11
|
@import "@faststore/ui/src/components/molecules/Toggle/styles.scss";
|
|
12
|
-
|
|
12
|
+
@import "../../../shared/components/EmptyState/empty-state.scss";
|
|
13
13
|
@import "../../components/OrgUnitsHierarchyTree/org-units-hierarchy-tree.scss";
|
|
14
14
|
|
|
15
15
|
@import "../../../shared/components/HeaderInside/header-inside.scss";
|
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
@import "../../../shared/components/InternalSearch/internal-search.scss";
|
|
18
18
|
|
|
19
19
|
padding: 0 calc(var(--fs-spacing-9) - var(--fs-spacing-0));
|
|
20
|
+
height: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
|
|
24
|
+
[data-fs-hierarchy-tree-wrapper] {
|
|
25
|
+
flex: 1;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
20
29
|
|
|
21
30
|
[data-fs-buyer-portal-org-units-filter] {
|
|
22
31
|
display: flex;
|