sr-npm 1.7.349 → 1.7.351

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.349",
3
+ "version": "1.7.351",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,15 +19,17 @@ const {
19
19
  let queryKeyWordVar;
20
20
  let queryDepartmentVar;
21
21
  let queryLocationVar;
22
+ let queryJobTypeVar;
22
23
  let searchInputBlurredFirstTime=true;
23
24
  let deletedParam=false;
24
25
  async function careersPageOnReady(_$w,thisObject,queryParams) {
25
26
  console.log("queryParams: ", queryParams);
26
- const { page, keyWord, department, location } = queryParams;
27
+ const { page, keyWord, department, location,jobType } = queryParams;
27
28
  queryPageVar=page;
28
29
  queryKeyWordVar=keyWord;
29
30
  queryDepartmentVar=department;
30
31
  queryLocationVar=location;
32
+ queryJobTypeVar=jobType;
31
33
  thisObjectVar=thisObject;
32
34
  allJobs=await getAllPositions();
33
35
  await activateAutoLoad(_$w);
@@ -102,7 +104,9 @@ async function handleUrlParams(_$w) {
102
104
  if (queryLocationVar) {
103
105
  await handleLocationParam(_$w,queryLocationVar);
104
106
  }
105
-
107
+ if (queryJobTypeVar) {
108
+ await handleJobTypeParam(_$w,queryJobTypeVar);
109
+ }
106
110
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
107
111
  }
108
112
 
@@ -188,31 +192,9 @@ function init(_$w) {
188
192
 
189
193
  //URL onChange
190
194
  onChange(async ()=>{
191
- let deletedParam=false
192
- const newQueryParams=await location.query();
193
- console.log("onChange triggering on ready");
194
- console.log("newQueryParams: ", newQueryParams);
195
- if(newQueryParams.department){
196
- queryDepartmentVar=newQueryParams.department;
197
- }
198
- else{
199
- queryDepartmentVar=undefined;
200
- deletedParam=true;
201
- _$w('#dropdownDepartment').value = '';
202
- }
203
- if(newQueryParams.location){
204
- queryLocationVar=newQueryParams.location;
205
- }
206
- else{
207
- queryLocationVar=undefined;
208
- deletedParam=true
209
- _$w('#dropdownLocation').value = '';
210
- }
211
- await handleUrlParams(_$w);
212
- // if(deletedParam){
213
- // await applyFilters(_$w,true);
214
- // }
215
-
195
+ await handleBackAndForth(_$w);
196
+
197
+
216
198
 
217
199
 
218
200
 
@@ -272,6 +254,48 @@ function init(_$w) {
272
254
  }
273
255
 
274
256
 
257
+ async function handleBackAndForth(_$w){
258
+ const newQueryParams=await location.query();
259
+ console.log("newQueryParams: ", newQueryParams);
260
+ if(newQueryParams.department){
261
+ queryDepartmentVar=newQueryParams.department;
262
+ }
263
+ else{
264
+ queryDepartmentVar=undefined;
265
+ deletedParam=true;
266
+ _$w('#dropdownDepartment').value = '';
267
+ }
268
+ if(newQueryParams.location){
269
+ queryLocationVar=newQueryParams.location;
270
+ }
271
+ else{
272
+ queryLocationVar=undefined;
273
+ deletedParam=true
274
+ _$w('#dropdownLocation').value = '';
275
+ }
276
+ if(newQueryParams.keyWord){
277
+ queryKeyWordVar=newQueryParams.keyWord;
278
+ }
279
+ else{
280
+ queryKeyWordVar=undefined;
281
+ deletedParam=true;
282
+ _$w('#searchInput').value = '';
283
+ }
284
+ if(newQueryParams.jobType){
285
+ queryJobTypeVar=newQueryParams.jobType;
286
+ }
287
+ else{
288
+ queryJobTypeVar=undefined;
289
+ deletedParam=true;
290
+ _$w('#dropdownJobType').value = '';
291
+ }
292
+ await handleUrlParams(_$w);
293
+ // if(deletedParam){
294
+ // await applyFilters(_$w,true);
295
+ // }
296
+
297
+ }
298
+
275
299
  async function applyFilters(_$w, skipUrlUpdate = false) {
276
300
  console.log("applying filters");
277
301
  const dropdownFiltersMapping = [
@@ -292,12 +316,6 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
292
316
  if (filter.value === RESET_ALL) {
293
317
  _$w(filter.elementId).value = '';
294
318
  filter.value = '';
295
- if (!skipUrlUpdate) {
296
- queryParams.remove(["keyWord", "department","page","location"]);
297
- // queryKeyWordVar=undefined;
298
- // queryDepartmentVar=undefined;
299
- // queryLocationVar=undefined;
300
- }
301
319
  }
302
320
 
303
321
  // build filters
@@ -455,6 +473,20 @@ async function handleLocationParam(_$w,location) {
455
473
 
456
474
  }
457
475
 
476
+ async function handleJobTypeParam(_$w,jobType) {
477
+ const jobTypeValue = decodeURIComponent(jobType);
478
+ let dropdownOptions = _$w('#dropdownJobType').options;
479
+ console.log("jobType dropdown options:", dropdownOptions);
480
+ const option=_$w('#dropdownJobType').options.find(option => option.value.toLowerCase() === jobTypeValue.toLowerCase())
481
+ if(option){
482
+ _$w('#dropdownJobType').value = option.value;
483
+ }
484
+ else{
485
+ console.warn("jobType value not found in dropdown options");
486
+ queryParams.remove(["jobType"]);
487
+ }
488
+ }
489
+
458
490
  async function updateMapMarkers(_$w){
459
491
  const numOfItems = await _$w('#jobsDataset').getTotalCount();
460
492
  const items = await _$w('#jobsDataset').getItems(0, numOfItems);