@nuskin/ns-product-lib 2.5.0-fix.2 → 2.5.1-cx24-3282m.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +85 -70
- 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.1-cx24-3282m.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0...v2.5.1-cx24-3282m.1) (2023-02-28)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* Do not set availability from status service if eq ([545ec0e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/545ec0e4abe500842cc0631ba2d9b33dd8bee86f))
|
7
|
+
|
8
|
+
# [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)
|
9
|
+
|
10
|
+
|
11
|
+
### New
|
12
|
+
|
13
|
+
* 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)
|
14
|
+
|
15
|
+
# [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)
|
16
|
+
|
17
|
+
|
18
|
+
### Fix
|
19
|
+
|
20
|
+
* Get test environment if not PROD ([913abb6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/913abb61f8bc6aa8a2cb271d67de08f2f9505c5e))
|
21
|
+
|
22
|
+
# [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)
|
23
|
+
|
24
|
+
|
25
|
+
### Fix
|
26
|
+
|
27
|
+
* 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)
|
28
|
+
|
29
|
+
### Update
|
30
|
+
|
31
|
+
* 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)
|
32
|
+
|
33
|
+
# [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)
|
34
|
+
|
35
|
+
|
36
|
+
### Update
|
37
|
+
|
38
|
+
* dynamically select environment (CX24-2556) ([03af29f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/03af29ffa8be3dca1b6df0b15094fe91bfd27d08))
|
39
|
+
|
40
|
+
# [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)
|
41
|
+
|
42
|
+
|
43
|
+
### Update
|
44
|
+
|
45
|
+
* dynamically select environment (CX24-2556) ([3ba9fea](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3ba9fea8a3e308b25f8dea39572af59f86b4d2b8))
|
46
|
+
* dynamically select environment (CX24-2556) ([4729d82](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4729d82e49c9a21d17f3e6a619b25fe0aa51dc88))
|
47
|
+
|
48
|
+
# [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)
|
49
|
+
|
50
|
+
|
51
|
+
### Fix
|
52
|
+
|
53
|
+
* 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))
|
54
|
+
|
55
|
+
# [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)
|
56
|
+
|
57
|
+
|
58
|
+
### Update
|
59
|
+
|
60
|
+
* 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)
|
61
|
+
|
62
|
+
# [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)
|
63
|
+
|
64
|
+
|
65
|
+
### Fix
|
66
|
+
|
67
|
+
* 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))
|
68
|
+
|
69
|
+
# [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)
|
70
|
+
|
71
|
+
|
72
|
+
### Fix
|
73
|
+
|
74
|
+
* 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))
|
75
|
+
|
76
|
+
# [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)
|
77
|
+
|
78
|
+
|
79
|
+
### Fix
|
80
|
+
|
81
|
+
* 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))
|
82
|
+
|
83
|
+
# [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)
|
84
|
+
|
85
|
+
|
86
|
+
### Fix
|
87
|
+
|
88
|
+
* 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))
|
89
|
+
|
90
|
+
# [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)
|
91
|
+
|
92
|
+
|
93
|
+
### Fix
|
94
|
+
|
95
|
+
* Equinox API called for non equinox market ([50eaa48](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/50eaa48a41a9e00d48ff79de35b955b817c4c0ea))
|
96
|
+
|
97
|
+
# [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)
|
98
|
+
|
99
|
+
|
100
|
+
### Fix
|
101
|
+
|
102
|
+
* 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))
|
103
|
+
|
104
|
+
# [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)
|
105
|
+
|
106
|
+
|
107
|
+
### Fix
|
108
|
+
|
109
|
+
* 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)
|
110
|
+
* 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))
|
111
|
+
* Unit Tests ([ace52c6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ace52c6418991d0263a1e1f8d99901e724abf923))
|
112
|
+
|
113
|
+
### Release
|
114
|
+
|
115
|
+
* Automated changes by GitLab pipeline [skip ci] ([eb755fa](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/eb755fae1e1f1f221a34d92f5ff4e64787a4132d))
|
116
|
+
* Automated changes by GitLab pipeline [skip ci] ([6a75f7a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/6a75f7a5f8b2f3b17e4d7387af37cad4f367b45c))
|
117
|
+
|
118
|
+
### Update
|
119
|
+
|
120
|
+
* 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))
|
121
|
+
|
122
|
+
# [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)
|
123
|
+
|
124
|
+
* 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)
|
125
|
+
|
126
|
+
# [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)
|
127
|
+
|
128
|
+
|
129
|
+
### New
|
130
|
+
|
131
|
+
* 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)
|
132
|
+
|
133
|
+
# [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)
|
134
|
+
|
135
|
+
|
136
|
+
### New
|
137
|
+
|
138
|
+
* 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)
|
139
|
+
|
140
|
+
# [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)
|
141
|
+
|
142
|
+
|
143
|
+
### New
|
144
|
+
|
145
|
+
* 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)
|
146
|
+
|
147
|
+
# [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)
|
148
|
+
|
149
|
+
|
150
|
+
### New
|
151
|
+
|
152
|
+
* 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)
|
153
|
+
|
154
|
+
# [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)
|
155
|
+
|
156
|
+
|
157
|
+
### New
|
158
|
+
|
159
|
+
* 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)
|
160
|
+
|
161
|
+
# [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)
|
162
|
+
>>>>>>> CX24.2
|
163
|
+
|
164
|
+
|
165
|
+
### Fix
|
166
|
+
|
167
|
+
* [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))
|
168
|
+
|
169
|
+
### Release
|
170
|
+
|
171
|
+
* Automated changes by GitLab pipeline [skip ci] ([07bfa40](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/07bfa404c552c05637c2c8a537c4ff298536874e))
|
172
|
+
* Automated changes by GitLab pipeline [skip ci] ([fa1c0d9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fa1c0d9d5853482e3ac49cea4e99599e7192f85b))
|
173
|
+
* Automated changes by GitLab pipeline [skip ci] ([2d20787](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2d2078763b2d57edb8a24f438ac90dd37c3ff41b))
|
174
|
+
|
175
|
+
### Update
|
176
|
+
|
177
|
+
* set ADR pricing from equinox (CX24-2862) ([65d04d2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65d04d2e9ff4018edfe99e5a7412bee985d3def2))
|
178
|
+
* set ADR pricing from equinox (CX24-2862) ([54a5693](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/54a56932e5df36c9c30ce6358d8597c98be3d20d))
|
179
|
+
* set ADR pricing from equinox (CX24-2862) ([bbd135f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/bbd135f1ed0395c578be2274c84ba136ceed9376))
|
180
|
+
* set ADR pricing from equinox (CX24-2862) ([197003e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/197003e1629bd394c547a118d332b5e8574dfc7d))
|
181
|
+
|
182
|
+
# [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)
|
183
|
+
|
184
|
+
|
185
|
+
### Update
|
186
|
+
|
187
|
+
* set ADR pricing from equinox (CX24-2862) ([b64dcea](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b64dcea4dd3374be992c667db5c0b2604aacc029))
|
188
|
+
|
189
|
+
# [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)
|
190
|
+
|
191
|
+
|
192
|
+
### Update
|
193
|
+
|
194
|
+
* set ADR pricing from equinox (CX24-2862) ([9f6dfb7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f6dfb726f40b1335411318629a2ebdf1b4dac96))
|
195
|
+
* set ADR pricing from equinox (CX24-2862) ([61f550a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/61f550a21c5cc9d062549ec2aaf2758aebccf2be))
|
196
|
+
|
197
|
+
## [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)
|
198
|
+
|
199
|
+
|
200
|
+
### Fix
|
201
|
+
|
202
|
+
* [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))
|
203
|
+
|
204
|
+
## [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)
|
205
|
+
|
206
|
+
|
207
|
+
### Fix
|
208
|
+
|
209
|
+
* platform agnostic updates to ns-product-lib ([d53659f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d53659f20ab708b1212dd5820be9321e6d1855a5))
|
210
|
+
|
1
211
|
# [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)
|
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.
|
3
|
+
"version": "2.5.1-cx24-3282m.1",
|
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
|
|