@vtex/faststore-plugin-buyer-portal 1.1.88 → 1.1.90

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/README.md CHANGED
@@ -14,14 +14,14 @@
14
14
  - Run `yarn link @vtex/faststore-plugin-buyer-portal`
15
15
  - Run `yarn`
16
16
  - Run `yarn dev` to start your local server
17
- - You will acess the buyer-portal via: localhost:3000/buyer-portal
17
+ - You will acess the Organization Account via: localhost:3000/pvt/organization-account
18
18
 
19
19
  ### Generating a Cookie
20
20
 
21
21
  - Go to `b2bdev.vtexfaststore.com/login` and log-in as a user that has already been added to an Unit. If you don't have one, contact someone on the B2B - Enabler
22
22
  - Go to copy your `VtexIdclientAutCookie_b2bfaststoredev` cookie
23
23
  - Create a cookie in your `localhost:3000` with the `VtexIdclientAutCookie_b2bfaststoredev` key and the value you just copied
24
- - Go to `localhost:3000/buyer-portal`
24
+ - Go to `localhost:3000/pvt/organization-account`
25
25
 
26
26
  ## Developing
27
27
 
@@ -2,7 +2,7 @@
2
2
  export const TEST_CONFIG = {
3
3
  LOCAL_URL: "http://localhost:3000",
4
4
  ROUTES: {
5
- BUYER_PORTAL: "/buyer-portal",
5
+ BUYER_PORTAL: "/pvt/organization-account",
6
6
  },
7
7
  PAYMENT_METHODS: {
8
8
  MASTERCARD: "Mastercard",
@@ -27,11 +27,15 @@ describe("Collections", () => {
27
27
  });
28
28
 
29
29
  it("Should show empty state when unit has no collection", () => {
30
- cy.intercept("GET", "/_next/data/**/buyer-portal/collections/**", (req) => {
31
- req.reply((res) => {
32
- res.body.pageProps.data.isContractEmpty = true;
33
- });
34
- });
30
+ cy.intercept(
31
+ "GET",
32
+ "/_next/data/**/pvt/organization-account/collections/**",
33
+ (req) => {
34
+ req.reply((res) => {
35
+ res.body.pageProps.data.isContractEmpty = true;
36
+ });
37
+ }
38
+ );
35
39
 
36
40
  visitCollectionsPage();
37
41
 
@@ -23,26 +23,30 @@ function interceptCreateCreditCard() {
23
23
  }
24
24
 
25
25
  function interceptGetCreditCards() {
26
- cy.intercept("GET", "/_next/data/**/buyer-portal/credit-cards/**", (req) => {
27
- req.reply((res) => {
28
- res.body.pageProps.data.data.push({
29
- accountId: "FAKE_ACCOUNT_ID",
30
- paymentSystem: "1",
31
- paymentSystemName: "Visa",
32
- cardNumber: "************1234",
33
- bin: "411111",
34
- availableAddresses: [],
35
- expirationDate: "12/2030",
36
- isExpired: false,
37
- accountStatus: null,
38
- cardLabel: "Personal Card",
39
- useCvvForAuthorization: true,
40
- isCardToken: false,
41
- isDefault: false,
42
- isActive: true,
26
+ cy.intercept(
27
+ "GET",
28
+ "/_next/data/**/pvt/pvt/organization-account/credit-cards/**",
29
+ (req) => {
30
+ req.reply((res) => {
31
+ res.body.pageProps.data.data.push({
32
+ accountId: "FAKE_ACCOUNT_ID",
33
+ paymentSystem: "1",
34
+ paymentSystemName: "Visa",
35
+ cardNumber: "************1234",
36
+ bin: "411111",
37
+ availableAddresses: [],
38
+ expirationDate: "12/2030",
39
+ isExpired: false,
40
+ accountStatus: null,
41
+ cardLabel: "Personal Card",
42
+ useCvvForAuthorization: true,
43
+ isCardToken: false,
44
+ isDefault: false,
45
+ isActive: true,
46
+ });
43
47
  });
44
- });
45
- }).as("getCreditCards");
48
+ }
49
+ ).as("getCreditCards");
46
50
  }
47
51
 
48
52
  function fillInitialCreditCardData() {
@@ -175,7 +179,7 @@ describe("Credit Cards Page", () => {
175
179
  // Intercept the server-side request and modify only the data field to simulate an empty state
176
180
  cy.intercept(
177
181
  "GET",
178
- "/_next/data/**/buyer-portal/credit-cards/**",
182
+ "/_next/data/**/pvt/pvt/organization-account/credit-cards/**",
179
183
  (req) => {
180
184
  req.reply((res) => {
181
185
  res.body.pageProps.data.data = []; // Set the data field to an empty array
@@ -3,7 +3,9 @@ import { TEST_CONFIG } from "../constants";
3
3
  // Utility function to navigate to Roles page
4
4
  function goToRolesPage() {
5
5
  cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
6
- cy.get('a[data-fs-vertical-nav-menu-link][href^="/buyer-portal/roles/"]')
6
+ cy.get(
7
+ 'a[data-fs-vertical-nav-menu-link][href^="/pvt/organization-account/roles/"]'
8
+ )
7
9
  .contains("Roles")
8
10
  .click();
9
11
  }
@@ -1,7 +1,7 @@
1
1
  import { TEST_CONFIG } from "../constants";
2
2
 
3
3
  Cypress.Commands.add("login", () => {
4
- cy.session("buyer-portal-login", () => {
4
+ cy.session("organization-account-login", () => {
5
5
  const loginOrigin = new URL(TEST_CONFIG.AUTH.LOGIN_URL).origin;
6
6
  const login = Cypress.env("VTEX_ACCOUNT_LOGIN");
7
7
  const password = Cypress.env("VTEX_ACCOUNT_PASSWORD");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.1.88",
3
+ "version": "1.1.90",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.config.js CHANGED
@@ -3,89 +3,89 @@ module.exports = {
3
3
  name: "poc-plugin",
4
4
  pages: {
5
5
  home: {
6
- path: "/buyer-portal/[[...contractMode]]",
6
+ path: "/pvt/organization-account/[[...contractMode]]",
7
7
  appLayout: false,
8
8
  },
9
9
  "address-details": {
10
- path: "/buyer-portal/address/[orgUnitId]/[contractId]/[addressId]",
10
+ path: "/pvt/organization-account/address/[orgUnitId]/[contractId]/[addressId]",
11
11
  appLayout: false,
12
12
  },
13
13
 
14
14
  // ----
15
15
  profile: {
16
- path: "/buyer-portal/profile/[orgUnitId]/[contractId]",
16
+ path: "/pvt/organization-account/profile/[orgUnitId]/[contractId]",
17
17
  appLayout: false,
18
18
  },
19
19
  addresses: {
20
- path: "/buyer-portal/addresses/[orgUnitId]/[contractId]",
20
+ path: "/pvt/organization-account/addresses/[orgUnitId]/[contractId]",
21
21
  appLayout: false,
22
22
  },
23
23
  budgets: {
24
- path: "/buyer-portal/budgets/[orgUnitId]/[contractId]",
24
+ path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]",
25
25
  appLayout: false,
26
26
  },
27
27
  "budgets-details": {
28
- path: "/buyer-portal/budgets/[orgUnitId]/[contractId]/[budgetId]",
28
+ path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]/[budgetId]",
29
29
  appLayout: false,
30
30
  },
31
31
  "payment-methods": {
32
- path: "/buyer-portal/payment-methods/[orgUnitId]/[contractId]",
32
+ path: "/pvt/organization-account/payment-methods/[orgUnitId]/[contractId]",
33
33
  appLayout: false,
34
34
  },
35
35
  "credit-cards": {
36
- path: "/buyer-portal/credit-cards/[orgUnitId]/[contractId]",
36
+ path: "/pvt/organization-account/credit-cards/[orgUnitId]/[contractId]",
37
37
  appLayout: false,
38
38
  },
39
39
  collections: {
40
- path: "/buyer-portal/collections/[orgUnitId]/[contractId]",
40
+ path: "/pvt/organization-account/collections/[orgUnitId]/[contractId]",
41
41
  appLayout: false,
42
42
  },
43
43
  "po-numbers": {
44
- path: "/buyer-portal/po-numbers/[orgUnitId]/[contractId]",
44
+ path: "/pvt/organization-account/po-numbers/[orgUnitId]/[contractId]",
45
45
  appLayout: false,
46
46
  },
47
47
  "cost-centers": {
48
- path: "/buyer-portal/cost-centers/[orgUnitId]/[contractId]",
48
+ path: "/pvt/organization-account/cost-centers/[orgUnitId]/[contractId]",
49
49
  appLayout: false,
50
50
  },
51
51
  releases: {
52
- path: "/buyer-portal/releases/[orgUnitId]/[contractId]",
52
+ path: "/pvt/organization-account/releases/[orgUnitId]/[contractId]",
53
53
  appLayout: false,
54
54
  },
55
55
  roles: {
56
- path: "/buyer-portal/roles/[orgUnitId]",
56
+ path: "/pvt/organization-account/roles/[orgUnitId]",
57
57
  appLayout: false,
58
58
  },
59
59
  "role-details": {
60
- path: "/buyer-portal/roles/[orgUnitId]/[roleName]",
60
+ path: "/pvt/organization-account/roles/[orgUnitId]/[roleName]",
61
61
  appLayout: false,
62
62
  },
63
63
  "buying-policies": {
64
- path: "/buyer-portal/buying-policies/[orgUnitId]/[contractId]",
64
+ path: "/pvt/organization-account/buying-policies/[orgUnitId]/[contractId]",
65
65
  appLayout: false,
66
66
  },
67
67
 
68
68
  "buying-policy-details": {
69
- path: "/buyer-portal/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
69
+ path: "/pvt/organization-account/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
70
70
  appLayout: false,
71
71
  },
72
72
 
73
73
  users: {
74
- path: "/buyer-portal/users/[orgUnitId]",
74
+ path: "/pvt/organization-account/users/[orgUnitId]",
75
75
  appLayout: false,
76
76
  },
77
77
 
78
78
  "org-units": {
79
- path: "/buyer-portal/org-units/[orgUnitId]",
79
+ path: "/pvt/organization-account/org-units/[orgUnitId]",
80
80
  appLayout: false,
81
81
  },
82
82
 
83
83
  "user-details": {
84
- path: "/buyer-portal/user/[orgUnitId]/[userId]",
84
+ path: "/pvt/organization-account/user/[orgUnitId]/[userId]",
85
85
  appLayout: false,
86
86
  },
87
87
  "org-unit-details": {
88
- path: "/buyer-portal/org-unit/[orgUnitId]",
88
+ path: "/pvt/organization-account/org-unit/[orgUnitId]",
89
89
  appLayout: false,
90
90
  },
91
91
  },
@@ -25,7 +25,7 @@ export const InternalTopBar = ({
25
25
  titleDropDownItems,
26
26
  showActions = true,
27
27
  children,
28
- href = "/buyer-portal",
28
+ href = "/pvt/organization-account",
29
29
  }: InternapTopBarProps) => {
30
30
  const { currentOrgUnit } = useBuyerPortal();
31
31
 
@@ -25,7 +25,7 @@ const getMenuItems = (orgUnit?: OrgUnitBasicData | null) => {
25
25
 
26
26
  const firstOption = orgUnit
27
27
  ? { name: orgUnit.name, link: `/org-unit/${orgUnit.id}` }
28
- : { name: "Buyer Portal", link: "/buyer-portal" };
28
+ : { name: "Organization Account", link: "/pvt/organization-account" };
29
29
 
30
30
  return [firstOption, ...menuItems];
31
31
  };
@@ -1,4 +1,4 @@
1
- const base = "/buyer-portal";
1
+ const base = "/pvt/organization-account";
2
2
 
3
3
  function replaceParams(template: string, params: Record<string, string>) {
4
4
  return Object.entries(params).reduce((url, [key, value]) => {
@@ -12,89 +12,90 @@ export interface RouteTabsLayoutConfig {
12
12
 
13
13
  export const ROUTE_TABS_LAYOUT_MAPPING: Record<string, RouteTabsLayoutConfig> =
14
14
  {
15
- "/buyer-portal/profile/[orgUnitId]/[contractId]": {
15
+ "/pvt/organization-account/profile/[orgUnitId]/[contractId]": {
16
16
  layout: "ContractTabsLayout",
17
17
  pageName: "Contract",
18
18
  pageTitle: "Profile",
19
19
  },
20
- "/buyer-portal/addresses/[orgUnitId]/[contractId]": {
20
+ "/pvt/organization-account/addresses/[orgUnitId]/[contractId]": {
21
21
  layout: "ContractTabsLayout",
22
22
  pageName: "Contract",
23
23
  pageTitle: "Addresses",
24
24
  },
25
- "/buyer-portal/address/[orgUnitId]/[contractId]/[addressId]": {
25
+ "/pvt/organization-account/address/[orgUnitId]/[contractId]/[addressId]": {
26
26
  layout: "ContractTabsLayout",
27
27
  pageName: "Contract",
28
28
  pageTitle: "Address Details",
29
29
  },
30
- "/buyer-portal/payment-methods/[orgUnitId]/[contractId]": {
30
+ "/pvt/organization-account/payment-methods/[orgUnitId]/[contractId]": {
31
31
  layout: "ContractTabsLayout",
32
32
  pageName: "Contract",
33
33
  pageTitle: "Payment Methods",
34
34
  },
35
- "/buyer-portal/credit-cards/[orgUnitId]/[contractId]": {
35
+ "/pvt/organization-account/credit-cards/[orgUnitId]/[contractId]": {
36
36
  layout: "ContractTabsLayout",
37
37
  pageName: "Contract",
38
38
  pageTitle: "Credit Cards",
39
39
  },
40
- "/buyer-portal/collections/[orgUnitId]/[contractId]": {
40
+ "/pvt/organization-account/collections/[orgUnitId]/[contractId]": {
41
41
  layout: "ContractTabsLayout",
42
42
  pageName: "Contract",
43
43
  pageTitle: "Collections",
44
44
  },
45
- "/buyer-portal/po-numbers/[orgUnitId]/[contractId]": {
45
+ "/pvt/organization-account/po-numbers/[orgUnitId]/[contractId]": {
46
46
  layout: "ContractTabsLayout",
47
47
  pageName: "Contract",
48
48
  pageTitle: "PO Numbers",
49
49
  },
50
- "/buyer-portal/cost-centers/[orgUnitId]/[contractId]": {
50
+ "/pvt/organization-account/cost-centers/[orgUnitId]/[contractId]": {
51
51
  layout: "ContractTabsLayout",
52
52
  pageName: "Contract",
53
53
  pageTitle: "Cost Centers",
54
54
  },
55
- "/buyer-portal/releases/[orgUnitId]/[contractId]": {
55
+ "/pvt/organization-account/releases/[orgUnitId]/[contractId]": {
56
56
  layout: "ContractTabsLayout",
57
57
  pageName: "Contract",
58
58
  pageTitle: "Releases",
59
59
  },
60
60
 
61
- "/buyer-portal/buying-policies/[orgUnitId]/[contractId]": {
61
+ "/pvt/organization-account/buying-policies/[orgUnitId]/[contractId]": {
62
62
  layout: "FinanceTabsLayout",
63
63
  pageName: "Finance and Compliance",
64
64
  pageTitle: "Buying Policies",
65
65
  },
66
- "/buyer-portal/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]": {
67
- layout: "FinanceTabsLayout",
68
- pageName: "Finance and Compliance",
69
- pageTitle: "Buying Policy Details",
70
- },
66
+ "/pvt/organization-account/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]":
67
+ {
68
+ layout: "FinanceTabsLayout",
69
+ pageName: "Finance and Compliance",
70
+ pageTitle: "Buying Policy Details",
71
+ },
71
72
 
72
- "/buyer-portal/roles/[orgUnitId]": {
73
+ "/pvt/organization-account/roles/[orgUnitId]": {
73
74
  layout: "OrgUnitTabsLayout",
74
75
  pageName: "Organization",
75
76
  pageTitle: "Roles",
76
77
  },
77
- "/buyer-portal/roles/[orgUnitId]/[roleName]": {
78
+ "/pvt/organization-account/roles/[orgUnitId]/[roleName]": {
78
79
  layout: "OrgUnitTabsLayout",
79
80
  pageName: "Organization",
80
81
  pageTitle: "Role Details",
81
82
  },
82
- "/buyer-portal/users/[orgUnitId]": {
83
+ "/pvt/organization-account/users/[orgUnitId]": {
83
84
  layout: "OrgUnitTabsLayout",
84
85
  pageName: "Organization",
85
86
  pageTitle: "Users",
86
87
  },
87
- "/buyer-portal/user/[orgUnitId]/[userId]": {
88
+ "/pvt/organization-account/user/[orgUnitId]/[userId]": {
88
89
  layout: "OrgUnitTabsLayout",
89
90
  pageName: "Organization",
90
91
  pageTitle: "User Details",
91
92
  },
92
- "/buyer-portal/org-units/[orgUnitId]": {
93
+ "/pvt/organization-account/org-units/[orgUnitId]": {
93
94
  layout: "OrgUnitTabsLayout",
94
95
  pageName: "Organization",
95
96
  pageTitle: "Organization Details",
96
97
  },
97
- "/buyer-portal/org-unit/[orgUnitId]": {
98
+ "/pvt/organization-account/org-unit/[orgUnitId]": {
98
99
  layout: "OrgUnitDetailsLayout",
99
100
  pageName: "Organization",
100
101
  pageTitle: "Organization Details",
@@ -95,7 +95,7 @@ export async function loader(
95
95
  };
96
96
  }
97
97
 
98
- data.res?.writeHead(302, { Location: "/buyer-portal" });
98
+ data.res?.writeHead(302, { Location: "/pvt/organization-account" });
99
99
  data.res?.end();
100
100
 
101
101
  return {
@@ -41,7 +41,7 @@ export async function loader(
41
41
  const user = await getUserByIdService({ orgUnitId, userId, cookie });
42
42
 
43
43
  if (!user) {
44
- data.res?.writeHead(302, { Location: "/buyer-portal" });
44
+ data.res?.writeHead(302, { Location: "/pvt/organization-account" });
45
45
  data.res?.end();
46
46
  }
47
47