@nuskin/product-components 3.1.9 → 3.2.0-CX24.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/.releaserc +1 -1
- package/CHANGELOG.md +7 -0
- package/mixins/NsProductMixin.js +42 -15
- package/package.json +2 -2
package/.releaserc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.2.0-CX24.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.9...v3.2.0-CX24.1) (2022-11-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### New
|
|
5
|
+
|
|
6
|
+
* MySite PDP - Integrate Add to Cart, cart count to Equinox ([19d06fa](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/19d06fa0c574b04ba7c8ad0ffecc7799e4c12f03))
|
|
7
|
+
|
|
1
8
|
## [3.1.9](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.8...v3.1.9) (2022-10-31)
|
|
2
9
|
|
|
3
10
|
|
package/mixins/NsProductMixin.js
CHANGED
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
StoreFrontSponsorStorageService,
|
|
8
8
|
PersonalOfferStorageService,
|
|
9
9
|
dateFormatter,
|
|
10
|
-
UrlService
|
|
10
|
+
UrlService,
|
|
11
|
+
RunConfigService,
|
|
12
|
+
equinoxLocalStorage
|
|
11
13
|
} from "@nuskin/ns-util";
|
|
12
14
|
import {
|
|
13
15
|
CartService,
|
|
@@ -15,11 +17,13 @@ import {
|
|
|
15
17
|
FavoritesService,
|
|
16
18
|
ProductStatus,
|
|
17
19
|
QualificationService,
|
|
18
|
-
Product as ShopProduct
|
|
20
|
+
Product as ShopProduct,
|
|
21
|
+
EquinoxCartService
|
|
19
22
|
} from "@nuskin/ns-shop";
|
|
20
23
|
import webLoyalty from "@nuskin/ns-loyalty-web";
|
|
21
24
|
import { getProp, getFullUrl } from "@nuskin/ns-common-lib";
|
|
22
|
-
import { PriceType } from "@nuskin/ns-product-lib";
|
|
25
|
+
import { Contentstack, PriceType } from "@nuskin/ns-product-lib";
|
|
26
|
+
import { ProductDataService } from "@nuskin/ns-product";
|
|
23
27
|
|
|
24
28
|
//const PRODUCT_SMALL_VARIANT = "product-card.selected-variant";
|
|
25
29
|
const PENDING_FAVORITE = "pendingFavorite";
|
|
@@ -902,18 +906,41 @@ const NsProductMixin = {
|
|
|
902
906
|
domain: window.location.hostname
|
|
903
907
|
};
|
|
904
908
|
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
909
|
+
const country = RunConfigService.getRunConfig().country;
|
|
910
|
+
Contentstack.isMarketEnabled(country).then(equinoxMarket => {
|
|
911
|
+
if (equinoxMarket && equinoxLocalStorage.isEquinoxEnabled()) {
|
|
912
|
+
ProductDataService.getProductData(options.sku).then(productData => {
|
|
913
|
+
options.product = new ShopProduct(productData.products[0]);
|
|
914
|
+
options.add = {
|
|
915
|
+
item: {
|
|
916
|
+
qty: options.qty
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
EquinoxCartService.addProductToEquinoxCart(options)
|
|
921
|
+
.then(() => {
|
|
922
|
+
events.publish(events.shop.ADD_TO_CART, options);
|
|
923
|
+
})
|
|
924
|
+
.catch(err => {
|
|
925
|
+
// TODO
|
|
926
|
+
console.error(err.response.data);
|
|
927
|
+
});
|
|
928
|
+
});
|
|
929
|
+
} else {
|
|
930
|
+
CartService.addProductToCart(options)
|
|
931
|
+
.then(() => {
|
|
932
|
+
this.maxQuantity -= options.qty;
|
|
933
|
+
this.setStatus();
|
|
934
|
+
events.publish(events.shop.ADD_TO_CART, options);
|
|
935
|
+
// don't show the Polymer add to bag modal unless required
|
|
936
|
+
// events.publish(events.shop.SHOW_ADD_TO_BAG, options);
|
|
937
|
+
this.$emit("added-to-cart", options);
|
|
938
|
+
})
|
|
939
|
+
.catch(error => {
|
|
940
|
+
console.error("Failed to add to cart.", error);
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
});
|
|
917
944
|
}
|
|
918
945
|
},
|
|
919
946
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/product-components",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.0-CX24.1",
|
|
4
4
|
"description": "Nu Skin Product Components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@nuskin/ns-common-lib": "1.4.5",
|
|
28
28
|
"@nuskin/ns-core-styles": "2.11.2",
|
|
29
29
|
"@nuskin/ns-loyalty-web": "1.5.6",
|
|
30
|
-
"@nuskin/ns-product-lib": "2.
|
|
30
|
+
"@nuskin/ns-product-lib": "2.3.0",
|
|
31
31
|
"@nuskin/product-recommendation": "2.0.1",
|
|
32
32
|
"axios": "^0.19.2",
|
|
33
33
|
"lodash": "^4.17.15",
|