@nuskin/ns-util 4.2.2 → 4.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-util",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "baseURL": "/",
5
5
  "main": "src/util.js",
6
6
  "scripts": {
package/src/tdcStrings.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import UrlService from './urlService';
4
4
  import mktRegionMapping from './regionMapping.js';
5
5
  import axios from 'axios';
6
- import { getCachedConfigField } from '@nuskin/configuration-sdk';
6
+ import { getConfiguration, getCachedConfigField } from '@nuskin/configuration-sdk';
7
7
 
8
8
  /**
9
9
  *
@@ -105,24 +105,24 @@ async function getServiceJSON(path, selector) {
105
105
  }
106
106
  }
107
107
 
108
- let getTdcStrings = function(page, language, country, angApp) {
108
+ let getTdcStrings = async function(page, language, country, angApp) {
109
109
  return doStringsRequest(page, language, country, angApp, 'noTdc_');
110
110
  };
111
111
 
112
- let getNonTdcStrings = function(page, language, country, angApp) {
112
+ let getNonTdcStrings = async function(page, language, country, angApp) {
113
113
  return doStringsRequest(page, language, country, angApp, 'nonTdc');
114
114
  };
115
115
 
116
- function doStringsRequest(page, language, country, angApp, mode) {
116
+ async function doStringsRequest(page, language, country, angApp, mode) {
117
117
  let tdc = {};
118
118
  let url;
119
119
 
120
120
  if (UrlService.isMeCommerce()){
121
121
  url = window.location.protocol + "//" + window.location.host + '/content/mecommerce/{region}/{market}/{language}/shop/{page}.service.' + mode + '.json';
122
122
  url = url.replace('{region}', mktRegionMapping[country]).replace('{market}', country).replace('{language}', language).replace('{page}', page);
123
- }
124
- else{
125
- url = UrlService.extractHostURL(getCachedConfigField('tdcStringsUrl') || '');
123
+ } else {
124
+ const {Url: urlCfg} = await getConfiguration(['Url', 'Basic']);
125
+ url = UrlService.extractHostURL(urlCfg.tdcStringsUrl);
126
126
  if (typeof url !== "undefined") {
127
127
  url = url.replace('{language}', language).replace('{market}', country).replace('{page}', page).replace('.noTdc_.', '.' + mode + '.');
128
128
  }