@vtex/faststore-plugin-buyer-portal 1.3.45 → 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 +8 -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/utils/constants.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ 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
|
+
|
|
10
16
|
## [1.3.45] - 2025-12-17
|
|
11
17
|
|
|
12
18
|
### Fixed
|
|
@@ -394,7 +400,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
394
400
|
- Add CHANGELOG file
|
|
395
401
|
- Add README file
|
|
396
402
|
|
|
397
|
-
[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
|
|
398
404
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
|
|
399
405
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
|
|
400
406
|
[1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
|
|
@@ -444,6 +450,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
444
450
|
[1.3.36]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.35...v1.3.36
|
|
445
451
|
[1.3.35]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.35
|
|
446
452
|
|
|
453
|
+
[1.3.46]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.45...v1.3.46
|
|
447
454
|
[1.3.45]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.44...v1.3.45
|
|
448
455
|
[1.3.44]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.43...v1.3.44
|
|
449
456
|
[1.3.43]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.42...v1.3.43
|
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
|
/>
|