sr-npm 1.7.355 → 1.7.357

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.355",
3
+ "version": "1.7.357",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,6 +21,7 @@ const {
21
21
  let queryLocationVar;
22
22
  let queryJobTypeVar;
23
23
  let searchInputBlurredFirstTime=true;
24
+ let deletedParam=false;
24
25
  async function careersPageOnReady(_$w,thisObject,queryParams) {
25
26
  console.log("queryParams: ", queryParams);
26
27
  const { page, keyWord, department, location,jobType } = queryParams;
@@ -87,6 +88,11 @@ async function setPageParamInUrl() {
87
88
 
88
89
  }
89
90
  async function handleUrlParams(_$w) {
91
+ console.log("queryKeyWordVar: ", queryKeyWordVar);
92
+ console.log("queryPageVar: ", queryPageVar);
93
+ console.log("queryDepartmentVar: ", queryDepartmentVar);
94
+ console.log("queryLocationVar: ", queryLocationVar);
95
+ console.log("queryJobTypeVar: ", queryJobTypeVar);
90
96
  if (queryKeyWordVar) {
91
97
  await handleKeyWordParam(_$w,queryKeyWordVar);
92
98
  }
@@ -108,7 +114,7 @@ async function handleUrlParams(_$w) {
108
114
  async function handleKeyWordParam(_$w,keyWord) {
109
115
  _$w('#searchInput').value = keyWord;
110
116
  // Use applyFilters to maintain consistency instead of directly setting filter
111
-
117
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
112
118
  }
113
119
 
114
120
  async function handlePageParam(_$w) {
@@ -171,7 +177,10 @@ function init(_$w) {
171
177
  searchInputBlurredFirstTime=false;
172
178
  }
173
179
  });
174
- _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(applyFilters(_$w));
180
+ _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>{
181
+ console.log("onChange triggering on dropdown@@@@@@");
182
+ applyFilters(_$w);
183
+ });
175
184
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
176
185
 
177
186
  _$w('#openFiltersButton').onClick(()=>{
@@ -185,6 +194,59 @@ function init(_$w) {
185
194
  //URL onChange
186
195
  onChange(async ()=>{
187
196
  await handleBackAndForth(_$w);
197
+
198
+
199
+
200
+
201
+
202
+
203
+ //try onready first
204
+ //try location to
205
+
206
+
207
+
208
+
209
+
210
+ // handleBackAndForth(_$w);
211
+ // const newQueryParams=await location.query();
212
+ // console.log("location.query(): ", newQueryParams);
213
+ // if(newQueryParams.keyWord){
214
+ // console.log("setting querykeyparam")
215
+ // queryKeyWordVar=newQueryParams.keyWord;
216
+ // }
217
+ // else
218
+ // {
219
+ // queryKeyWordVar=undefined;
220
+ // _$w('#searchInput').value = '';
221
+ // deletedParam=true;
222
+ // }
223
+ // if(newQueryParams.department){
224
+ // console.log("setting queryDepartmentVar")
225
+ // queryDepartmentVar=newQueryParams.department;
226
+ // }
227
+ // else
228
+ // {
229
+ // queryDepartmentVar=undefined;
230
+ // _$w('#dropdownDepartment').value = '';
231
+ // deletedParam=true;
232
+ // }
233
+ // if(newQueryParams.location){
234
+ // console.log("setting queryLocationVar")
235
+ // queryLocationVar=newQueryParams.location;
236
+ // }
237
+ // else
238
+ // {
239
+ // queryLocationVar=undefined;
240
+ // _$w('#dropdownLocation').value = '';
241
+ // deletedParam=true;
242
+ // }
243
+
244
+ // await handleUrlParams(_$w);
245
+ // if(deletedParam)
246
+ // {
247
+ // await applyFilters(_$w,true);
248
+ // deletedParam=false;
249
+ // }
188
250
  });
189
251
 
190
252
 
@@ -229,6 +291,9 @@ async function handleBackAndForth(_$w){
229
291
  _$w('#dropdownJobType').value = '';
230
292
  }
231
293
  await handleUrlParams(_$w);
294
+ // if(deletedParam){
295
+ // await applyFilters(_$w,true);
296
+ // }
232
297
 
233
298
  }
234
299
 
@@ -259,12 +324,15 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
259
324
  if (!skipUrlUpdate) {
260
325
  if(filter.field === 'title'){
261
326
  queryParams.add({ keyWord: filter.value });
327
+ // queryKeyWordVar=filter.value;
262
328
  }
263
329
  if(filter.field === 'department'){
264
330
  queryParams.add({ department: encodeURIComponent(filter.value) });
331
+ //queryDepartmentVar=filter.value;
265
332
  }
266
333
  if(filter.field === 'cityText'){
267
334
  queryParams.add({ location: encodeURIComponent(filter.value) });
335
+ //queryLocationVar=filter.value;
268
336
  }
269
337
  if(filter.field === 'remote'){
270
338
  if(filter.value === 'true'){
@@ -273,6 +341,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
273
341
  else{
274
342
  queryParams.add({ jobType: encodeURIComponent("onsite") });
275
343
  }
344
+ //queryJobTypeVar=filter.value;
276
345
  }
277
346
  }
278
347
  if(filter.field === 'remote') {
@@ -286,18 +355,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
286
355
  if (!skipUrlUpdate) {
287
356
  if(filter.field === 'title'){
288
357
  queryParams.remove(["keyWord" ]);
358
+ // queryKeyWordVar=undefined;
289
359
  }
290
360
  if(filter.field === 'department'){
291
361
  console.log("removing department from url")
292
362
  queryParams.remove(["department" ]);
363
+ // queryDepartmentVar=undefined;
293
364
  }
294
365
  if(filter.field === 'cityText'){
295
366
  console.log("removing location from url")
296
367
  queryParams.remove(["location" ]);
368
+ // queryLocationVar=undefined;
297
369
  }
298
370
  if(filter.field === 'remote'){
299
371
  console.log("removing jobType from url")
300
372
  queryParams.remove(["jobType" ]);
373
+ // queryJobTypeVar=undefined;
301
374
  }
302
375
  }
303
376
  }
@@ -365,6 +438,7 @@ async function handleDepartmentParam(_$w,department) {
365
438
  {
366
439
  console.log("department value found in dropdown options ",departmentValue);
367
440
  _$w('#dropdownDepartment').value = departmentValue;
441
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
368
442
  }
369
443
  else{
370
444
  console.warn("department value not found in dropdown options");
@@ -405,6 +479,7 @@ async function handleLocationParam(_$w,location) {
405
479
 
406
480
  if(option){
407
481
  _$w('#dropdownLocation').value = option.value;
482
+ // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
408
483
  }
409
484
  else{
410
485
  console.warn("location value not found in dropdown options");
@@ -417,9 +492,17 @@ async function handleJobTypeParam(_$w,jobType) {
417
492
  const jobTypeValue = decodeURIComponent(jobType);
418
493
  let dropdownOptions = _$w('#dropdownJobType').options;
419
494
  console.log("jobType dropdown options:", dropdownOptions);
420
- const option=_$w('#dropdownJobType').options.find(option => option.value.toLowerCase() === jobTypeValue.toLowerCase())
495
+ let option;
496
+ if(jobTypeValue.toLocaleLowerCase==="remote"){
497
+ option="true";
498
+ }
499
+ if(jobTypeValue.toLocaleLowerCase==="onsite"){
500
+ option="false";
501
+ }
502
+ //const option=_$w('#dropdownJobType').options.find(option => option.value.toLowerCase() === jobTypeValue.toLowerCase())
421
503
  if(option){
422
- _$w('#dropdownJobType').value = option.value;
504
+
505
+ _$w('#dropdownJobType').value = option;
423
506
  }
424
507
  else{
425
508
  console.warn("jobType value not found in dropdown options");