@nuskin/ns-product-lib 1.3.7
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 +146 -0
- package/README.md +33 -0
- package/package.json +37 -0
- package/src/agelocme.js +35 -0
- package/src/index.js +24 -0
- package/src/priceType.js +18 -0
- package/src/product.js +803 -0
- package/src/productContentMapper.js +196 -0
- package/src/productStatus.js +20 -0
- package/src/productStatusMapper.js +190 -0
- package/src/productUtils.js +83 -0
package/CHANGELOG.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
## [1.3.7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.6...v1.3.7) (2021-09-17)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* fixed issue of new order types coming in as true when set to [secure] (#CX12-4252) ([ab1d15e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ab1d15ec9591ad98b113bb0ce8817c1c1c2c03f0)), closes [#CX12-4252](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-4252)
|
7
|
+
|
8
|
+
## [1.3.6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.5...v1.3.6) (2021-05-18)
|
9
|
+
|
10
|
+
|
11
|
+
### Fix
|
12
|
+
|
13
|
+
* Steel Curtain publish change (#CCPO1-275) ([720b16a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/720b16a52bbb72be858cb056559f7ce3ca2bb0b5)), closes [#CCPO1-275](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CCPO1-275)
|
14
|
+
|
15
|
+
## [1.3.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.4...v1.3.5) (2021-05-10)
|
16
|
+
|
17
|
+
|
18
|
+
### Fix
|
19
|
+
|
20
|
+
* added a method which was omitted in the migration of product.js from ns-shop (#CX15-3097) ([db002a0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/db002a074a3eaf5a1a87bd223a18d3fa3dec9e91)), closes [#CX15-3097](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX15-3097)
|
21
|
+
|
22
|
+
## [1.3.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.3...v1.3.4) (2021-05-10)
|
23
|
+
|
24
|
+
|
25
|
+
### Fix
|
26
|
+
|
27
|
+
* fixed isExclusive evaluating occasional "[secure]" strings as true (#CX12-3323) ([f50ceb0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f50ceb0101c11430f8cdb1458b249f9589b041b5)), closes [#CX12-3323](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3323)
|
28
|
+
|
29
|
+
## [1.3.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.2...v1.3.3) (2021-04-19)
|
30
|
+
|
31
|
+
|
32
|
+
### Fix
|
33
|
+
|
34
|
+
* fix for null baseUrl being passed causing console error (#CX12-3323) ([c9b6789](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/c9b678938e56af85143be4336f38ab12fbb045f2)), closes [#CX12-3323](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3323)
|
35
|
+
|
36
|
+
## [1.3.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.1...v1.3.2) (2021-04-15)
|
37
|
+
|
38
|
+
|
39
|
+
### Chore
|
40
|
+
|
41
|
+
* minor change to comment in product.js, based on changes in ns-shop (#CX12-3323) ([ff1fc30](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/ff1fc3013585ffde40c126ff808a18caa8e286fb)), closes [#CX12-3323](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3323)
|
42
|
+
|
43
|
+
### Fix
|
44
|
+
|
45
|
+
* updated version of ns-common-lib (#CX12-3046) ([307e35f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/307e35fbd2d6777628f6047173e2e78c4735728a)), closes [#CX12-3046](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3046)
|
46
|
+
|
47
|
+
## [1.3.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.0...v1.3.1) (2021-03-18)
|
48
|
+
|
49
|
+
|
50
|
+
### Fix
|
51
|
+
|
52
|
+
* fixed cannot set property 'PTS' of undefined (#CX12-3360) ([c45d778](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/c45d7784dc93eb55a11b375d03338a81eac513eb)), closes [#CX12-3360](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3360)
|
53
|
+
|
54
|
+
## [1.3.1-pts-error.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.3.0...v1.3.1-pts-error.1) (2021-03-18)
|
55
|
+
|
56
|
+
|
57
|
+
### Fix
|
58
|
+
|
59
|
+
* fixed cannot set property 'PTS' of undefined (#CX12-3360) ([2ed4b3e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/2ed4b3eb3da8b5e73ecafe9b7c923851f3123dbd)), closes [#CX12-3360](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-3360)
|
60
|
+
|
61
|
+
# [1.3.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.2.0...v1.3.0) (2021-03-10)
|
62
|
+
|
63
|
+
|
64
|
+
### New
|
65
|
+
|
66
|
+
* added globalProductID to product data. (#CX101-1465) ([d79aaff](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d79aaff1e341a2f5bc2296a203bdb14520552caf)), closes [#CX101-1465](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX101-1465)
|
67
|
+
|
68
|
+
# [1.3.0-cx101-1465.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.2.0...v1.3.0-cx101-1465.1) (2021-03-10)
|
69
|
+
|
70
|
+
|
71
|
+
### Fix
|
72
|
+
|
73
|
+
* test. (#CX101-1465) ([83330d3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/83330d33fbab9fda056b47c5200714c7102470c0)), closes [#CX101-1465](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX101-1465)
|
74
|
+
|
75
|
+
### New
|
76
|
+
|
77
|
+
* add globalProductID to product.js. (#CX101-1465) ([7218660](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/721866074d11f0d1d1b78bebf720f0ec94f0a836)), closes [#CX101-1465](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX101-1465)
|
78
|
+
|
79
|
+
# [1.2.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.1.3...v1.2.0) (2021-02-09)
|
80
|
+
|
81
|
+
|
82
|
+
### Fix
|
83
|
+
|
84
|
+
* Didn't fix the unit tests before ([b087533](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b0875338c5e89b622f8cdf0bc9fa0fc482c3e146))
|
85
|
+
|
86
|
+
### Update
|
87
|
+
|
88
|
+
* Added childSkus to the object to allow for debugging through the ProductData lambda call ([8703aed](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8703aede5e43b57469b819dbb6e2cf36ccf3a283))
|
89
|
+
|
90
|
+
## [1.1.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.1.2...v1.1.3) (2020-11-03)
|
91
|
+
|
92
|
+
|
93
|
+
### Fix
|
94
|
+
|
95
|
+
* product content mapping fixes for foreign markets without options passed to create, additional unit testing (#CX12-2663) ([1ad7418](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1ad74187ad5d6e448bd1802ac169586843aa93b0)), closes [#CX12-2663](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2663)
|
96
|
+
|
97
|
+
## [1.1.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.1.1...v1.1.2) (2020-10-14)
|
98
|
+
|
99
|
+
|
100
|
+
### Fix
|
101
|
+
|
102
|
+
* [Product] updated the from json code to add back baseSku for variants (#CX12-2420) ([7f790ab](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/7f790ab4560428a86cc934e23935e8066eea3ac2)), closes [#CX12-2420](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2420)
|
103
|
+
|
104
|
+
## [1.1.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.1.0...v1.1.1) (2020-10-05)
|
105
|
+
|
106
|
+
|
107
|
+
### Fix
|
108
|
+
|
109
|
+
* updated set order types logic (#CX12-2487) ([1c9cd30](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1c9cd30a860efafaec8a1a963698bb366f2f6232)), closes [#CX12-2487](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2487)
|
110
|
+
|
111
|
+
# [1.1.0-types-fix.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.1.0-types-fix.1...v1.1.0-types-fix.2) (2020-10-05)
|
112
|
+
|
113
|
+
|
114
|
+
### Chore
|
115
|
+
|
116
|
+
* Merge branch 'order-types-fix' of code.tls.nuskin.io:ns-am/product/js-libs/ns-product-lib into order-types-fix ([9e738eb](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9e738eb725e1ff12bad448d503ad0e14569b01d4))
|
117
|
+
|
118
|
+
### Fix
|
119
|
+
|
120
|
+
* updated product content mapping of order types, moved around some code (#CX12-2487) ([a413c4e](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a413c4e098768f5e74e7dcc2df88930d899ebf37)), closes [#CX12-2487](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2487)
|
121
|
+
|
122
|
+
# [1.1.0-types-fix.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.0.0...v1.1.0-types-fix.1) (2020-10-05)
|
123
|
+
|
124
|
+
|
125
|
+
### Fix
|
126
|
+
|
127
|
+
* updated set order types logic (#CX12-2487) ([bbee624](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/bbee624c845bdbb66055e6b1995ed495c1ce3c55)), closes [#CX12-2487](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2487)
|
128
|
+
|
129
|
+
# [1.1.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.0.0...v1.1.0) (2020-10-02)
|
130
|
+
|
131
|
+
|
132
|
+
### New
|
133
|
+
|
134
|
+
* added product status mapper for product data lambda (#CX12-2487) ([8c9fc88](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8c9fc88d14c607865b3fe6f6ab0da7040f388676)), closes [#CX12-2487](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2487)
|
135
|
+
|
136
|
+
# 1.0.0 (2020-09-28)
|
137
|
+
|
138
|
+
|
139
|
+
### Fix
|
140
|
+
|
141
|
+
* remove coverage statics from Jest, that's handled in the default build (#CX12-2412) ([f44f791](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/f44f791ae39b9bb96b25bc386616a2147d6406da)), closes [#CX12-2412](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2412)
|
142
|
+
* various fixes and a few extra unit tests (#CX12-2412) ([092bcce](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/092bcce29890657c6de06123bf9955c8358786a8)), closes [#CX12-2412](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2412)
|
143
|
+
|
144
|
+
### New
|
145
|
+
|
146
|
+
* initial commit of ns-product-lib (#CX12-2412) ([5669a16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5669a161594010017bdb113acd44dd5e6d1323e9)), closes [#CX12-2412](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX12-2412)
|
package/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# @nuskin/ns-product-lib
|
2
|
+
|
3
|
+
This project contains shared Product models and code between the backend and frontend.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Usng npm:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
npm add @nuskin/ns-product-lib
|
11
|
+
```
|
12
|
+
|
13
|
+
Usng yarn:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
yarn add @nuskin/ns-product-lib
|
17
|
+
```
|
18
|
+
|
19
|
+
## Example usage
|
20
|
+
|
21
|
+
```js
|
22
|
+
const { Product } = require('@nuskin/ns-product-lib')
|
23
|
+
|
24
|
+
let product = new Product();
|
25
|
+
```
|
26
|
+
|
27
|
+
## Resources
|
28
|
+
|
29
|
+
- https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
[MIT](https://opensource.org/licenses/MIT)
|
package/package.json
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"name": "@nuskin/ns-product-lib",
|
3
|
+
"version": "1.3.7",
|
4
|
+
"description": "This project contains shared Product models and code between the backend and frontend.",
|
5
|
+
"main": "src/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "jest --coverage",
|
8
|
+
"lint": "eslint src __tests__"
|
9
|
+
},
|
10
|
+
"publishConfig": {
|
11
|
+
"access": "public"
|
12
|
+
},
|
13
|
+
"repository": {
|
14
|
+
"type": "git",
|
15
|
+
"url": "git@code.tls.nuskin.io:ns-am/product/js-libs/ns-product-lib.git"
|
16
|
+
},
|
17
|
+
"keywords": [],
|
18
|
+
"author": "Kody Crossman <kcrossman@nuskin.com>",
|
19
|
+
"license": "ISC",
|
20
|
+
"homepage": "https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/blob/master/README.md",
|
21
|
+
"devDependencies": {
|
22
|
+
"eslint": "5.16.0",
|
23
|
+
"eslint-config-google": "0.14.0",
|
24
|
+
"eslint-config-prettier": "4.1.0",
|
25
|
+
"eslint-plugin-json": "2.1.1",
|
26
|
+
"eslint-plugin-prettier": "3.1.2",
|
27
|
+
"jest": "25.1.0",
|
28
|
+
"jest-sonar-reporter": "2.0.0",
|
29
|
+
"prettier": "1.19.1"
|
30
|
+
},
|
31
|
+
"dependencies": {
|
32
|
+
"@nuskin/ns-common-lib": "1.3.0"
|
33
|
+
},
|
34
|
+
"files": [
|
35
|
+
"src/"
|
36
|
+
]
|
37
|
+
}
|
package/src/agelocme.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const Agelocme = function(agelocmeData) {
|
4
|
+
this.code = agelocmeData && agelocmeData.code ? agelocmeData.code : null;
|
5
|
+
this.label = agelocmeData && agelocmeData.label ? agelocmeData.label : null;
|
6
|
+
this.name = agelocmeData && agelocmeData.name ? agelocmeData.name : null;
|
7
|
+
this.calibration = agelocmeData ? agelocmeData.calibration === true : false;
|
8
|
+
this.isCoreSolution = agelocmeData
|
9
|
+
? agelocmeData.isCoreSolution === true
|
10
|
+
: false;
|
11
|
+
|
12
|
+
this.isCustom = !this.calibration;
|
13
|
+
this.matches = function(obj) {
|
14
|
+
obj = obj || {};
|
15
|
+
return (
|
16
|
+
this.code === obj.code &&
|
17
|
+
this.label === obj.label &&
|
18
|
+
this.name === obj.name &&
|
19
|
+
this.calibration === obj.calibration &&
|
20
|
+
this.isCoreSolution === obj.isCoreSolution
|
21
|
+
);
|
22
|
+
};
|
23
|
+
|
24
|
+
this.toJSON = function() {
|
25
|
+
return {
|
26
|
+
code: this.code,
|
27
|
+
label: this.label,
|
28
|
+
name: this.name,
|
29
|
+
calibration: this.calibration,
|
30
|
+
isCoreSolution: this.isCoreSolution
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
|
35
|
+
module.exports = Agelocme;
|
package/src/index.js
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* WARNING: The use of `require` and `module.exports` is because this package has to remain
|
3
|
+
* in CommonJS format. Do not change ANY files here to ES6 standards or it will break usages.
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const Agelocme = require("./agelocme.js");
|
9
|
+
const PriceType = require("./priceType.js");
|
10
|
+
const Product = require("./product.js");
|
11
|
+
const ProductContentMapper = require("./productContentMapper.js");
|
12
|
+
const ProductStatus = require("./productStatus.js");
|
13
|
+
const ProductStatusMapper = require("./productStatusMapper.js");
|
14
|
+
const ProductUtils = require("./productUtils.js");
|
15
|
+
|
16
|
+
module.exports = {
|
17
|
+
Agelocme,
|
18
|
+
PriceType,
|
19
|
+
Product,
|
20
|
+
ProductContentMapper,
|
21
|
+
ProductStatus,
|
22
|
+
ProductStatusMapper,
|
23
|
+
ProductUtils
|
24
|
+
};
|
package/src/priceType.js
ADDED