sr-npm 1.7.514 → 1.7.516

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": "sr-npm",
3
- "version": "1.7.514",
3
+ "version": "1.7.516",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,8 +3,9 @@ const {wixData} = require('wix-data');
3
3
  const { window } = require('@wix/site-window');
4
4
  const { query,queryParams,onChange} = require("wix-location-frontend");
5
5
  const { location } = require("@wix/site-location");
6
- const { COLLECTIONS } = require('../backend/collectionConsts');
6
+ const { COLLECTIONS, TOKEN_NAME } = require('../backend/collectionConsts');
7
7
  const { getTokenFromCMS } = require('../backend/secretsData');
8
+
8
9
  const {
9
10
  debounce,
10
11
  getFilter,
@@ -495,20 +496,25 @@ async function updateMapMarkers(_$w){
495
496
 
496
497
  }
497
498
 
498
- async function handleBrandDropdown(_$w){
499
- const brands=await wixData.query(COLLECTIONS.BRANDS).find();
500
- const disableMultiBrand=await getTokenFromCMS(TOKEN_NAME.DISABLE_MULTI_BRAND)
501
- if(disableMultiBrand==='true'){
502
- console.log("disabling brand dropdown because disableMultiBrand is true");
503
- _$w('#dropdownBrand').hide();
499
+ async function handleBrandDropdown(_$w) {
500
+ const brands = await wixData.query(COLLECTIONS.BRANDS).find();
501
+ let disableMultiBrand;
502
+ try {
503
+ disableMultiBrand = await getTokenFromCMS(TOKEN_NAME.DISABLE_MULTI_BRAND);
504
+ } catch (e) {
505
+ if (e.message !== "[getTokenFromCMS], No disableMultiBrand found") throw e;
506
+ console.log("disableMultiBrand token wasn't found");
507
+
504
508
  }
505
- else{
506
- if(brands.items.length>1){
509
+ if (disableMultiBrand === 'true') {
510
+ console.log("hiding brand dropdown");
511
+ _$w('#dropdownBrand').hide();
512
+ } else if (brands.items.length > 1) {
507
513
  console.log("showing brand dropdown");
508
514
  _$w('#dropdownBrand').show();
509
515
  }
510
- }
511
516
  }
517
+
512
518
  module.exports = {
513
519
  careersPageOnReady,
514
520
  };