@nuskin/ns-shop 6.0.1 → 6.0.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-shop",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
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": {
@@ -1,5 +1,5 @@
1
1
  import $ from '@nuskin/nuskinjquery';
2
- import {RunConfigService, UrlService, events, storage, nuskin} from '@nuskin/ns-util';
2
+ import {RunConfigService, UrlService, events, storage} from '@nuskin/ns-util';
3
3
  import axios from 'axios';
4
4
  import { UserService } from '@nuskin/ns-account';
5
5
 
@@ -1087,13 +1087,7 @@ async function _init(force = true) {
1087
1087
  // init is passed arguments when initiated by $(document).ready(init) below. Need
1088
1088
  // to check for actual boolean true for initialization.
1089
1089
  if (await _initData(force === true)) {
1090
- if (!nuskin || !nuskin.hasOwnProperty("configuration")) {
1091
- events.subscribe(events.global.CONFIGURATION_SET, () => {
1092
- initActiveEvents().catch((err) => {console.error('Error initializing event tickets.', err)});
1093
- });
1094
- } else {
1095
- initActiveEvents().catch((err) => {console.error('Error initializing event tickets.', err)});
1096
- }
1090
+ initActiveEvents().catch((err) => {console.error('Error initializing event tickets.', err)});
1097
1091
  } else {
1098
1092
  _removeWaitCheck(INITIALIZING);
1099
1093
  }
@@ -1114,9 +1108,11 @@ events.subscribe(events.salesevent.ACTIVE_EVENTS, (/*activeEvents*/) => {
1114
1108
  });
1115
1109
 
1116
1110
  /**
1117
- * Waits for document readiness and market configuration loading and then
1118
- * initializes tickets for events associated to the current market.
1111
+ * Waits for config to be loaded and then initializes tickets
1112
+ * for events associated to the current market.
1119
1113
  */
1120
- $(document).ready(async function() {
1121
- await _init(false);
1122
- });
1114
+ events.getValue(events.global.CS_CONFIG_SET, async (configs) => {
1115
+ if (configs != null) {
1116
+ await _init(false);
1117
+ }
1118
+ })
@@ -24,11 +24,13 @@ let setEcom3Cookie = function(value) {
24
24
  let getPriceType = (isAdr, _user) => {
25
25
  const user = _user || UserService.getUser();
26
26
  const isRetail =
27
- !AuthenticationService.isLoggedIn() ||
28
- !user ||
29
- user.priceType == 'RTL' ||
30
- user.isCustomer() ||
31
- user.isGuest;
27
+ !getCachedConfigField('showWholeSalePricing') && (
28
+ !AuthenticationService.isLoggedIn() ||
29
+ !user ||
30
+ user.priceType == 'RTL' ||
31
+ user.isCustomer() ||
32
+ user.isGuest
33
+ );
32
34
 
33
35
  let priceType;
34
36