@nuskin/product-components 3.1.0 → 3.1.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [3.1.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.0...v3.1.1) (2022-05-17)
2
+
3
+
4
+ ### Fix
5
+
6
+ * fix product card redirect to pdp, cleanup (#CX12-4584) ([9559706](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/9559706bc3675e0fdadfaf503bef0d4ac0b0a163)), closes [#CX12-4584](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-4584)
7
+ * removed changes that would require mock/test fixes ([aa93fe3](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/aa93fe30ccb3ab26f429bb833e47470ff6138eaa))
8
+
9
+ ### Release
10
+
11
+ * Automated changes by GitLab pipeline [skip ci] ([c72dbc8](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/c72dbc81924bfa9d64453dfaf62d09f8b9e86c9c))
12
+
13
+ ## [3.1.1-card-redirect.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.0...v3.1.1-card-redirect.1) (2022-05-17)
14
+
15
+
16
+ ### Fix
17
+
18
+ * fix product card redirect to pdp, cleanup (#CX12-4584) ([9559706](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/9559706bc3675e0fdadfaf503bef0d4ac0b0a163)), closes [#CX12-4584](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-4584)
19
+ * removed changes that would require mock/test fixes ([aa93fe3](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/aa93fe30ccb3ab26f429bb833e47470ff6138eaa))
20
+
1
21
  # [3.1.0](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.0.5...v3.1.0) (2022-05-12)
2
22
 
3
23
 
@@ -407,10 +407,7 @@ export default {
407
407
  await this.getOffer();
408
408
 
409
409
  // without these, required to refresh for runConfig/context changes
410
- const productAppService = Vue.prototype.$NsProductAppService;
411
- if (!isNullOrEmpty(productAppService)) {
412
- productAppService.setConfig(this.runConfig);
413
- }
410
+ this.$NsProductAppService.setConfig(this.runConfig);
414
411
 
415
412
  const appService = Vue.prototype.$NsAppService;
416
413
  if (!isNullOrEmpty(appService)) {
@@ -17,7 +17,7 @@ import {
17
17
  Product as ShopProduct
18
18
  } from "@nuskin/ns-shop";
19
19
  import webLoyalty from "@nuskin/ns-loyalty-web";
20
- import { getProp } from "@nuskin/ns-common-lib";
20
+ import { getProp, getFullUrl, isNullOrEmpty } from "@nuskin/ns-common-lib";
21
21
  import { PriceType } from "@nuskin/ns-product-lib";
22
22
 
23
23
  //const PRODUCT_SMALL_VARIANT = "product-card.selected-variant";
@@ -796,19 +796,48 @@ const NsProductMixin = {
796
796
  }
797
797
  },
798
798
  eventCallback: () => {
799
- window.location = `${UrlService.getAemLocaleUrl()}products/product.${
800
- this.product.sku
801
- }.html`;
799
+ this.redirectToDetailsPage();
802
800
  }
803
801
  };
804
802
  window.dataLayer.push(impression);
805
803
  } else {
806
- window.location = `${UrlService.getAemLocaleUrl()}products/product.${
807
- this.product.sku
808
- }.html`;
804
+ this.redirectToDetailsPage();
809
805
  }
810
806
  },
811
807
 
808
+ redirectToDetailsPage() {
809
+ const sponsor = StoreFrontSponsorStorageService.getStoreFrontSponsor();
810
+ const isStorefront = !isNullOrEmpty(sponsor) && !!sponsor.sapId;
811
+ const sponsorSubdomain = isStorefront
812
+ ? Object.keys(sponsor.storefront || {})[0] || ""
813
+ : "";
814
+ const isPersonalOffer = !!(
815
+ PersonalOfferStorageService.getPersonalOffer() || {}
816
+ ).active;
817
+ const useMysiteUrl = isStorefront && !isPersonalOffer;
818
+ const baseUrl =
819
+ window.location.hostname === "localhost"
820
+ ? useMysiteUrl
821
+ ? `https://mysite${
822
+ this.runConfig.envCode === "test" ? ".test" : ""
823
+ }.mynuskin.com`
824
+ : this.marketConfig.siteUrl
825
+ : window.location.origin;
826
+ let pdpPath = `products/product.${this.product.sku}`;
827
+ if (isStorefront || isPersonalOffer) {
828
+ pdpPath += ".mysite";
829
+ }
830
+ if (useMysiteUrl) {
831
+ pdpPath += `.${sponsorSubdomain}`;
832
+ }
833
+ pdpPath += ".html";
834
+ const detailsPageUrl = `${getFullUrl(
835
+ baseUrl,
836
+ UrlService.getAemLocaleUrl()
837
+ )}${pdpPath}`;
838
+ window.location = detailsPageUrl;
839
+ },
840
+
812
841
  handleVariantSelect(variantSku) {
813
842
  this.activeSku = variantSku;
814
843
  this.setActiveProduct();
@@ -917,6 +946,7 @@ const NsProductMixin = {
917
946
  handleCardClick() {
918
947
  if (this.$listeners["card-click"]) {
919
948
  this.$emit("card-click", this.product);
949
+ this.goToDetails();
920
950
  } else {
921
951
  this.goToDetails();
922
952
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {