@nuskin/ns-product-lib 2.5.0-cx24-2462.3.3 → 2.5.0-cx24-2179.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,30 +1,48 @@
1
- # [2.5.0-cx24-2462.3.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2462.3.2...v2.5.0-cx24-2462.3.3) (2022-11-16)
1
+ # [2.5.0-cx24-2179.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.1) (2022-11-21)
2
2
 
3
3
 
4
+ ### Fix
5
+
6
+ * [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))
7
+
8
+ ### New
9
+
10
+ * added support for variant and promotion (#CX24-2179) ([cf1f623](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/cf1f623c61de55fb969e7debd5c456483f1283b5)), closes [#CX24-2179](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-2179)
11
+
12
+ ### Release
13
+
14
+ * Automated changes by GitLab pipeline [skip ci] ([07bfa40](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/07bfa404c552c05637c2c8a537c4ff298536874e))
15
+ * Automated changes by GitLab pipeline [skip ci] ([fa1c0d9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fa1c0d9d5853482e3ac49cea4e99599e7192f85b))
16
+ * Automated changes by GitLab pipeline [skip ci] ([2d20787](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2d2078763b2d57edb8a24f438ac90dd37c3ff41b))
17
+
4
18
  ### Update
5
19
 
6
- * map equinox properties (CX24-2462) ([406575c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/406575c992b3aec9a0dda7d873624172f18ff9ae))
20
+ * set ADR pricing from equinox (CX24-2862) ([65d04d2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65d04d2e9ff4018edfe99e5a7412bee985d3def2))
21
+ * set ADR pricing from equinox (CX24-2862) ([54a5693](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/54a56932e5df36c9c30ce6358d8597c98be3d20d))
22
+ * set ADR pricing from equinox (CX24-2862) ([bbd135f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/bbd135f1ed0395c578be2274c84ba136ceed9376))
23
+ * set ADR pricing from equinox (CX24-2862) ([197003e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/197003e1629bd394c547a118d332b5e8574dfc7d))
7
24
 
8
- # [2.5.0-cx24-2462.3.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.5.0-cx24-2462.3.1...v2.5.0-cx24-2462.3.2) (2022-11-16)
25
+ # [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)
9
26
 
10
27
 
11
28
  ### Update
12
29
 
13
- * map equinox properties (CX24-2462) ([dbfe9ed](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dbfe9ed0a4bf5f06fd4f797fcb10f1c1246dacbd))
30
+ * set ADR pricing from equinox (CX24-2862) ([b64dcea](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b64dcea4dd3374be992c667db5c0b2604aacc029))
14
31
 
15
- # [2.5.0-cx24-2462.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-2462.3.1) (2022-11-15)
32
+ # [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)
16
33
 
17
34
 
18
35
  ### Update
19
36
 
20
- * map equinox properties (CX24-2462) ([fdb813d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fdb813d6b2f5d9f877ffa870e4102e7d5e0dff07))
37
+ * set ADR pricing from equinox (CX24-2862) ([9f6dfb7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f6dfb726f40b1335411318629a2ebdf1b4dac96))
38
+ * set ADR pricing from equinox (CX24-2862) ([61f550a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/61f550a21c5cc9d062549ec2aaf2758aebccf2be))
21
39
 
22
- ## [2.4.2-CX24.2.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.4.1...v2.4.2-CX24.2.1) (2022-11-07)
40
+ ## [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)
23
41
 
24
42
 
25
43
  ### Fix
26
44
 
27
- * [Equinox market] Admin > Move up/down/top/bottom of featured products and edit bundle is not working ([82611ca](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/82611cab93c990ed1ce05690feb9d00967090dea))
45
+ * [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))
28
46
 
29
47
  ## [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)
30
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.5.0-cx24-2462.3.3",
3
+ "version": "2.5.0-cx24-2179.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": {
@@ -25,8 +25,8 @@
25
25
  "eslint-config-prettier": "4.1.0",
26
26
  "eslint-plugin-json": "2.1.1",
27
27
  "eslint-plugin-prettier": "3.1.2",
28
- "jest": "26.0.1",
29
- "jest-environment-jsdom": "26.0.1",
28
+ "jest": "29.2.2",
29
+ "jest-environment-jsdom": "29.2.2",
30
30
  "jest-sonar-reporter": "2.0.0",
31
31
  "prettier": "1.19.1"
32
32
  },
@@ -81,7 +81,7 @@ const ProductData = {
81
81
  /**
82
82
  * @param {contentstack.MarketConfig} marketConfig
83
83
  */
84
- getLegacyRequestHeaders: function (marketConfig) {
84
+ getLegacyRequestHeaders: function(marketConfig) {
85
85
  return {
86
86
  'Content-Type': 'application/json',
87
87
  client_id: marketConfig.checkout_client_id,
@@ -90,13 +90,12 @@ const ProductData = {
90
90
  },
91
91
 
92
92
  /**
93
- * Map product variant
93
+ * map product from equinox to nuskin product data structure
94
94
  * @todo remove unnecessary fields
95
95
  * @param {*} eqVariant
96
- * @returns Array<Product>
96
+ * @returns obj Product
97
97
  */
98
- eqProductVariantMapper: function (eqVariant) {
99
-
98
+ productMapper : function(eqVariant) {
100
99
  let imageURL = eqVariant.properties.imageURL;
101
100
  const regex = /\d+.\d+/
102
101
  let thumbnailImage = ''
@@ -104,10 +103,13 @@ const ProductData = {
104
103
  if (imageURL.includes('contentstack')) {
105
104
  thumbnailImage = imageURL + '?width=40'
106
105
  } else {
107
- thumbnailImage = imageURL.replace(regex, '40.40')
106
+ thumbnailImage = imageURL.replace(regex,'40.40')
108
107
  }
109
108
 
110
- return {
109
+ //get the last promotion
110
+ const salesPromotion = Array.isArray(eqVariant.promotion) > 0 ? eqVariant.promotion[eqVariant.promotion.length - 1] : null;
111
+ const productPrice = salesPromotion && salesPromotion.discount ? salesPromotion.discount : (eqVariant.priceFacet ? eqVariant.priceFacets["Regular Price"] : '');
112
+ return {
111
113
  "sku": eqVariant.identifier,
112
114
  "globalProductID": eqVariant.identifier,
113
115
  "title": eqVariant.properties.name,
@@ -125,7 +127,7 @@ const ProductData = {
125
127
  }
126
128
  ],
127
129
  "thumbnail": thumbnailImage,
128
- ingredients: mapIngredients(eqVariant.properties.ingredients),
130
+ "ingredients": eqVariant.properties.ingredients,
129
131
  "benefits": eqVariant.properties.benefits,
130
132
  "usage": eqVariant.properties.usage,
131
133
  "resources": eqVariant.properties.resources,
@@ -142,42 +144,30 @@ const ProductData = {
142
144
  "availableQuantity": eqVariant.inventoryProperties.atpQty,
143
145
  "maxQuantity": 999,
144
146
  "points": "",
145
- "cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
146
- "pv": eqVariant.priceFacets.PV,
147
+ "cv": eqVariant.priceFacets ? eqVariant.priceFacets.CV : '',
148
+ "pv": eqVariant.priceFacets ? eqVariant.priceFacets.PV : '',
147
149
  "priceType": "WRTL",
148
- "price": eqVariant.priceFacets["Regular Price"],
150
+ "price": productPrice,
149
151
  "priceMap": {
150
- "WRTL": eqVariant.priceFacets["Regular Price"],
151
- "WADW-WRTL": eqVariant.priceFacets["Regular Price"],
152
- "WADR": 9999.01,
153
- "RTL": eqVariant.priceFacets["Regular Price"],
154
- "WWHL": eqVariant.priceFacets["Wholesale Price"],
155
- "WADW": 9998.01,
156
- "WHL": eqVariant.priceFacets["Wholesale Price"]
152
+ "WRTL": productPrice,
153
+ "WADW-WRTL": productPrice,
154
+ "WADR": eqVariant.priceFacet ? eqVariant.priceFacets["Regular Price"] : '',
155
+ "RTL": eqVariant.priceFacet ? eqVariant.priceFacets["Regular Price"] : '',
156
+ "WWHL": eqVariant.priceFacet ? eqVariant.priceFacets["Wholesale Price"] : '',
157
+ "WADW": eqVariant.priceFacet ? eqVariant.priceFacets["Wholesale Price"] : '',
158
+ "WHL": eqVariant.priceFacet ? eqVariant.priceFacets["Wholesale Price"] : ''
157
159
  },
158
160
  "cvMap": {
159
- "WWHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
160
- "WADW": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
161
- "WHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : ''
161
+ "WWHL": (eqVariant.priceFacets) ? eqVariant.priceFacets.CV : '',
162
+ "WADW": (eqVariant.priceFacets) ? eqVariant.priceFacets.CV : '',
163
+ "WHL": (eqVariant.priceFacets) ? eqVariant.priceFacets.CV : ''
162
164
  },
163
165
  "pvMap": {
164
- "WWHL": eqVariant.priceFacets.PV,
165
- "WADW": eqVariant.priceFacets.PV,
166
- "WHL": eqVariant.priceFacets.PV
167
- },
168
- "orderTypes": {
169
- "adr": true,
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
166
+ "WWHL": eqVariant.priceFacets ? eqVariant.priceFacets.PV : '',
167
+ "WADW": eqVariant.priceFacets ? eqVariant.priceFacets.PV : '',
168
+ "WHL": eqVariant.priceFacets ? eqVariant.priceFacets.PV : ''
180
169
  },
170
+ "orderTypes": this._setOrderType(eqVariant.properties),
181
171
  "division": eqVariant.properties.division,
182
172
  "backOrderDate": null,
183
173
  "locallyProduced": false,
@@ -188,14 +178,14 @@ const ProductData = {
188
178
  "shade": "",
189
179
  "status": this.switchStatusFromEquinox(eqVariant.properties.status),
190
180
  "variantType": "Other",
191
- "variantDropdownLabel": eqVariant.properties.variantLabel || "",
181
+ "variantDropdownLabel": eqVariant.properties.variantLabel || "",
192
182
  "variantDropdownPlaceholder": "Select Type",
193
- "variantsLabel": eqVariant.properties.variantLabel || "",
183
+ "variantsLabel": eqVariant.properties.variantLabel || "",
194
184
  "groupOffer": false,
195
185
  "personalOffer": false,
196
- "savedEventName": null,
197
- "salesLabel": "",
198
- "eventName": null,
186
+ "savedEventName": salesPromotion ? salesPromotion.promotionClass : '',
187
+ "salesLabel": salesPromotion ? salesPromotion.message : '',
188
+ "eventName": salesPromotion ? salesPromotion.promotionClass : '',
199
189
  "sizeWeight": '',
200
190
  "nettoWeight": "",
201
191
  "searchScore": 0,
@@ -208,146 +198,57 @@ const ProductData = {
208
198
  "restrictedMarkets": [],
209
199
  "addOns": []
210
200
  };
201
+
202
+ },
203
+
204
+
205
+ /**
206
+ *
207
+ * Map product variants
208
+ * @param Array<eqVariant>
209
+ * @returns Array<Product>
210
+ */
211
+ eqProductVariantMapper : function (eqVariants) {
212
+
213
+ let variants = {};
214
+
215
+ eqVariants.map(eqVariant => {
216
+ variants[eqVariant.identifier] = this.productMapper(eqVariant);
217
+ return eqVariant;
218
+ });
219
+
220
+ return variants;
211
221
  },
212
222
 
223
+
224
+ /**
225
+ * eqProductMapper
226
+ * @param {*} productDataResponse
227
+ * @param {*} skus
228
+ * @returns obj
229
+ */
213
230
  eqProductMapper: function (productDataResponse, skus) {
214
- let prod = [];
215
231
  let count = 0;
216
232
  let variants = {};
217
233
 
218
234
  let prodArr = productDataResponse.map((data) => {
219
- let imageURL = data.sku[count].properties.imageURL;
220
- const regex = /\d+.\d+/
221
- let thumbnailImage = ''
222
-
223
- if (imageURL.includes('contentstack')) {
224
- thumbnailImage = imageURL + '?width=40'
225
- } else {
226
- thumbnailImage = imageURL.replace(regex, '40.40')
227
- }
228
235
 
229
- if (data.sku && data.sku.length > 1) {
230
- data.sku.map(variant => {
231
- variants[variant.identifier] = this.eqProductVariantMapper(variant);
232
- return variant;
233
- });
236
+ const mappedProduct = this.productMapper(data.sku[count]);
237
+
238
+ if (data.sku && data.sku.length > 0) {
239
+ variants = this.eqProductVariantMapper(data.sku);
234
240
  }
235
241
 
236
- prod = {
237
- "sku": data.sku[count].identifier,
238
- "globalProductID": data.identifier,
239
- "title": data.properties.name,
240
- "country": data.sku[count].properties.market,
241
- "language": "en",
242
- "shortDescr": data.properties.description,
243
- "longDescr": data.properties.productDetailsDescription,
244
- "fullImage": imageURL,
245
- "imageAltText": data.properties.name,
246
- productCarouselImages: data.sku[count].properties.productImages
247
- ? JSON.parse(data.sku[count].properties.productImages).map(img => (
248
- {
249
- contentType: /\.jpg/i.test(img.url) ? 'img' : 'video',
250
- src: img.url,
251
- alt: img.alt
252
- }
253
- )) : [],
254
- "thumbnail": thumbnailImage,
255
- ingredients: mapIngredients(data.properties.ingredients),
256
- benefits: mapBenefits(data.properties.benefits),
257
- usage: mapUsage(data.properties.usage),
258
- resources: mapResources(data.properties.resources),
259
- "videos": "",
260
- "movie": "",
261
- "youtube": "",
262
- "salesEventText": "",
263
- "contentSection": [
264
- {
265
- "sectionContent": "<div class=\"contentSections\"></div>\n"
266
- }
267
- ],
268
- "scanQualified": data.properties.scanQualifiedCount,
269
- "availableQuantity": data.sku[count].inventoryProperties.atpQty,
270
- "maxQuantity": 999,
271
- "points": "",
272
- "cv": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
273
- "pv": data.sku[count].priceFacets.PV,
274
- "priceType": "WRTL",
275
- "price": data.sku[count].priceFacets["Regular Price"],
276
- "priceMap": {
277
- "WRTL": data.sku[count].priceFacets["Regular Price"],
278
- "WADW-WRTL": data.sku[count].priceFacets["Regular Price"],
279
- "WADR": 9999.01,
280
- "RTL": data.sku[count].priceFacets["Regular Price"],
281
- "WADW": 9998.01,
282
- "WHL": data.sku[count].priceFacets["Wholesale Price"],
283
- "WWHL": data.sku[count].priceFacets["Wholesale Price"]
284
- },
285
- "cvMap": {
286
- "WWHL": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
287
- "WADW": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : '',
288
- "WHL": (data.sku[count].priceFacets.CV) ? data.sku[count].priceFacets.CV : ''
289
- },
290
- "pvMap": {
291
- "WWHL": data.sku[count].priceFacets.PV,
292
- "WADW": data.sku[count].priceFacets.PV,
293
- "WHL": data.sku[count].priceFacets.PV
294
- },
295
- "orderTypes": {
296
- "adr": true,
297
- "order": true,
298
- "zpfc": false,
299
- "zadp": true,
300
- "ars": true,
301
- "kiosk": true,
302
- "mobile": true,
303
- "preferred customer": true,
304
- "retail": true,
305
- "web": true,
306
- "web display": true
307
- },
308
- "childSkus": [],
309
- "custTypes": this.switchCustType(data.properties.customerTypes),
310
- "division": data.properties.division,
311
- "backOrderDate": null,
312
- "locallyProduced": false,
313
- "agelocme": null,
314
- "count": "",
315
- "flavor": "",
316
- "size": data.sku[count].properties.size,
317
- "shade": "",
318
- "status": this.switchStatusFromEquinox(data.sku[count].properties.productStatus),
319
- "variantType": "Other",
320
- "variantDropdownLabel": data.sku[count].properties.variantLabel || "",
321
- "variantDropdownPlaceholder": "Select Type",
322
- "variantsLabel": data.sku[count].properties.variantLabel || "",
323
- "groupOffer": false,
324
- "personalOffer": false,
325
- "savedEventName": null,
326
- "salesLabel": "",
327
- "eventName": null,
328
- "sizeWeight": '',
329
- "nettoWeight": "",
330
- "variants": variants,
331
- "searchScore": 0,
332
- "isExclusive": data.sku[count].properties.isExclusive,
333
- "marketAttributes": {
334
- "discount": true,
335
- "redeem": true,
336
- "earn": true
337
- },
338
- "restrictedMarkets": [],
339
- "addOns": [],
340
- "inventory": data.sku[count].inventory || "" //inventory label
341
-
342
- };
343
- let newProduct = new Product(prod);
344
- return newProduct
345
- })
242
+ let newProduct = new Product({...mappedProduct, variants: variants});
243
+ return newProduct;
244
+
245
+ });
346
246
 
347
247
  let data = {
348
248
  products: this._sortProductsBySku(skus, prodArr),
349
249
  count: productDataResponse.length
350
250
  };
251
+
351
252
  return {
352
253
  data: {
353
254
  "status": 200,
@@ -406,82 +307,73 @@ const ProductData = {
406
307
 
407
308
  _sortProductsBySku: function (skus, products) {
408
309
 
409
- if (!skus || !products || products.length === 1) {
310
+ if(!skus || !products || products.length === 1) {
410
311
  return products
411
312
  }
412
313
 
413
- return products.sort(function (a, b) {
314
+ const sortedProducts = products.sort(function (a, b) {
414
315
  return skus.indexOf(a.sku) - skus.indexOf(b.sku);
415
316
  });
416
317
 
417
- }
418
- }
419
-
420
- function mapBenefits(benefits) {
421
- if (!benefits) {
422
- return {};
423
- }
424
-
425
- const list = JSON.parse(benefits)
426
- .map(item => item.benefits.map(benefit => benefit).join(''))
427
- .join('');
428
-
429
- return {
430
- benefitsHTML: list,
431
- benefitsText: 'Benefits',
432
- benefitItems: []
433
- };
434
- }
435
-
436
- function mapIngredients(ingredients) {
437
- if (!ingredients) {
438
- return {};
439
- }
440
-
441
- // concatenating the name, description, keyIngredients, and otherIngredients
442
- const list = JSON.parse(ingredients)
443
- .map(i => [
444
- i.keyIngredients
445
- .map(k => `<img src="${k.image.url}" alt="${k.image.alt}" /> ${k.name} ${k.description}`)
446
- .join(' '),
447
- i.otherIngredients
448
- ].join(' '))
449
- .join(' ');
450
-
451
- return {
452
- ingredientsHTML: list,
453
- ingredientsText: 'Ingredients',
454
- ingredients: []
455
- }
456
- }
457
-
458
- function mapResources(resources) {
459
- if (!resources) {
460
- return {};
461
- }
318
+ return sortedProducts
462
319
 
463
- const text = JSON.parse(resources)
464
- .map(res => `<p><a href="${res.url}" target="_blank">${res.title}</a></p>`)
465
- .join('');
466
-
467
- return {
468
- resourcesHTML: text,
469
- resourcesText: 'Resources',
470
- resourceLinks: []
471
- }
472
- }
320
+ },
473
321
 
474
- function mapUsage(usage) {
475
- if (!usage) {
476
- return {};
477
- }
322
+ /**
323
+ *
324
+ * @param {*} availableChannels
325
+ *
326
+ * This function is use to convert arsPhone,web,kiosk,mobile,subscription
327
+ * to orderType object
328
+ * "adr”
329
+ "order"
330
+ "zpfc"
331
+ "zadp"
332
+ "ars"
333
+ "kiosk"
334
+ "mobile"
335
+ "preferred customer"
336
+ "retail"
337
+ "web"
338
+ "web display"
339
+ */
340
+ _setOrderType: function (properties) {
341
+ let orderTypeArr = {
342
+ "adr": false,
343
+ "order": false,
344
+ "zpfc": false,
345
+ "zadp": false,
346
+ "ars": false,
347
+ "kiosk": false,
348
+ "mobile": false,
349
+ "preferred customer": false,
350
+ "retail": false,
351
+ "web": false,
352
+ "web display": false
353
+ };
354
+ let availableChannelsArr = properties.availableChannels.split(',')
355
+
356
+ availableChannelsArr.forEach(channel => {
357
+ if (channel == 'arsPhone')
358
+ orderTypeArr.ars = true
359
+ if (channel == 'web') {
360
+ orderTypeArr.order = true
361
+ orderTypeArr.web = true
362
+ }
363
+ if (channel == 'kiosk')
364
+ orderTypeArr.kiosk = true
365
+ if (channel == 'mobile')
366
+ orderTypeArr.mobile = true
367
+ if (channel == 'subscription')
368
+ orderTypeArr.adr = true
478
369
 
479
- const text = JSON.parse(usage).additionalText
480
- .map(t => t).join('');
370
+ });
371
+ if (properties.retail)
372
+ orderTypeArr.retail = true
373
+ if (properties.prefferredCustomer)
374
+ orderTypeArr['preferred customer'] = true
481
375
 
482
- return {
483
- usageHTML: text,
484
- usageText: 'Usage'
376
+ return orderTypeArr;
485
377
  }
486
378
  }
487
379