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

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.13",
3
+ "version": "1.0.15",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {},
package/plugin.config.js CHANGED
@@ -2,7 +2,7 @@ module.exports = {
2
2
  name: "poc-plugin",
3
3
  pages: {
4
4
  home: {
5
- path: "/buyer-portal",
5
+ path: "/buyer-portal/[[...contractMode]]",
6
6
  appLayout: false,
7
7
  },
8
8
  "org-units": {
@@ -33,7 +33,7 @@ export const ProfileSummary = ({
33
33
  <h2 data-fs-self-profile-summary-org-name>{orgName}</h2>
34
34
  {showManageLink && (
35
35
  <Link data-fs-self-profile-summary-org-link href="/buyer-portal">
36
- Menage Organization <Icon name="OpenInNew" width={20} height={20} />
36
+ Manage Organization <Icon name="OpenInNew" width={20} height={20} />
37
37
  </Link>
38
38
  )}
39
39
  </div>
@@ -23,9 +23,9 @@ export const HomeLayout = ({ data }: HomeLayoutProps) => (
23
23
  <UsersCard users={data.users} />
24
24
 
25
25
  {/* Remove this comments when mocks be removed */}
26
- {/* {data.contracts.length === 1 && ( */}
27
- <AddressesCard addresses={data.addresses} />
28
- {/* )} */}
26
+ {data.contracts.length === 1 && (
27
+ <AddressesCard addresses={data.addresses} />
28
+ )}
29
29
  <OrganizationalUnitsCard
30
30
  organizationalUnits={data.orgUnitsHierarchy.nodes}
31
31
  />
@@ -2,34 +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
- {
6
- name: "ByTech",
7
- email: "bytech@demo.com",
8
- id: "12-32-DDDD",
9
- status: false,
10
- creationDate: "October 10, 2024"
11
- }
12
-
13
- // Comment to test with single contract
14
5
  // {
15
6
  // name: "ByTech",
16
7
  // email: "bytech@demo.com",
17
8
  // id: "12-32-DDDD",
18
9
  // status: false,
19
10
  // 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
- // },
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
+ },
35
35
  ];
@@ -4,8 +4,14 @@ import { OrganizationData } from "../types/OrganizationData";
4
4
 
5
5
  export type HomePageData = { data: OrganizationData };
6
6
 
7
- export async function loader(): Promise<HomePageData> {
8
- return { data: await getOrganizationService() };
7
+ type HomePageLoaderContext = {
8
+ query: {
9
+ contractMode?: string[]
10
+ }
11
+ }
12
+
13
+ export async function loader(data: HomePageLoaderContext): Promise<HomePageData> {
14
+ return { data: await getOrganizationService(data.query.contractMode ? data.query.contractMode[0] : '') };
9
15
  }
10
16
 
11
17
  const HomePage = ({ data }: HomePageData) => {
@@ -1,6 +1,13 @@
1
1
  import { organizationData } from "../mock/organization-data";
2
2
  import { OrganizationData } from "../types/OrganizationData";
3
3
 
4
- export const getOrganizationService = async (): Promise<OrganizationData> => {
5
- return organizationData;
4
+ export const getOrganizationService = async (contractMode: string): Promise<OrganizationData> => {
5
+ let mockOrganizationData = organizationData
6
+ console.log('>>>', contractMode)
7
+
8
+ if (contractMode === 'single') {
9
+ mockOrganizationData = { ...organizationData, contracts: [organizationData.contracts[0]] }
10
+ }
11
+
12
+ return mockOrganizationData;
6
13
  };