@vtex/faststore-plugin-buyer-portal 1.3.9 → 1.3.11

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 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.11] - 2025-10-23
11
+
12
+ ### Added
13
+
14
+ - Add About drawer to check app's version and it's dependencies.
15
+
10
16
  ## [1.3.9] - 2025-10-21
11
17
 
12
18
  ### Added
@@ -159,7 +165,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
159
165
  - Add CHANGELOG file
160
166
  - Add README file
161
167
 
162
- [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.9...HEAD
168
+ [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/1.3.11...HEAD
163
169
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
164
170
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
165
171
  [1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
@@ -171,3 +177,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
171
177
  [1.3.9]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.8...v1.3.9
172
178
  [1.3.8]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.7...v1.3.8
173
179
  [1.3.7]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.7
180
+
181
+ [1.3.11]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,13 +7,17 @@ import {
7
7
  DropdownButton,
8
8
  DropdownMenu,
9
9
  Skeleton,
10
+ IconButton,
10
11
  } from "@faststore/ui";
11
12
 
12
13
  import { ProfileSummary } from "../../../profile/components";
13
14
  import { Icon } from "../../../shared/components";
15
+ import { useDrawerProps } from "../../../shared/hooks";
16
+ import { AboutDrawer } from "../../../shared/layouts/BaseTabsLayout/about-drawer/AboutDrawer";
14
17
  import { doLogout } from "../../../shared/utils";
15
18
 
16
19
  export type OrgUnitDetailsNavbarProps = {
20
+ orgId: string;
17
21
  orgName: string;
18
22
  person: {
19
23
  image?: string;
@@ -26,8 +30,15 @@ export type OrgUnitDetailsNavbarProps = {
26
30
  export const OrgUnitDetailsNavbar = ({
27
31
  person,
28
32
  orgName,
33
+ orgId,
29
34
  loading = false,
30
35
  }: OrgUnitDetailsNavbarProps) => {
36
+ const {
37
+ open: openAboutMenu,
38
+ isOpen: isOpenAboutMenu,
39
+ ...aboutMenuDrawerProps
40
+ } = useDrawerProps();
41
+
31
42
  return (
32
43
  <header data-fs-bp-org-unit-details-navbar>
33
44
  <Link href="/" data-fs-bp-org-unit-details-navbar-link>
@@ -37,6 +48,21 @@ export const OrgUnitDetailsNavbar = ({
37
48
  <Link href="/" data-fs-bp-org-unit-details-navbar-start-shopping-link>
38
49
  Start shopping
39
50
  </Link>
51
+
52
+ <IconButton
53
+ data-fs-bp-nav-about-trigger
54
+ icon={
55
+ <Icon
56
+ name="CircleQuestionMark"
57
+ width={24}
58
+ height={24}
59
+ weight="regular"
60
+ />
61
+ }
62
+ aria-label={"open about menu"}
63
+ onClick={openAboutMenu}
64
+ />
65
+
40
66
  {loading ? (
41
67
  <Skeleton size={{ width: "2.5rem", height: "2.5rem" }} />
42
68
  ) : (
@@ -58,6 +84,13 @@ export const OrgUnitDetailsNavbar = ({
58
84
  </Dropdown>
59
85
  )}
60
86
  </div>
87
+ {isOpenAboutMenu && (
88
+ <AboutDrawer
89
+ {...aboutMenuDrawerProps}
90
+ isOpen={isOpenAboutMenu}
91
+ unitId={orgId}
92
+ />
93
+ )}
61
94
  </header>
62
95
  );
63
96
  };
@@ -54,6 +54,16 @@
54
54
  height: var(--fs-spacing-6);
55
55
  cursor: pointer;
56
56
  }
57
+
58
+ [data-fs-bp-nav-about-trigger] {
59
+ display: flex;
60
+ justify-content: center;
61
+ align-items: center;
62
+ width: var(--fs-spacing-6);
63
+ height: var(--fs-spacing-6);
64
+ cursor: pointer;
65
+ margin-top: 0.2rem;
66
+ }
57
67
  }
58
68
 
59
69
  [data-fs-bp-org-unit-details-navbar-menu] {
@@ -76,6 +76,7 @@ export const OrgUnitsDetailsLayout = ({
76
76
  <GlobalLayout>
77
77
  {/* TODO: Add person here */}
78
78
  <OrgUnitDetailsNavbar
79
+ orgId={orgUnit.id}
79
80
  orgName={orgUnit.name}
80
81
  person={{
81
82
  name: user?.name ?? "",
@@ -2,6 +2,7 @@
2
2
  @import "@faststore/ui/src/components/molecules/Breadcrumb/styles.scss";
3
3
  @import "../../../shared/components/BasicDropdownMenu/basic-dropdown-menu.scss";
4
4
  @import "../../components/OrgUnitDetailsNavbar/org-unit-details-navbar.scss";
5
+ @import "../../../shared/layouts/BaseTabsLayout/about-drawer/about-drawer.scss";
5
6
  @import "../../../credit-cards/components/CreateCreditCardDrawer/create-credit-card-drawer.scss";
6
7
  @import "../../components/OrgUnitBreadcrumb/org-unit-breadcrumb.scss";
7
8
 
@@ -10,13 +11,22 @@
10
11
  @import "../../../shared/components/VerticalNav/vertical-nav.scss";
11
12
  @import "../../../shared/components/LetterHighlight/letter-highlight.scss";
12
13
  @import "../../../shared/components/HeaderInside/header-inside.scss";
13
-
14
-
15
- $fs-spacing-3-0: calc(var(--fs-spacing-3) + var(--fs-spacing-0)); // 1.25rem, 20px
16
- $fs-spacing-3-2: calc(var(--fs-spacing-3) + var(--fs-spacing-2)); // 1.75rem, 28px
17
- $fs-spacing-7-2: calc(var(--fs-spacing-7) + var(--fs-spacing-2)); // 3.75rem, 52px
18
- $fs-spacing-9-0: calc(var(--fs-spacing-9) + var(--fs-spacing-0)); // 4.25rem, 68px
19
- $fs-spacing-13-4: calc(var(--fs-spacing-13) + var(--fs-spacing-4)); // 7.5rem, 120px
14
+
15
+ $fs-spacing-3-0: calc(
16
+ var(--fs-spacing-3) + var(--fs-spacing-0)
17
+ ); // 1.25rem, 20px
18
+ $fs-spacing-3-2: calc(
19
+ var(--fs-spacing-3) + var(--fs-spacing-2)
20
+ ); // 1.75rem, 28px
21
+ $fs-spacing-7-2: calc(
22
+ var(--fs-spacing-7) + var(--fs-spacing-2)
23
+ ); // 3.75rem, 52px
24
+ $fs-spacing-9-0: calc(
25
+ var(--fs-spacing-9) + var(--fs-spacing-0)
26
+ ); // 4.25rem, 68px
27
+ $fs-spacing-13-4: calc(
28
+ var(--fs-spacing-13) + var(--fs-spacing-4)
29
+ ); // 7.5rem, 120px
20
30
 
21
31
  padding: 0 $fs-spacing-7-2 $fs-spacing-13-4 $fs-spacing-7-2;
22
32
 
@@ -0,0 +1,30 @@
1
+ import { getApiUrl } from "../utils";
2
+
3
+ import { Client } from "./Client";
4
+
5
+ type BuyerPortalApp = {
6
+ appName: string;
7
+ appVersion: string;
8
+ };
9
+
10
+ type AppVersionInformation = {
11
+ buyerPortalApps: BuyerPortalApp[];
12
+ };
13
+
14
+ export default class AboutClient extends Client {
15
+ constructor() {
16
+ super(getApiUrl());
17
+ }
18
+
19
+ getVersionInformation(unitId: string, cookie: string) {
20
+ return this.get<AppVersionInformation>(`units/${unitId}/about`, {
21
+ headers: {
22
+ Cookie: cookie,
23
+ },
24
+ });
25
+ }
26
+ }
27
+
28
+ const aboutClient = new AboutClient();
29
+
30
+ export { aboutClient };
@@ -12,3 +12,4 @@ export { useAddToScope } from "./useAddToScope";
12
12
  export { useRemoveFromScope } from "./useRemoveFromScope";
13
13
  export { usePageItems, type UsePageItemsProps } from "./usePageItems";
14
14
  export { useRouterLoading } from "./useRouterLoading";
15
+ export { useGetDependenciesVersion } from "./useGetDependenciesVersion";
@@ -0,0 +1,21 @@
1
+ import { getDependenciesVersionService } from "../services";
2
+
3
+ import { type QueryOptions, useQuery } from "./useQuery";
4
+
5
+ export const useGetDependenciesVersion = (
6
+ unitId: string,
7
+ options?: QueryOptions<AwaitedType<typeof getDependenciesVersionService>>
8
+ ) => {
9
+ const { data, error, isLoading, refetch } = useQuery(
10
+ `api/about/${unitId}`,
11
+ ({ cookie }) => getDependenciesVersionService({ unitId, cookie }),
12
+ options
13
+ );
14
+
15
+ return {
16
+ dependenciesVersion: data,
17
+ hasDependenciesVersionError: error,
18
+ isDependenciesVersionLoading: isLoading,
19
+ refetchDependenciesVersion: refetch,
20
+ };
21
+ };
@@ -18,6 +18,7 @@ import { useDrawerProps } from "../../hooks";
18
18
  import { doLogout } from "../../utils";
19
19
  import { buyerPortalRoutes } from "../../utils/buyerPortalRoutes";
20
20
 
21
+ import { AboutDrawer } from "./about-drawer/AboutDrawer";
21
22
  import { SidebarDrawer } from "./sidebar-drawer/SidebarDrawer";
22
23
 
23
24
  import type { OrgUnitBasicData } from "../../../org-units/types";
@@ -47,6 +48,12 @@ export const Navbar = ({
47
48
  ...deleteOpenSidebarMenuDrawerProps
48
49
  } = useDrawerProps();
49
50
 
51
+ const {
52
+ open: openAboutMenu,
53
+ isOpen: isOpenAboutMenu,
54
+ ...aboutMenuDrawerProps
55
+ } = useDrawerProps();
56
+
50
57
  const { orgUnit: userUnit } = useOrgUnitByUser(person.id);
51
58
 
52
59
  const orgUnitList = orgUnit?.path.ids.split("/").slice(1) ?? [];
@@ -89,6 +96,13 @@ export const Navbar = ({
89
96
  Start shopping
90
97
  </Link>
91
98
 
99
+ <IconButton
100
+ data-fs-bp-nav-about-trigger
101
+ icon={<Icon name="CircleQuestionMark" width={24} height={24} />}
102
+ aria-label={"open about menu"}
103
+ onClick={openAboutMenu}
104
+ />
105
+
92
106
  {loading ? (
93
107
  <Skeleton size={{ width: "2.5rem", height: "2.5rem" }} />
94
108
  ) : (
@@ -121,6 +135,13 @@ export const Navbar = ({
121
135
  isOpen={isOpenSidebarMenuDrawerOpen}
122
136
  />
123
137
  )}
138
+ {isOpenAboutMenu && (
139
+ <AboutDrawer
140
+ {...aboutMenuDrawerProps}
141
+ unitId={orgUnit?.id ?? ""}
142
+ isOpen={isOpenAboutMenu}
143
+ />
144
+ )}
124
145
  </>
125
146
  );
126
147
  };
@@ -0,0 +1,59 @@
1
+ import { Skeleton } from "@faststore/ui";
2
+
3
+ import { BasicDrawer, type BasicDrawerProps } from "../../../components";
4
+ import { useGetDependenciesVersion } from "../../../hooks";
5
+ import { CURRENT_VERSION } from "../../../utils/constants";
6
+
7
+ export type AboutDrawerProps = Omit<BasicDrawerProps, "children"> & {
8
+ unitId: string;
9
+ close: () => void;
10
+ };
11
+
12
+ export const AboutDrawer = ({ unitId, close, ...props }: AboutDrawerProps) => {
13
+ const { dependenciesVersion, isDependenciesVersionLoading } =
14
+ useGetDependenciesVersion(unitId);
15
+
16
+ return (
17
+ <BasicDrawer
18
+ data-bp-about-menu
19
+ close={close}
20
+ {...props}
21
+ data-fs-slide-over-direction="rightSide"
22
+ >
23
+ <BasicDrawer.Heading title="About" onClose={close} />
24
+ <BasicDrawer.Body data-bp-about-menu-drawer-body>
25
+ Version details
26
+ {isDependenciesVersionLoading && (
27
+ <div data-fs-bp-basic-buying-policy-drawer-skeleton>
28
+ <Skeleton size={{ width: "100%", height: "3.5rem" }} />
29
+ </div>
30
+ )}
31
+ {!isDependenciesVersionLoading && (
32
+ <div data-fs-bp-about-information>
33
+ <div data-fs-bp-about-row>
34
+ <span data-fs-bp-about-row-label>Organization Account</span>
35
+ <span data-fs-bp-about-row-value>{CURRENT_VERSION}</span>
36
+ </div>
37
+ <hr data-fs-bp-about-divider />
38
+ {dependenciesVersion &&
39
+ dependenciesVersion.buyerPortalApps.map((buyerPortalApp) => {
40
+ return (
41
+ <div key={buyerPortalApp.appName}>
42
+ <div data-fs-bp-about-row>
43
+ <span data-fs-bp-about-row-label>
44
+ {buyerPortalApp.appName}
45
+ </span>
46
+ <span data-fs-bp-about-row-value>
47
+ {buyerPortalApp.appVersion}
48
+ </span>
49
+ </div>
50
+ <hr data-fs-bp-about-divider />
51
+ </div>
52
+ );
53
+ })}
54
+ </div>
55
+ )}
56
+ </BasicDrawer.Body>
57
+ </BasicDrawer>
58
+ );
59
+ };
@@ -0,0 +1,57 @@
1
+ [data-bp-about-menu] {
2
+ @import "../../../../shared/components/BasicDrawer/basic-drawer.scss";
3
+
4
+ @include media(">=tablet") {
5
+ width: 30rem !important;
6
+ min-width: 30rem !important;
7
+ max-width: 30rem !important;
8
+ }
9
+
10
+ @include media("<=tablet") {
11
+ width: 19rem !important;
12
+ min-width: 19rem !important;
13
+ max-width: 19rem !important;
14
+ height: 100% !important;
15
+ border-radius: 0 !important;
16
+ }
17
+ [data-fs-bp-basic-drawer-body] [data-fs-bp-basic-drawer-body-wrapper] {
18
+ padding-top: 2.5rem !important;
19
+ }
20
+
21
+ [data-fs-bp-basic-drawer-heading] {
22
+ [data-fs-bp-basic-drawer-heading-title] {
23
+ font-weight: 600;
24
+ font-size: 20px;
25
+ line-height: 28px;
26
+ color: #1f1f1f;
27
+ }
28
+ }
29
+
30
+ [data-fs-bp-about-row] {
31
+ display: flex;
32
+ padding: 1.375rem 0;
33
+ font-weight: var(--fs-text-weight-medium);
34
+ size: var(--fs-text-size-1);
35
+ line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
36
+
37
+ [data-fs-bp-about-row-label] {
38
+ width: 12.5rem;
39
+ color: #707070;
40
+ font-size: var(--fs-text-size-1);
41
+ font-weight: 500;
42
+ }
43
+
44
+ [data-fs-bp-about-row-details] {
45
+ color: #000;
46
+ font-size: var(--fs-text-size-1);
47
+ font-weight: 500;
48
+ }
49
+ }
50
+
51
+ [data-fs-bp-about-divider] {
52
+ border: calc(var(--fs-border-width) / 2) solid #e0e0e0;
53
+ }
54
+ [data-fs-bp-about-information] {
55
+ padding-top: 1rem;
56
+ }
57
+ }
@@ -24,11 +24,11 @@
24
24
  [data-fs-bp-breadcrumb-current],
25
25
  [data-fs-bp-breadcrumb-dropdown-trigger] {
26
26
  font-size: var(--fs-text-size-2);
27
-
27
+
28
28
  @include media("<=phonemid") {
29
29
  font-size: var(--fs-text-size-1);
30
30
  }
31
- }
31
+ }
32
32
  }
33
33
 
34
34
  [data-fs-bp-nav-menu-btn-container] {
@@ -63,6 +63,14 @@
63
63
  line-height: var(--fs-text-size-5);
64
64
  }
65
65
 
66
+ [data-fs-bp-nav-about-trigger] {
67
+ cursor: pointer;
68
+ }
69
+
70
+ [data-fs-bp-nav-account-menu-trigger] {
71
+ cursor: pointer;
72
+ }
73
+
66
74
  [data-fs-bp-nav-menu] {
67
75
  --fs-profile-dropdown-menu-width: 22.5rem;
68
76
  width: auto;
@@ -106,6 +106,7 @@ export const ErrorTabsLayout = ({ children, error }: ErrorTabsLayoutProps) => {
106
106
  return (
107
107
  <div data-fs-bp-create-user-error-state>
108
108
  <OrgUnitDetailsNavbar
109
+ orgId={orgUnit?.id ?? ""}
109
110
  orgName={orgUnit?.name ?? ""}
110
111
  person={{
111
112
  name: user?.name ?? "",
@@ -0,0 +1,13 @@
1
+ import { aboutClient } from "../clients/AboutClient";
2
+
3
+ export type GetDependenciesVersionProps = {
4
+ unitId: string;
5
+ cookie: string;
6
+ };
7
+
8
+ export const getDependenciesVersionService = async ({
9
+ cookie,
10
+ unitId,
11
+ }: GetDependenciesVersionProps) => {
12
+ return aboutClient.getVersionInformation(unitId, cookie);
13
+ };
@@ -10,3 +10,7 @@ export {
10
10
  validateAccessService,
11
11
  type ValidateAccessServiceProps,
12
12
  } from "./validate-access.service";
13
+ export {
14
+ getDependenciesVersionService,
15
+ type GetDependenciesVersionProps,
16
+ } from "./get-dependencies-version.service";
@@ -13,4 +13,4 @@ export const LOCAL_STORAGE_LOCATION_EDIT_KEY = "bp_hide_edit_location_confirm";
13
13
  export const LOCAL_STORAGE_RECIPIENT_EDIT_KEY =
14
14
  "bp_hide_edit_recipient_confirm";
15
15
 
16
- export const CURRENT_VERSION = "1.3.9";
16
+ export const CURRENT_VERSION = "1.3.11";