@nuskin/ns-product-lib 2.5.0-fix.1 → 2.5.0
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 +210 -0
- package/package.json +2 -1
- package/src/contentstack/contentstack.js +3 -101
- package/src/index.js +5 -3
- package/src/models/customerTypes.js +16 -0
- package/src/{productStatus.js → models/productStatus.js} +7 -0
- package/src/product.js +22 -9
- package/src/productData.js +307 -95
- /package/src/{priceType.js → models/priceType.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,213 @@
|
|
|
1
|
+
# [2.5.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.5.0) (2023-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### New
|
|
5
|
+
|
|
6
|
+
* equinox API integration (#CX24) ([a169d58](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a169d5806f20737fae42d0ebe18a7c746861a4fb)), closes [#CX24](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24)
|
|
7
|
+
|
|
8
|
+
# [2.5.0-cx24-2179.2.20](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.19...v2.5.0-cx24-2179.2.20) (2023-02-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Fix
|
|
12
|
+
|
|
13
|
+
* Get test environment if not PROD ([913abb6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/913abb61f8bc6aa8a2cb271d67de08f2f9505c5e))
|
|
14
|
+
|
|
15
|
+
# [2.5.0-cx24-2179.2.19](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.18...v2.5.0-cx24-2179.2.19) (2023-01-27)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Fix
|
|
19
|
+
|
|
20
|
+
* parent product customer types (#CX24-3175) ([411b2cc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/411b2cc5a7cf687152dc346579766c8f923b795a)), closes [#CX24-3175](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3175)
|
|
21
|
+
|
|
22
|
+
### Update
|
|
23
|
+
|
|
24
|
+
* clean ups - expose customerTypes (#CX24-3175) ([3b7d9b1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3b7d9b12a9cf815b11a8af61621ab9ebc76c37b5)), closes [#CX24-3175](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3175)
|
|
25
|
+
|
|
26
|
+
# [2.5.0-cx24-2179.2.18](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.17...v2.5.0-cx24-2179.2.18) (2023-01-26)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Update
|
|
30
|
+
|
|
31
|
+
* dynamically select environment (CX24-2556) ([03af29f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/03af29ffa8be3dca1b6df0b15094fe91bfd27d08))
|
|
32
|
+
|
|
33
|
+
# [2.5.0-cx24-2556.10.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.17...v2.5.0-cx24-2556.10.1) (2023-01-26)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Update
|
|
37
|
+
|
|
38
|
+
* dynamically select environment (CX24-2556) ([3ba9fea](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3ba9fea8a3e308b25f8dea39572af59f86b4d2b8))
|
|
39
|
+
* dynamically select environment (CX24-2556) ([4729d82](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4729d82e49c9a21d17f3e6a619b25fe0aa51dc88))
|
|
40
|
+
|
|
41
|
+
# [2.5.0-cx24-2179.2.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.16...v2.5.0-cx24-2179.2.17) (2023-01-24)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Fix
|
|
45
|
+
|
|
46
|
+
* undefined value of the URL (CX24-3122,CX24-3234) ([e6a9a9d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e6a9a9de118d2bdfa921a48d1c15f7b2a413e32b))
|
|
47
|
+
|
|
48
|
+
# [2.5.0-cx24-2179.2.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.15...v2.5.0-cx24-2179.2.16) (2023-01-24)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Update
|
|
52
|
+
|
|
53
|
+
* Re-map changed Equinox properties after data migration (#CX24-3175) ([f20cbc4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f20cbc4bd63a3e0f810fbd6d0b2c5ad1aa236a8f)), closes [#CX24-3175](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3175)
|
|
54
|
+
|
|
55
|
+
# [2.5.0-cx24-2179.2.15](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.14...v2.5.0-cx24-2179.2.15) (2023-01-23)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Fix
|
|
59
|
+
|
|
60
|
+
* undefined value of the URL (CX24-3122,CX24-3234) ([5605d97](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5605d971de278b941d9d5776563fc8681a6c732a))
|
|
61
|
+
|
|
62
|
+
# [2.5.0-cx24-2179.2.14](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.13...v2.5.0-cx24-2179.2.14) (2023-01-23)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Fix
|
|
66
|
+
|
|
67
|
+
* undefined value of the URL (CX24-3122,CX24-3234) ([f1d22e6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f1d22e60995a1d7282559286c3195b5d51e96ad0))
|
|
68
|
+
|
|
69
|
+
# [2.5.0-cx24-2179.2.13](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.12...v2.5.0-cx24-2179.2.13) (2023-01-23)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Fix
|
|
73
|
+
|
|
74
|
+
* undefined value of the URL (CX24-3122,CX24-3234) ([1ea65a7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1ea65a7cf8249dfa4a378a66e74823aca76f5566))
|
|
75
|
+
|
|
76
|
+
# [2.5.0-cx24-2179.2.12](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.11...v2.5.0-cx24-2179.2.12) (2023-01-23)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
### Fix
|
|
80
|
+
|
|
81
|
+
* undefined value of the URL (CX24-3122,CX24-3234) ([f4c1837](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f4c1837d44da364711cc65b0c7c7a0c02f225f2e))
|
|
82
|
+
|
|
83
|
+
# [2.5.0-cx24-2179.2.11](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.10...v2.5.0-cx24-2179.2.11) (2023-01-16)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Fix
|
|
87
|
+
|
|
88
|
+
* Equinox API called for non equinox market ([50eaa48](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/50eaa48a41a9e00d48ff79de35b955b817c4c0ea))
|
|
89
|
+
|
|
90
|
+
# [2.5.0-cx24-2179.2.10](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.9...v2.5.0-cx24-2179.2.10) (2023-01-16)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### Fix
|
|
94
|
+
|
|
95
|
+
* Equinox API called for non equinox market (CX24-3168) ([399e615](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/399e6150914dcafd5bd9fcd7ca0e0a95b65656d7))
|
|
96
|
+
|
|
97
|
+
# [2.5.0-cx24-2179.2.9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.8...v2.5.0-cx24-2179.2.9) (2022-12-20)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Fix
|
|
101
|
+
|
|
102
|
+
* eq market event pricing and name (#CX24-2179) ([213b59a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/213b59a33a208ffad0a6726521ce7f365d34d36e)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
103
|
+
* Slow response of add-to-cart button function for Equinox Cart ([14394b2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/14394b299afbd53254a3ec053ad41e68ed526dfe))
|
|
104
|
+
* Unit Tests ([ace52c6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ace52c6418991d0263a1e1f8d99901e724abf923))
|
|
105
|
+
|
|
106
|
+
### Release
|
|
107
|
+
|
|
108
|
+
* Automated changes by GitLab pipeline [skip ci] ([eb755fa](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/eb755fae1e1f1f221a34d92f5ff4e64787a4132d))
|
|
109
|
+
* Automated changes by GitLab pipeline [skip ci] ([6a75f7a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/6a75f7a5f8b2f3b17e4d7387af37cad4f367b45c))
|
|
110
|
+
|
|
111
|
+
### Update
|
|
112
|
+
|
|
113
|
+
* use configuration-sdk to pull the configurations (CX24-2931) ([6934570](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/69345701e6b44754ffeb648ead56f0288aadeb16))
|
|
114
|
+
|
|
115
|
+
# [2.5.0-CX24.3.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-CX24.2.1...v2.5.0-CX24.3.1) (2022-12-06)
|
|
116
|
+
|
|
117
|
+
* added eq promoion bypass for setPriceAndPvFromType v5 (#CX24-2179) ([f5b62e5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f5b62e5e82f1830d4105ffc965b64e9a7fc88d9b)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
118
|
+
|
|
119
|
+
# [2.5.0-cx24-2179.2.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.5...v2.5.0-cx24-2179.2.6) (2022-12-05)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### New
|
|
123
|
+
|
|
124
|
+
* added eq promoion bypass for setPriceAndPvFromType v4 (#CX24-2179) ([abcdd30](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/abcdd30223107786c0c2f9d1a8946053ef6dcef5)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
125
|
+
|
|
126
|
+
# [2.5.0-cx24-2179.2.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.4...v2.5.0-cx24-2179.2.5) (2022-12-05)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### New
|
|
130
|
+
|
|
131
|
+
* added eq promoion bypass for setPriceAndPvFromType v3 (#CX24-2179) ([79fe156](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/79fe1562d0cafc44f8945e57c316c8ba0b55a88b)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
132
|
+
|
|
133
|
+
# [2.5.0-cx24-2179.2.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.3...v2.5.0-cx24-2179.2.4) (2022-12-05)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### New
|
|
137
|
+
|
|
138
|
+
* added eq promoion bypass for setPriceAndPvFromType v2 (#CX24-2179) ([25bde9a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/25bde9a8e19b1e4e44e37457dfb087e0a6212ee1)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
139
|
+
|
|
140
|
+
# [2.5.0-cx24-2179.2.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.2...v2.5.0-cx24-2179.2.3) (2022-12-05)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### New
|
|
144
|
+
|
|
145
|
+
* added eq promoion bypass for setPriceAndPvFromType (#CX24-2179) ([716cefc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/716cefc2a2522287e017709a8b2cfef5a7ce5e07)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
146
|
+
|
|
147
|
+
# [2.5.0-cx24-2179.2.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2179.2.1...v2.5.0-cx24-2179.2.2) (2022-12-05)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### New
|
|
151
|
+
|
|
152
|
+
* added eq promotion support- debug sales event (#CX24-2179) ([992a2cf](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/992a2cfb178b3e12a6b8a0229ae5f6f607fb41d3)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
|
|
153
|
+
|
|
154
|
+
# [2.5.0-cx24-2179.2.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-CX24.2.1...v2.5.0-cx24-2179.2.1) (2022-12-02)
|
|
155
|
+
>>>>>>> CX24.2
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### Fix
|
|
159
|
+
|
|
160
|
+
* [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([a89af4a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a89af4a5d00c6a68fcaeff22f128554270add21e))
|
|
161
|
+
|
|
162
|
+
### Release
|
|
163
|
+
|
|
164
|
+
* Automated changes by GitLab pipeline [skip ci] ([07bfa40](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/07bfa404c552c05637c2c8a537c4ff298536874e))
|
|
165
|
+
* Automated changes by GitLab pipeline [skip ci] ([fa1c0d9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fa1c0d9d5853482e3ac49cea4e99599e7192f85b))
|
|
166
|
+
* Automated changes by GitLab pipeline [skip ci] ([2d20787](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2d2078763b2d57edb8a24f438ac90dd37c3ff41b))
|
|
167
|
+
|
|
168
|
+
### Update
|
|
169
|
+
|
|
170
|
+
* set ADR pricing from equinox (CX24-2862) ([65d04d2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65d04d2e9ff4018edfe99e5a7412bee985d3def2))
|
|
171
|
+
* set ADR pricing from equinox (CX24-2862) ([54a5693](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/54a56932e5df36c9c30ce6358d8597c98be3d20d))
|
|
172
|
+
* set ADR pricing from equinox (CX24-2862) ([bbd135f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/bbd135f1ed0395c578be2274c84ba136ceed9376))
|
|
173
|
+
* set ADR pricing from equinox (CX24-2862) ([197003e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/197003e1629bd394c547a118d332b5e8574dfc7d))
|
|
174
|
+
|
|
175
|
+
# [2.5.0-cx24-2862.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2862.1...v2.5.0-cx24-2862.2) (2022-11-11)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
### Update
|
|
179
|
+
|
|
180
|
+
* set ADR pricing from equinox (CX24-2862) ([b64dcea](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b64dcea4dd3374be992c667db5c0b2604aacc029))
|
|
181
|
+
|
|
182
|
+
# [2.5.0-cx24-2862.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.2-cx24-2612.1.1...v2.5.0-cx24-2862.1) (2022-11-10)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### Update
|
|
186
|
+
|
|
187
|
+
* set ADR pricing from equinox (CX24-2862) ([9f6dfb7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f6dfb726f40b1335411318629a2ebdf1b4dac96))
|
|
188
|
+
* set ADR pricing from equinox (CX24-2862) ([61f550a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/61f550a21c5cc9d062549ec2aaf2758aebccf2be))
|
|
189
|
+
|
|
190
|
+
## [2.4.2-cx24-2612.1.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.4.2-cx24-2612.1.1) (2022-11-07)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Fix
|
|
194
|
+
|
|
195
|
+
* [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([9d9d106](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9d9d10667477b4c7ef7bf8ec013aab322d3cdbcc))
|
|
196
|
+
|
|
197
|
+
## [2.4.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.0...v2.4.1) (2022-11-06)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Fix
|
|
201
|
+
|
|
202
|
+
* platform agnostic updates to ns-product-lib ([d53659f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d53659f20ab708b1212dd5820be9321e6d1855a5))
|
|
203
|
+
|
|
204
|
+
# [2.5.0-fix.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-fix.1...v2.5.0-fix.2) (2022-11-04)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
### Fix
|
|
208
|
+
|
|
209
|
+
* update inventory label to match with master ([005b52c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/005b52cd10063d9af6975315f37d8995d630eb66))
|
|
210
|
+
|
|
1
211
|
# [2.5.0-fix.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.0...v2.5.0-fix.1) (2022-11-04)
|
|
2
212
|
|
|
3
213
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
|
3
|
-
"version": "2.5.0
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "This project contains shared Product models and code between the backend and frontend.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"prettier": "1.19.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@nuskin/configuration-sdk": "1.0.1",
|
|
34
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
|
35
36
|
"@nuskin/ns-util": "3.107.0",
|
|
36
37
|
"axios": "0.27.2",
|
|
@@ -21,7 +21,6 @@ function usePlatformSpecificVariables() {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function useWebEnvironment() {
|
|
24
|
-
console.log('web');
|
|
25
24
|
const env = getEnvironmentFromUrl(window.location.host);
|
|
26
25
|
const envConfig = config.getCredentials(env);
|
|
27
26
|
const baseURL = `${envConfig.url}/stacks/${envConfig.apiKey}?environment=${envConfig.env}`;
|
|
@@ -99,7 +98,7 @@ function getCachedData(key) {
|
|
|
99
98
|
* @property {string} checkout_client_secret
|
|
100
99
|
*
|
|
101
100
|
* @export
|
|
102
|
-
* @return {Promise<null|MarketConfig>}
|
|
101
|
+
* @return {Promise<null|MarketConfig>}
|
|
103
102
|
*/
|
|
104
103
|
async function getAEMConfig() {
|
|
105
104
|
try {
|
|
@@ -131,100 +130,6 @@ async function getAEMConfig() {
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
/**
|
|
135
|
-
* getEquinoxMarkets will get the list of Equinox-enabled markets from contentstack
|
|
136
|
-
*
|
|
137
|
-
* @typedef EquinoxEnabledMarket
|
|
138
|
-
* @property {string} market_name
|
|
139
|
-
* @property {string} country_code
|
|
140
|
-
* @property {string} store_id
|
|
141
|
-
*
|
|
142
|
-
* @typedef EquinoxEnabledMarkets
|
|
143
|
-
* @property {EquinoxEnabledMarket[]} [dev_markets]
|
|
144
|
-
* @property {EquinoxEnabledMarket[]} [test_markets]
|
|
145
|
-
* @property {EquinoxEnabledMarket[]} [staging_markets]
|
|
146
|
-
* @property {EquinoxEnabledMarket[]} [prod_markets]
|
|
147
|
-
*
|
|
148
|
-
* @export
|
|
149
|
-
* @return {Promise<EquinoxEnabledMarkets>}
|
|
150
|
-
*/
|
|
151
|
-
async function getEquinoxMarkets() {
|
|
152
|
-
try {
|
|
153
|
-
if (isCacheExpired(cacheKeys.equinoxMarkets)) {
|
|
154
|
-
const marketConfig = `${platform.env}_markets`;
|
|
155
|
-
const variables = { uid: 'blt5633ff9e560f14ef' };
|
|
156
|
-
const query = `query EquinoxMarketsByUid($uid: String!) {
|
|
157
|
-
equinox_markets(uid: $uid) {
|
|
158
|
-
${marketConfig} {
|
|
159
|
-
market_name
|
|
160
|
-
country_code
|
|
161
|
-
store_id
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}`;
|
|
165
|
-
|
|
166
|
-
const { data } = await contentstackService({
|
|
167
|
-
data: { variables, query }
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
setCachedData(cacheKeys.equinoxMarkets, data.equinox_markets[marketConfig]);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return getCachedData(cacheKeys.equinoxMarkets);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
console.error(error);
|
|
176
|
-
return [];
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**getKongUrl gets the URL for Kong in contentstack
|
|
181
|
-
*
|
|
182
|
-
* @returns {string}
|
|
183
|
-
*/
|
|
184
|
-
async function getKongUrl() {
|
|
185
|
-
try {
|
|
186
|
-
if (isCacheExpired(cacheKeys.kongUrl)) {
|
|
187
|
-
const variables = { uid: 'blt5633ff9e560f14ef' };
|
|
188
|
-
const query = `query KongUrlByUid($uid: String!) {
|
|
189
|
-
equinox_markets(uid: $uid) {
|
|
190
|
-
kong_urls {
|
|
191
|
-
${platform.env}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}`;
|
|
195
|
-
|
|
196
|
-
const { data } = await contentstackService({
|
|
197
|
-
data: { variables, query }
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
setCachedData(cacheKeys.kongUrl, data.equinox_markets.kong_urls[platform.env]);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return getCachedData(cacheKeys.kongUrl);
|
|
204
|
-
} catch (error) {
|
|
205
|
-
console.error(error);
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* isMarketEnabled checks is the given market is in the list
|
|
212
|
-
* of equinox-enabled markets.
|
|
213
|
-
*
|
|
214
|
-
* @param {string} market
|
|
215
|
-
* @returns {EquinoxEnabledMarket|null}
|
|
216
|
-
*/
|
|
217
|
-
async function isMarketEnabled(market) {
|
|
218
|
-
const markets = await getEquinoxMarkets();
|
|
219
|
-
const currentMarket = markets.filter(m => m.country_code.toLowerCase() === market.toLowerCase());
|
|
220
|
-
|
|
221
|
-
if (currentMarket.length > 0) {
|
|
222
|
-
return currentMarket[0];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
133
|
/**
|
|
229
134
|
* Contentstack HTTP - axios wrapper for contentstack request
|
|
230
135
|
*
|
|
@@ -244,8 +149,5 @@ async function contentstackService(config) {
|
|
|
244
149
|
}
|
|
245
150
|
|
|
246
151
|
module.exports = {
|
|
247
|
-
getAEMConfig
|
|
248
|
-
|
|
249
|
-
isMarketEnabled,
|
|
250
|
-
getKongUrl
|
|
251
|
-
}
|
|
152
|
+
getAEMConfig
|
|
153
|
+
}
|
package/src/index.js
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
const Agelocme = require("./agelocme.js");
|
|
9
9
|
const Contentstack = require('./contentstack/contentstack');
|
|
10
|
-
const PriceType = require("./priceType.js");
|
|
10
|
+
const PriceType = require("./models/priceType.js");
|
|
11
11
|
const Product = require("./product.js");
|
|
12
12
|
const ProductContentMapper = require("./productContentMapper.js");
|
|
13
|
-
const ProductStatus = require("./productStatus.js");
|
|
13
|
+
const ProductStatus = require("./models/productStatus.js");
|
|
14
14
|
const ProductStatusMapper = require("./productStatusMapper.js");
|
|
15
15
|
const ProductUtils = require("./productUtils.js");
|
|
16
16
|
const ProductData = require("./productData.js");
|
|
17
|
+
const CustomerTypes = require('./models/customerTypes');
|
|
17
18
|
|
|
18
19
|
module.exports = {
|
|
19
20
|
Agelocme,
|
|
@@ -24,5 +25,6 @@ module.exports = {
|
|
|
24
25
|
ProductStatus,
|
|
25
26
|
ProductStatusMapper,
|
|
26
27
|
ProductUtils,
|
|
27
|
-
ProductData
|
|
28
|
+
ProductData,
|
|
29
|
+
CustomerTypes
|
|
28
30
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const CustomerTypes = {
|
|
4
|
+
BrandAffiliate: "brandaffiliate",
|
|
5
|
+
Preferred: "preferred",
|
|
6
|
+
PreferredCustomer: "preferred customer",
|
|
7
|
+
Retail: "retail",
|
|
8
|
+
properties: {
|
|
9
|
+
BRAND_AFFILIATE: { stringKey: "DIST", code: 10 },
|
|
10
|
+
RETAIL: { stringKey: "CUST", code: 20 },
|
|
11
|
+
PREFERRED: { stringKey: "preferred", code: 30 },
|
|
12
|
+
PREFERRED_CUSTOMER: { stringKey: "PREF", code: 30 }
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = CustomerTypes;
|
|
@@ -17,6 +17,13 @@ const ProductStatus = {
|
|
|
17
17
|
STOP_STATUS: { stringKey: "stopStatus", code: 5 },
|
|
18
18
|
NOT_FOUND: { stringKey: "", code: 0 },
|
|
19
19
|
NOT_SOLD_SEPERATELY: {stringKey: "notSoldSeperately", code: 4 }
|
|
20
|
+
},
|
|
21
|
+
equinoxStatus: {
|
|
22
|
+
SELLABLE: 'sellable',
|
|
23
|
+
PREVIEW_PRODUCT: 'preview product',
|
|
24
|
+
DISCONTINUED: 'discontinued',
|
|
25
|
+
STOPPED: 'stopped',
|
|
26
|
+
REPLACEMENT: 'Replacement'
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
29
|
|
package/src/product.js
CHANGED
|
@@ -5,8 +5,8 @@ const { isTrue } = require("@nuskin/ns-common-lib");
|
|
|
5
5
|
const ProductUtils = require("./productUtils.js");
|
|
6
6
|
|
|
7
7
|
const Agelocme = require("./agelocme.js");
|
|
8
|
-
const PriceType = require("./priceType.js");
|
|
9
|
-
const ProductStatus = require("./productStatus.js");
|
|
8
|
+
const PriceType = require("./models/priceType.js");
|
|
9
|
+
const ProductStatus = require("./models/productStatus.js");
|
|
10
10
|
|
|
11
11
|
const Product = function(productData) {
|
|
12
12
|
this.priceMap = {};
|
|
@@ -75,6 +75,7 @@ const Product = function(productData) {
|
|
|
75
75
|
//equinox inventory / stock label
|
|
76
76
|
//@example "IN STOCK"
|
|
77
77
|
this.inventory = "";
|
|
78
|
+
this.equinoxProductId = "";
|
|
78
79
|
|
|
79
80
|
this.setMarketAttributes = function(productStatus) {
|
|
80
81
|
if (productStatus.marketAttributes) {
|
|
@@ -225,7 +226,7 @@ const Product = function(productData) {
|
|
|
225
226
|
}
|
|
226
227
|
};
|
|
227
228
|
|
|
228
|
-
this.setPriceAndPvFromType = function(_priceType, _activeEvents = null) {
|
|
229
|
+
this.setPriceAndPvFromType = function(_priceType, _activeEvents = null, option = {}) {
|
|
229
230
|
// WARNING: priceType needs to be handled client-side
|
|
230
231
|
// const priceType = ConfigService.getMarketConfig().showWholeSalePricing && !AccountManager.isLoggedIn()
|
|
231
232
|
// ? PriceType.WWHL
|
|
@@ -234,11 +235,11 @@ const Product = function(productData) {
|
|
|
234
235
|
const eventPricing = getEventPricing(this, priceType, _activeEvents);
|
|
235
236
|
|
|
236
237
|
let changed = false;
|
|
237
|
-
if (
|
|
238
|
+
if ((
|
|
238
239
|
!this.price ||
|
|
239
240
|
priceType !== this.priceType ||
|
|
240
241
|
this.eventName !== eventPricing.eventName
|
|
241
|
-
) {
|
|
242
|
+
) && !option.isEqPromotion) {
|
|
242
243
|
this.setPrice(eventPricing.price || this.getPricing(priceType));
|
|
243
244
|
this.setCv(eventPricing.cv || this.getCvWithType(priceType));
|
|
244
245
|
this.setPv(eventPricing.pv || this.getPvWithType(priceType));
|
|
@@ -247,11 +248,20 @@ const Product = function(productData) {
|
|
|
247
248
|
changed = true;
|
|
248
249
|
}
|
|
249
250
|
|
|
251
|
+
if (option.isEqPromotion) {
|
|
252
|
+
//retain product.price as original price
|
|
253
|
+
this.setCv(this.getCvWithType(priceType));
|
|
254
|
+
this.setPv(this.getPvWithType(priceType));
|
|
255
|
+
this.priceType = priceType;
|
|
256
|
+
changed = true;
|
|
257
|
+
}
|
|
258
|
+
|
|
250
259
|
this.variantSkus().forEach((variantSku) => {
|
|
251
260
|
if (
|
|
252
261
|
this.variants[variantSku].setPriceAndPvFromType(
|
|
253
262
|
priceType,
|
|
254
|
-
_activeEvents
|
|
263
|
+
_activeEvents,
|
|
264
|
+
option
|
|
255
265
|
)
|
|
256
266
|
) {
|
|
257
267
|
changed = true;
|
|
@@ -281,7 +291,7 @@ const Product = function(productData) {
|
|
|
281
291
|
this.priceMap[type] = price;
|
|
282
292
|
};
|
|
283
293
|
|
|
284
|
-
this.addPricingFromStatus = function(productStatus, priceType) {
|
|
294
|
+
this.addPricingFromStatus = function(productStatus, priceType, option ={}) {
|
|
285
295
|
let modified = false;
|
|
286
296
|
|
|
287
297
|
if (!priceType) {
|
|
@@ -319,13 +329,13 @@ const Product = function(productData) {
|
|
|
319
329
|
if(productStatus.childSkus) {
|
|
320
330
|
this.childSkus = productStatus.childSkus;
|
|
321
331
|
}
|
|
322
|
-
this.setPriceAndPvFromType(priceType);
|
|
332
|
+
this.setPriceAndPvFromType(priceType, null, option);
|
|
323
333
|
modified = true;
|
|
324
334
|
} else {
|
|
325
335
|
let variant = this.getVariant(productStatusSku);
|
|
326
336
|
|
|
327
337
|
if (variant) {
|
|
328
|
-
if (variant.addPricingFromStatus(productStatus, priceType)) {
|
|
338
|
+
if (variant.addPricingFromStatus(productStatus, priceType, option)) {
|
|
329
339
|
variant.setMarketAttributes(productStatus);
|
|
330
340
|
updateBaseRanges(this, variant);
|
|
331
341
|
modified = true;
|
|
@@ -523,6 +533,7 @@ const Product = function(productData) {
|
|
|
523
533
|
retData.restrictedMarkets = this.restrictedMarkets;
|
|
524
534
|
retData.addOns = this.addOns;
|
|
525
535
|
retData.inventory = this.inventory;
|
|
536
|
+
retData.equinoxProductId = this.equinoxProductId;
|
|
526
537
|
|
|
527
538
|
return retData;
|
|
528
539
|
};
|
|
@@ -662,6 +673,8 @@ const Product = function(productData) {
|
|
|
662
673
|
if (data.agelocme) {
|
|
663
674
|
this.agelocme = new Agelocme(data.agelocme);
|
|
664
675
|
}
|
|
676
|
+
|
|
677
|
+
this.equinoxProductId = data.equinoxProductId;
|
|
665
678
|
}
|
|
666
679
|
};
|
|
667
680
|
|
package/src/productData.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const { getConfiguration } = require('@nuskin/configuration-sdk');
|
|
3
|
+
const { getEnvironmentFromUrl } = require('@nuskin/ns-common-lib');
|
|
2
4
|
const axios = require("axios");
|
|
3
5
|
const contentstack = require('./contentstack/contentstack');
|
|
4
6
|
const Product = require("./product");
|
|
5
|
-
|
|
7
|
+
const CustomerTypes = require('./models/customerTypes');
|
|
8
|
+
const ProductStatus = require("./models/productStatus");
|
|
6
9
|
/** @type {*} */
|
|
7
10
|
const ProductData = {
|
|
8
11
|
/**
|
|
@@ -15,35 +18,39 @@ const ProductData = {
|
|
|
15
18
|
const localeMarket = `${locale}_${market}`;
|
|
16
19
|
|
|
17
20
|
if (isEquinoxEnabled) {
|
|
18
|
-
|
|
21
|
+
let config = (await getConfiguration({
|
|
22
|
+
configMapNames: ['Equinox_Markets'],
|
|
23
|
+
country: market,
|
|
24
|
+
environment: contentstackEnv(),
|
|
25
|
+
clientId: '735b1eb810304bba966af0891ab54053'
|
|
26
|
+
}));
|
|
19
27
|
|
|
20
|
-
if (
|
|
21
|
-
return await this.getProductFromEquinox(skus, localeMarket,
|
|
28
|
+
if (config.Equinox_Markets.country_code === market && config.Equinox_Markets.active) {
|
|
29
|
+
return await this.getProductFromEquinox(skus, localeMarket, config);
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
|
-
|
|
25
32
|
return await this.getProductFromLegacy(skus, localeMarket);
|
|
26
33
|
},
|
|
27
34
|
|
|
28
|
-
getProductFromEquinox: async function (skus, locale,
|
|
29
|
-
const filter =
|
|
35
|
+
getProductFromEquinox: async function (skus, locale, config) {
|
|
36
|
+
const filter = `{"filters": [{"field": "index_key_skuId","operation": "IN", "value": "${skus.toString()}"}]}`;
|
|
30
37
|
axios.defaults.withCredentials = true;
|
|
31
38
|
|
|
32
|
-
const url =
|
|
39
|
+
const url = `${config.Equinox_Markets.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
|
33
40
|
const href = `${url}?filter=${encodeURI(filter)}`;
|
|
34
41
|
const response = await axios.request({
|
|
35
42
|
method: 'get',
|
|
36
43
|
url: href,
|
|
37
44
|
params: {
|
|
38
45
|
locale,
|
|
39
|
-
storeId:
|
|
46
|
+
storeId: config.Equinox_Markets.store_id
|
|
40
47
|
},
|
|
41
48
|
headers: this.getEquinoxRequestHeaders(),
|
|
42
49
|
responseType: 'json'
|
|
43
50
|
});
|
|
44
51
|
|
|
45
52
|
if (response.data.product) {
|
|
46
|
-
return this.eqProductMapper(response.data.product);
|
|
53
|
+
return this.eqProductMapper(response.data.product, skus);
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
return {
|
|
@@ -81,7 +88,7 @@ const ProductData = {
|
|
|
81
88
|
/**
|
|
82
89
|
* @param {contentstack.MarketConfig} marketConfig
|
|
83
90
|
*/
|
|
84
|
-
getLegacyRequestHeaders: function(marketConfig) {
|
|
91
|
+
getLegacyRequestHeaders: function (marketConfig) {
|
|
85
92
|
return {
|
|
86
93
|
'Content-Type': 'application/json',
|
|
87
94
|
client_id: marketConfig.checkout_client_id,
|
|
@@ -91,11 +98,11 @@ const ProductData = {
|
|
|
91
98
|
|
|
92
99
|
/**
|
|
93
100
|
* Map product variant
|
|
94
|
-
* @todo remove unnecessary fields
|
|
101
|
+
* @todo remove unnecessary fields and do code refactoring
|
|
95
102
|
* @param {*} eqVariant
|
|
96
103
|
* @returns Array<Product>
|
|
97
104
|
*/
|
|
98
|
-
eqProductVariantMapper
|
|
105
|
+
eqProductVariantMapper: function (eqVariant) {
|
|
99
106
|
|
|
100
107
|
let imageURL = eqVariant.properties.imageURL;
|
|
101
108
|
const regex = /\d+.\d+/
|
|
@@ -104,9 +111,13 @@ const ProductData = {
|
|
|
104
111
|
if (imageURL.includes('contentstack')) {
|
|
105
112
|
thumbnailImage = imageURL + '?width=40'
|
|
106
113
|
} else {
|
|
107
|
-
thumbnailImage = imageURL.replace(regex,'40.40')
|
|
114
|
+
thumbnailImage = imageURL.replace(regex, '40.40')
|
|
108
115
|
}
|
|
109
116
|
|
|
117
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice } = this.getEqProductPromotions(eqVariant);
|
|
118
|
+
const productPrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Regular Price"];
|
|
119
|
+
const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
|
|
120
|
+
|
|
110
121
|
return {
|
|
111
122
|
"sku": eqVariant.identifier,
|
|
112
123
|
"globalProductID": eqVariant.identifier,
|
|
@@ -135,24 +146,94 @@ const ProductData = {
|
|
|
135
146
|
"salesEventText": "",
|
|
136
147
|
"contentSection": [
|
|
137
148
|
{
|
|
138
|
-
"sectionContent":
|
|
149
|
+
"sectionContent": `<div class="contentSections">
|
|
150
|
+
<div class="contentSection section">
|
|
151
|
+
<div>\n<h3>BENEFITS</h3>\n
|
|
152
|
+
<div>\n
|
|
153
|
+
<div class="sectionContent parsys">
|
|
154
|
+
<div class="text parbase section">\n
|
|
155
|
+
<p>
|
|
156
|
+
Green tea has been used in China for thousands of years for its health-preserving and
|
|
157
|
+
revitalizing power. Modern science has identified powerful antioxidants in green tea
|
|
158
|
+
called polyphenols. One group of polyphenols called catechins is particularly potent
|
|
159
|
+
and is highly effective at neutralizing free radicals at the cellular level. Catechins
|
|
160
|
+
support healthy cell function while providing antioxidant protection to critical cell
|
|
161
|
+
structures such as DNA. Clinical studies show catechins interfere with the production
|
|
162
|
+
of certain enzymes involved in cell damage. Additionally, catechins have been demonstrated
|
|
163
|
+
to cause a thermogenic effect that enhances the body s metabolic rate. Tegreen 97<sup>®</sup>
|
|
164
|
+
from Pharmanex is a proprietary, highly concentrated extract of the catechins found
|
|
165
|
+
in green tea. Tegreen 97<sup>®</sup> is one of the most potent antioxidant supplements
|
|
166
|
+
on the market with a 97 percent polyphenol content, 65% catechins. Each Tegreen 97<sup>®</sup>
|
|
167
|
+
capsule contains the catechin equivalent of approximately seven cups of green tea and is
|
|
168
|
+
99.5 percent caffeine free.
|
|
169
|
+
</p>\r\n\n
|
|
170
|
+
</div>\n\n
|
|
171
|
+
</div>\n\n
|
|
172
|
+
</div>\n
|
|
173
|
+
</div>\n
|
|
174
|
+
</div>\n
|
|
175
|
+
<div class="contentSection section">
|
|
176
|
+
<div>\n<h3>USAGE</h3>\n
|
|
177
|
+
<div>\n
|
|
178
|
+
<div class="sectionContent parsys">
|
|
179
|
+
<div class="text parbase section">\n
|
|
180
|
+
<p>As a dietary supplement, take one (1) to four (4) capsules daily; preferably one (1)
|
|
181
|
+
to two (2) each morning and evening with food. Store in a cool, dry place.</p>\r\n\n
|
|
182
|
+
</div>\n\n
|
|
183
|
+
</div>\n\n
|
|
184
|
+
</div>\n
|
|
185
|
+
</div>\n
|
|
186
|
+
</div>\n
|
|
187
|
+
<div class="contentSection section">
|
|
188
|
+
<div>\n<h3>INGREDIENTS</h3>\n
|
|
189
|
+
<div>\n
|
|
190
|
+
<div class="sectionContent parsys">
|
|
191
|
+
<div class="text parbase section">\n
|
|
192
|
+
<table border="1" cellspacing="1" cellpadding="0" width="360">
|
|
193
|
+
<tbody>\r\n
|
|
194
|
+
<tr>\r\n
|
|
195
|
+
<td><b>Nutritional Facts</b></td>\r\n
|
|
196
|
+
<td><b>Amount</b></td>\r\n<td><b>% Daily Value</b></td>\r\n
|
|
197
|
+
</tr>\r\n
|
|
198
|
+
<tr>\r\n
|
|
199
|
+
<td colspan="3"><b>Serving Size: 1 Capsule<br>\r\nServings Per Container: 120</b></td>\r\n
|
|
200
|
+
</tr>\r\n
|
|
201
|
+
<tr>\r\n
|
|
202
|
+
<td width="55%">Green tea leaf (20:1) Extract (<i>Camellia sinensis</i></td>\r\n
|
|
203
|
+
<td width="20%">250 mg</td>\r\n<td width="25%"> </td>\r\n
|
|
204
|
+
</tr>\r\n
|
|
205
|
+
<tr>\r\n<td width="55%" colspan="3">* Daily Value not established</td>\r\n</tr>\r\n
|
|
206
|
+
<tr>\r\n
|
|
207
|
+
<td width="55%" colspan="3">
|
|
208
|
+
<b>Other Ingredients: Gelatin, Silicon Dioxide,
|
|
209
|
+
Microcrystalline Cellulose, Magnesium Stearate.</b>
|
|
210
|
+
</td>\r\n</tr>\r\n
|
|
211
|
+
</tbody>\r\n
|
|
212
|
+
</table>\r\n
|
|
213
|
+
<p> </p>\r\n\n
|
|
214
|
+
</div>\n\n
|
|
215
|
+
</div>\n\n
|
|
216
|
+
</div>\n
|
|
217
|
+
</div>\n
|
|
218
|
+
</div>\n
|
|
219
|
+
</div>\n`
|
|
139
220
|
}
|
|
140
221
|
],
|
|
141
222
|
"scanQualified": eqVariant.properties.scanQualifiedCount,
|
|
142
223
|
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
|
143
224
|
"maxQuantity": 999,
|
|
144
225
|
"points": "",
|
|
145
|
-
"cv": (eqVariant.priceFacets.CV) ?
|
|
146
|
-
"pv":eqVariant.priceFacets.PV,
|
|
226
|
+
"cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
|
227
|
+
"pv": eqVariant.priceFacets.PV,
|
|
147
228
|
"priceType": "WRTL",
|
|
148
|
-
"price":
|
|
229
|
+
"price": discountedPrice,
|
|
149
230
|
"priceMap": {
|
|
150
|
-
"WRTL":
|
|
231
|
+
"WRTL": productPrice,
|
|
151
232
|
"WADW-WRTL": eqVariant.priceFacets["Regular Price"],
|
|
152
|
-
"WADR":
|
|
233
|
+
"WADR": eqVariant.priceFacets["Regular Price"],
|
|
153
234
|
"RTL": eqVariant.priceFacets["Regular Price"],
|
|
154
235
|
"WWHL": eqVariant.priceFacets["Wholesale Price"],
|
|
155
|
-
"WADW":
|
|
236
|
+
"WADW": eqVariant.priceFacets["Wholesale Price"],
|
|
156
237
|
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
|
157
238
|
},
|
|
158
239
|
"cvMap": {
|
|
@@ -165,19 +246,8 @@ const ProductData = {
|
|
|
165
246
|
"WADW": eqVariant.priceFacets.PV,
|
|
166
247
|
"WHL": eqVariant.priceFacets.PV
|
|
167
248
|
},
|
|
168
|
-
"orderTypes":
|
|
169
|
-
|
|
170
|
-
"order": true,
|
|
171
|
-
"zpfc": false,
|
|
172
|
-
"zadp": true,
|
|
173
|
-
"ars": true,
|
|
174
|
-
"kiosk": true,
|
|
175
|
-
"mobile": true,
|
|
176
|
-
"preferred customer": true,
|
|
177
|
-
"retail": true,
|
|
178
|
-
"web": true,
|
|
179
|
-
"web display": true
|
|
180
|
-
},
|
|
249
|
+
"orderTypes": this._setOrderType(eqVariant.properties),
|
|
250
|
+
"custTypes": this.switchCustType(eqVariant.properties.customerTypes),
|
|
181
251
|
"division": eqVariant.properties.division,
|
|
182
252
|
"backOrderDate": null,
|
|
183
253
|
"locallyProduced": false,
|
|
@@ -188,29 +258,67 @@ const ProductData = {
|
|
|
188
258
|
"shade": "",
|
|
189
259
|
"status": this.switchStatusFromEquinox(eqVariant.properties.status),
|
|
190
260
|
"variantType": "Other",
|
|
191
|
-
"variantDropdownLabel": eqVariant.properties.
|
|
261
|
+
"variantDropdownLabel": eqVariant.properties.variantSelectLabel || "",
|
|
192
262
|
"variantDropdownPlaceholder": "Select Type",
|
|
193
|
-
"variantsLabel": eqVariant.properties.
|
|
263
|
+
"variantsLabel": eqVariant.properties.variantSelectLabel || "",
|
|
194
264
|
"groupOffer": false,
|
|
195
265
|
"personalOffer": false,
|
|
196
|
-
"savedEventName":
|
|
197
|
-
"salesLabel":
|
|
198
|
-
"eventName":
|
|
266
|
+
"savedEventName": eventName,
|
|
267
|
+
"salesLabel": eventLabels,
|
|
268
|
+
"eventName": eventName,
|
|
199
269
|
"sizeWeight": '',
|
|
200
270
|
"nettoWeight": "",
|
|
201
271
|
"searchScore": 0,
|
|
202
|
-
"isExclusive": false,
|
|
272
|
+
"isExclusive": eqVariant.properties.isExclusive || false,
|
|
203
273
|
"marketAttributes": {
|
|
204
274
|
"discount": true,
|
|
205
275
|
"redeem": true,
|
|
206
276
|
"earn": true
|
|
207
277
|
},
|
|
208
278
|
"restrictedMarkets": [],
|
|
209
|
-
"addOns": []
|
|
279
|
+
"addOns": [],
|
|
280
|
+
"equinoxProductId": eqVariant.identifier
|
|
210
281
|
};
|
|
211
282
|
},
|
|
212
283
|
|
|
213
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Get EQ product promotions
|
|
286
|
+
* @param {*} product
|
|
287
|
+
* @returns {obj} promotion
|
|
288
|
+
*/
|
|
289
|
+
getEqProductPromotions(product) {
|
|
290
|
+
|
|
291
|
+
if (!Array.isArray(product.promotion)) {
|
|
292
|
+
return {
|
|
293
|
+
eventLabels: "",
|
|
294
|
+
computedPrice: 0,
|
|
295
|
+
defaultProductPrice: product.priceFacets ? product.priceFacets["Regular Price"] : 0,
|
|
296
|
+
eventName: null
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const defaultProductPrice = product.totalValue ? product.totalValue.originalPrice : 0;
|
|
301
|
+
const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
|
|
302
|
+
? product.totalValue.priceAfterDiscount
|
|
303
|
+
: 0;
|
|
304
|
+
let eventName = "";
|
|
305
|
+
const eventLabels = [];
|
|
306
|
+
|
|
307
|
+
product.promotion.map(promotion => {
|
|
308
|
+
eventName = promotion.offerId;
|
|
309
|
+
eventLabels.push(promotion.message);
|
|
310
|
+
return promotion;
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
return {
|
|
314
|
+
eventLabels: eventLabels.join(','),
|
|
315
|
+
defaultProductPrice,
|
|
316
|
+
computedPrice,
|
|
317
|
+
eventName
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
eqProductMapper: function (productDataResponse, skus) {
|
|
214
322
|
let prod = [];
|
|
215
323
|
let count = 0;
|
|
216
324
|
let variants = {};
|
|
@@ -223,16 +331,26 @@ const ProductData = {
|
|
|
223
331
|
if (imageURL.includes('contentstack')) {
|
|
224
332
|
thumbnailImage = imageURL + '?width=40'
|
|
225
333
|
} else {
|
|
226
|
-
thumbnailImage = imageURL.replace(regex,'40.40')
|
|
334
|
+
thumbnailImage = imageURL.replace(regex, '40.40')
|
|
227
335
|
}
|
|
228
336
|
|
|
229
337
|
if (data.sku && data.sku.length > 1) {
|
|
230
|
-
|
|
338
|
+
//exclude base product from variants
|
|
339
|
+
data.sku.filter(v => v.identifier.substring(2, 4) !== "55").map(variant => {
|
|
231
340
|
variants[variant.identifier] = this.eqProductVariantMapper(variant);
|
|
232
341
|
return variant;
|
|
233
342
|
});
|
|
234
343
|
}
|
|
235
344
|
|
|
345
|
+
const {
|
|
346
|
+
eventName,
|
|
347
|
+
eventLabels,
|
|
348
|
+
computedPrice,
|
|
349
|
+
defaultProductPrice
|
|
350
|
+
} = this.getEqProductPromotions(data.sku[count]);
|
|
351
|
+
const productPrice = eventName ? defaultProductPrice : data.sku[count].priceFacets["Regular Price"];
|
|
352
|
+
const discountedPrice = eventName ? computedPrice : data.sku[count].priceFacets["Regular Price"];
|
|
353
|
+
|
|
236
354
|
prod = {
|
|
237
355
|
"sku": data.sku[count].identifier,
|
|
238
356
|
"globalProductID": data.identifier,
|
|
@@ -268,16 +386,16 @@ const ProductData = {
|
|
|
268
386
|
"availableQuantity": data.sku[count].inventoryProperties.atpQty,
|
|
269
387
|
"maxQuantity": 999,
|
|
270
388
|
"points": "",
|
|
271
|
-
"cv": (data.sku[count].priceFacets.CV) ?
|
|
389
|
+
"cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
|
|
272
390
|
"pv": data.sku[count].priceFacets.PV,
|
|
273
391
|
"priceType": "WRTL",
|
|
274
|
-
"price":
|
|
392
|
+
"price": discountedPrice,
|
|
275
393
|
"priceMap": {
|
|
276
|
-
"WRTL":
|
|
394
|
+
"WRTL": productPrice,
|
|
277
395
|
"WADW-WRTL": data.sku[count].priceFacets["Regular Price"],
|
|
278
|
-
"WADR":
|
|
396
|
+
"WADR": data.sku[count].priceFacets["Regular Price"],
|
|
279
397
|
"RTL": data.sku[count].priceFacets["Regular Price"],
|
|
280
|
-
"WADW":
|
|
398
|
+
"WADW": data.sku[count].priceFacets["Wholesale Price"],
|
|
281
399
|
"WHL": data.sku[count].priceFacets["Wholesale Price"],
|
|
282
400
|
"WWHL": data.sku[count].priceFacets["Wholesale Price"]
|
|
283
401
|
},
|
|
@@ -291,21 +409,9 @@ const ProductData = {
|
|
|
291
409
|
"WADW": data.sku[count].priceFacets.PV,
|
|
292
410
|
"WHL": data.sku[count].priceFacets.PV
|
|
293
411
|
},
|
|
294
|
-
"orderTypes":
|
|
295
|
-
"adr": true,
|
|
296
|
-
"order": true,
|
|
297
|
-
"zpfc": false,
|
|
298
|
-
"zadp": true,
|
|
299
|
-
"ars": true,
|
|
300
|
-
"kiosk": true,
|
|
301
|
-
"mobile": true,
|
|
302
|
-
"preferred customer": true,
|
|
303
|
-
"retail": true,
|
|
304
|
-
"web": true,
|
|
305
|
-
"web display": true
|
|
306
|
-
},
|
|
412
|
+
"orderTypes": this._setOrderType(data.sku[count].properties),
|
|
307
413
|
"childSkus": [],
|
|
308
|
-
"custTypes": this.switchCustType(data.properties.customerTypes),
|
|
414
|
+
"custTypes": this.switchCustType(data.sku[count].properties.customerTypes),
|
|
309
415
|
"division": data.properties.division,
|
|
310
416
|
"backOrderDate": null,
|
|
311
417
|
"locallyProduced": false,
|
|
@@ -316,19 +422,19 @@ const ProductData = {
|
|
|
316
422
|
"shade": "",
|
|
317
423
|
"status": this.switchStatusFromEquinox(data.sku[count].properties.productStatus),
|
|
318
424
|
"variantType": "Other",
|
|
319
|
-
"variantDropdownLabel": data.sku[count].properties.variantLabel
|
|
425
|
+
"variantDropdownLabel": data.sku[count].properties.variantLabel || "",
|
|
320
426
|
"variantDropdownPlaceholder": "Select Type",
|
|
321
|
-
"variantsLabel": data.sku[count].properties.variantLabel
|
|
427
|
+
"variantsLabel": data.sku[count].properties.variantLabel || "",
|
|
322
428
|
"groupOffer": false,
|
|
323
429
|
"personalOffer": false,
|
|
324
|
-
"savedEventName":
|
|
325
|
-
"salesLabel":
|
|
326
|
-
"eventName":
|
|
430
|
+
"savedEventName": eventName,
|
|
431
|
+
"salesLabel": eventLabels,
|
|
432
|
+
"eventName": eventName,
|
|
327
433
|
"sizeWeight": '',
|
|
328
434
|
"nettoWeight": "",
|
|
329
435
|
"variants": variants,
|
|
330
436
|
"searchScore": 0,
|
|
331
|
-
"isExclusive": data.sku[count].properties.isExclusive,
|
|
437
|
+
"isExclusive": data.sku[count].properties.isExclusive || false,
|
|
332
438
|
"marketAttributes": {
|
|
333
439
|
"discount": true,
|
|
334
440
|
"redeem": true,
|
|
@@ -336,15 +442,15 @@ const ProductData = {
|
|
|
336
442
|
},
|
|
337
443
|
"restrictedMarkets": [],
|
|
338
444
|
"addOns": [],
|
|
339
|
-
"
|
|
340
|
-
|
|
445
|
+
"inventory": data.sku[count].inventory || "", //inventory label
|
|
446
|
+
"equinoxProductId": data.identifier
|
|
341
447
|
};
|
|
342
448
|
let newProduct = new Product(prod);
|
|
343
449
|
return newProduct
|
|
344
|
-
})
|
|
450
|
+
});
|
|
345
451
|
|
|
346
452
|
let data = {
|
|
347
|
-
products: prodArr,
|
|
453
|
+
products: this._sortProductsBySku(skus, prodArr),
|
|
348
454
|
count: productDataResponse.length
|
|
349
455
|
};
|
|
350
456
|
return {
|
|
@@ -356,46 +462,152 @@ const ProductData = {
|
|
|
356
462
|
};
|
|
357
463
|
},
|
|
358
464
|
|
|
465
|
+
/**
|
|
466
|
+
*
|
|
467
|
+
* Map status from equinox to legacy
|
|
468
|
+
*
|
|
469
|
+
* @param {*} status
|
|
470
|
+
* @returns {string} productStatus
|
|
471
|
+
*/
|
|
359
472
|
switchStatusFromEquinox: function (status) {
|
|
473
|
+
const { equinoxStatus } = ProductStatus;
|
|
360
474
|
let newStatus = '';
|
|
361
|
-
switch (status) {
|
|
362
|
-
case
|
|
363
|
-
newStatus =
|
|
475
|
+
switch (status.toLowerCase()) {
|
|
476
|
+
case equinoxStatus.SELLABLE:
|
|
477
|
+
newStatus = ProductStatus.ReleasedForSale;
|
|
364
478
|
break;
|
|
365
|
-
case
|
|
366
|
-
newStatus =
|
|
479
|
+
case equinoxStatus.PREVIEW_PRODUCT:
|
|
480
|
+
newStatus = ProductStatus.NotReleasedForSale;
|
|
367
481
|
break;
|
|
368
|
-
case
|
|
369
|
-
newStatus =
|
|
482
|
+
case equinoxStatus.DISCONTINUED:
|
|
483
|
+
newStatus = ProductStatus.Discontinued;
|
|
370
484
|
break;
|
|
371
|
-
case
|
|
372
|
-
newStatus =
|
|
485
|
+
case equinoxStatus.STOPPED:
|
|
486
|
+
newStatus = ProductStatus.Discontinued;
|
|
373
487
|
break;
|
|
374
|
-
case
|
|
375
|
-
newStatus =
|
|
488
|
+
case equinoxStatus.REPLACEMENT:
|
|
489
|
+
newStatus = ProductStatus.NotReleasedForSale;
|
|
376
490
|
break;
|
|
377
491
|
default:
|
|
378
|
-
newStatus =
|
|
492
|
+
newStatus = ProductStatus.NotReleasedForSale;
|
|
379
493
|
break;
|
|
380
494
|
}
|
|
495
|
+
|
|
381
496
|
return newStatus;
|
|
382
497
|
},
|
|
383
498
|
|
|
384
499
|
/**
|
|
385
|
-
*
|
|
386
|
-
* @param {*}
|
|
387
|
-
*
|
|
500
|
+
* map customer types from string to code<number>
|
|
501
|
+
* @param {*} eqCustomerTypes
|
|
502
|
+
* @returns
|
|
388
503
|
*/
|
|
389
|
-
switchCustType: function (
|
|
504
|
+
switchCustType: function (eqCustomerTypes) {
|
|
505
|
+
if (!eqCustomerTypes) {
|
|
506
|
+
return "";
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
const custTypes = eqCustomerTypes.split(',').map(customerType => customerType.trim().toLowerCase());
|
|
510
|
+
|
|
390
511
|
let newCustType = [];
|
|
391
|
-
if (
|
|
392
|
-
newCustType.push(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (
|
|
396
|
-
newCustType.push(
|
|
512
|
+
if (custTypes.includes(CustomerTypes.BrandAffiliate)) {
|
|
513
|
+
newCustType.push(CustomerTypes.properties.BRAND_AFFILIATE.code);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (custTypes.includes(CustomerTypes.Retail)) {
|
|
517
|
+
newCustType.push(CustomerTypes.properties.RETAIL.code);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (custTypes.includes(CustomerTypes.Preferred) || custTypes.includes(CustomerTypes.PreferredCustomer)) {
|
|
521
|
+
newCustType.push(CustomerTypes.properties.PREFERRED.code);
|
|
522
|
+
}
|
|
523
|
+
|
|
397
524
|
return newCustType.toString()
|
|
525
|
+
},
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Sorts the product by sku
|
|
529
|
+
* @param {Array} skus - the skus arrangment which the sorting will base out of
|
|
530
|
+
* @param {Array} products - this products to be sorted
|
|
531
|
+
*/
|
|
532
|
+
|
|
533
|
+
_sortProductsBySku: function (skus, products) {
|
|
534
|
+
|
|
535
|
+
if (!skus || !products || products.length === 1) {
|
|
536
|
+
return products
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const sortedProducts = products.sort(function (a, b) {
|
|
540
|
+
return skus.indexOf(a.sku) - skus.indexOf(b.sku);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
return sortedProducts
|
|
544
|
+
|
|
545
|
+
},
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
*
|
|
549
|
+
* @param {*} availableChannels
|
|
550
|
+
*
|
|
551
|
+
* This function is use to convert arsPhone,web,kiosk,mobile,subscription
|
|
552
|
+
* to orderType object
|
|
553
|
+
* "adr”
|
|
554
|
+
"order"
|
|
555
|
+
"zpfc"
|
|
556
|
+
"zadp"
|
|
557
|
+
"ars"
|
|
558
|
+
"kiosk"
|
|
559
|
+
"mobile"
|
|
560
|
+
"preferred customer"
|
|
561
|
+
"retail"
|
|
562
|
+
"web"
|
|
563
|
+
"web display"
|
|
564
|
+
*/
|
|
565
|
+
_setOrderType: function (properties) {
|
|
566
|
+
let orderTypeArr = {
|
|
567
|
+
"adr": false,
|
|
568
|
+
"order": false,
|
|
569
|
+
"zpfc": false,
|
|
570
|
+
"zadp": false,
|
|
571
|
+
"ars": false,
|
|
572
|
+
"kiosk": false,
|
|
573
|
+
"mobile": false,
|
|
574
|
+
"preferred customer": false,
|
|
575
|
+
"retail": false,
|
|
576
|
+
"web": false,
|
|
577
|
+
"web display": false
|
|
578
|
+
};
|
|
579
|
+
let availableChannelsArr = properties.availableChannels.split(',')
|
|
580
|
+
|
|
581
|
+
availableChannelsArr.forEach(channel => {
|
|
582
|
+
if (channel == 'arsPhone')
|
|
583
|
+
orderTypeArr.ars = true
|
|
584
|
+
if (channel == 'web') {
|
|
585
|
+
orderTypeArr.order = true
|
|
586
|
+
orderTypeArr.web = true
|
|
587
|
+
}
|
|
588
|
+
if (channel == 'kiosk')
|
|
589
|
+
orderTypeArr.kiosk = true
|
|
590
|
+
if (channel == 'mobile')
|
|
591
|
+
orderTypeArr.mobile = true
|
|
592
|
+
if (channel == 'subscription')
|
|
593
|
+
orderTypeArr.adr = true
|
|
594
|
+
|
|
595
|
+
});
|
|
596
|
+
if (properties.retail)
|
|
597
|
+
orderTypeArr.retail = true
|
|
598
|
+
if (properties.prefferredCustomer)
|
|
599
|
+
orderTypeArr['preferred customer'] = true
|
|
600
|
+
|
|
601
|
+
return orderTypeArr;
|
|
398
602
|
}
|
|
399
603
|
}
|
|
400
604
|
|
|
605
|
+
function contentstackEnv() {
|
|
606
|
+
if (typeof window === 'undefined') {
|
|
607
|
+
return 'test';
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return (getEnvironmentFromUrl(window.location.host) != "prod") ? "test" : "prod";
|
|
611
|
+
}
|
|
612
|
+
|
|
401
613
|
module.exports = ProductData;
|
|
File without changes
|