sr-npm 1.7.487 → 1.7.489

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.487",
3
+ "version": "1.7.489",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,16 +20,18 @@ const {
20
20
  let queryDepartmentVar;
21
21
  let queryLocationVar;
22
22
  let queryJobTypeVar;
23
+ let queryBrandVar;
23
24
  let searchInputBlurredFirstTime=true;
24
25
  let deletedParam=false;
25
26
  async function careersPageOnReady(_$w,thisObject,queryParams) {
26
27
  console.log("queryParams: ", queryParams);
27
- const { page, keyWord, department, location,jobType } = queryParams;
28
+ const { page, keyWord, department, location,jobType,brand } = queryParams;
28
29
  queryPageVar=page;
29
30
  queryKeyWordVar=keyWord;
30
31
  queryDepartmentVar=department;
31
32
  queryLocationVar=location;
32
33
  queryJobTypeVar=jobType;
34
+ queryBrandVar=brand;
33
35
  thisObjectVar=thisObject;
34
36
  allJobs=await getAllPositions();
35
37
  await activateAutoLoad(_$w);
@@ -104,6 +106,10 @@ async function handleUrlParams(_$w) {
104
106
  if (queryJobTypeVar) {
105
107
  await handleJobTypeParam(_$w,queryJobTypeVar);
106
108
  }
109
+ console.log("_$w('#dropdownBrand'): ", _$w('#dropdownBrand'));
110
+ if (queryBrandVar && _$w('#dropdownBrand').isVisible()) { //if it is not visible, ignore it
111
+ await handleBrandParam(_$w,queryBrandVar);
112
+ }
107
113
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
108
114
  }
109
115
 
@@ -228,6 +234,16 @@ async function handleBackAndForth(_$w){
228
234
  deletedParam=true;
229
235
  _$w('#dropdownJobType').value = '';
230
236
  }
237
+ if(_$w('#dropdownBrand').isVisible()){
238
+ if(newQueryParams.brand){
239
+ queryBrandVar=newQueryParams.brand;
240
+ }
241
+ else{
242
+ queryBrandVar=undefined;
243
+ deletedParam=true;
244
+ _$w('#dropdownBrand').value = '';
245
+ }
246
+ }
231
247
  await handleUrlParams(_$w);
232
248
 
233
249
  }
@@ -275,6 +291,9 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
275
291
  queryParams.add({ jobType: encodeURIComponent("onsite") });
276
292
  }
277
293
  }
294
+ if(filter.field === 'brand'){
295
+ queryParams.add({ brand: encodeURIComponent(filter.value) });
296
+ }
278
297
  }
279
298
  if(filter.field === 'remote') {
280
299
  value = filter.value === 'true';
@@ -418,6 +437,24 @@ async function handleLocationParam(_$w,location) {
418
437
 
419
438
  }
420
439
 
440
+ async function handleBrandParam(_$w,brand){
441
+ const brandValue = decodeURIComponent(brand);
442
+ let dropdownOptions = _$w('#dropdownBrand').options;
443
+ console.log("brand dropdown options:", dropdownOptions);
444
+ const optionsFromCMS=await wixData.query("Brands").find();
445
+ if(dropdownOptions.length!==optionsFromCMS.items.length+1){
446
+ fixDropdownOptions('#dropdownBrand',optionsFromCMS, _$w);
447
+ }
448
+ const option=_$w('#dropdownBrand').options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
449
+ if(option){
450
+ _$w('#dropdownBrand').value = option.value;
451
+ }
452
+ else{
453
+ console.warn("brand value not found in dropdown options");
454
+ queryParams.remove(["brand"]);
455
+ }
456
+ }
457
+
421
458
  async function handleJobTypeParam(_$w,jobType) {
422
459
  const jobTypeValue = decodeURIComponent(jobType);
423
460
  let dropdownOptions = _$w('#dropdownJobType').options;