sr-npm 1.7.227 → 1.7.229

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/backend/utils.js CHANGED
@@ -48,7 +48,7 @@ function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddre
48
48
  } else {
49
49
  return Object.entries(jobsPerField).map(([value, amount]) => ({
50
50
  title: value,
51
- _id: value.replace(/\s+/g, '').replace(/&/g, 'and'),
51
+ _id: sanitizeId(value),
52
52
  count: amount,
53
53
  }));
54
54
  }
@@ -63,6 +63,15 @@ function normalizeCityName(city) {
63
63
  .trim();
64
64
  }
65
65
 
66
+ function sanitizeId(input) {
67
+ if (!input) return '';
68
+ const withoutDiacritics = String(input)
69
+ .normalize('NFD')
70
+ .replace(/\p{Diacritic}/gu, '');
71
+ const withAnd = withoutDiacritics.replace(/&/g, 'and');
72
+ return withAnd.replace(/[^A-Za-z0-9-]/g, '');
73
+ }
74
+
66
75
  module.exports = {
67
76
  chunkedBulkOperation,
68
77
  delay,
@@ -70,4 +79,5 @@ module.exports = {
70
79
  fillCityLocationAndLocationAddress,
71
80
  prepareToSaveArray,
72
81
  normalizeCityName,
82
+ sanitizeId,
73
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.227",
3
+ "version": "1.7.229",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -144,7 +144,6 @@ async function handlePageParam(_$w) {
144
144
  async function bind(_$w) {
145
145
  await _$w('#jobsDataset').onReady(async () => {
146
146
  await updateCount(_$w);
147
- await updateMapMarkers(_$w);
148
147
 
149
148
  });
150
149
 
@@ -239,7 +238,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
239
238
 
240
239
  const count = await updateCount(_$w);
241
240
  console.log("updating map markers");
242
- await updateMapMarkers(_$w);
241
+ await updateMapMarkers(_$w,count);
243
242
  console.log("updating map markers completed");
244
243
  count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
245
244
 
@@ -259,13 +258,9 @@ async function resetFilters(_$w) {
259
258
 
260
259
  _$w('#resetFiltersButton').disable();
261
260
 
262
- queryParams.remove(["keyWord", "department","page","location"]);
263
-
261
+ queryParams.remove(["keyWord", "department","page"]);
264
262
 
265
263
  await updateCount(_$w);
266
- console.log("reseting map markers");
267
- await updateMapMarkers(_$w);
268
- console.log("reseting map markers completed");
269
264
  }
270
265
 
271
266
  async function updateCount(_$w) {
@@ -343,9 +338,9 @@ async function handleLocationParam(_$w,location) {
343
338
 
344
339
  }
345
340
 
346
- async function updateMapMarkers(_$w){
341
+ async function updateMapMarkers(_$w,count){
342
+ if(count>0){
347
343
  const numOfItems = await _$w('#jobsDataset').getTotalCount();
348
- // if(numOfItems>0){
349
344
  const items = await _$w('#jobsDataset').getItems(0, numOfItems);
350
345
  const markers = items.items.map(item => {
351
346
  const location = item.locationAddress.location;
@@ -358,23 +353,12 @@ async function updateMapMarkers(_$w){
358
353
  title: item.title,
359
354
  };
360
355
  });
361
- console.log("markers: ", markers);
362
- console.log("type of markers: ", typeof markers);
363
356
  //@ts-ignore
364
357
  _$w('#googleMaps').setMarkers(markers);
365
- let getmarkers2=await _$w('#googleMaps').markers;
366
- console.log("getmarkers2: ", getmarkers2);
367
- //}
368
- // else{
369
- // console.log("no positions found");
370
- // _$w('#googleMaps').setMarkers([{
371
- // location: {
372
- // latitude: 0,
373
- // longitude: 0
374
- // },
375
- // address: "No positions found",
376
- // }]);
377
- // }
358
+ }
359
+ else{
360
+ _$w('#googleMaps').setMarkers([]);
361
+ }
378
362
  }
379
363
 
380
364