Skip to content

Commit f6d4ce1

Browse files
authored
Procurement Support (#747)
* Able to merge functionality * remove console.log * add bearer * Allow for logging out and enable the procurement system to set the new cookie * Fix case where cookie is set but no localstorage was set. * set the auth header * updates * Revert "updates" This reverts commit c15532e. * Auto stash before revert of "updates" * update the netlify origin * add new line * revert configurations * Remove the TODO * Update styling file type and add README to the new component
1 parent 69df821 commit f6d4ce1

15 files changed

+741
-21
lines changed

_redirects

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/cortex/* https://reference80.epdemos.com/cortex/:splat 200
1+
/cortex/* https://reference80.epdemos.com/cortex/:splat 200
22
/* /index.html 200

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"jest-resolve": "24.8.0",
5959
"jest-watch-typeahead": "0.3.1",
6060
"jquery": "~3.5.1",
61+
"js-cookie": "^2.2.1",
6162
"js-file-download": "^0.4.8",
6263
"less-loader": "^5.0.0",
6364
"less-vars-to-js": "^1.3.0",

src/components/src/AppHeaderLogin/appheaderlogin.main.tsx

+18-3
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class AppHeaderLoginMain extends Component<AppHeaderLoginMainProps, AppHeaderLog
128128

129129
this.handleModalClose = this.handleModalClose.bind(this);
130130
this.fetchProfileData = this.fetchProfileData.bind(this);
131+
this.getB2cUserName = this.getB2cUserName.bind(this);
131132
}
132133

133134
componentDidMount() {
@@ -335,19 +336,31 @@ class AppHeaderLoginMain extends Component<AppHeaderLoginMainProps, AppHeaderLog
335336
});
336337
}
337338

339+
340+
getB2cUserName() {
341+
const { profileData } = this.state;
342+
let b2cUserName = null;
343+
344+
if (profileData && profileData['given-name'] && profileData['family-name']) {
345+
b2cUserName = profileData ? `${profileData['given-name']} ${profileData['family-name']}` : '';
346+
}
347+
348+
return b2cUserName;
349+
}
350+
338351
render() {
339352
const {
340353
isMobileView, permission, onLogin, onResetPassword, onContinueCart, locationSearchData, appHeaderLoginLinks, appModalLoginLinks, isLoggedIn, disableLogin, locationPathName,
341354
} = this.props;
342355
const {
343-
openModal, openCartModal, showForgotPasswordLink, accountData, loginUrlAddress, oidcParameters, showRequisitionListsLink, profileData,
356+
openModal, openCartModal, showForgotPasswordLink, accountData, loginUrlAddress, oidcParameters, showRequisitionListsLink,
344357
} = this.state;
345358
let keycloakLoginRedirectUrl = '';
346359
if (Config.b2b.enable && Config.b2b.openId && !Config.b2b.openId.enable) {
347360
keycloakLoginRedirectUrl = `${Config.b2b.keycloak.loginRedirectUrl}?client_id=${Config.b2b.keycloak.client_id}&response_type=code&scope=openid&redirect_uri=${encodeURIComponent(Config.b2b.keycloak.callbackUrl)}`;
348361
}
349362
const userName = localStorage.getItem(`${Config.cortexApi.scope}_oAuthUserName`) || localStorage.getItem(`${Config.cortexApi.scope}_oAuthUserId`);
350-
const b2cUserName = profileData ? `${profileData['given-name']} ${profileData['family-name']}` : '';
363+
const b2cUserName = this.getB2cUserName();
351364
const b2bUserName = accountData ? accountData._myprofile && accountData._myprofile[0].name : '';
352365
const email = accountData && accountData._myprofile && accountData._myprofile[0]._primaryemail[0].email;
353366

@@ -397,7 +410,9 @@ class AppHeaderLoginMain extends Component<AppHeaderLoginMainProps, AppHeaderLog
397410
</li>
398411
) : (
399412
<li className="dropdown-item shop-for b2c">
400-
<span className="user-name">{b2cUserName}</span>
413+
{b2cUserName !== 'undefined' ? (
414+
<span className="user-name">{b2cUserName}</span>
415+
) : ('')}
401416
{userName !== 'undefined' ? (
402417
<span className="email-title">{userName}</span>
403418
) : ('')}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"self": {
3+
"type": "carts.cart",
4+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
5+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
6+
},
7+
"messages": [],
8+
"links": [{
9+
"rel": "lineitems",
10+
"rev": "cart",
11+
"type": "carts.line-items",
12+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/lineitems",
13+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/lineitems"
14+
}, {
15+
"rel": "additemstocartform",
16+
"type": "carts.add-items-to-cart-form",
17+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/form",
18+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/form"
19+
}, {
20+
"rel": "descriptor",
21+
"type": "carts.cart-descriptor",
22+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor",
23+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor"
24+
}, {
25+
"rel": "discount",
26+
"rev": "cart",
27+
"type": "discounts.discount-for-cart",
28+
"uri": "/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
29+
"href": "https://reference.epdemos.com/cortex/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
30+
}, {
31+
"rel": "order",
32+
"rev": "cart",
33+
"type": "orders.order",
34+
"uri": "/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=",
35+
"href": "https://reference.epdemos.com/cortex/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi="
36+
}, {
37+
"rel": "appliedpromotions",
38+
"rev": "cart",
39+
"type": "promotions.applied-promotions-for-cart",
40+
"uri": "/promotions/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/applied",
41+
"href": "https://reference.epdemos.com/cortex/promotions/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/applied"
42+
}, {
43+
"rel": "total",
44+
"rev": "cart",
45+
"type": "totals.cart-total",
46+
"uri": "/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
47+
"href": "https://reference.epdemos.com/cortex/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
48+
}],
49+
"_descriptor": [{
50+
"self": {
51+
"type": "carts.cart-descriptor",
52+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor",
53+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor"
54+
},
55+
"cart-transfer-url": "https://connect.procurement.com/gateway/link/return/id/AH5e39b48e23f3d",
56+
"messages": [],
57+
"links": [],
58+
"default": "true"
59+
}],
60+
"_discount": [{
61+
"self": {
62+
"type": "discounts.discount-for-cart",
63+
"uri": "/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
64+
"href": "https://reference.epdemos.com/cortex/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
65+
},
66+
"messages": [],
67+
"links": [{
68+
"rel": "cart",
69+
"rev": "discount",
70+
"type": "carts.cart",
71+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
72+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
73+
}],
74+
"discount": [{
75+
"amount": 0,
76+
"currency": "USD",
77+
"display": "$0.00"
78+
}]
79+
}],
80+
"_order": [{
81+
"_couponinfo": [{
82+
"_couponform": [{
83+
"self": {
84+
"type": "coupons.apply-coupon-to-order-form",
85+
"uri": "/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form",
86+
"href": "https://reference.epdemos.com/cortex/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form"
87+
},
88+
"messages": [],
89+
"links": [{
90+
"rel": "applycouponaction",
91+
"type": "coupons.apply-coupon-to-order-form",
92+
"uri": "/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form",
93+
"href": "https://reference.epdemos.com/cortex/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form"
94+
}],
95+
"code": ""
96+
}]
97+
}]
98+
}],
99+
"_total": [{
100+
"self": {
101+
"type": "totals.cart-total",
102+
"uri": "/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
103+
"href": "https://reference.epdemos.com/cortex/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
104+
},
105+
"messages": [],
106+
"links": [{
107+
"rel": "cart",
108+
"rev": "total",
109+
"type": "carts.cart",
110+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
111+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
112+
}],
113+
"cost": [{
114+
"amount": 0,
115+
"currency": "USD",
116+
"display": "$0.00"
117+
}]
118+
}],
119+
"total-quantity": 0
120+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"self": {
3+
"type": "carts.cart",
4+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
5+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
6+
},
7+
"messages": [],
8+
"links": [{
9+
"rel": "lineitems",
10+
"rev": "cart",
11+
"type": "carts.line-items",
12+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/lineitems",
13+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/lineitems"
14+
}, {
15+
"rel": "additemstocartform",
16+
"type": "carts.add-items-to-cart-form",
17+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/form",
18+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/form"
19+
}, {
20+
"rel": "descriptor",
21+
"type": "carts.cart-descriptor",
22+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor",
23+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor"
24+
}, {
25+
"rel": "discount",
26+
"rev": "cart",
27+
"type": "discounts.discount-for-cart",
28+
"uri": "/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
29+
"href": "https://reference.epdemos.com/cortex/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
30+
}, {
31+
"rel": "order",
32+
"rev": "cart",
33+
"type": "orders.order",
34+
"uri": "/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=",
35+
"href": "https://reference.epdemos.com/cortex/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi="
36+
}, {
37+
"rel": "appliedpromotions",
38+
"rev": "cart",
39+
"type": "promotions.applied-promotions-for-cart",
40+
"uri": "/promotions/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/applied",
41+
"href": "https://reference.epdemos.com/cortex/promotions/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/applied"
42+
}, {
43+
"rel": "total",
44+
"rev": "cart",
45+
"type": "totals.cart-total",
46+
"uri": "/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
47+
"href": "https://reference.epdemos.com/cortex/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
48+
}],
49+
"_descriptor": [{
50+
"self": {
51+
"type": "carts.cart-descriptor",
52+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor",
53+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=/descriptor"
54+
},
55+
"messages": [],
56+
"links": [],
57+
"default": "true"
58+
}],
59+
"_discount": [{
60+
"self": {
61+
"type": "discounts.discount-for-cart",
62+
"uri": "/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
63+
"href": "https://reference.epdemos.com/cortex/discounts/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
64+
},
65+
"messages": [],
66+
"links": [{
67+
"rel": "cart",
68+
"rev": "discount",
69+
"type": "carts.cart",
70+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
71+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
72+
}],
73+
"discount": [{
74+
"amount": 0,
75+
"currency": "USD",
76+
"display": "$0.00"
77+
}]
78+
}],
79+
"_order": [{
80+
"_couponinfo": [{
81+
"_couponform": [{
82+
"self": {
83+
"type": "coupons.apply-coupon-to-order-form",
84+
"uri": "/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form",
85+
"href": "https://reference.epdemos.com/cortex/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form"
86+
},
87+
"messages": [],
88+
"links": [{
89+
"rel": "applycouponaction",
90+
"type": "coupons.apply-coupon-to-order-form",
91+
"uri": "/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form",
92+
"href": "https://reference.epdemos.com/cortex/coupons/orders/vestri/gm4tenjzmvrtmljuga4tkljuguytollbmvqwcljqgiydsnjwmvrdeojrmi=/form"
93+
}],
94+
"code": ""
95+
}]
96+
}]
97+
}],
98+
"_total": [{
99+
"self": {
100+
"type": "totals.cart-total",
101+
"uri": "/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
102+
"href": "https://reference.epdemos.com/cortex/totals/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
103+
},
104+
"messages": [],
105+
"links": [{
106+
"rel": "cart",
107+
"rev": "total",
108+
"type": "carts.cart",
109+
"uri": "/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu=",
110+
"href": "https://reference.epdemos.com/cortex/carts/vestri/mrstazjqgbrwcllcg5staljuha3doljzgzqtkllfha2gmnjwgu4genjsmu="
111+
}],
112+
"cost": [{
113+
"amount": 0,
114+
"currency": "USD",
115+
"display": "$0.00"
116+
}]
117+
}],
118+
"total-quantity": 1
119+
}

0 commit comments

Comments
 (0)