@nuskin/ns-shop 6.0.0 → 6.0.1
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
|
@@ -47,7 +47,7 @@ Private Methods
|
|
|
47
47
|
* @returns {{Accept: string, "Content-Type": string, client_id: *, client_secret: *}}
|
|
48
48
|
* @private
|
|
49
49
|
*/
|
|
50
|
-
const _getHeaders = (
|
|
50
|
+
const _getHeaders = (jwt) => {
|
|
51
51
|
let headers = {
|
|
52
52
|
'Accept': 'application/json',
|
|
53
53
|
'Content-Type': 'application/json',
|
package/src/receiver.js
CHANGED
|
@@ -3,7 +3,7 @@ import {UserService, AuthenticationService, VGDistInfoService} from "@nuskin/ns-
|
|
|
3
3
|
import {RunConfigService, storage, util, ShoppingContext, Base64, events} from "@nuskin/ns-util";
|
|
4
4
|
import CartService from './cart/cartService';
|
|
5
5
|
import AdrService from './adr/AdrService';
|
|
6
|
-
import {
|
|
6
|
+
import {getCachedConfigField} from '@nuskin/configuration-sdk';
|
|
7
7
|
|
|
8
8
|
const PARAMS_COOKIE = "parametersJSON";
|
|
9
9
|
const removedParameters = {
|
|
@@ -33,23 +33,6 @@ let paramMap;
|
|
|
33
33
|
let adrEcomm3OneTimePointRedemption;
|
|
34
34
|
let user;
|
|
35
35
|
|
|
36
|
-
const getConfig = async (country, clientId) => {
|
|
37
|
-
const context = ShoppingContext.getShoppingContext();
|
|
38
|
-
const shoppingContext = context && context.context ? context.context : undefined;
|
|
39
|
-
const {
|
|
40
|
-
ADP: adpCfg
|
|
41
|
-
} = await getPartialConfig({
|
|
42
|
-
queryFields: {
|
|
43
|
-
ADP: ['keepCartOnAdrOverride']
|
|
44
|
-
},
|
|
45
|
-
country: country,
|
|
46
|
-
environment: RunConfigService.getEnvironmentCode(),
|
|
47
|
-
clientId,
|
|
48
|
-
shoppingContext
|
|
49
|
-
});
|
|
50
|
-
return adpCfg;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
36
|
/**
|
|
54
37
|
*
|
|
55
38
|
* @return {string|*}
|
|
@@ -157,14 +140,13 @@ const addItemsToCart = async () => {
|
|
|
157
140
|
// Add SKUs from query parameters to the cart
|
|
158
141
|
const items = getItems();
|
|
159
142
|
const runConfig = RunConfigService.getRunConfig();
|
|
160
|
-
const adpCfg = await getConfig(runConfig.country, runConfig.clientId);
|
|
161
143
|
const promises = [];
|
|
162
144
|
|
|
163
145
|
if (items.length > 0) {
|
|
164
146
|
|
|
165
147
|
// This section sets up the page refresh listener unless this is also an ADR Override,
|
|
166
148
|
// in which case the ADR Override handling block below will do so after completing its asynch calls
|
|
167
|
-
if (!paramMap.initAdrOverride || !
|
|
149
|
+
if (!paramMap.initAdrOverride || !getCachedConfigField('keepCartOnAdrOverride')) {
|
|
168
150
|
// Set recieving flag
|
|
169
151
|
storage.setItem(RECEIVING_ITEMS, true);
|
|
170
152
|
// setupListener(items.length, getRedirectPath());
|
|
@@ -192,7 +174,7 @@ const addItemsToCart = async () => {
|
|
|
192
174
|
}
|
|
193
175
|
|
|
194
176
|
// (ADR Override only) add contents of the overridden ADR to the cart
|
|
195
|
-
if (paramMap.initAdrOverride &&
|
|
177
|
+
if (paramMap.initAdrOverride && getCachedConfigField('keepCartOnAdrOverride')) {
|
|
196
178
|
AdrService.getAdrDetails(AdrService.getAdrOverrideId())
|
|
197
179
|
.then(function(adr) {
|
|
198
180
|
if (adr && adr['SalesOrderDetail']) {
|