@nuskin/ns-product-lib 2.13.2 → 2.13.3-cx24-5694.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/graph-ql/mappers/index.js +14 -0
- package/src/graph-ql/mappers/originalPrice.js +24 -0
- package/src/graph-ql/mappers/retailPrice.js +23 -0
- package/src/graph-ql/mappers/retailSubscriptionPrice.js +22 -0
- package/src/graph-ql/mappers/wholesalePrice.js +21 -0
- package/src/graph-ql/mappers/wholesaleSubscriptionPrice.js +22 -0
- package/src/graph-ql/product.js +72 -17
- package/src/graph-ql/query/getProductById.js +542 -0
- package/src/graph-ql/query/getProductsById.js +543 -0
- package/src/graph-ql/query/index.js +5 -0
package/package.json
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
const wholesalePrice = require('./wholesalePrice');
|
3
|
+
const retailPrice = require('./retailPrice');
|
4
|
+
const retailSubscriptionPrice = require('./retailSubscriptionPrice')
|
5
|
+
const wholesaleSubscriptionPrice = require('./wholesaleSubscriptionPrice')
|
6
|
+
const originalPrice = require('./originalPrice');
|
7
|
+
|
8
|
+
module.exports = {
|
9
|
+
mapWholesalePrice: wholesalePrice,
|
10
|
+
mapRetailPrice: retailPrice,
|
11
|
+
mapRetailSubscriptionPrice: retailSubscriptionPrice,
|
12
|
+
mapWholesaleSubscriptionPrice: wholesaleSubscriptionPrice,
|
13
|
+
mapOriginalPrice : originalPrice
|
14
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Map original price (set to retail)
|
5
|
+
* use original price if product type is equal to kit/bundle
|
6
|
+
* @param {obj} product
|
7
|
+
* @param {boolean} isWholesale default === false
|
8
|
+
* @param {boolean} isBundleKit default === false
|
9
|
+
* @return {number} retailPrice
|
10
|
+
*/
|
11
|
+
function originalPrice(product, isWholesale = false, isBundleKit = false) {
|
12
|
+
const { price, totalPrice } = product;
|
13
|
+
const productPrice = totalPrice ? totalPrice : price;
|
14
|
+
|
15
|
+
if (isBundleKit) {
|
16
|
+
|
17
|
+
return isWholesale ? productPrice.wholesaleOriginal : productPrice.retailOriginal;
|
18
|
+
}
|
19
|
+
|
20
|
+
return isWholesale ? productPrice.wholesale : productPrice.retail;
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
module.exports = originalPrice;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Map retail price
|
5
|
+
* Map retailSales if it has sales/promotions
|
6
|
+
* @param {obj} product
|
7
|
+
* @param {boolean} isBundleKit
|
8
|
+
* @return {number} retailPrice
|
9
|
+
*/
|
10
|
+
function retailPrice(product, isBundleKit = false) {
|
11
|
+
const { price, totalPrice } = product;
|
12
|
+
const productPrice = totalPrice ? totalPrice : price;
|
13
|
+
|
14
|
+
if (productPrice.retailSales) {
|
15
|
+
|
16
|
+
return productPrice.retailSales;
|
17
|
+
}
|
18
|
+
|
19
|
+
return isBundleKit ? productPrice.retailOriginal : productPrice.retail;
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
module.exports = retailPrice;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Map retail subscription price
|
5
|
+
* Map retailSales if it has sales/promotions
|
6
|
+
* @param {obj} product
|
7
|
+
* @return {number} retail subscpription price
|
8
|
+
*/
|
9
|
+
function retailSubscriptionPrice(product) {
|
10
|
+
const { price, totalPrice } = product;
|
11
|
+
const productPrice = totalPrice ? totalPrice : price;
|
12
|
+
|
13
|
+
if (productPrice.retailSales) {
|
14
|
+
|
15
|
+
return productPrice.retailSales;
|
16
|
+
}
|
17
|
+
|
18
|
+
return productPrice.retailSubscription;
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
module.exports = retailSubscriptionPrice;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Map wholesale price
|
5
|
+
* Map wholesaleSales if it has sales/promotions
|
6
|
+
* @param {*} product
|
7
|
+
* @param {boolean} isBundleKit
|
8
|
+
* @return {number} wholesalePrice
|
9
|
+
*/
|
10
|
+
function wholeSalePrice(product, isBundleKit) {
|
11
|
+
const { price, totalPrice } = product;
|
12
|
+
const productPrice = totalPrice ? totalPrice : price;
|
13
|
+
|
14
|
+
if (productPrice.wholesaleSales) {
|
15
|
+
return productPrice.wholesaleSales;
|
16
|
+
}
|
17
|
+
|
18
|
+
return isBundleKit ? productPrice.wholesaleOriginal : productPrice.wholesale;
|
19
|
+
}
|
20
|
+
|
21
|
+
module.exports = wholeSalePrice;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Map wholesale subscription price
|
5
|
+
* Map wholesaleSales if it has sales/promotions
|
6
|
+
* @param {obj} product
|
7
|
+
* @return {number} wholesale subscription price
|
8
|
+
*/
|
9
|
+
function wholesaleSubscriptionPrice(product) {
|
10
|
+
const { price, totalPrice } = product;
|
11
|
+
const productPrice = totalPrice ? totalPrice : price;
|
12
|
+
|
13
|
+
if (productPrice.wholesaleSales) {
|
14
|
+
|
15
|
+
return productPrice.wholesaleSales;
|
16
|
+
}
|
17
|
+
|
18
|
+
return productPrice.wholesaleSubscription;
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
module.exports = wholesaleSubscriptionPrice;
|
package/src/graph-ql/product.js
CHANGED
@@ -3,6 +3,13 @@ const { getProductByIdQuery } = require('./query');
|
|
3
3
|
const ProductStatus = require("../models/productStatus");
|
4
4
|
const CustomerTypes = require('./customerTypes');
|
5
5
|
const Product = require("../product");
|
6
|
+
const {
|
7
|
+
mapWholesalePrice,
|
8
|
+
mapRetailPrice,
|
9
|
+
mapRetailSubscriptionPrice,
|
10
|
+
mapWholesaleSubscriptionPrice,
|
11
|
+
mapOriginalPrice
|
12
|
+
} = require('./mappers');
|
6
13
|
|
7
14
|
const defaultPayload = {
|
8
15
|
operationName: "getProduct",
|
@@ -42,7 +49,12 @@ async function getProduct(id, market, locale, config) {
|
|
42
49
|
const payload = {
|
43
50
|
...defaultPayload,
|
44
51
|
query: getProductByIdQuery,
|
45
|
-
variables: {
|
52
|
+
variables: {
|
53
|
+
id,
|
54
|
+
market,
|
55
|
+
locale,
|
56
|
+
quantity: 1 // set defaul to 1
|
57
|
+
}
|
46
58
|
}
|
47
59
|
|
48
60
|
try {
|
@@ -67,6 +79,32 @@ async function getProduct(id, market, locale, config) {
|
|
67
79
|
};
|
68
80
|
}
|
69
81
|
|
82
|
+
/**
|
83
|
+
* Map product prices
|
84
|
+
* @param {*} product
|
85
|
+
* @param {boolean} isKitBundle
|
86
|
+
* @return {obj} prices
|
87
|
+
*/
|
88
|
+
function mapPrices(product, isKitBundle = false) {
|
89
|
+
const originalPrice = mapOriginalPrice(product, isKitBundle);
|
90
|
+
const retailPrice = mapRetailPrice(product, isKitBundle);
|
91
|
+
const wholesalePrice = mapWholesalePrice(product, isKitBundle);
|
92
|
+
const originalWholeSalePrice = mapOriginalPrice(product, true, isKitBundle);
|
93
|
+
|
94
|
+
//map subscription (ADR) prices
|
95
|
+
const retailSubscriptionPrice = mapRetailSubscriptionPrice(product);
|
96
|
+
const wholesaleSubscriptionPrice = mapWholesaleSubscriptionPrice(product);
|
97
|
+
|
98
|
+
return {
|
99
|
+
originalPrice,
|
100
|
+
originalWholeSalePrice,
|
101
|
+
retailPrice,
|
102
|
+
wholesalePrice,
|
103
|
+
retailSubscriptionPrice,
|
104
|
+
wholesaleSubscriptionPrice
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
70
108
|
/**
|
71
109
|
*
|
72
110
|
* Map product data to be product card consumable structure *
|
@@ -98,6 +136,16 @@ function mapProduct(product, market, locale, config) {
|
|
98
136
|
//serves as parent
|
99
137
|
const defaultVariant = variants[0];
|
100
138
|
const productImages = mapProductImages(defaultVariant);
|
139
|
+
|
140
|
+
const {
|
141
|
+
originalPrice,
|
142
|
+
retailPrice,
|
143
|
+
wholesalePrice,
|
144
|
+
retailSubscriptionPrice,
|
145
|
+
wholesaleSubscriptionPrice,
|
146
|
+
originalWholeSalePrice
|
147
|
+
} = mapPrices(defaultVariant, !!kitBundleProducts);
|
148
|
+
|
101
149
|
const productDetail = {
|
102
150
|
"sku": defaultVariant.sku || product.id,
|
103
151
|
"globalProductID": product.id,
|
@@ -119,15 +167,15 @@ function mapProduct(product, market, locale, config) {
|
|
119
167
|
"cv": (defaultVariant.points) ? defaultVariant.points.wholesale.cv : 0,
|
120
168
|
"pv": (defaultVariant.points) ? defaultVariant.points.wholesale.pv : 0,
|
121
169
|
"priceType": "WRTL",
|
122
|
-
"price":
|
170
|
+
"price": originalPrice,
|
123
171
|
"priceMap": {
|
124
|
-
"WRTL":
|
125
|
-
"WADW-WRTL":
|
126
|
-
"WADR":
|
127
|
-
"RTL":
|
128
|
-
"WWHL":
|
129
|
-
"WADW":
|
130
|
-
"WHL":
|
172
|
+
"WRTL": retailPrice,
|
173
|
+
"WADW-WRTL": retailSubscriptionPrice,
|
174
|
+
"WADR": retailSubscriptionPrice,
|
175
|
+
"RTL": retailPrice,
|
176
|
+
"WWHL": wholesalePrice,
|
177
|
+
"WADW": wholesaleSubscriptionPrice,
|
178
|
+
"WHL": originalWholeSalePrice
|
131
179
|
},
|
132
180
|
"cvMap": {
|
133
181
|
"WWHL": (defaultVariant.points) ? defaultVariant.points.wholesale.cv : 0,
|
@@ -209,6 +257,13 @@ function mapVariants(product) {
|
|
209
257
|
const sku = variant.sku || variant.id;
|
210
258
|
|
211
259
|
const productImages = mapProductImages(variant);
|
260
|
+
const {
|
261
|
+
originalPrice,
|
262
|
+
retailPrice,
|
263
|
+
wholesalePrice,
|
264
|
+
retailSubscriptionPrice,
|
265
|
+
wholesaleSubscriptionPrice
|
266
|
+
} = mapPrices(variant);
|
212
267
|
|
213
268
|
variants[sku] = {
|
214
269
|
"sku": sku,
|
@@ -229,15 +284,15 @@ function mapVariants(product) {
|
|
229
284
|
"cv": (variant.points) ? variant.points.wholesale.cv : 0,
|
230
285
|
"pv": (variant.points) ? variant.points.wholesale.pv : 0,
|
231
286
|
"priceType": "WRTL",
|
232
|
-
"price":
|
287
|
+
"price": originalPrice,
|
233
288
|
"priceMap": {
|
234
|
-
"WRTL":
|
235
|
-
"WADW-WRTL":
|
236
|
-
"WADR":
|
237
|
-
"RTL":
|
238
|
-
"WWHL":
|
239
|
-
"WADW":
|
240
|
-
"WHL":
|
289
|
+
"WRTL": retailPrice,
|
290
|
+
"WADW-WRTL": retailSubscriptionPrice,
|
291
|
+
"WADR": retailSubscriptionPrice,
|
292
|
+
"RTL": retailPrice,
|
293
|
+
"WWHL": wholesalePrice,
|
294
|
+
"WADW": wholesaleSubscriptionPrice,
|
295
|
+
"WHL": wholesalePrice
|
241
296
|
},
|
242
297
|
"cvMap": {
|
243
298
|
"WWHL": (variant.points) ? variant.points.wholesale.cv : 0,
|
@@ -0,0 +1,542 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// eslint-disable-next-line max-len
|
4
|
+
const getProductByIdQuery = `query getProduct($id: String!, $market: String, $language: String, $useContentSource: String, $okta: String, $quantity: Int) {
|
5
|
+
productById(
|
6
|
+
id: $id
|
7
|
+
market: $market
|
8
|
+
language: $language
|
9
|
+
useContentSource: $useContentSource
|
10
|
+
okta: $okta
|
11
|
+
quantity: $quantity
|
12
|
+
) {
|
13
|
+
...Product
|
14
|
+
bundle {
|
15
|
+
...Kit
|
16
|
+
__typename
|
17
|
+
}
|
18
|
+
__typename
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
fragment Product on Product {
|
23
|
+
id
|
24
|
+
slug
|
25
|
+
title
|
26
|
+
secondaryTitle
|
27
|
+
productImages {
|
28
|
+
url
|
29
|
+
alt
|
30
|
+
thumbnail
|
31
|
+
__typename
|
32
|
+
}
|
33
|
+
salesLabel
|
34
|
+
salesText
|
35
|
+
description
|
36
|
+
salesDisclaimer
|
37
|
+
variantSelectLabel
|
38
|
+
variants {
|
39
|
+
...Variant
|
40
|
+
__typename
|
41
|
+
}
|
42
|
+
features {
|
43
|
+
image {
|
44
|
+
url
|
45
|
+
alt
|
46
|
+
thumbnail
|
47
|
+
__typename
|
48
|
+
}
|
49
|
+
subtitle
|
50
|
+
features
|
51
|
+
backgroundColor
|
52
|
+
textColor
|
53
|
+
__typename
|
54
|
+
}
|
55
|
+
productDetails {
|
56
|
+
description
|
57
|
+
includedItems
|
58
|
+
highlights {
|
59
|
+
iconUrl
|
60
|
+
label
|
61
|
+
__typename
|
62
|
+
}
|
63
|
+
originCountry
|
64
|
+
importer
|
65
|
+
warnings
|
66
|
+
__typename
|
67
|
+
}
|
68
|
+
benefits {
|
69
|
+
benefits
|
70
|
+
image {
|
71
|
+
url
|
72
|
+
alt
|
73
|
+
thumbnail
|
74
|
+
__typename
|
75
|
+
}
|
76
|
+
youTubeVideoId
|
77
|
+
__typename
|
78
|
+
}
|
79
|
+
results {
|
80
|
+
summary
|
81
|
+
results {
|
82
|
+
percentage
|
83
|
+
text
|
84
|
+
__typename
|
85
|
+
}
|
86
|
+
report {
|
87
|
+
url
|
88
|
+
text
|
89
|
+
__typename
|
90
|
+
}
|
91
|
+
image {
|
92
|
+
url
|
93
|
+
alt
|
94
|
+
thumbnail
|
95
|
+
__typename
|
96
|
+
}
|
97
|
+
youTubeVideoId
|
98
|
+
__typename
|
99
|
+
}
|
100
|
+
sustainability {
|
101
|
+
youTubeVideoId
|
102
|
+
image {
|
103
|
+
url
|
104
|
+
__typename
|
105
|
+
}
|
106
|
+
description
|
107
|
+
highlights {
|
108
|
+
image {
|
109
|
+
url
|
110
|
+
__typename
|
111
|
+
}
|
112
|
+
description
|
113
|
+
__typename
|
114
|
+
}
|
115
|
+
__typename
|
116
|
+
}
|
117
|
+
usage {
|
118
|
+
steps
|
119
|
+
recommendations
|
120
|
+
warnings
|
121
|
+
additionalText
|
122
|
+
image {
|
123
|
+
url
|
124
|
+
alt
|
125
|
+
thumbnail
|
126
|
+
__typename
|
127
|
+
}
|
128
|
+
youTubeVideoId
|
129
|
+
markdown
|
130
|
+
__typename
|
131
|
+
}
|
132
|
+
resources {
|
133
|
+
title
|
134
|
+
url
|
135
|
+
image {
|
136
|
+
url
|
137
|
+
alt
|
138
|
+
thumbnail
|
139
|
+
__typename
|
140
|
+
}
|
141
|
+
__typename
|
142
|
+
}
|
143
|
+
warranty
|
144
|
+
faqs {
|
145
|
+
question
|
146
|
+
answers
|
147
|
+
__typename
|
148
|
+
}
|
149
|
+
ingredients {
|
150
|
+
productName
|
151
|
+
allIngredients
|
152
|
+
otherIngredients
|
153
|
+
activeIngredients
|
154
|
+
inactiveIngredients
|
155
|
+
ingredientDisclaimers
|
156
|
+
markdown
|
157
|
+
keyIngredients {
|
158
|
+
image {
|
159
|
+
url
|
160
|
+
alt
|
161
|
+
thumbnail
|
162
|
+
__typename
|
163
|
+
}
|
164
|
+
name
|
165
|
+
description
|
166
|
+
__typename
|
167
|
+
}
|
168
|
+
nutritionInformationImage {
|
169
|
+
url
|
170
|
+
alt
|
171
|
+
__typename
|
172
|
+
}
|
173
|
+
__typename
|
174
|
+
}
|
175
|
+
disclaimers
|
176
|
+
disclaimerWarnings {
|
177
|
+
icon {
|
178
|
+
url
|
179
|
+
alt
|
180
|
+
__typename
|
181
|
+
}
|
182
|
+
markdown
|
183
|
+
__typename
|
184
|
+
}
|
185
|
+
seoInformation {
|
186
|
+
metaDescription
|
187
|
+
metaTitle
|
188
|
+
canonicalURL
|
189
|
+
ogImage {
|
190
|
+
url
|
191
|
+
alt
|
192
|
+
__typename
|
193
|
+
}
|
194
|
+
__typename
|
195
|
+
}
|
196
|
+
thirdPartyScripts
|
197
|
+
productDataSource {
|
198
|
+
source
|
199
|
+
webBaseUrl
|
200
|
+
apiBaseUrl
|
201
|
+
storeId
|
202
|
+
__typename
|
203
|
+
}
|
204
|
+
error {
|
205
|
+
name
|
206
|
+
errors
|
207
|
+
lines
|
208
|
+
message
|
209
|
+
status
|
210
|
+
__typename
|
211
|
+
}
|
212
|
+
upSellProductIds
|
213
|
+
crossProductIds
|
214
|
+
__typename
|
215
|
+
}
|
216
|
+
|
217
|
+
fragment Variant on Variant {
|
218
|
+
sku
|
219
|
+
globalId
|
220
|
+
slug
|
221
|
+
variantLabel
|
222
|
+
variantColor
|
223
|
+
availableChannels
|
224
|
+
availableQuantity
|
225
|
+
customerTypes
|
226
|
+
maxQuantity
|
227
|
+
title
|
228
|
+
size
|
229
|
+
productImages {
|
230
|
+
url
|
231
|
+
alt
|
232
|
+
thumbnail
|
233
|
+
__typename
|
234
|
+
}
|
235
|
+
salesLabel
|
236
|
+
salesText
|
237
|
+
description
|
238
|
+
salesDisclaimer
|
239
|
+
nettoWeight
|
240
|
+
features {
|
241
|
+
image {
|
242
|
+
url
|
243
|
+
alt
|
244
|
+
thumbnail
|
245
|
+
__typename
|
246
|
+
}
|
247
|
+
subtitle
|
248
|
+
features
|
249
|
+
backgroundColor
|
250
|
+
textColor
|
251
|
+
__typename
|
252
|
+
}
|
253
|
+
productDetails {
|
254
|
+
description
|
255
|
+
includedItems
|
256
|
+
highlights {
|
257
|
+
iconUrl
|
258
|
+
label
|
259
|
+
__typename
|
260
|
+
}
|
261
|
+
originCountry
|
262
|
+
importer
|
263
|
+
warnings
|
264
|
+
__typename
|
265
|
+
}
|
266
|
+
benefits {
|
267
|
+
benefits
|
268
|
+
image {
|
269
|
+
url
|
270
|
+
alt
|
271
|
+
thumbnail
|
272
|
+
__typename
|
273
|
+
}
|
274
|
+
youTubeVideoId
|
275
|
+
__typename
|
276
|
+
}
|
277
|
+
results {
|
278
|
+
summary
|
279
|
+
results {
|
280
|
+
percentage
|
281
|
+
text
|
282
|
+
__typename
|
283
|
+
}
|
284
|
+
report {
|
285
|
+
url
|
286
|
+
text
|
287
|
+
__typename
|
288
|
+
}
|
289
|
+
image {
|
290
|
+
url
|
291
|
+
alt
|
292
|
+
thumbnail
|
293
|
+
__typename
|
294
|
+
}
|
295
|
+
youTubeVideoId
|
296
|
+
__typename
|
297
|
+
}
|
298
|
+
usage {
|
299
|
+
steps
|
300
|
+
recommendations
|
301
|
+
warnings
|
302
|
+
additionalText
|
303
|
+
image {
|
304
|
+
url
|
305
|
+
alt
|
306
|
+
thumbnail
|
307
|
+
__typename
|
308
|
+
}
|
309
|
+
youTubeVideoId
|
310
|
+
markdown
|
311
|
+
__typename
|
312
|
+
}
|
313
|
+
resources {
|
314
|
+
title
|
315
|
+
url
|
316
|
+
image {
|
317
|
+
url
|
318
|
+
alt
|
319
|
+
thumbnail
|
320
|
+
__typename
|
321
|
+
}
|
322
|
+
__typename
|
323
|
+
}
|
324
|
+
faqs {
|
325
|
+
question
|
326
|
+
answers
|
327
|
+
__typename
|
328
|
+
}
|
329
|
+
ingredients {
|
330
|
+
productName
|
331
|
+
allIngredients
|
332
|
+
otherIngredients
|
333
|
+
activeIngredients
|
334
|
+
inactiveIngredients
|
335
|
+
ingredientDisclaimers
|
336
|
+
markdown
|
337
|
+
keyIngredients {
|
338
|
+
image {
|
339
|
+
url
|
340
|
+
alt
|
341
|
+
thumbnail
|
342
|
+
__typename
|
343
|
+
}
|
344
|
+
name
|
345
|
+
description
|
346
|
+
__typename
|
347
|
+
}
|
348
|
+
nutritionInformationImage {
|
349
|
+
url
|
350
|
+
alt
|
351
|
+
__typename
|
352
|
+
}
|
353
|
+
__typename
|
354
|
+
}
|
355
|
+
isExclusive
|
356
|
+
price {
|
357
|
+
retail
|
358
|
+
wholesale
|
359
|
+
retailSales
|
360
|
+
wholesaleSales
|
361
|
+
retailSubscription
|
362
|
+
wholesaleSubscription
|
363
|
+
retailOriginal
|
364
|
+
wholesaleOriginal
|
365
|
+
currencyCode
|
366
|
+
__typename
|
367
|
+
}
|
368
|
+
totalPrice {
|
369
|
+
retail
|
370
|
+
wholesale
|
371
|
+
retailSales
|
372
|
+
wholesaleSales
|
373
|
+
retailSubscription
|
374
|
+
wholesaleSubscription
|
375
|
+
retailOriginal
|
376
|
+
wholesaleOriginal
|
377
|
+
currencyCode
|
378
|
+
__typename
|
379
|
+
}
|
380
|
+
points {
|
381
|
+
wholesale {
|
382
|
+
cv
|
383
|
+
pv
|
384
|
+
__typename
|
385
|
+
}
|
386
|
+
subscription {
|
387
|
+
cv
|
388
|
+
pv
|
389
|
+
__typename
|
390
|
+
}
|
391
|
+
__typename
|
392
|
+
}
|
393
|
+
totalPoints {
|
394
|
+
wholesale {
|
395
|
+
cv
|
396
|
+
pv
|
397
|
+
__typename
|
398
|
+
}
|
399
|
+
subscription {
|
400
|
+
cv
|
401
|
+
pv
|
402
|
+
__typename
|
403
|
+
}
|
404
|
+
__typename
|
405
|
+
}
|
406
|
+
pricingJson
|
407
|
+
availableQuantity
|
408
|
+
maxQuantity
|
409
|
+
status {
|
410
|
+
isBackordered
|
411
|
+
backorderedAvailableDate
|
412
|
+
status
|
413
|
+
__typename
|
414
|
+
}
|
415
|
+
purchaseTypes {
|
416
|
+
buyOnce
|
417
|
+
subscription
|
418
|
+
__typename
|
419
|
+
}
|
420
|
+
marketAttributes {
|
421
|
+
redeem
|
422
|
+
earn
|
423
|
+
__typename
|
424
|
+
}
|
425
|
+
disclaimers
|
426
|
+
disclaimerWarnings {
|
427
|
+
icon {
|
428
|
+
url
|
429
|
+
alt
|
430
|
+
__typename
|
431
|
+
}
|
432
|
+
markdown
|
433
|
+
__typename
|
434
|
+
}
|
435
|
+
restrictedMarkets
|
436
|
+
matchingVariant
|
437
|
+
shadeable
|
438
|
+
productType
|
439
|
+
primaryBrand
|
440
|
+
brandFamily
|
441
|
+
__typename
|
442
|
+
}
|
443
|
+
|
444
|
+
fragment Kit on Kit {
|
445
|
+
id
|
446
|
+
type
|
447
|
+
price {
|
448
|
+
currencyCode
|
449
|
+
retail
|
450
|
+
wholesale
|
451
|
+
retailSales
|
452
|
+
wholesaleSales
|
453
|
+
retailSubscription
|
454
|
+
wholesaleSubscription
|
455
|
+
retailOriginal
|
456
|
+
wholesaleOriginal
|
457
|
+
__typename
|
458
|
+
}
|
459
|
+
totalPrice {
|
460
|
+
currencyCode
|
461
|
+
retail
|
462
|
+
wholesale
|
463
|
+
retailSales
|
464
|
+
wholesaleSales
|
465
|
+
retailSubscription
|
466
|
+
wholesaleSubscription
|
467
|
+
retailOriginal
|
468
|
+
wholesaleOriginal
|
469
|
+
__typename
|
470
|
+
}
|
471
|
+
points {
|
472
|
+
wholesale {
|
473
|
+
cv
|
474
|
+
pv
|
475
|
+
__typename
|
476
|
+
}
|
477
|
+
subscription {
|
478
|
+
cv
|
479
|
+
pv
|
480
|
+
__typename
|
481
|
+
}
|
482
|
+
__typename
|
483
|
+
}
|
484
|
+
totalPoints {
|
485
|
+
wholesale {
|
486
|
+
cv
|
487
|
+
pv
|
488
|
+
__typename
|
489
|
+
}
|
490
|
+
subscription {
|
491
|
+
cv
|
492
|
+
pv
|
493
|
+
__typename
|
494
|
+
}
|
495
|
+
__typename
|
496
|
+
}
|
497
|
+
retailDiscount
|
498
|
+
wholesaleDiscount
|
499
|
+
pvDiscount
|
500
|
+
cvDiscount
|
501
|
+
sbDiscount
|
502
|
+
grpDiscount
|
503
|
+
availableChannels
|
504
|
+
customerTypes
|
505
|
+
purchaseTypes {
|
506
|
+
buyOnce
|
507
|
+
subscription
|
508
|
+
__typename
|
509
|
+
}
|
510
|
+
status {
|
511
|
+
status
|
512
|
+
isBackordered
|
513
|
+
backorderedAvailableDate
|
514
|
+
__typename
|
515
|
+
}
|
516
|
+
availableQuantity
|
517
|
+
chargeShipping
|
518
|
+
dangerousGoods
|
519
|
+
excludeFromSearch
|
520
|
+
isExclusive
|
521
|
+
marketAttributes {
|
522
|
+
discount
|
523
|
+
redeem
|
524
|
+
earn
|
525
|
+
__typename
|
526
|
+
}
|
527
|
+
restrictedMarkets
|
528
|
+
scanQualifiedCount
|
529
|
+
kitProducts {
|
530
|
+
quantity
|
531
|
+
isMandatory
|
532
|
+
product {
|
533
|
+
...Product
|
534
|
+
__typename
|
535
|
+
}
|
536
|
+
__typename
|
537
|
+
}
|
538
|
+
__typename
|
539
|
+
}`
|
540
|
+
|
541
|
+
|
542
|
+
module.exports = getProductByIdQuery;
|
@@ -0,0 +1,543 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// eslint-disable-next-line max-len
|
4
|
+
const getProductsByIdQuery = `query getProducts($id: String!, $market: String, $language: String, $useContentSource: String, $okta: String, quantity: Int) {
|
5
|
+
productsById(
|
6
|
+
id: $id
|
7
|
+
market: $market
|
8
|
+
language: $language
|
9
|
+
useContentSource: $useContentSource
|
10
|
+
okta: $okta
|
11
|
+
quantity: $quantity
|
12
|
+
) {
|
13
|
+
products {
|
14
|
+
...Product
|
15
|
+
__typename
|
16
|
+
}
|
17
|
+
skip
|
18
|
+
totalCount
|
19
|
+
validCount
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
fragment Product on Product {
|
24
|
+
id
|
25
|
+
slug
|
26
|
+
title
|
27
|
+
secondaryTitle
|
28
|
+
productImages {
|
29
|
+
url
|
30
|
+
alt
|
31
|
+
thumbnail
|
32
|
+
__typename
|
33
|
+
}
|
34
|
+
salesLabel
|
35
|
+
salesText
|
36
|
+
description
|
37
|
+
salesDisclaimer
|
38
|
+
variantSelectLabel
|
39
|
+
variants {
|
40
|
+
...Variant
|
41
|
+
__typename
|
42
|
+
}
|
43
|
+
features {
|
44
|
+
image {
|
45
|
+
url
|
46
|
+
alt
|
47
|
+
thumbnail
|
48
|
+
__typename
|
49
|
+
}
|
50
|
+
subtitle
|
51
|
+
features
|
52
|
+
backgroundColor
|
53
|
+
textColor
|
54
|
+
__typename
|
55
|
+
}
|
56
|
+
productDetails {
|
57
|
+
description
|
58
|
+
includedItems
|
59
|
+
highlights {
|
60
|
+
iconUrl
|
61
|
+
label
|
62
|
+
__typename
|
63
|
+
}
|
64
|
+
originCountry
|
65
|
+
importer
|
66
|
+
warnings
|
67
|
+
__typename
|
68
|
+
}
|
69
|
+
benefits {
|
70
|
+
benefits
|
71
|
+
image {
|
72
|
+
url
|
73
|
+
alt
|
74
|
+
thumbnail
|
75
|
+
__typename
|
76
|
+
}
|
77
|
+
youTubeVideoId
|
78
|
+
__typename
|
79
|
+
}
|
80
|
+
results {
|
81
|
+
summary
|
82
|
+
results {
|
83
|
+
percentage
|
84
|
+
text
|
85
|
+
__typename
|
86
|
+
}
|
87
|
+
report {
|
88
|
+
url
|
89
|
+
text
|
90
|
+
__typename
|
91
|
+
}
|
92
|
+
image {
|
93
|
+
url
|
94
|
+
alt
|
95
|
+
thumbnail
|
96
|
+
__typename
|
97
|
+
}
|
98
|
+
youTubeVideoId
|
99
|
+
__typename
|
100
|
+
}
|
101
|
+
sustainability {
|
102
|
+
youTubeVideoId
|
103
|
+
image {
|
104
|
+
url
|
105
|
+
__typename
|
106
|
+
}
|
107
|
+
description
|
108
|
+
highlights {
|
109
|
+
image {
|
110
|
+
url
|
111
|
+
__typename
|
112
|
+
}
|
113
|
+
description
|
114
|
+
__typename
|
115
|
+
}
|
116
|
+
__typename
|
117
|
+
}
|
118
|
+
usage {
|
119
|
+
steps
|
120
|
+
recommendations
|
121
|
+
warnings
|
122
|
+
additionalText
|
123
|
+
image {
|
124
|
+
url
|
125
|
+
alt
|
126
|
+
thumbnail
|
127
|
+
__typename
|
128
|
+
}
|
129
|
+
youTubeVideoId
|
130
|
+
markdown
|
131
|
+
__typename
|
132
|
+
}
|
133
|
+
resources {
|
134
|
+
title
|
135
|
+
url
|
136
|
+
image {
|
137
|
+
url
|
138
|
+
alt
|
139
|
+
thumbnail
|
140
|
+
__typename
|
141
|
+
}
|
142
|
+
__typename
|
143
|
+
}
|
144
|
+
warranty
|
145
|
+
faqs {
|
146
|
+
question
|
147
|
+
answers
|
148
|
+
__typename
|
149
|
+
}
|
150
|
+
ingredients {
|
151
|
+
productName
|
152
|
+
allIngredients
|
153
|
+
otherIngredients
|
154
|
+
activeIngredients
|
155
|
+
inactiveIngredients
|
156
|
+
ingredientDisclaimers
|
157
|
+
markdown
|
158
|
+
keyIngredients {
|
159
|
+
image {
|
160
|
+
url
|
161
|
+
alt
|
162
|
+
thumbnail
|
163
|
+
__typename
|
164
|
+
}
|
165
|
+
name
|
166
|
+
description
|
167
|
+
__typename
|
168
|
+
}
|
169
|
+
nutritionInformationImage {
|
170
|
+
url
|
171
|
+
alt
|
172
|
+
__typename
|
173
|
+
}
|
174
|
+
__typename
|
175
|
+
}
|
176
|
+
disclaimers
|
177
|
+
disclaimerWarnings {
|
178
|
+
icon {
|
179
|
+
url
|
180
|
+
alt
|
181
|
+
__typename
|
182
|
+
}
|
183
|
+
markdown
|
184
|
+
__typename
|
185
|
+
}
|
186
|
+
seoInformation {
|
187
|
+
metaDescription
|
188
|
+
metaTitle
|
189
|
+
canonicalURL
|
190
|
+
ogImage {
|
191
|
+
url
|
192
|
+
alt
|
193
|
+
__typename
|
194
|
+
}
|
195
|
+
__typename
|
196
|
+
}
|
197
|
+
thirdPartyScripts
|
198
|
+
productDataSource {
|
199
|
+
source
|
200
|
+
webBaseUrl
|
201
|
+
apiBaseUrl
|
202
|
+
storeId
|
203
|
+
__typename
|
204
|
+
}
|
205
|
+
error {
|
206
|
+
name
|
207
|
+
errors
|
208
|
+
lines
|
209
|
+
message
|
210
|
+
status
|
211
|
+
__typename
|
212
|
+
}
|
213
|
+
upSellProductIds
|
214
|
+
crossProductIds
|
215
|
+
__typename
|
216
|
+
}
|
217
|
+
|
218
|
+
fragment Variant on Variant {
|
219
|
+
sku
|
220
|
+
globalId
|
221
|
+
slug
|
222
|
+
variantLabel
|
223
|
+
variantColor
|
224
|
+
availableChannels
|
225
|
+
availableQuantity
|
226
|
+
customerTypes
|
227
|
+
maxQuantity
|
228
|
+
title
|
229
|
+
size
|
230
|
+
productImages {
|
231
|
+
url
|
232
|
+
alt
|
233
|
+
thumbnail
|
234
|
+
__typename
|
235
|
+
}
|
236
|
+
salesLabel
|
237
|
+
salesText
|
238
|
+
description
|
239
|
+
salesDisclaimer
|
240
|
+
nettoWeight
|
241
|
+
features {
|
242
|
+
image {
|
243
|
+
url
|
244
|
+
alt
|
245
|
+
thumbnail
|
246
|
+
__typename
|
247
|
+
}
|
248
|
+
subtitle
|
249
|
+
features
|
250
|
+
backgroundColor
|
251
|
+
textColor
|
252
|
+
__typename
|
253
|
+
}
|
254
|
+
productDetails {
|
255
|
+
description
|
256
|
+
includedItems
|
257
|
+
highlights {
|
258
|
+
iconUrl
|
259
|
+
label
|
260
|
+
__typename
|
261
|
+
}
|
262
|
+
originCountry
|
263
|
+
importer
|
264
|
+
warnings
|
265
|
+
__typename
|
266
|
+
}
|
267
|
+
benefits {
|
268
|
+
benefits
|
269
|
+
image {
|
270
|
+
url
|
271
|
+
alt
|
272
|
+
thumbnail
|
273
|
+
__typename
|
274
|
+
}
|
275
|
+
youTubeVideoId
|
276
|
+
__typename
|
277
|
+
}
|
278
|
+
results {
|
279
|
+
summary
|
280
|
+
results {
|
281
|
+
percentage
|
282
|
+
text
|
283
|
+
__typename
|
284
|
+
}
|
285
|
+
report {
|
286
|
+
url
|
287
|
+
text
|
288
|
+
__typename
|
289
|
+
}
|
290
|
+
image {
|
291
|
+
url
|
292
|
+
alt
|
293
|
+
thumbnail
|
294
|
+
__typename
|
295
|
+
}
|
296
|
+
youTubeVideoId
|
297
|
+
__typename
|
298
|
+
}
|
299
|
+
usage {
|
300
|
+
steps
|
301
|
+
recommendations
|
302
|
+
warnings
|
303
|
+
additionalText
|
304
|
+
image {
|
305
|
+
url
|
306
|
+
alt
|
307
|
+
thumbnail
|
308
|
+
__typename
|
309
|
+
}
|
310
|
+
youTubeVideoId
|
311
|
+
markdown
|
312
|
+
__typename
|
313
|
+
}
|
314
|
+
resources {
|
315
|
+
title
|
316
|
+
url
|
317
|
+
image {
|
318
|
+
url
|
319
|
+
alt
|
320
|
+
thumbnail
|
321
|
+
__typename
|
322
|
+
}
|
323
|
+
__typename
|
324
|
+
}
|
325
|
+
faqs {
|
326
|
+
question
|
327
|
+
answers
|
328
|
+
__typename
|
329
|
+
}
|
330
|
+
ingredients {
|
331
|
+
productName
|
332
|
+
allIngredients
|
333
|
+
otherIngredients
|
334
|
+
activeIngredients
|
335
|
+
inactiveIngredients
|
336
|
+
ingredientDisclaimers
|
337
|
+
markdown
|
338
|
+
keyIngredients {
|
339
|
+
image {
|
340
|
+
url
|
341
|
+
alt
|
342
|
+
thumbnail
|
343
|
+
__typename
|
344
|
+
}
|
345
|
+
name
|
346
|
+
description
|
347
|
+
__typename
|
348
|
+
}
|
349
|
+
nutritionInformationImage {
|
350
|
+
url
|
351
|
+
alt
|
352
|
+
__typename
|
353
|
+
}
|
354
|
+
__typename
|
355
|
+
}
|
356
|
+
isExclusive
|
357
|
+
price {
|
358
|
+
retail
|
359
|
+
wholesale
|
360
|
+
retailSales
|
361
|
+
wholesaleSales
|
362
|
+
retailSubscription
|
363
|
+
wholesaleSubscription
|
364
|
+
currencyCode
|
365
|
+
retailOriginal
|
366
|
+
wholesaleOriginal
|
367
|
+
__typename
|
368
|
+
}
|
369
|
+
totalPrice {
|
370
|
+
retail
|
371
|
+
wholesale
|
372
|
+
retailSales
|
373
|
+
wholesaleSales
|
374
|
+
retailSubscription
|
375
|
+
wholesaleSubscription
|
376
|
+
currencyCode
|
377
|
+
retailOriginal
|
378
|
+
wholesaleOriginal
|
379
|
+
__typename
|
380
|
+
}
|
381
|
+
points {
|
382
|
+
wholesale {
|
383
|
+
cv
|
384
|
+
pv
|
385
|
+
__typename
|
386
|
+
}
|
387
|
+
subscription {
|
388
|
+
cv
|
389
|
+
pv
|
390
|
+
__typename
|
391
|
+
}
|
392
|
+
__typename
|
393
|
+
}
|
394
|
+
totalPoints {
|
395
|
+
wholesale {
|
396
|
+
cv
|
397
|
+
pv
|
398
|
+
__typename
|
399
|
+
}
|
400
|
+
subscription {
|
401
|
+
cv
|
402
|
+
pv
|
403
|
+
__typename
|
404
|
+
}
|
405
|
+
__typename
|
406
|
+
}
|
407
|
+
pricingJson
|
408
|
+
availableQuantity
|
409
|
+
maxQuantity
|
410
|
+
status {
|
411
|
+
isBackordered
|
412
|
+
backorderedAvailableDate
|
413
|
+
status
|
414
|
+
__typename
|
415
|
+
}
|
416
|
+
purchaseTypes {
|
417
|
+
buyOnce
|
418
|
+
subscription
|
419
|
+
__typename
|
420
|
+
}
|
421
|
+
marketAttributes {
|
422
|
+
redeem
|
423
|
+
earn
|
424
|
+
__typename
|
425
|
+
}
|
426
|
+
disclaimers
|
427
|
+
disclaimerWarnings {
|
428
|
+
icon {
|
429
|
+
url
|
430
|
+
alt
|
431
|
+
__typename
|
432
|
+
}
|
433
|
+
markdown
|
434
|
+
__typename
|
435
|
+
}
|
436
|
+
restrictedMarkets
|
437
|
+
matchingVariant
|
438
|
+
shadeable
|
439
|
+
productType
|
440
|
+
primaryBrand
|
441
|
+
brandFamily
|
442
|
+
__typename
|
443
|
+
}
|
444
|
+
|
445
|
+
fragment Kit on Kit {
|
446
|
+
id
|
447
|
+
type
|
448
|
+
price {
|
449
|
+
currencyCode
|
450
|
+
retail
|
451
|
+
wholesale
|
452
|
+
retailSales
|
453
|
+
wholesaleSales
|
454
|
+
retailSubscription
|
455
|
+
wholesaleSubscription
|
456
|
+
retailOriginal
|
457
|
+
wholesaleOriginal
|
458
|
+
__typename
|
459
|
+
}
|
460
|
+
totalPrice {
|
461
|
+
currencyCode
|
462
|
+
retail
|
463
|
+
wholesale
|
464
|
+
retailSales
|
465
|
+
wholesaleSales
|
466
|
+
retailSubscription
|
467
|
+
wholesaleSubscription
|
468
|
+
retailOriginal
|
469
|
+
wholesaleOriginal
|
470
|
+
__typename
|
471
|
+
}
|
472
|
+
points {
|
473
|
+
wholesale {
|
474
|
+
cv
|
475
|
+
pv
|
476
|
+
__typename
|
477
|
+
}
|
478
|
+
subscription {
|
479
|
+
cv
|
480
|
+
pv
|
481
|
+
__typename
|
482
|
+
}
|
483
|
+
__typename
|
484
|
+
}
|
485
|
+
totalPoints {
|
486
|
+
wholesale {
|
487
|
+
cv
|
488
|
+
pv
|
489
|
+
__typename
|
490
|
+
}
|
491
|
+
subscription {
|
492
|
+
cv
|
493
|
+
pv
|
494
|
+
__typename
|
495
|
+
}
|
496
|
+
__typename
|
497
|
+
}
|
498
|
+
retailDiscount
|
499
|
+
wholesaleDiscount
|
500
|
+
pvDiscount
|
501
|
+
cvDiscount
|
502
|
+
sbDiscount
|
503
|
+
grpDiscount
|
504
|
+
availableChannels
|
505
|
+
customerTypes
|
506
|
+
purchaseTypes {
|
507
|
+
buyOnce
|
508
|
+
subscription
|
509
|
+
__typename
|
510
|
+
}
|
511
|
+
status {
|
512
|
+
status
|
513
|
+
isBackordered
|
514
|
+
backorderedAvailableDate
|
515
|
+
__typename
|
516
|
+
}
|
517
|
+
availableQuantity
|
518
|
+
chargeShipping
|
519
|
+
dangerousGoods
|
520
|
+
excludeFromSearch
|
521
|
+
isExclusive
|
522
|
+
marketAttributes {
|
523
|
+
discount
|
524
|
+
redeem
|
525
|
+
earn
|
526
|
+
__typename
|
527
|
+
}
|
528
|
+
restrictedMarkets
|
529
|
+
scanQualifiedCount
|
530
|
+
kitProducts {
|
531
|
+
quantity
|
532
|
+
isMandatory
|
533
|
+
product {
|
534
|
+
...Product
|
535
|
+
__typename
|
536
|
+
}
|
537
|
+
__typename
|
538
|
+
}
|
539
|
+
__typename
|
540
|
+
}`
|
541
|
+
|
542
|
+
|
543
|
+
module.exports = getProductsByIdQuery;
|