@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 +2 -2
- package/cypress/constants.ts +1 -1
- package/cypress/integration/collections.test.ts +9 -5
- package/cypress/integration/credit-cards.test.ts +24 -20
- package/cypress/integration/roles.test.ts +3 -1
- package/cypress/support/commands.ts +1 -1
- package/package.json +1 -1
- package/plugin.config.js +20 -20
- package/src/features/shared/components/InternalTopbar/InternalTopbar.tsx +1 -1
- package/src/features/shared/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +1 -1
- package/src/features/shared/utils/buyerPortalRoutes.ts +1 -1
- package/src/features/shared/utils/routeLayoutMapping.ts +22 -21
- package/src/pages/org-units.tsx +1 -1
- package/src/pages/user-details.tsx +1 -1
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
|
|
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/
|
|
24
|
+
- Go to `localhost:3000/pvt/organization-account`
|
|
25
25
|
|
|
26
26
|
## Developing
|
|
27
27
|
|
package/cypress/constants.ts
CHANGED
|
@@ -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(
|
|
31
|
-
|
|
32
|
-
|
|
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(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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/**/
|
|
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(
|
|
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("
|
|
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
package/plugin.config.js
CHANGED
|
@@ -3,89 +3,89 @@ module.exports = {
|
|
|
3
3
|
name: "poc-plugin",
|
|
4
4
|
pages: {
|
|
5
5
|
home: {
|
|
6
|
-
path: "/
|
|
6
|
+
path: "/pvt/organization-account/[[...contractMode]]",
|
|
7
7
|
appLayout: false,
|
|
8
8
|
},
|
|
9
9
|
"address-details": {
|
|
10
|
-
path: "/
|
|
10
|
+
path: "/pvt/organization-account/address/[orgUnitId]/[contractId]/[addressId]",
|
|
11
11
|
appLayout: false,
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
// ----
|
|
15
15
|
profile: {
|
|
16
|
-
path: "/
|
|
16
|
+
path: "/pvt/organization-account/profile/[orgUnitId]/[contractId]",
|
|
17
17
|
appLayout: false,
|
|
18
18
|
},
|
|
19
19
|
addresses: {
|
|
20
|
-
path: "/
|
|
20
|
+
path: "/pvt/organization-account/addresses/[orgUnitId]/[contractId]",
|
|
21
21
|
appLayout: false,
|
|
22
22
|
},
|
|
23
23
|
budgets: {
|
|
24
|
-
path: "/
|
|
24
|
+
path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]",
|
|
25
25
|
appLayout: false,
|
|
26
26
|
},
|
|
27
27
|
"budgets-details": {
|
|
28
|
-
path: "/
|
|
28
|
+
path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]/[budgetId]",
|
|
29
29
|
appLayout: false,
|
|
30
30
|
},
|
|
31
31
|
"payment-methods": {
|
|
32
|
-
path: "/
|
|
32
|
+
path: "/pvt/organization-account/payment-methods/[orgUnitId]/[contractId]",
|
|
33
33
|
appLayout: false,
|
|
34
34
|
},
|
|
35
35
|
"credit-cards": {
|
|
36
|
-
path: "/
|
|
36
|
+
path: "/pvt/organization-account/credit-cards/[orgUnitId]/[contractId]",
|
|
37
37
|
appLayout: false,
|
|
38
38
|
},
|
|
39
39
|
collections: {
|
|
40
|
-
path: "/
|
|
40
|
+
path: "/pvt/organization-account/collections/[orgUnitId]/[contractId]",
|
|
41
41
|
appLayout: false,
|
|
42
42
|
},
|
|
43
43
|
"po-numbers": {
|
|
44
|
-
path: "/
|
|
44
|
+
path: "/pvt/organization-account/po-numbers/[orgUnitId]/[contractId]",
|
|
45
45
|
appLayout: false,
|
|
46
46
|
},
|
|
47
47
|
"cost-centers": {
|
|
48
|
-
path: "/
|
|
48
|
+
path: "/pvt/organization-account/cost-centers/[orgUnitId]/[contractId]",
|
|
49
49
|
appLayout: false,
|
|
50
50
|
},
|
|
51
51
|
releases: {
|
|
52
|
-
path: "/
|
|
52
|
+
path: "/pvt/organization-account/releases/[orgUnitId]/[contractId]",
|
|
53
53
|
appLayout: false,
|
|
54
54
|
},
|
|
55
55
|
roles: {
|
|
56
|
-
path: "/
|
|
56
|
+
path: "/pvt/organization-account/roles/[orgUnitId]",
|
|
57
57
|
appLayout: false,
|
|
58
58
|
},
|
|
59
59
|
"role-details": {
|
|
60
|
-
path: "/
|
|
60
|
+
path: "/pvt/organization-account/roles/[orgUnitId]/[roleName]",
|
|
61
61
|
appLayout: false,
|
|
62
62
|
},
|
|
63
63
|
"buying-policies": {
|
|
64
|
-
path: "/
|
|
64
|
+
path: "/pvt/organization-account/buying-policies/[orgUnitId]/[contractId]",
|
|
65
65
|
appLayout: false,
|
|
66
66
|
},
|
|
67
67
|
|
|
68
68
|
"buying-policy-details": {
|
|
69
|
-
path: "/
|
|
69
|
+
path: "/pvt/organization-account/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
|
|
70
70
|
appLayout: false,
|
|
71
71
|
},
|
|
72
72
|
|
|
73
73
|
users: {
|
|
74
|
-
path: "/
|
|
74
|
+
path: "/pvt/organization-account/users/[orgUnitId]",
|
|
75
75
|
appLayout: false,
|
|
76
76
|
},
|
|
77
77
|
|
|
78
78
|
"org-units": {
|
|
79
|
-
path: "/
|
|
79
|
+
path: "/pvt/organization-account/org-units/[orgUnitId]",
|
|
80
80
|
appLayout: false,
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
"user-details": {
|
|
84
|
-
path: "/
|
|
84
|
+
path: "/pvt/organization-account/user/[orgUnitId]/[userId]",
|
|
85
85
|
appLayout: false,
|
|
86
86
|
},
|
|
87
87
|
"org-unit-details": {
|
|
88
|
-
path: "/
|
|
88
|
+
path: "/pvt/organization-account/org-unit/[orgUnitId]",
|
|
89
89
|
appLayout: false,
|
|
90
90
|
},
|
|
91
91
|
},
|
|
@@ -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: "
|
|
28
|
+
: { name: "Organization Account", link: "/pvt/organization-account" };
|
|
29
29
|
|
|
30
30
|
return [firstOption, ...menuItems];
|
|
31
31
|
};
|
|
@@ -12,89 +12,90 @@ export interface RouteTabsLayoutConfig {
|
|
|
12
12
|
|
|
13
13
|
export const ROUTE_TABS_LAYOUT_MAPPING: Record<string, RouteTabsLayoutConfig> =
|
|
14
14
|
{
|
|
15
|
-
"/
|
|
15
|
+
"/pvt/organization-account/profile/[orgUnitId]/[contractId]": {
|
|
16
16
|
layout: "ContractTabsLayout",
|
|
17
17
|
pageName: "Contract",
|
|
18
18
|
pageTitle: "Profile",
|
|
19
19
|
},
|
|
20
|
-
"/
|
|
20
|
+
"/pvt/organization-account/addresses/[orgUnitId]/[contractId]": {
|
|
21
21
|
layout: "ContractTabsLayout",
|
|
22
22
|
pageName: "Contract",
|
|
23
23
|
pageTitle: "Addresses",
|
|
24
24
|
},
|
|
25
|
-
"/
|
|
25
|
+
"/pvt/organization-account/address/[orgUnitId]/[contractId]/[addressId]": {
|
|
26
26
|
layout: "ContractTabsLayout",
|
|
27
27
|
pageName: "Contract",
|
|
28
28
|
pageTitle: "Address Details",
|
|
29
29
|
},
|
|
30
|
-
"/
|
|
30
|
+
"/pvt/organization-account/payment-methods/[orgUnitId]/[contractId]": {
|
|
31
31
|
layout: "ContractTabsLayout",
|
|
32
32
|
pageName: "Contract",
|
|
33
33
|
pageTitle: "Payment Methods",
|
|
34
34
|
},
|
|
35
|
-
"/
|
|
35
|
+
"/pvt/organization-account/credit-cards/[orgUnitId]/[contractId]": {
|
|
36
36
|
layout: "ContractTabsLayout",
|
|
37
37
|
pageName: "Contract",
|
|
38
38
|
pageTitle: "Credit Cards",
|
|
39
39
|
},
|
|
40
|
-
"/
|
|
40
|
+
"/pvt/organization-account/collections/[orgUnitId]/[contractId]": {
|
|
41
41
|
layout: "ContractTabsLayout",
|
|
42
42
|
pageName: "Contract",
|
|
43
43
|
pageTitle: "Collections",
|
|
44
44
|
},
|
|
45
|
-
"/
|
|
45
|
+
"/pvt/organization-account/po-numbers/[orgUnitId]/[contractId]": {
|
|
46
46
|
layout: "ContractTabsLayout",
|
|
47
47
|
pageName: "Contract",
|
|
48
48
|
pageTitle: "PO Numbers",
|
|
49
49
|
},
|
|
50
|
-
"/
|
|
50
|
+
"/pvt/organization-account/cost-centers/[orgUnitId]/[contractId]": {
|
|
51
51
|
layout: "ContractTabsLayout",
|
|
52
52
|
pageName: "Contract",
|
|
53
53
|
pageTitle: "Cost Centers",
|
|
54
54
|
},
|
|
55
|
-
"/
|
|
55
|
+
"/pvt/organization-account/releases/[orgUnitId]/[contractId]": {
|
|
56
56
|
layout: "ContractTabsLayout",
|
|
57
57
|
pageName: "Contract",
|
|
58
58
|
pageTitle: "Releases",
|
|
59
59
|
},
|
|
60
60
|
|
|
61
|
-
"/
|
|
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
|
-
"/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
"/
|
|
73
|
+
"/pvt/organization-account/roles/[orgUnitId]": {
|
|
73
74
|
layout: "OrgUnitTabsLayout",
|
|
74
75
|
pageName: "Organization",
|
|
75
76
|
pageTitle: "Roles",
|
|
76
77
|
},
|
|
77
|
-
"/
|
|
78
|
+
"/pvt/organization-account/roles/[orgUnitId]/[roleName]": {
|
|
78
79
|
layout: "OrgUnitTabsLayout",
|
|
79
80
|
pageName: "Organization",
|
|
80
81
|
pageTitle: "Role Details",
|
|
81
82
|
},
|
|
82
|
-
"/
|
|
83
|
+
"/pvt/organization-account/users/[orgUnitId]": {
|
|
83
84
|
layout: "OrgUnitTabsLayout",
|
|
84
85
|
pageName: "Organization",
|
|
85
86
|
pageTitle: "Users",
|
|
86
87
|
},
|
|
87
|
-
"/
|
|
88
|
+
"/pvt/organization-account/user/[orgUnitId]/[userId]": {
|
|
88
89
|
layout: "OrgUnitTabsLayout",
|
|
89
90
|
pageName: "Organization",
|
|
90
91
|
pageTitle: "User Details",
|
|
91
92
|
},
|
|
92
|
-
"/
|
|
93
|
+
"/pvt/organization-account/org-units/[orgUnitId]": {
|
|
93
94
|
layout: "OrgUnitTabsLayout",
|
|
94
95
|
pageName: "Organization",
|
|
95
96
|
pageTitle: "Organization Details",
|
|
96
97
|
},
|
|
97
|
-
"/
|
|
98
|
+
"/pvt/organization-account/org-unit/[orgUnitId]": {
|
|
98
99
|
layout: "OrgUnitDetailsLayout",
|
|
99
100
|
pageName: "Organization",
|
|
100
101
|
pageTitle: "Organization Details",
|
package/src/pages/org-units.tsx
CHANGED
|
@@ -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: "/
|
|
44
|
+
data.res?.writeHead(302, { Location: "/pvt/organization-account" });
|
|
45
45
|
data.res?.end();
|
|
46
46
|
}
|
|
47
47
|
|