@vtex/faststore-plugin-buyer-portal 1.0.12 → 1.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {},
package/plugin.config.js CHANGED
@@ -29,5 +29,9 @@ module.exports = {
29
29
  path: "/user/[id]",
30
30
  appLayout: false,
31
31
  },
32
+ profile: {
33
+ path: "/profile",
34
+ appLayout: false,
35
+ }
32
36
  },
33
37
  };
@@ -31,7 +31,7 @@ export default function AddressesCard({ addresses }: AddressesCardProps) {
31
31
  <IconButton
32
32
  icon={<UIIcon name="PlusCircle" width={20} height={20} />}
33
33
  aria-label={`$addresses action`}
34
- onClick={() => {}}
34
+ onClick={() => { }}
35
35
  />
36
36
  </CardHeader>
37
37
  <CardBody>
@@ -52,7 +52,7 @@ export default function AddressesCard({ addresses }: AddressesCardProps) {
52
52
 
53
53
  <div data-fs-card-information-type>
54
54
  {address.tags.map((tag) => (
55
- <Tag>{tag}</Tag>
55
+ <Tag key={`${address.id}-${tag}`}>{tag}</Tag>
56
56
  ))}
57
57
  </div>
58
58
  </div>
@@ -39,13 +39,15 @@ export default function ProfileCard({
39
39
  </div>
40
40
  </CardBody>
41
41
  <CardFooter>
42
- <Link href="/" data-fs-card-footer-link>
42
+ <Link href="/profile" data-fs-card-footer-link>
43
43
  <span>View Profile</span>
44
44
  </Link>
45
- <IconButton
46
- icon={<Icon name="CaretRight" data-fs-card-footer-icon />}
47
- aria-label="view-profile"
48
- />
45
+ <Link href="/profile">
46
+ <IconButton
47
+ icon={<Icon name="CaretRight" data-fs-card-footer-icon />}
48
+ aria-label="view-profile"
49
+ />
50
+ </Link>
49
51
  </CardFooter>
50
52
  </Card>
51
53
  );
@@ -0,0 +1,64 @@
1
+ import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
2
+ import { getTreeDepth } from "../../utils/getTreeDepth";
3
+ import { OrgUnitsHierarchyTree } from "../../components/OrgUnitsHierarchyTree/OrgUnitsHierarchyTree";
4
+ import { Structure } from "../../components/HierarchyTree/HierarchyTree";
5
+ import { ContractData } from "../../types/ContractData";
6
+ import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
7
+ import { Icon } from "../../components/Icon";
8
+
9
+ export type ProfileLayoutProps = {
10
+ data: ContractData;
11
+ };
12
+
13
+ export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
14
+ return (
15
+ <GlobalLayout>
16
+ <section data-fs-bp-profile>
17
+ <InternalTopBar
18
+ rootName="Stars Corp Inc."
19
+ title={
20
+ <div data-fs-bp-profile-title>
21
+ Profile
22
+ </div>
23
+ }
24
+ showActions={false}
25
+ />
26
+
27
+ <div data-fs-bp-profile-details>
28
+ <span data-fs-bp-profile-details-title>
29
+ Details
30
+ </span>
31
+ <hr data-fs-bp-profile-divider />
32
+
33
+ <div data-fs-bp-profile-details-row>
34
+ <span data-fs-bp-profile-details-row-label>Name</span>
35
+ <span data-fs-bp-profile-details-row-value>{data.name}</span>
36
+ </div>
37
+
38
+ <hr data-fs-bp-profile-divider />
39
+
40
+ <div data-fs-bp-profile-details-row>
41
+ <span data-fs-bp-profile-details-row-label>Email</span>
42
+ <span data-fs-bp-profile-details-row-value>{data.email}</span>
43
+ </div>
44
+
45
+ <hr data-fs-bp-profile-divider />
46
+
47
+ <div data-fs-bp-profile-details-row>
48
+ <span data-fs-bp-profile-details-row-label>ID</span>
49
+ <span data-fs-bp-profile-details-row-value>{data.id}</span>
50
+ </div>
51
+
52
+ <hr data-fs-bp-profile-divider />
53
+
54
+ <div data-fs-bp-profile-details-row>
55
+ <span data-fs-bp-profile-details-row-label>Creation Date</span>
56
+ <span data-fs-bp-profile-details-row-value>{data.creationDate}</span>
57
+ </div>
58
+
59
+ <hr data-fs-bp-profile-divider />
60
+ </div>
61
+ </section>
62
+ </GlobalLayout>
63
+ );
64
+ };
@@ -0,0 +1,49 @@
1
+ [data-fs-bp-profile]{
2
+ @import "@faststore/ui/src/components/molecules/Toggle/styles.scss";
3
+ @import "../../components/InternalTopbar/internal-top-bar.scss";
4
+
5
+ width: 100%;
6
+
7
+ [data-fs-bp-profile-details-title] {
8
+ font-weight: var(--fs-text-weight-semibold);
9
+ size: var(--fs-spacing-3);
10
+ line-height: var(--fs-spacing-4);
11
+
12
+ display: flex;
13
+ justify-content: space-between;
14
+ padding: var(--fs-spacing-4);
15
+ align-items: center;
16
+ }
17
+
18
+ [data-fs-bp-profile-divider] {
19
+ border: 0.5px solid #e0e0e0;
20
+ }
21
+
22
+ [data-fs-button][data-fs-button-variant="primary"] [data-fs-button-wrapper] {
23
+ border-radius: var(--fs-border-radius-pill);
24
+ }
25
+
26
+ [data-fs-bp-profile-details-row] {
27
+ display: flex;
28
+ padding: var(--fs-spacing-4);
29
+ font-weight: var(--fs-text-weight-medium);
30
+ size: var(--fs-text-size-1);
31
+ line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
32
+
33
+ [data-fs-bp-profile-details-row-label] {
34
+ width: 30%;
35
+
36
+ color: #707070;
37
+ }
38
+
39
+ [data-fs-bp-profile-details-row-value] {
40
+ width: 70%;
41
+ color: #000;
42
+ }
43
+ }
44
+
45
+ [data-fs-bp-profile-details] {
46
+ padding: 0 calc(var(--fs-spacing-8) + var(--fs-spacing-0));
47
+ }
48
+ }
49
+
@@ -6,3 +6,4 @@
6
6
  @import "./ContractsLayout/contracts-layout.scss";
7
7
  @import "./UsersLayout/users-layout.scss";
8
8
  @import "./UserDetailsLayout/user-details-layout.scss";
9
+ @import "./ProfileLayout/profile-layout.scss"
@@ -2,30 +2,34 @@ import { ContractData } from "../types/ContractData";
2
2
 
3
3
  export const contractsData: ContractData[] = [
4
4
  // Uncomment to test with a single contract
5
- // contracts: [{
6
- // name: 'ByTech',
7
- // email: 'bytech@demo.com',
8
- // id: '12-32-DDDD',
9
- // status: false,
10
- // }],
11
-
12
- // Comment to test with single contract
13
5
  {
14
6
  name: "ByTech",
15
7
  email: "bytech@demo.com",
16
8
  id: "12-32-DDDD",
17
9
  status: false,
18
- },
19
- {
20
- name: "ByTech South",
21
- email: "bytech@demo.com",
22
- id: "12-32-AAAA",
23
- status: true,
24
- },
25
- {
26
- name: "Stellar Inc",
27
- email: "Stellar@stellar.com",
28
- id: "32-32-32",
29
- status: true,
30
- },
10
+ creationDate: "October 10, 2024"
11
+ }
12
+
13
+ // Comment to test with single contract
14
+ // {
15
+ // name: "ByTech",
16
+ // email: "bytech@demo.com",
17
+ // id: "12-32-DDDD",
18
+ // status: false,
19
+ // creationDate: "October 10, 2024"
20
+ // },
21
+ // {
22
+ // name: "ByTech South",
23
+ // email: "bytech@demo.com",
24
+ // id: "12-32-AAAA",
25
+ // status: true,
26
+ // creationDate: "May 5, 2024"
27
+ // },
28
+ // {
29
+ // name: "Stellar Inc",
30
+ // email: "Stellar@stellar.com",
31
+ // id: "32-32-32",
32
+ // status: true,
33
+ // creationDate: "January 1, 2025"
34
+ // },
31
35
  ];
@@ -0,0 +1,26 @@
1
+ import { ProfileLayout } from "../layouts/ProfileLayout/ProfileLayout";
2
+ import {
3
+ getContractsService,
4
+ GetContractsServiceProps,
5
+ } from "../services/get-contracts.service";
6
+ import { ContractData } from "../types/ContractData";
7
+
8
+ export type ContractsPageData = { data: ContractData };
9
+
10
+ export type ContractsPageContext = {
11
+ query: GetContractsServiceProps;
12
+ };
13
+
14
+ export async function loader({
15
+ query,
16
+ }: ContractsPageContext): Promise<ContractsPageData> {
17
+ const contracts = await getContractsService(query)
18
+
19
+ return { data: contracts[0] };
20
+ }
21
+
22
+ const ContractsPage = ({ data }: ContractsPageData) => (
23
+ <ProfileLayout data={data} />
24
+ );
25
+
26
+ export default ContractsPage;
@@ -3,4 +3,5 @@ export type ContractData = {
3
3
  email: string;
4
4
  id: string;
5
5
  status: boolean;
6
+ creationDate: string;
6
7
  };