@nuskin/product-components 3.0.2 → 3.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.0.3](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.0.2...v3.0.3) (2022-02-09)
2
+
3
+
4
+ ### Fix
5
+
6
+ * [NsProductDetail] Send analytics whenever title changes (now sent when variant is selected) (#CX12-4270) ([b21973f](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/b21973f36aa13963b2bd3f8a0cfab29e158f13e2)), closes [#CX12-4270](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-4270)
7
+ * Add cx.config ([d887042](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/d8870428055cb63d24150e3388d12f99e2c91ef5))
8
+
1
9
  ## [3.0.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.0.1...v3.0.2) (2021-09-29)
2
10
 
3
11
 
@@ -79,6 +79,7 @@
79
79
  <script>
80
80
  import NsProductDetailBase from "./NsProductDetailBase.vue";
81
81
  import NsProductMixin from "../mixins/NsProductMixin.js";
82
+ import { events } from "@nuskin/ns-util";
82
83
 
83
84
  /**
84
85
  * NsProductDetail
@@ -132,6 +133,48 @@ export default {
132
133
  loadFirstVariant: true,
133
134
  referrer: "productPage"
134
135
  };
136
+ },
137
+ watch: {
138
+ title() {
139
+ this.sendAnalytics();
140
+ }
141
+ },
142
+ methods: {
143
+ sendAnalytics() {
144
+ let tries = 0;
145
+ this.analyticsInterval = setInterval(() => {
146
+ if (window.dataLayer && window.ga && window.ga.loaded) {
147
+ const impression = {
148
+ event: events.shop.PRODUCT_IMPRESSION_DETAIL,
149
+ ecommerce: {
150
+ detail: {
151
+ products: [
152
+ {
153
+ id: this.activeSku,
154
+ name: this.title
155
+ // TODO: uncomment below when these fields are available (contentstack is up)
156
+ // category: this.category,
157
+ // brand: this.brand,
158
+ // variant: this.variant
159
+ }
160
+ ]
161
+ }
162
+ }
163
+ };
164
+ window.dataLayer.push(impression);
165
+ clearInterval(this.analyticsInterval);
166
+ this.analyticsInterval = null;
167
+ return;
168
+ }
169
+
170
+ tries += 1;
171
+
172
+ if (tries > 50) {
173
+ clearInterval(this.analyticsInterval);
174
+ this.analyticsInterval = null;
175
+ }
176
+ }, 200);
177
+ }
135
178
  }
136
179
  };
137
180
  </script>
@@ -364,7 +364,6 @@
364
364
 
365
365
  <script>
366
366
  import { NsIcon } from "@nuskin/design-components";
367
- import { events } from "@nuskin/ns-util";
368
367
  import NsImage from "./NsImage.vue";
369
368
  import NsProductDetailCarousel from "./NsProductDetailCarousel.vue";
370
369
  import NsProductVariantSelector from "./NsProductVariantSelector.vue";
@@ -706,9 +705,7 @@ export default {
706
705
  }
707
706
  }
708
707
  },
709
- mounted() {
710
- this.sendAnalytics();
711
- },
708
+ mounted() {},
712
709
  destroyed() {
713
710
  if (this.analyticsInterval) {
714
711
  clearInterval(this.analyticsInterval);
@@ -906,41 +903,6 @@ export default {
906
903
  }
907
904
 
908
905
  return data;
909
- },
910
- sendAnalytics() {
911
- let tries = 0;
912
- this.analyticsInterval = setInterval(() => {
913
- if (window.dataLayer && window.ga && window.ga.loaded) {
914
- const impression = {
915
- event: events.shop.PRODUCT_IMPRESSION_DETAIL,
916
- ecommerce: {
917
- detail: {
918
- products: [
919
- {
920
- id: this.sku,
921
- name: this.title
922
- // TODO: uncomment below when these fields are available (contentstack is up)
923
- // category: this.category,
924
- // brand: this.brand,
925
- // variant: this.variant
926
- }
927
- ]
928
- }
929
- }
930
- };
931
- window.dataLayer.push(impression);
932
- clearInterval(this.analyticsInterval);
933
- this.analyticsInterval = null;
934
- return;
935
- }
936
-
937
- tries += 1;
938
-
939
- if (tries > 50) {
940
- clearInterval(this.analyticsInterval);
941
- this.analyticsInterval = null;
942
- }
943
- }, 200);
944
906
  }
945
907
  }
946
908
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {