@nuskin/ns-product-lib 2.7.0-cx24-3682.26 → 2.7.0-cx24-3702.5
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 +19 -150
- package/package.json +2 -2
- package/src/equinox-helpers/childSKU.js +1 -1
- package/src/equinox-helpers/index.js +31 -173
- package/src/product.js +69 -82
- package/src/productData.js +43 -43
- package/src/equinox-helpers/interceptors/index.js +0 -5
- package/src/equinox-helpers/interceptors/productNotFound.js +0 -72
- package/src/equinox-helpers/mappers/identifier.js +0 -13
- package/src/equinox-helpers/mappers/index.js +0 -13
- package/src/equinox-helpers/mappers/inventoryProperties.js +0 -173
- package/src/equinox-helpers/mappers/properties.js +0 -169
- package/src/equinox-helpers/mappers/variant.js +0 -51
- package/src/equinox-helpers/mappers/variantProperties.js +0 -273
- package/src/equinox-helpers/models/index.js +0 -5
- package/src/equinox-helpers/models/productNotFound.js +0 -48
@@ -1,273 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @param {import('../').EquinoxProductVariantProperties} properties
|
5
|
-
*/
|
6
|
-
function mapVariantProperties(properties = {}) {
|
7
|
-
/** @type {import('../').EquinoxProductVariantProperties} */
|
8
|
-
const model = {};
|
9
|
-
model.benefits = mapBenefits(properties.benefits);
|
10
|
-
model.excludeFromSearch = mapExcludeFromSearch(properties.excludeFromSearch);
|
11
|
-
model.usage = mapUsage(properties.usage);
|
12
|
-
model.description = mapDescription(properties.description);
|
13
|
-
model.chargeShipping = mapChargeShipping(properties.chargeShipping);
|
14
|
-
model.globalProductId = mapGlobalProductId(properties.globalProductId);
|
15
|
-
model.title = mapTitle(properties.title);
|
16
|
-
model.scanQualifiedCount = mapScanQualifiedCount(properties.scanQualifiedCount);
|
17
|
-
model.division = mapDivision(properties.division);
|
18
|
-
model.isExclusive = mapIsExclusive('false',);
|
19
|
-
model.imageURL = mapImageURL(properties.imageURL);
|
20
|
-
model.customerTypes = mapCustomerTypes(properties.customerTypes);
|
21
|
-
model.ingredients = mapIngredients(properties.ingredients);
|
22
|
-
model.availableChannels = mapAvailableChannels(properties.availableChannels);
|
23
|
-
model.resources = mapResources(properties.resources);
|
24
|
-
model.market = mapMarket(properties.market);
|
25
|
-
model.size = mapSize(properties.size);
|
26
|
-
model.name = mapName(properties.name);
|
27
|
-
model.status = mapStatus(properties.status);
|
28
|
-
model.productStatus = mapProductStatus(properties.productStatus);
|
29
|
-
|
30
|
-
return model;
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* @param {string|undefined} benefits
|
35
|
-
* @returns {string}
|
36
|
-
*/
|
37
|
-
function mapBenefits(benefits) {
|
38
|
-
if (benefits) {
|
39
|
-
return benefits;
|
40
|
-
}
|
41
|
-
|
42
|
-
return '';
|
43
|
-
}
|
44
|
-
|
45
|
-
/**
|
46
|
-
* @param {string|undefined} excludeFromSearch
|
47
|
-
* @returns {string}
|
48
|
-
*/
|
49
|
-
function mapExcludeFromSearch(excludeFromSearch) {
|
50
|
-
if (excludeFromSearch) {
|
51
|
-
return excludeFromSearch;
|
52
|
-
}
|
53
|
-
|
54
|
-
return '';
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
* @param {string|undefined} usage
|
59
|
-
* @returns {string}
|
60
|
-
*/
|
61
|
-
function mapUsage(usage) {
|
62
|
-
if (usage) {
|
63
|
-
return usage;
|
64
|
-
}
|
65
|
-
|
66
|
-
return '';
|
67
|
-
}
|
68
|
-
|
69
|
-
/**
|
70
|
-
* @param {string|undefined} description
|
71
|
-
* @returns {string}
|
72
|
-
*/
|
73
|
-
function mapDescription(description) {
|
74
|
-
if (description) {
|
75
|
-
return description;
|
76
|
-
}
|
77
|
-
|
78
|
-
return '';
|
79
|
-
}
|
80
|
-
|
81
|
-
/**
|
82
|
-
* @param {string|undefined} chargeShipping
|
83
|
-
* @returns {string}
|
84
|
-
*/
|
85
|
-
function mapChargeShipping(chargeShipping) {
|
86
|
-
if (chargeShipping) {
|
87
|
-
return chargeShipping;
|
88
|
-
}
|
89
|
-
|
90
|
-
return '';
|
91
|
-
}
|
92
|
-
|
93
|
-
/**
|
94
|
-
* @param {string|undefined} globalProductId
|
95
|
-
* @returns {string}
|
96
|
-
*/
|
97
|
-
function mapGlobalProductId(globalProductId) {
|
98
|
-
if (globalProductId) {
|
99
|
-
return globalProductId;
|
100
|
-
}
|
101
|
-
|
102
|
-
return '';
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* @param {string|undefined} title
|
107
|
-
* @returns {string}
|
108
|
-
*/
|
109
|
-
function mapTitle(title) {
|
110
|
-
if (title) {
|
111
|
-
return title;
|
112
|
-
}
|
113
|
-
|
114
|
-
return '';
|
115
|
-
}
|
116
|
-
|
117
|
-
/**
|
118
|
-
* @param {string|undefined} scanQualifiedCount
|
119
|
-
* @returns {string}
|
120
|
-
*/
|
121
|
-
function mapScanQualifiedCount(scanQualifiedCount) {
|
122
|
-
if (scanQualifiedCount) {
|
123
|
-
return scanQualifiedCount;
|
124
|
-
}
|
125
|
-
|
126
|
-
return '';
|
127
|
-
}
|
128
|
-
|
129
|
-
/**
|
130
|
-
* @param {string|undefined} division
|
131
|
-
* @returns {string}
|
132
|
-
*/
|
133
|
-
function mapDivision(division) {
|
134
|
-
if (division) {
|
135
|
-
return division;
|
136
|
-
}
|
137
|
-
|
138
|
-
return '';
|
139
|
-
}
|
140
|
-
|
141
|
-
/**
|
142
|
-
* @param {string|undefined} isExclusive
|
143
|
-
* @returns {string}
|
144
|
-
*/
|
145
|
-
function mapIsExclusive(isExclusive) {
|
146
|
-
if (isExclusive) {
|
147
|
-
return isExclusive;
|
148
|
-
}
|
149
|
-
|
150
|
-
return '';
|
151
|
-
}
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @param {string|undefined} imageURL
|
155
|
-
* @returns {string}
|
156
|
-
*/
|
157
|
-
function mapImageURL(imageURL) {
|
158
|
-
if (imageURL) {
|
159
|
-
return imageURL;
|
160
|
-
}
|
161
|
-
|
162
|
-
return '';
|
163
|
-
}
|
164
|
-
|
165
|
-
/**
|
166
|
-
* @param {string|undefined} customerTypes
|
167
|
-
* @returns {string}
|
168
|
-
*/
|
169
|
-
function mapCustomerTypes(customerTypes) {
|
170
|
-
if (customerTypes) {
|
171
|
-
return customerTypes;
|
172
|
-
}
|
173
|
-
|
174
|
-
return '';
|
175
|
-
}
|
176
|
-
|
177
|
-
/**
|
178
|
-
* @param {string|undefined} ingredients
|
179
|
-
* @returns {string}
|
180
|
-
*/
|
181
|
-
function mapIngredients(ingredients) {
|
182
|
-
if (ingredients) {
|
183
|
-
return ingredients;
|
184
|
-
}
|
185
|
-
|
186
|
-
return '';
|
187
|
-
}
|
188
|
-
|
189
|
-
/**
|
190
|
-
* @param {string|undefined} availableChannels
|
191
|
-
* @returns {string}
|
192
|
-
*/
|
193
|
-
function mapAvailableChannels(availableChannels) {
|
194
|
-
if (availableChannels) {
|
195
|
-
return availableChannels;
|
196
|
-
}
|
197
|
-
|
198
|
-
return '';
|
199
|
-
}
|
200
|
-
|
201
|
-
/**
|
202
|
-
* @param {string|undefined} resources
|
203
|
-
* @returns {string}
|
204
|
-
*/
|
205
|
-
function mapResources(resources) {
|
206
|
-
if (resources) {
|
207
|
-
return resources;
|
208
|
-
}
|
209
|
-
|
210
|
-
return '';
|
211
|
-
}
|
212
|
-
|
213
|
-
/**
|
214
|
-
* @param {string|undefined} market
|
215
|
-
* @returns {string}
|
216
|
-
*/
|
217
|
-
function mapMarket(market) {
|
218
|
-
if (market) {
|
219
|
-
return market;
|
220
|
-
}
|
221
|
-
|
222
|
-
return '';
|
223
|
-
}
|
224
|
-
|
225
|
-
/**
|
226
|
-
* @param {string|undefined} size
|
227
|
-
* @returns {string}
|
228
|
-
*/
|
229
|
-
function mapSize(size) {
|
230
|
-
if (size) {
|
231
|
-
return size;
|
232
|
-
}
|
233
|
-
|
234
|
-
return '';
|
235
|
-
}
|
236
|
-
|
237
|
-
/**
|
238
|
-
* @param {string|undefined} name
|
239
|
-
* @returns {string}
|
240
|
-
*/
|
241
|
-
function mapName(name) {
|
242
|
-
if (name) {
|
243
|
-
return name;
|
244
|
-
}
|
245
|
-
|
246
|
-
return '';
|
247
|
-
}
|
248
|
-
|
249
|
-
/**
|
250
|
-
* @param {string|undefined} status
|
251
|
-
* @returns {string}
|
252
|
-
*/
|
253
|
-
function mapStatus(status) {
|
254
|
-
if (status) {
|
255
|
-
return status;
|
256
|
-
}
|
257
|
-
|
258
|
-
return '';
|
259
|
-
}
|
260
|
-
|
261
|
-
/**
|
262
|
-
* @param {string|undefined} productStatus
|
263
|
-
* @returns {string}
|
264
|
-
*/
|
265
|
-
function mapProductStatus(productStatus) {
|
266
|
-
if (productStatus) {
|
267
|
-
return productStatus;
|
268
|
-
}
|
269
|
-
|
270
|
-
return '';
|
271
|
-
}
|
272
|
-
|
273
|
-
module.exports = mapVariantProperties;
|
@@ -1,48 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
const { mapIdentifier, mapProperties, mapVariant } = require('../mappers');
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @param {import('../').EquinoxNormalProduct} product
|
6
|
-
* @param {string} market
|
7
|
-
* @returns {import('../').EquinoxNormalProduct}
|
8
|
-
*/
|
9
|
-
function productNotFound(product, market) {
|
10
|
-
/** @type {import('../').EquinoxNormalProduct} */
|
11
|
-
const model = {};
|
12
|
-
model.identifier = mapIdentifier(` ${product.identifier}`);
|
13
|
-
model.properties = mapProperties();
|
14
|
-
model.exists = mapExists(product.exists);
|
15
|
-
model.sku = [mapVariant({
|
16
|
-
// adding a whitespace allows us to display an SKU with 55
|
17
|
-
// without initializing the variant selector of ns-product-small
|
18
|
-
identifier: ` ${product.identifier}`,
|
19
|
-
properties: {
|
20
|
-
availableChannels: 'subscription,arsPhone,kiosk,mobile,web',
|
21
|
-
customerTypes: 'BrandAffiliate,Preferred,Retail',
|
22
|
-
description: 'not-found',
|
23
|
-
imageURL: 'https://nuskin.com/content/dam/global/images/products/01102730-nu-skin-tri-phasic-white-essence.png',
|
24
|
-
isExclusive: 'false',
|
25
|
-
market,
|
26
|
-
name: ` ${product.identifier}`,
|
27
|
-
productStatus: 'stopped',
|
28
|
-
scanQualifiedCount: '0',
|
29
|
-
status: 'active',
|
30
|
-
title: ` ${product.identifier}`
|
31
|
-
}
|
32
|
-
})];
|
33
|
-
|
34
|
-
return model;
|
35
|
-
}
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @param {boolean|undefined} exists
|
39
|
-
*/
|
40
|
-
function mapExists(exists) {
|
41
|
-
if (exists === undefined) {
|
42
|
-
return true;
|
43
|
-
}
|
44
|
-
|
45
|
-
return exists;
|
46
|
-
}
|
47
|
-
|
48
|
-
module.exports = productNotFound;
|