@nuskin/ns-product-lib 2.7.0-cx24-3682.12 → 2.7.0-cx24-3702.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -60
- package/package.json +2 -2
- package/src/equinox-helpers/childSKU.js +1 -1
- package/src/equinox-helpers/index.js +31 -172
- package/src/product.js +65 -62
- package/src/productData.js +43 -27
- package/src/equinox-helpers/interceptors/index.js +0 -5
- package/src/equinox-helpers/interceptors/productNotFound.js +0 -70
- package/src/equinox-helpers/mappers/identifier.js +0 -13
- package/src/equinox-helpers/mappers/index.js +0 -11
- package/src/equinox-helpers/mappers/inventoryProperties.js +0 -173
- package/src/equinox-helpers/mappers/properties.js +0 -182
- package/src/equinox-helpers/mappers/variant.js +0 -71
- package/src/equinox-helpers/models/index.js +0 -5
- package/src/equinox-helpers/models/productNotFound.js +0 -54
package/CHANGELOG.md
CHANGED
@@ -1,89 +1,44 @@
|
|
1
|
-
# [2.7.0-cx24-
|
1
|
+
# [2.7.0-cx24-3702.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3702.2...v2.7.0-cx24-3702.3) (2023-03-28)
|
2
2
|
|
3
3
|
|
4
4
|
### New
|
5
5
|
|
6
|
-
*
|
6
|
+
* adding properties variable to equinox product data ([7f33e91](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/7f33e916199d495b7c51d35d4acd7f1024feb781))
|
7
7
|
|
8
|
-
# [2.7.0-cx24-
|
8
|
+
# [2.7.0-cx24-3702.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3702.1...v2.7.0-cx24-3702.2) (2023-03-25)
|
9
9
|
|
10
10
|
|
11
11
|
### New
|
12
12
|
|
13
|
-
*
|
14
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([a9c1b38](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a9c1b380ecb1e98a496be4628f6e4e4f32ff2a98)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
13
|
+
* adding properties variable to equinox product data ([46e2c7e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/46e2c7e4b5727d02ae31ccd62ec32ed73bdb6bc7))
|
15
14
|
|
16
|
-
# [2.7.0-cx24-
|
15
|
+
# [2.7.0-cx24-3702.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2...v2.7.0-cx24-3702.1) (2023-03-25)
|
17
16
|
|
18
17
|
|
19
18
|
### New
|
20
19
|
|
21
|
-
*
|
20
|
+
* adding properties variable to equinox product data ([3a4971b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3a4971bc3620ac848c0ba6c541bf6906b09169fd))
|
22
21
|
|
23
|
-
|
22
|
+
## [2.6.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.6.2) (2023-03-24)
|
24
23
|
|
25
24
|
|
26
|
-
###
|
27
|
-
|
28
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([66c977b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/66c977b3114e0cd7517d6eaa19174b0a3a13d1ed)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
29
|
-
|
30
|
-
# [2.7.0-cx24-3682.8](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.7...v2.7.0-cx24-3682.8) (2023-03-26)
|
31
|
-
|
32
|
-
|
33
|
-
### New
|
34
|
-
|
35
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([3d69bbe](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3d69bbe486f13f4ae2a9fe4c07f53c4d27932177)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
36
|
-
|
37
|
-
# [2.7.0-cx24-3682.7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.6...v2.7.0-cx24-3682.7) (2023-03-25)
|
38
|
-
|
39
|
-
|
40
|
-
### New
|
41
|
-
|
42
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([a8f0331](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a8f0331970ed4631ceba029d48e246b83627a046)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
43
|
-
|
44
|
-
# [2.7.0-cx24-3682.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.5...v2.7.0-cx24-3682.6) (2023-03-25)
|
45
|
-
|
46
|
-
|
47
|
-
### New
|
48
|
-
|
49
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([13f2b76](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/13f2b76990dd2e4f4226367332212dcc7bd19977)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
50
|
-
|
51
|
-
# [2.7.0-cx24-3682.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.4...v2.7.0-cx24-3682.5) (2023-03-25)
|
52
|
-
|
53
|
-
|
54
|
-
### New
|
55
|
-
|
56
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([588161d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/588161d54fa2e97f6bee2fe33523f3f1bdcb1ed2)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
57
|
-
|
58
|
-
# [2.7.0-cx24-3682.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.3...v2.7.0-cx24-3682.4) (2023-03-24)
|
59
|
-
|
60
|
-
|
61
|
-
### New
|
62
|
-
|
63
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([f55854a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f55854ad4abb17dbd373fe5e36a38deb2bb8fc53)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
64
|
-
|
65
|
-
# [2.7.0-cx24-3682.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0-cx24-3682.2...v2.7.0-cx24-3682.3) (2023-03-24)
|
66
|
-
|
67
|
-
|
68
|
-
### New
|
25
|
+
### Fix
|
69
26
|
|
70
|
-
*
|
27
|
+
* Fix drop down variants Cx24 3377 ([262328e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/262328e617b87d6dbf44b1393fdffaa10d8de13d))
|
71
28
|
|
72
|
-
# [2.7.0-cx24-
|
29
|
+
# [2.7.0-cx24-337703.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2-cx24-337703.1...v2.7.0-cx24-337703.1) (2023-03-22)
|
73
30
|
|
74
31
|
|
75
|
-
###
|
32
|
+
### Update
|
76
33
|
|
77
|
-
*
|
78
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([b86a1d2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b86a1d2610892564c643bd851d873e507efedd49)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
79
|
-
* MySite product cards show blank data when users have setup AEM Base SKU's(55) in Admin #CX24-3682 ([60d61cc](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/60d61ccd38e9b971b7ac53cf4224a9897a63fef4)), closes [#CX24-3682](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3682)
|
34
|
+
* Merge CX24-3563 changes to CX24-337703 ([9e6ca40](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9e6ca40c35252c24394351275a234e9847f70bfc))
|
80
35
|
|
81
|
-
|
36
|
+
## [2.6.2-cx24-337703.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.6.2-cx24-337703.1) (2023-03-22)
|
82
37
|
|
83
38
|
|
84
|
-
###
|
39
|
+
### Fix
|
85
40
|
|
86
|
-
*
|
41
|
+
* Show dropdown for variants ([85cdf69](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/85cdf69cc2bbf6700ec5c9bcacc7222cf2ddf674))
|
87
42
|
|
88
43
|
## [2.6.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0...v2.6.1) (2023-03-16)
|
89
44
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.7.0-cx24-
|
3
|
+
"version": "2.7.0-cx24-3702.3",
|
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": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"dependencies": {
|
34
34
|
"@nuskin/configuration-sdk": "2.2.3",
|
35
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
36
|
-
"@nuskin/ns-util": "4.2.
|
36
|
+
"@nuskin/ns-util": "4.2.7",
|
37
37
|
"axios": "0.27.2",
|
38
38
|
"qs": "6.11.0"
|
39
39
|
},
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* childSKU maps a product variant. Used mainly in subscription.
|
3
3
|
*
|
4
4
|
* @param {import('.').KitSKUQuantity[]} kits
|
5
|
-
* @param {import('.').
|
5
|
+
* @param {import('.').EquinoxProduct} product
|
6
6
|
*/
|
7
7
|
function childSKU(kits, product) {
|
8
8
|
const sku = product.sku.filter(sku => sku.default)[0];
|
@@ -4,9 +4,7 @@
|
|
4
4
|
* @type {object}
|
5
5
|
* @property {ProductChildSku[]} childSkus
|
6
6
|
* @property {Inventory} [inventoryProperties]
|
7
|
-
|
8
|
-
|
9
|
-
/**
|
7
|
+
*
|
10
8
|
* @typedef ProductChildSku
|
11
9
|
* @type {object}
|
12
10
|
* @property {string} productId
|
@@ -15,182 +13,43 @@
|
|
15
13
|
* @property {number} skuQuantity
|
16
14
|
* @property {string} availableChannels
|
17
15
|
* @property {Inventory} [inventory]
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
*
|
17
|
+
* ---
|
18
|
+
*
|
19
|
+
* @description This model represents a product within an Equinox response.
|
20
|
+
* @typedef EquinoxProduct
|
21
|
+
* @type {object}
|
22
|
+
* @property {string} identifier
|
23
|
+
* @property {EquinoxProductSKU[]} sku
|
24
|
+
* @property {"kit"|"bundle"} [type]
|
25
|
+
*
|
26
|
+
* @typedef EquinoxProductSKU
|
27
|
+
* @type {object}
|
28
|
+
* @property {boolean} default
|
29
|
+
* For multi-variant products, this indicates that this is the searched SKU
|
30
|
+
* when using catalogs/search endpoint.
|
31
|
+
* @property {string} identifier
|
32
|
+
* @property {Inventory} inventoryProperties
|
33
|
+
* @property {EquinoxProductProperties} properties
|
34
|
+
*
|
35
|
+
* @typedef EquinoxProductProperties
|
36
|
+
* @type {object}
|
37
|
+
* @property {string} availableChannels
|
38
|
+
*
|
39
|
+
* ---
|
40
|
+
*
|
21
41
|
* Types common to Product model and Equinox Product model
|
42
|
+
*
|
22
43
|
* @typedef Inventory
|
23
44
|
* @type {object}
|
24
45
|
* @property {number} atpQty
|
25
46
|
* @property {boolean} backOrdered
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
* @description This model represents the error response.
|
30
|
-
* @typedef EquinoxErrorResponse
|
31
|
-
* @type {object}
|
32
|
-
* @property {string} code e.g., SFOSER002
|
33
|
-
* @property {string} message e.g., No Results Found dot Search Term null
|
34
|
-
* @property {number} timestamp e.g., 1679715447962
|
35
|
-
*/
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @description This model represents the response.
|
39
|
-
* @typedef EquinoxResponse
|
40
|
-
* @type {object}
|
41
|
-
* @property {EquinoxNormalProduct[]} product
|
42
|
-
*/
|
43
|
-
|
44
|
-
/**
|
45
|
-
* @description EquinoxNormalProduct represents an equinox Normal product type.
|
46
|
-
* @typedef EquinoxNormalProduct
|
47
|
-
* @type {object}
|
48
|
-
* @property {string} identifier e.g., Normal - "blt8b757df6dcaa199c" | Kit - "02001076"
|
49
|
-
* @property {EquinoxProductProperties} properties
|
50
|
-
* @property {EquinoxProductVariant[]} sku or varaints - available only when product is a normal product.
|
51
|
-
*/
|
52
|
-
|
53
|
-
/**
|
54
|
-
* @description EquinoxKitProduct represents an equinox Kit product type.
|
55
|
-
* @typedef EquinoxKitProduct
|
56
|
-
* @type {object}
|
57
|
-
* @property {"kit"|"bundle"} [type] available only when product is type of kit.
|
58
|
-
*/
|
59
|
-
|
60
|
-
/**
|
61
|
-
* @typedef {(
|
62
|
-
* EquinoxProductCommonProperties & EquinoxNormalProductProperties
|
63
|
-
* )} EquinoxProductProperties
|
64
|
-
*/
|
65
|
-
|
66
|
-
/**
|
67
|
-
* @description These are the properties unique to Normal product type.
|
68
|
-
* @typedef EquinoxNormalProductProperties
|
69
|
-
* @type {object}
|
70
|
-
* @property {string} ingredients
|
71
|
-
* @property {string} benefits
|
72
|
-
* @property {string} usage
|
73
|
-
* @property {string} resources
|
74
|
-
* @property {string} scanQualifiedCount e.g., "0"
|
75
|
-
* @property {string} status e.g., "active"
|
76
|
-
* @property {string} size e.g., "30 mL / 1 fl.oz"
|
77
|
-
* @property {string} productDetailsDescription e.g., "[]"
|
78
|
-
*/
|
79
|
-
|
80
|
-
/**
|
81
|
-
* @description These are the properties unique to Kit product type.
|
82
|
-
* @typedef EquinoxKitProductProperties
|
83
|
-
* @type {object}
|
84
|
-
* @property {string} skukits e.g., "02002145~1,02002146~1,02002147~1,02002148~1,02002142~1,02002143~1"
|
85
|
-
* @property {string} productStatus e.g., "Sellable"
|
86
|
-
* @property {string} availableChannels e.g., "subscription,arsPhone,kiosk,mobile,web"
|
87
|
-
*/
|
88
|
-
|
89
|
-
/**
|
90
|
-
* @description These are the common properties between Normal and Kit product types
|
91
|
-
* @typedef EquinoxProductCommonProperties
|
92
|
-
* @type {object}
|
93
|
-
* @property {string} name e.g., "180° Cell Renewal Fluid"
|
94
|
-
* @property {string} imageURL e.g., "https://nuskin.com/content/dam/global/...ule-refreshed.jpg"
|
95
|
-
* @property {string} market e.g., "CA"
|
96
|
-
* @property {string} description e.g., "180° Ampoule"
|
97
|
-
* @property {string} customerTypes e.g., "BrandAffiliate,Preferred,Retail"
|
98
|
-
* @property {string} division e.g., "Nu Skin"
|
99
|
-
*/
|
100
|
-
|
101
|
-
/**
|
102
|
-
* @typedef EquinoxProductVariant
|
103
|
-
* @type {object}
|
104
|
-
* @property {string} identifier e.g., "02002145"
|
105
|
-
* @property {string} inventory e.g., "IN STOCK"
|
106
|
-
* @property {EquinoxProductVariantProperties} properties
|
107
|
-
* @property {any[]} promotion e.g., ???
|
108
|
-
* @property {EquinoxProductPriceFacets} priceFacets
|
109
|
-
* @property {EquinoxProductInventoryProperties} inventoryProperties
|
110
|
-
* @property {EquinxProductTotalValue} totalValue
|
111
|
-
* @property {boolean} [default] For multi-variant products, this indicates that this is the searched SKU
|
112
|
-
* when using catalogs/search endpoint.
|
113
|
-
*/
|
114
|
-
|
115
|
-
/**
|
116
|
-
* @description This does not contain the full list of properties from the response.
|
117
|
-
* @typedef EquinoxProductVariantProperties
|
118
|
-
* @type {object}
|
119
|
-
* @property {string} availableChannels e.g., "subscription,arsPhone,kiosk,mobile,web"
|
120
|
-
* @property {string} imageURL e.g., "https://nuskin.com/cont...21/ca-180-Ampoule-refreshed.jpg"
|
121
|
-
* @property {string} name e.g., "180° Cell Renewal Fluid"
|
122
|
-
* @property {string} market e.g., "CA"
|
123
|
-
* @property {string} description e.g., "180° Ampoule"
|
124
|
-
* @property {string} ingredients
|
125
|
-
* @property {string} benefits
|
126
|
-
* @property {string} usage
|
127
|
-
* @property {string} resources
|
128
|
-
* @property {string} scanQualifiedCount e.g., "0"
|
129
|
-
* @property {string} customerTypes e.g., "BrandAffiliate,Preferred,Retail"
|
130
|
-
* @property {string} division e.g., "Nu Skin"
|
131
|
-
* @property {string} status e.g., "active"
|
132
|
-
* @property {string} size e.g., "30 mL / 1 fl.oz"
|
133
|
-
* @property {string} globalProductId
|
134
|
-
* @property {string} excludeFromSearch
|
135
|
-
* @property {string} chargeShipping
|
136
|
-
* @property {string} title
|
137
|
-
* @property {string} productStatus e.g., "Sellable"
|
138
|
-
* @property {string} [variantLabel]
|
139
|
-
* @property {string} [isExclusive] e.g., "false" - Why is this a string??
|
140
|
-
*/
|
141
|
-
|
142
|
-
/**
|
143
|
-
* @description Why are properties not camelCase and type of string instead of number? Super weird!
|
144
|
-
* @typedef EquinoxProductPriceFacets
|
145
|
-
* @type {object}
|
146
|
-
* @property {string} CV e.g., "76.0"
|
147
|
-
* @property {string} Regular Price e.g., "76.0"
|
148
|
-
* @property {string} PV e.g., "54.15"
|
149
|
-
* @property {string} Wholesale Price e.g., "88.0"
|
150
|
-
* @property {string} SB e.g., "4.25"
|
151
|
-
*/
|
152
|
-
|
153
|
-
/**
|
154
|
-
* @description
|
155
|
-
* @typedef EquinoxProductInventoryProperties
|
156
|
-
* @type {object}
|
157
|
-
* @property {boolean} available e.g., true
|
158
|
-
* @property {boolean} lowStock e.g., false
|
159
|
-
* @property {string} binName e.g., "1046_CA01"
|
160
|
-
* @property {boolean} backOrdered e.g., false
|
161
|
-
* @property {number} expectedBackOrderAvailabilityDate e.g., 0
|
162
|
-
* @property {boolean} preOrdered e.g., false
|
163
|
-
* @property {number} expectedPreOrderAvailabilityDate e.g., 0
|
164
|
-
* @property {number} atpQty e.g., 49882
|
165
|
-
* @property {number} preOrderedQty e.g., 0
|
166
|
-
* @property {number} backOrderedQty e.g., 0
|
167
|
-
* @property {number|null} lowStockThreshold e.g., null
|
168
|
-
* @property {number|null} outOfStockThreshold e.g., null
|
169
|
-
*/
|
170
|
-
|
171
|
-
/**
|
172
|
-
* @description
|
173
|
-
* @typedef EquinxProductTotalValue
|
174
|
-
* @type {object}
|
175
|
-
* @property {number} priceAfterDiscount e.g., 2
|
176
|
-
* @property {number} originalPrice e.g., 2
|
177
|
-
* @property {number} totaldiscount e.g., 0
|
178
|
-
* @property {{
|
179
|
-
* CV: { CV: number },
|
180
|
-
* "Regular Price": {
|
181
|
-
* "Regular Price": number
|
182
|
-
* },
|
183
|
-
* PV: { PV: number },
|
184
|
-
* "Wholesale Price": {
|
185
|
-
* "Wholesale Price": number
|
186
|
-
* },
|
187
|
-
* SB: { SB: number },
|
188
|
-
* }} priceFacets
|
189
|
-
*/
|
190
|
-
|
191
|
-
/**
|
47
|
+
*
|
48
|
+
* ---
|
49
|
+
*
|
192
50
|
* Standalone types. These are types not related to Product
|
193
51
|
* and Equinox Product models.
|
52
|
+
*
|
194
53
|
* @typedef KitSKUQuantity
|
195
54
|
* @type {object}
|
196
55
|
* @property {string} sku
|