@vtex/faststore-plugin-buyer-portal 1.3.44 → 1.3.46
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 +14 -1
- package/package.json +1 -1
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +3 -0
- package/src/features/org-units/components/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +30 -5
- package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +3 -0
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +1 -0
- package/src/features/shared/hooks/useGetScopeConfig.ts +0 -2
- package/src/features/shared/hooks/useSetScopeConfig.ts +0 -2
- package/src/features/shared/utils/constants.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.46] - 2025-12-19
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Organizational unit deletion now redirects to parent org unit instead of staying on deleted entity's page
|
|
15
|
+
|
|
16
|
+
## [1.3.45] - 2025-12-17
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Remove AwaitedType imports
|
|
20
|
+
|
|
10
21
|
## [1.3.44] - 2025-12-16
|
|
11
22
|
|
|
12
23
|
### Fixed
|
|
@@ -389,7 +400,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
389
400
|
- Add CHANGELOG file
|
|
390
401
|
- Add README file
|
|
391
402
|
|
|
392
|
-
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.
|
|
403
|
+
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.46...HEAD
|
|
393
404
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
|
|
394
405
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
|
|
395
406
|
[1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
|
|
@@ -439,6 +450,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
439
450
|
[1.3.36]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.35...v1.3.36
|
|
440
451
|
[1.3.35]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.35
|
|
441
452
|
|
|
453
|
+
[1.3.46]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.45...v1.3.46
|
|
454
|
+
[1.3.45]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.44...v1.3.45
|
|
442
455
|
[1.3.44]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.43...v1.3.44
|
|
443
456
|
[1.3.43]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.42...v1.3.43
|
|
444
457
|
[1.3.42]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.42
|
package/package.json
CHANGED
package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx
CHANGED
|
@@ -25,6 +25,7 @@ export type AddAllToOrgUnitDropdownProps = {
|
|
|
25
25
|
unitId: string;
|
|
26
26
|
unitName: string;
|
|
27
27
|
contractId: string;
|
|
28
|
+
pathIds?: string;
|
|
28
29
|
align?: "left" | "right";
|
|
29
30
|
};
|
|
30
31
|
|
|
@@ -33,6 +34,7 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
33
34
|
unitId,
|
|
34
35
|
unitName,
|
|
35
36
|
contractId,
|
|
37
|
+
pathIds,
|
|
36
38
|
align = "right",
|
|
37
39
|
}: AddAllToOrgUnitDropdownProps) => {
|
|
38
40
|
const sizeProps = { width: 20, height: 20 };
|
|
@@ -260,6 +262,7 @@ export const AddAllToOrgUnitDropdown = ({
|
|
|
260
262
|
<DeleteOrgUnitDrawer
|
|
261
263
|
id={unitId}
|
|
262
264
|
name={unitName}
|
|
265
|
+
pathIds={pathIds}
|
|
263
266
|
{...deleteDrawerProps}
|
|
264
267
|
isOpen={isOpenDeleteDrawer}
|
|
265
268
|
/>
|
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
InputText,
|
|
12
12
|
type BasicDrawerProps,
|
|
13
13
|
} from "../../../shared/components";
|
|
14
|
-
import { useAnalytics } from "../../../shared/hooks";
|
|
14
|
+
import { useBuyerPortal, useAnalytics } from "../../../shared/hooks";
|
|
15
15
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
16
|
+
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
16
17
|
import { useGetUserByOrgUnitId } from "../../../users/hooks/useGetUserByOrgUnitId";
|
|
17
18
|
import { useChildrenOrgUnits } from "../../hooks";
|
|
18
19
|
import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
|
|
@@ -21,15 +22,18 @@ import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
|
|
|
21
22
|
export type DeleteOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
22
23
|
id: string;
|
|
23
24
|
name: string;
|
|
25
|
+
pathIds?: string;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
export const DeleteOrgUnitDrawer = ({
|
|
27
29
|
id,
|
|
28
30
|
name,
|
|
31
|
+
pathIds,
|
|
29
32
|
close,
|
|
30
33
|
...props
|
|
31
34
|
}: DeleteOrgUnitDrawerProps) => {
|
|
32
35
|
const router = useRouter();
|
|
36
|
+
const { currentOrgUnit } = useBuyerPortal();
|
|
33
37
|
const { childrenOrgUnits } = useChildrenOrgUnits(id, name);
|
|
34
38
|
const { users } = useGetUserByOrgUnitId(id);
|
|
35
39
|
const { pushToast } = useUI();
|
|
@@ -58,14 +62,35 @@ export const DeleteOrgUnitDrawer = ({
|
|
|
58
62
|
message: "Organizational unit deleted successfully",
|
|
59
63
|
status: "INFO",
|
|
60
64
|
});
|
|
61
|
-
close();
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const currentPath = router.asPath;
|
|
67
|
+
const isOnDetailsPage = currentPath.includes(`/org-unit/${id}`);
|
|
68
|
+
const isOnListPageOfDeletedUnit =
|
|
69
|
+
currentPath === `/pvt/organization-account/org-units/${id}`;
|
|
70
|
+
|
|
71
|
+
const effectivePathIds =
|
|
72
|
+
pathIds ||
|
|
73
|
+
(id === currentOrgUnit?.id ? currentOrgUnit?.path?.ids : undefined);
|
|
74
|
+
|
|
75
|
+
if ((isOnDetailsPage || isOnListPageOfDeletedUnit) && effectivePathIds) {
|
|
76
|
+
const ids = effectivePathIds.split("/").filter(Boolean);
|
|
77
|
+
|
|
78
|
+
if (ids.length >= 2) {
|
|
79
|
+
const parentId = ids[ids.length - 2];
|
|
80
|
+
const redirectUrl = buyerPortalRoutes.orgUnitDetails({
|
|
81
|
+
orgUnitId: parentId,
|
|
82
|
+
});
|
|
83
|
+
router.replace(redirectUrl);
|
|
84
|
+
} else {
|
|
85
|
+
router.replace(`/pvt/organization-account`);
|
|
86
|
+
}
|
|
87
|
+
} else if (isOnDetailsPage || isOnListPageOfDeletedUnit) {
|
|
88
|
+
router.replace(`/pvt/organization-account`);
|
|
66
89
|
} else {
|
|
67
90
|
router.reload();
|
|
68
91
|
}
|
|
92
|
+
|
|
93
|
+
close();
|
|
69
94
|
};
|
|
70
95
|
|
|
71
96
|
const { deleteOrgUnit, isDeleteOrgUnitLoading } = useDeleteOrgUnit({
|
|
@@ -15,6 +15,7 @@ export type OrgUnitsDropdownMenuProps = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
onCreate?: () => void;
|
|
17
17
|
isComplete?: boolean;
|
|
18
|
+
pathIds?: string;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const OrgUnitsDropdownMenu = ({
|
|
@@ -22,6 +23,7 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
22
23
|
name,
|
|
23
24
|
onCreate,
|
|
24
25
|
isComplete = true,
|
|
26
|
+
pathIds,
|
|
25
27
|
}: OrgUnitsDropdownMenuProps) => {
|
|
26
28
|
const { rolesOptions } = useGetRolesOptions(id);
|
|
27
29
|
const {
|
|
@@ -97,6 +99,7 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
97
99
|
<DeleteOrgUnitDrawer
|
|
98
100
|
id={id}
|
|
99
101
|
name={name}
|
|
102
|
+
pathIds={pathIds}
|
|
100
103
|
{...deleteDrawerProps}
|
|
101
104
|
isOpen={isDeleteDrawerOpen}
|
|
102
105
|
/>
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import { useQuery, type QueryOptions } from "./useQuery";
|
|
8
8
|
|
|
9
|
-
import type { AwaitedType } from "../types";
|
|
10
|
-
|
|
11
9
|
export const useGetScopeConfig = (
|
|
12
10
|
props: Omit<GetScopeConfigServiceProps, "cookie">,
|
|
13
11
|
options?: QueryOptions<AwaitedType<typeof getScopeConfigService>>
|