@nuskin/ns-shop 5.16.0 → 5.17.0

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-shop",
3
- "version": "5.16.0",
3
+ "version": "5.17.0",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
@@ -156,14 +156,28 @@ async function getVNRegionList () {
156
156
  * @return {Promise<PostalCodeLookupDTO[]>} Promise that resolves to address data set
157
157
  */
158
158
  async function getListOfCitiesFromPostalCode (country, zip) {
159
- let url = ConfigService.getMarketConfig().checkout.postalCodeServiceUrl;
160
- url = url.replace(/\/:cntry\/:code/, `/${country}/${zip}`);
161
- return fetch(url, {
159
+ const {
160
+ awsUrl,
161
+ checkout: { postalCodeServiceUrl }
162
+ } = ConfigService.getMarketConfig();
163
+
164
+ let url;
165
+ if (country === 'MX') {
166
+ url = `${awsUrl}/mexico-check/v1/zzip/${zip}`;
167
+ } else {
168
+ url = postalCodeServiceUrl
169
+ .replace(/:cntry/g, country)
170
+ .replace(/:code/g, zip);
171
+ }
172
+
173
+ const results = await fetch(url, {
162
174
  method: 'GET',
163
175
  credentials: 'omit',
164
176
  headers: ServiceUtils.getHeaders()
165
177
  })
166
178
  .then(ServiceUtils.transformFetchResponse);
179
+
180
+ return (country === 'MX') ? results.zzipRecords : results;
167
181
  }
168
182
 
169
183
  /**