@nuskin/ns-product-lib 2.13.0-cx24-5107.15 → 2.13.0-cx24-5107.17

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [2.13.0-cx24-5107.17](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.16...v2.13.0-cx24-5107.17) (2023-10-19)
2
+
3
+
4
+ ### Fix
5
+
6
+ * product images array instead of obj ([26b7786](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/26b77867ea0dbc6bf1ab482535d8f3d823eb3e8e))
7
+
8
+ # [2.13.0-cx24-5107.16](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.15...v2.13.0-cx24-5107.16) (2023-10-19)
9
+
10
+
11
+ ### Fix
12
+
13
+ * async graphql ([1da1d02](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1da1d02eac113c6d57546680c5d936d2139afa7e))
14
+
1
15
  # [2.13.0-cx24-5107.15](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.14...v2.13.0-cx24-5107.15) (2023-10-19)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.13.0-cx24-5107.15",
3
+ "version": "2.13.0-cx24-5107.17",
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": {
@@ -14,15 +14,14 @@ const defaultPayload = {
14
14
  * @param {obj} payload
15
15
  * @returns {Promise}
16
16
  */
17
- function graphQlHttpRequest(payload, config) {
17
+ async function graphQlHttpRequest(payload, config) {
18
18
  const url = config.graphqlUrl
19
- return axios.request({
19
+ return await axios.request({
20
20
  method: 'post',
21
21
  url: url,
22
22
  data: payload,
23
23
  responseType: 'json'
24
24
  });
25
-
26
25
  }
27
26
 
28
27
  /**
@@ -356,14 +355,15 @@ function mapProductImages(product) {
356
355
  thumbnail: ""
357
356
  };
358
357
 
359
- if (product.productImages) {
360
- productImages.fullImage = product.productImages.url || '';
361
- productImages.imageAltText = product.productImages.alt || '';
362
- productImages.thumbnail = product.productImages.thumbnail || '';
358
+ if (product.productImages && product.productImages.length) {
359
+ productImages.fullImage = product.productImages[0].url || '';
360
+ productImages.imageAltText = product.productImages[0].alt || '';
361
+ productImages.thumbnail = product.productImages[0].thumbnail || '';
363
362
  }
364
363
 
365
364
  return productImages;
366
365
  }
366
+
367
367
  /**
368
368
  * Map Order Types
369
369
  * @param {Array<string>} availableChannels