sr-npm 1.7.355 → 1.7.356

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