@nuskin/cs-product-lib 1.1.0-subscription-dc.2 → 1.1.0-subscription-dc.3

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/README.md CHANGED
@@ -19,8 +19,18 @@ yarn add @nuskin/cs-product-lib
19
19
  ## Example usage
20
20
 
21
21
  ```js
22
- const { tbd } = require('@nuskin/cs-product-lib')
23
- tbd.doSomething()
22
+ const { ContentStackProduct } = require('@nuskin/cs-product-lib');
23
+ const config = {
24
+ apiKey: 'apikey',
25
+ environment: 'cs-environment',
26
+ deliveryToken: 'cs-delivery-token',
27
+ awsBase: 'https://devapi.cloud.nuskin.com',
28
+ homeUrl: 'https://dev.nuskin.com',
29
+ clientId: 'clientId'
30
+ }
31
+
32
+ const csProduct = ContentStackProduct.csProduct(config);
33
+ csProduct.getProductsByUID('uid')
24
34
 
25
35
  ```
26
36
 
@@ -38,6 +48,6 @@ Once you are ready for your project to start running the CI/CD pipeline, you sho
38
48
  to `.gitlab-ci.yml`.
39
49
  ```bash
40
50
  git mv gitlab-ci.yml .gitlab-ci.yml
41
- git commit -am"Chore: renaming gitlab-ci.yml to .gitlab-ci.yml so my pipeline runs"
51
+ git commit -am'Chore: renaming gitlab-ci.yml to .gitlab-ci.yml so my pipeline runs'
42
52
  git push
43
53
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.1.0-subscription-dc.2",
3
+ "version": "1.1.0-subscription-dc.3",
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": {
package/src/csProduct.js CHANGED
@@ -9,6 +9,7 @@ const { formatProduct } = require('./formatProduct')
9
9
  const { transformBundle } = require('./transformBundle')
10
10
  const { formatCategoryTranslations } = require('./formatCategoryTranslations')
11
11
  const { isNullOrEmpty } = require('@nuskin/ns-common-lib')
12
+ const { formatDiscounts } = require('./helpers/formatDiscounts');
12
13
 
13
14
  const validateConfig = (props) => {
14
15
  if (!props) {
@@ -266,6 +267,7 @@ const csProduct = (props) => {
266
267
  productBundle.pvdis = discounts.pvDiscount || skuKit[0].pvdis
267
268
  productBundle.rtlpricedis = discounts.retailDiscount || skuKit[0].rtlpricedis
268
269
  productBundle.sbdis = discounts.sbDiscount || skuKit[0].sbdis
270
+ productBundle.subscription_discounts = formatDiscounts(skuKit[0], 'subscription_discounts');
269
271
  productBundle.scan_qualified_count = skuKit[0].scan_qualified_count
270
272
  productBundle.tax_class = skuKit[0].tax_class
271
273
  productBundle.title = skuKit[0].title
@@ -386,11 +388,21 @@ const csProduct = (props) => {
386
388
  return products
387
389
  }
388
390
 
391
+ /**
392
+ *
393
+ * @deprecated use getProductsByUID instead
394
+ * @returns
395
+ */
389
396
  const getBundle = async (id, locale) => {
390
397
  const bundles = await getBundles(id, locale)
391
398
  return bundles && bundles[0] ? bundles[0] : null
392
399
  }
393
400
 
401
+ /**
402
+ *
403
+ * @deprecated use getProductsByUID instead
404
+ * @returns
405
+ */
394
406
  const getBundles = async (ids, locale) => {
395
407
  if (!Array.isArray(ids)) {
396
408
  ids = [ids]