@nuskin/ns-shop 7.9.1-td-4379.2 → 7.9.1-td-4379.3
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 +1 -1
- package/src/cart/equinoxCartService.js +23 -12
package/package.json
CHANGED
|
@@ -34,6 +34,7 @@ export default {
|
|
|
34
34
|
_getSessionShoppingContext,
|
|
35
35
|
_equinoxRequest,
|
|
36
36
|
goToCartPage,
|
|
37
|
+
getSessionShopURL,
|
|
37
38
|
_assembleChildSkus,
|
|
38
39
|
_assembleAdrProperties
|
|
39
40
|
}
|
|
@@ -390,30 +391,40 @@ function goToCartPage() {
|
|
|
390
391
|
const [locale, market] = UrlService.getLocale().split("_");
|
|
391
392
|
const currentEnvironment = RunConfigService.getEnvironmentCode();
|
|
392
393
|
const env = currentEnvironment !== 'prod' ? 'test.' : '';
|
|
393
|
-
|
|
394
|
-
let sessionStorefront = sessionStorage.getItem('storefront') ? JSON.parse(sessionStorage.getItem('storefront')) : null;
|
|
395
|
-
|
|
396
|
-
if (!shoppingContext) {
|
|
397
|
-
shoppingContext = _getSessionShoppingContext();
|
|
398
|
-
}
|
|
394
|
+
const shoppingContext = storage.getItem(storage.keys.SHOPPING_CONTEXT);
|
|
399
395
|
|
|
400
396
|
let url = `https://${env}nuskin.com/${market.toLowerCase()}/${locale.toLowerCase()}/viewCart`;
|
|
401
397
|
|
|
402
398
|
if (shoppingContext && shoppingContext.context === "storefront") {
|
|
403
399
|
url = `https://mysite.${env}mynuskin.com/${market.toLowerCase()}/${locale.toLowerCase()}/viewCart`;
|
|
400
|
+
} else if (!shoppingContext) {
|
|
401
|
+
const sessionUrl = getSessionShopURL();
|
|
402
|
+
if (sessionUrl) {
|
|
403
|
+
url = `https://${env}nuskin.com/${sessionUrl}`;
|
|
404
|
+
}
|
|
404
405
|
}
|
|
406
|
+
|
|
407
|
+
window.location = url;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
//Gets the shop URL and sapId from session storage.
|
|
411
|
+
function getSessionShopURL() {
|
|
412
|
+
const [locale, market] = UrlService.getLocale().split("_");
|
|
413
|
+
const shoppingContext = _getSessionShoppingContext();
|
|
414
|
+
const sessionStorefront = sessionStorage.getItem('storefront') ? JSON.parse(sessionStorage.getItem('storefront')) : null;
|
|
415
|
+
let url;
|
|
405
416
|
|
|
406
|
-
if (sessionStorefront && sessionStorefront.user && sessionStorefront.user.shopUrl
|
|
417
|
+
if (sessionStorefront && sessionStorefront.user && sessionStorefront.user.shopUrl) {
|
|
407
418
|
if (shoppingContext && shoppingContext.context === "storefront") {
|
|
408
419
|
const shopUrl = sessionStorefront.user.shopUrl;
|
|
409
|
-
url =
|
|
410
|
-
} else if (shoppingContext && shoppingContext.context === 'personal_offer') {
|
|
420
|
+
url = `${market.toLowerCase()}/${locale.toLowerCase()}/mysite/${shopUrl}/viewCart`;
|
|
421
|
+
} else if (shoppingContext && shoppingContext.context === 'personal_offer' && sessionStorefront.user.sapId) {
|
|
411
422
|
const sapId = sessionStorefront.user.sapId;
|
|
412
|
-
url =
|
|
423
|
+
url = `${market.toLowerCase()}/${locale.toLowerCase()}/personal-offer/${sapId}/viewCart`;
|
|
413
424
|
}
|
|
414
425
|
}
|
|
415
|
-
|
|
416
|
-
|
|
426
|
+
|
|
427
|
+
return url;
|
|
417
428
|
}
|
|
418
429
|
|
|
419
430
|
/**
|