sr-npm 1.7.323 → 1.7.325

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.323",
3
+ "version": "1.7.325",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,7 @@
1
1
  const { getAllPositions } = require('../backend/queries');
2
2
  const {wixData} = require('wix-data');
3
3
  const { window } = require('@wix/site-window');
4
- //const { query,queryParams} = require("wix-location-frontend");
5
- const {wixLocationFrontend} = require("wix-location-frontend");
4
+ const { query,queryParams,onChange} = require("wix-location-frontend");
6
5
  const {
7
6
  debounce,
8
7
  getFilter,
@@ -55,7 +54,7 @@ async function loadMoreJobs(_$w) {
55
54
  let shouldLoad = false;
56
55
  if (pageParamSet == 0) {
57
56
  shouldLoad = true;
58
- } else if (wixLocationFrontend.query.page % 2 == pageParamSet % 2) {
57
+ } else if (query.page % 2 == pageParamSet % 2) {
59
58
  shouldLoad = true;
60
59
  } else {
61
60
  pageParamSet = Number(pageParamSet) + 1;
@@ -84,6 +83,10 @@ async function setPageParamInUrl() {
84
83
 
85
84
  }
86
85
  async function handleUrlParams(_$w) {
86
+ console.log("queryKeyWordVar: ", queryKeyWordVar);
87
+ console.log("queryPageVar: ", queryPageVar);
88
+ console.log("queryDepartmentVar: ", queryDepartmentVar);
89
+ console.log("queryLocationVar: ", queryLocationVar);
87
90
  if (queryKeyWordVar) {
88
91
  await handleKeyWordParam(_$w,queryKeyWordVar);
89
92
  }
@@ -108,12 +111,12 @@ async function handlePageParam(_$w) {
108
111
 
109
112
  if(allJobs.length/itemsPerPage<queryPageVar){
110
113
  console.log(`max page is: ${allJobs.length/itemsPerPage}`)
111
- wixLocationFrontend.queryParams.add({ page: allJobs.length/itemsPerPage })
114
+ queryParams.add({ page: allJobs.length/itemsPerPage })
112
115
  }
113
116
  if(queryPageVar<=1){
114
117
  console.log("min page is : 2")
115
118
  pageParamSet=2;
116
- wixLocationFrontend.queryParams.add({ page: 2 })
119
+ queryParams.add({ page: 2 })
117
120
  }
118
121
  if (queryPageVar) {
119
122
  pageParamSet=queryPageVar;
@@ -175,8 +178,9 @@ function init(_$w) {
175
178
  _$w('#dropdownsContainer, #closeFiltersButton').collapse();
176
179
  });
177
180
 
178
- wixLocationFrontend.onChange((location)=>{
179
- console.log("onChange#@!@!@#@#@!#",location);
181
+ onChange(()=>{
182
+ console.log("URL changed onChange");
183
+ handleUrlParams(_$w);
180
184
  });
181
185
 
182
186
 
@@ -206,7 +210,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
206
210
  _$w(filter.elementId).value = '';
207
211
  filter.value = '';
208
212
  if (!skipUrlUpdate) {
209
- wixLocationFrontend.queryParams.remove(["keyWord", "department","page","location"]);
213
+ queryParams.remove(["keyWord", "department","page","location"]);
210
214
  }
211
215
  }
212
216
 
@@ -214,13 +218,13 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
214
218
  if (filter.value && filter.value.trim() !== '') {
215
219
  if (!skipUrlUpdate) {
216
220
  if(filter.field === 'title'){
217
- wixLocationFrontend.queryParams.add({ keyWord: filter.value });
221
+ queryParams.add({ keyWord: filter.value });
218
222
  }
219
223
  if(filter.field === 'department'){
220
- wixLocationFrontend.queryParams.add({ department: encodeURIComponent(filter.value) });
224
+ queryParams.add({ department: encodeURIComponent(filter.value) });
221
225
  }
222
226
  if(filter.field === 'cityText'){
223
- wixLocationFrontend.queryParams.add({ location: encodeURIComponent(filter.value) });
227
+ queryParams.add({ location: encodeURIComponent(filter.value) });
224
228
  }
225
229
  }
226
230
  if(filter.field === 'remote') {
@@ -233,13 +237,13 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
233
237
  else{
234
238
  if (!skipUrlUpdate) {
235
239
  if(filter.field === 'title'){
236
- wixLocationFrontend.queryParams.remove(["keyWord" ]);
240
+ queryParams.remove(["keyWord" ]);
237
241
  }
238
242
  if(filter.field === 'department'){
239
- wixLocationFrontend.queryParams.remove(["department" ]);
243
+ queryParams.remove(["department" ]);
240
244
  }
241
245
  if(filter.field === 'cityText'){
242
- wixLocationFrontend.queryParams.remove(["location" ]);
246
+ queryParams.remove(["location" ]);
243
247
  }
244
248
  }
245
249
  }
@@ -273,7 +277,7 @@ async function resetFilters(_$w) {
273
277
 
274
278
  _$w('#resetFiltersButton').disable();
275
279
 
276
- wixLocationFrontend.queryParams.remove(["keyWord", "department","page","location"]);
280
+ queryParams.remove(["keyWord", "department","page","location"]);
277
281
 
278
282
 
279
283
  await updateCount(_$w);
@@ -310,7 +314,7 @@ async function handleDepartmentParam(_$w,department) {
310
314
  }
311
315
  else{
312
316
  console.warn("department value not found in dropdown options");
313
- wixLocationFrontend.queryParams.remove(["department" ]);
317
+ queryParams.remove(["department" ]);
314
318
 
315
319
  }
316
320
 
@@ -351,7 +355,7 @@ async function handleLocationParam(_$w,location) {
351
355
  }
352
356
  else{
353
357
  console.warn("location value not found in dropdown options");
354
- wixLocationFrontend.queryParams.remove(["location"]);
358
+ queryParams.remove(["location"]);
355
359
  }
356
360
 
357
361
  }