@nuskin/cs-product-lib 1.0.31 → 1.0.32
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/package.json +2 -1
- package/src/helpers.js +75 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/cs-product-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "Library for pulling and parsing product content (and applying business logic) retrieved from Contentstack",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"turndown": "7.1.1"
|
|
50
50
|
},
|
|
51
51
|
"resolutions": {
|
|
52
|
+
"follow-redirects": "1.15.4",
|
|
52
53
|
"marked": "4.0.10",
|
|
53
54
|
"semver": "7.5.2",
|
|
54
55
|
"underscore": "1.13.1",
|
package/src/helpers.js
CHANGED
|
@@ -371,7 +371,58 @@ function mapPurchaseTypes(parent) {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
+
function mapPrice(parent) {
|
|
375
|
+
return {
|
|
376
|
+
retail:
|
|
377
|
+
_.get(parent, 'price.retail', null) ||
|
|
378
|
+
_.get(
|
|
379
|
+
parent,
|
|
380
|
+
'defaults.status.pricing.retail.webOrder.price',
|
|
381
|
+
null
|
|
382
|
+
) ||
|
|
383
|
+
_.get(parent, 'defaults.status.pricing.retail.order.price', null),
|
|
384
|
+
retailSubscription:
|
|
385
|
+
_.get(parent, 'price.retailSubscription', null) ||
|
|
386
|
+
_.get(
|
|
387
|
+
parent,
|
|
388
|
+
'defaults.status.pricing.retail.webAdr.price',
|
|
389
|
+
null
|
|
390
|
+
),
|
|
391
|
+
wholesale:
|
|
392
|
+
_.get(parent, 'price.wholesale', null) ||
|
|
393
|
+
_.get(
|
|
394
|
+
parent,
|
|
395
|
+
'defaults.status.pricing.wholesale.webOrder.price',
|
|
396
|
+
null
|
|
397
|
+
) ||
|
|
398
|
+
_.get(
|
|
399
|
+
parent,
|
|
400
|
+
'defaults.status.pricing.wholesale.order.price',
|
|
401
|
+
null
|
|
402
|
+
),
|
|
403
|
+
wholesaleSubscription:
|
|
404
|
+
_.get(parent, 'price.wholesaleSubscription', null) ||
|
|
405
|
+
_.get(
|
|
406
|
+
parent,
|
|
407
|
+
'defaults.status.pricing.wholesale.ADR5.price',
|
|
408
|
+
null
|
|
409
|
+
) ||
|
|
410
|
+
_.get(
|
|
411
|
+
parent,
|
|
412
|
+
'defaults.status.pricing.wholesale.WADW.price',
|
|
413
|
+
null
|
|
414
|
+
) ||
|
|
415
|
+
_.get(
|
|
416
|
+
parent,
|
|
417
|
+
'defaults.status.pricing.wholesale.webAdr.price',
|
|
418
|
+
null
|
|
419
|
+
),
|
|
420
|
+
currencyCode: _.get(parent, 'defaults.marketData.currency_code', null)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
374
424
|
function mapPoints(parent) {
|
|
425
|
+
const pricing = mapPrice(parent)
|
|
375
426
|
return {
|
|
376
427
|
wholesale: {
|
|
377
428
|
cv:
|
|
@@ -397,7 +448,20 @@ function mapPoints(parent) {
|
|
|
397
448
|
parent,
|
|
398
449
|
'defaults.status.pricing.wholesale.order.pv',
|
|
399
450
|
null
|
|
400
|
-
)
|
|
451
|
+
),
|
|
452
|
+
sb:
|
|
453
|
+
_.get(parent, 'points.wholesale.SB', null) ||
|
|
454
|
+
_.get(
|
|
455
|
+
parent,
|
|
456
|
+
'defaults.status.pricing.wholesale.webOrder.SB',
|
|
457
|
+
null
|
|
458
|
+
) ||
|
|
459
|
+
_.get(
|
|
460
|
+
parent,
|
|
461
|
+
'defaults.status.pricing.wholesale.order.SB',
|
|
462
|
+
null
|
|
463
|
+
),
|
|
464
|
+
grp: pricing.retail - pricing.wholesale
|
|
401
465
|
},
|
|
402
466
|
subscription: {
|
|
403
467
|
cv:
|
|
@@ -419,60 +483,20 @@ function mapPoints(parent) {
|
|
|
419
483
|
'defaults.status.pricing.wholesale.WADW.pv',
|
|
420
484
|
null
|
|
421
485
|
) ||
|
|
422
|
-
_.get(parent, 'defaults.status.pricing.wholesale.ADR5.pv', null)
|
|
486
|
+
_.get(parent, 'defaults.status.pricing.wholesale.ADR5.pv', null),
|
|
487
|
+
sb:
|
|
488
|
+
_.get(parent, 'points.subscription.SB', null) ||
|
|
489
|
+
_.get(
|
|
490
|
+
parent,
|
|
491
|
+
'defaults.status.pricing.wholesale.WADW.SB',
|
|
492
|
+
null
|
|
493
|
+
) ||
|
|
494
|
+
_.get(parent, 'defaults.status.pricing.wholesale.ADR5.SB', null),
|
|
495
|
+
grp: pricing.retailSubscription - pricing.wholesaleSubscription
|
|
423
496
|
}
|
|
424
497
|
}
|
|
425
498
|
}
|
|
426
499
|
|
|
427
|
-
function mapPrice(parent) {
|
|
428
|
-
return {
|
|
429
|
-
retail:
|
|
430
|
-
_.get(parent, 'price.retail', null) ||
|
|
431
|
-
_.get(
|
|
432
|
-
parent,
|
|
433
|
-
'defaults.status.pricing.retail.webOrder.price',
|
|
434
|
-
null
|
|
435
|
-
) ||
|
|
436
|
-
_.get(parent, 'defaults.status.pricing.retail.order.price', null),
|
|
437
|
-
retailSubscription:
|
|
438
|
-
_.get(parent, 'price.retailSubscription', null) ||
|
|
439
|
-
_.get(
|
|
440
|
-
parent,
|
|
441
|
-
'defaults.status.pricing.retail.webAdr.price',
|
|
442
|
-
null
|
|
443
|
-
),
|
|
444
|
-
wholesale:
|
|
445
|
-
_.get(parent, 'price.wholesale', null) ||
|
|
446
|
-
_.get(
|
|
447
|
-
parent,
|
|
448
|
-
'defaults.status.pricing.wholesale.webOrder.price',
|
|
449
|
-
null
|
|
450
|
-
) ||
|
|
451
|
-
_.get(
|
|
452
|
-
parent,
|
|
453
|
-
'defaults.status.pricing.wholesale.order.price',
|
|
454
|
-
null
|
|
455
|
-
),
|
|
456
|
-
wholesaleSubscription:
|
|
457
|
-
_.get(parent, 'price.wholesaleSubscription', null) ||
|
|
458
|
-
_.get(
|
|
459
|
-
parent,
|
|
460
|
-
'defaults.status.pricing.wholesale.ADR5.price',
|
|
461
|
-
null
|
|
462
|
-
) ||
|
|
463
|
-
_.get(
|
|
464
|
-
parent,
|
|
465
|
-
'defaults.status.pricing.wholesale.WADW.price',
|
|
466
|
-
null
|
|
467
|
-
) ||
|
|
468
|
-
_.get(
|
|
469
|
-
parent,
|
|
470
|
-
'defaults.status.pricing.wholesale.webAdr.price',
|
|
471
|
-
null
|
|
472
|
-
),
|
|
473
|
-
currencyCode: _.get(parent, 'defaults.marketData.currency_code', null)
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
500
|
/* istanbul ignore next */
|
|
477
501
|
function mapImage(image) {
|
|
478
502
|
if (Array.isArray(image)) {
|