@nuskin/product-components 3.3.7 → 3.3.9

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,8 +1,26 @@
1
+ ## [3.3.9](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.8...v3.3.9) (2023-04-10)
2
+
3
+
4
+ ### Fix
5
+
6
+ * fixes to get exclusive offer working (#CX15-6971) ([2333571](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/23335712d88116f3238536b0a53b8a270a5d11e4)), closes [#CX15-6971](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX15-6971)
7
+
8
+ ## [3.3.8](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.7...v3.3.8) (2023-04-06)
9
+
10
+
11
+ ### Fix
12
+
13
+ * added waitForConfig in NsPrductMixin #CX16-8633 ([53813b0](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/53813b05400128f0de8e350cd545345684dc8917)), closes [#CX16-8633](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX16-8633)
14
+
15
+ ## [3.3.7-cx16-8633.3](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.7-cx16-8633.2...v3.3.7-cx16-8633.3) (2023-04-05)
1
16
  ## [3.3.7](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.6...v3.3.7) (2023-04-05)
2
17
 
3
18
 
4
19
  ### Fix
5
20
 
21
+ * added wait in NsProductMixin #CX16-8633 ([b802a9b](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/b802a9b188ef90c4e5568e47031f41ab5ca67efa)), closes [#CX16-8633](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX16-8633)
22
+
23
+ ## [3.3.7-cx16-8633.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.7-cx16-8633.1...v3.3.7-cx16-8633.2) (2023-04-04)
6
24
  * CX24 Batch 2 Fixes ([5eaec1e](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/5eaec1e9bb7c7d7979f4da14dcf3732a43c3ed2c))
7
25
 
8
26
  # [3.4.0-cx24-3706.4](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.4.0-cx24-3706.3...v3.4.0-cx24-3706.4) (2023-04-04)
@@ -10,6 +28,10 @@
10
28
 
11
29
  ### Fix
12
30
 
31
+ * default export #CX16-8633 ([aa2baa5](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/aa2baa5f19cb74427d232543d2a02e7b7d06c5b7)), closes [#CX16-8633](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX16-8633)
32
+ * trying wait in different place #CX16-8633 ([4c9eb00](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/4c9eb00b16974e5ac93104a1ca30db4503d08e36)), closes [#CX16-8633](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX16-8633)
33
+
34
+ ## [3.3.7-cx16-8633.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.3.6...v3.3.7-cx16-8633.1) (2023-04-03)
13
35
  * Add to Bag in product offer ([3212ce0](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/3212ce049979b7f2f3c26c5e64ef8a98eb669e9b))
14
36
 
15
37
  # [3.4.0-cx24-3706.3](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.4.0-cx24-3706.2...v3.4.0-cx24-3706.3) (2023-04-04)
@@ -17,6 +39,7 @@
17
39
 
18
40
  ### Fix
19
41
 
42
+ * unit tests and wait in NsProductMixin #CX16-8633 ([868234a](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/868234a9cf5803efc389a966274ba66a5be87b4d)), closes [#CX16-8633](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX16-8633)
20
43
  * Add to Bag in product offer ([b6fb956](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/b6fb9561044911f58ac680e497a74661c5c14894))
21
44
 
22
45
  # [3.4.0-cx24-3706.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.4.0-cx24-3706.1...v3.4.0-cx24-3706.2) (2023-04-03)
@@ -17,18 +17,45 @@ import {
17
17
  AdrService,
18
18
  FavoritesService,
19
19
  ProductStatus,
20
- QualificationService,
20
+ QualificationService as OldQualificationService,
21
21
  Product as ShopProduct,
22
22
  EquinoxCartService
23
23
  } from "@nuskin/ns-shop";
24
+ import { default as NewQualificationService } from "@nuskin/exclusive-offer-sdk";
24
25
  import webLoyalty from "@nuskin/ns-loyalty-web";
25
26
  import { getProp, getFullUrl } from "@nuskin/ns-common-lib";
26
27
  import { PriceType } from "@nuskin/ns-product-lib";
27
28
  import { ProductDataService } from "@nuskin/ns-product";
29
+ import { waitForConfig } from "../services/configHelper";
28
30
 
29
31
  const PENDING_FAVORITE = "pendingFavorite";
30
32
  const KEY_BREADCRUMB_BACK = "breadcrumbBack";
31
33
 
34
+ let equinoxMarket = {
35
+ promise: getConfiguration(["Equinox_Markets"]).then(config => {
36
+ equinoxMarket = {
37
+ value:
38
+ config && config.Equinox_Markets
39
+ ? !!config.Equinox_Markets.active
40
+ : false,
41
+ promise: null,
42
+ loaded: true
43
+ };
44
+ }),
45
+ loaded: false,
46
+ value: undefined
47
+ };
48
+
49
+ const getQualificationService = async () => {
50
+ if (!equinoxMarket.loaded) {
51
+ await equinoxMarket.promise;
52
+ }
53
+ if (equinoxMarket.value) {
54
+ return NewQualificationService;
55
+ }
56
+ return OldQualificationService;
57
+ };
58
+
32
59
  /**
33
60
  * NsProductMixin
34
61
  *
@@ -342,6 +369,7 @@ const NsProductMixin = {
342
369
  * Initializes product data
343
370
  */
344
371
  async refreshProductData(sku) {
372
+ await waitForConfig();
345
373
  if (
346
374
  !sku ||
347
375
  this.$NsProductAppService.loading ||
@@ -571,7 +599,9 @@ const NsProductMixin = {
571
599
  (this.baseSku === product.sku ||
572
600
  product.variantSkus().includes(this.activeSku));
573
601
  const productChanged =
574
- !baseProductChanged && this.activeSku === product.sku;
602
+ !baseProductChanged &&
603
+ (this.activeSku === product.sku ||
604
+ this.activeSku === product.equinoxProductId);
575
605
  if (baseProductChanged || productChanged) {
576
606
  this.setFromProductData(this.activeSku, product);
577
607
  }
@@ -667,9 +697,9 @@ const NsProductMixin = {
667
697
  this.exclusiveOfferMessage = "";
668
698
  if (this.isExclusive) {
669
699
  if (this.isLoggedIn) {
670
- const productQualification = await QualificationService.getQualification(
671
- this.activeSku
672
- );
700
+ const productQualification = await (
701
+ await getQualificationService()
702
+ ).getQualification(this.activeSku);
673
703
 
674
704
  let cartQuantity;
675
705
  if (!this.baseSku) {
@@ -682,10 +712,10 @@ const NsProductMixin = {
682
712
  cartQuantity = (cartItem || {}).qty || 0;
683
713
  } else {
684
714
  const cartData =
685
- (await QualificationService.convertCartDataToBaseSkus(
686
- CartService.getItemData(),
687
- true
688
- )) || {};
715
+ (await (
716
+ await getQualificationService()
717
+ ).convertCartDataToBaseSkus(CartService.getItemData(), true)) ||
718
+ {};
689
719
  const cartItem = cartData[this.baseSku] || {};
690
720
  cartQuantity = cartItem.qty || 0;
691
721
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.3.7",
3
+ "version": "3.3.9",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,6 +42,7 @@
42
42
  "fibers": "^4.0.1"
43
43
  },
44
44
  "peerDependencies": {
45
+ "@nuskin/exclusive-offer-sdk": "1.x",
45
46
  "@nuskin/ns-account": "5.x",
46
47
  "@nuskin/ns-checkout-common": "3.x",
47
48
  "@nuskin/ns-feature-flags": "1.x",
@@ -198,7 +198,10 @@ if (!NsProductDataService) {
198
198
  continue;
199
199
  }
200
200
  const product = this.products.find(
201
- p => p.sku === sku || p.variantSkus().includes(sku)
201
+ p =>
202
+ p.sku === sku ||
203
+ p.variantSkus().includes(sku) ||
204
+ p.equinoxProductId === sku
202
205
  );
203
206
  if (product) {
204
207
  if (product.sku === sku || top) {
@@ -200,10 +200,40 @@
200
200
  </template>
201
201
 
202
202
  <script>
203
- import { QualificationService, CartService } from "@nuskin/ns-shop";
204
-
203
+ import {
204
+ QualificationService as OldQualificationService,
205
+ CartService
206
+ } from "@nuskin/ns-shop";
207
+ import { getConfiguration } from "@nuskin/configuration-sdk";
208
+ import { default as NewQualificationService } from "@nuskin/exclusive-offer-sdk";
205
209
  import NsProductMixin from "../mixins/NsProductMixin";
206
210
  import "@nuskin/ns-core-styles/src/dist/main.css";
211
+
212
+ let equinoxMarket = {
213
+ promise: getConfiguration(["Equinox_Markets"]).then(config => {
214
+ equinoxMarket = {
215
+ value:
216
+ config && config.Equinox_Markets
217
+ ? !!config.Equinox_Markets.active
218
+ : false,
219
+ promise: null,
220
+ loaded: true
221
+ };
222
+ }),
223
+ loaded: false,
224
+ value: undefined
225
+ };
226
+
227
+ const getQualificationService = async () => {
228
+ if (!equinoxMarket.loaded) {
229
+ await equinoxMarket.promise;
230
+ }
231
+ if (equinoxMarket.value) {
232
+ return NewQualificationService;
233
+ }
234
+ return OldQualificationService;
235
+ };
236
+
207
237
  export default {
208
238
  name: "NsProductMixinPreview",
209
239
  filters: {
@@ -377,9 +407,9 @@ export default {
377
407
  async mounted() {
378
408
  if (this.isExclusive) {
379
409
  if (this.isLoggedIn) {
380
- this.productQualification = await QualificationService.getQualification(
381
- this.activeSku
382
- );
410
+ this.productQualification = await (
411
+ await getQualificationService()
412
+ ).getQualification(this.activeSku);
383
413
 
384
414
  this.cartItem = await CartService.getFirstItemBySku(this.activeSku, {
385
415
  cartOrderItems: true