sr-npm 1.7.256 → 1.7.258

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.256",
3
+ "version": "1.7.258",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@ const {
7
7
  debounce,
8
8
  getFilter,
9
9
  } = require('../public/filterUtils');
10
-
10
+ const { filterBrokenMarkers } = require('../public/utils');
11
11
  let currentLoadedItems =100;
12
12
  const itemsPerPage = 100;
13
13
  let allJobs=[]
@@ -349,20 +349,7 @@ async function handleLocationParam(_$w,location) {
349
349
  async function updateMapMarkers(_$w){
350
350
  const numOfItems = await _$w('#jobsDataset').getTotalCount();
351
351
  const items = await _$w('#jobsDataset').getItems(0, numOfItems);
352
- const markers = items.items
353
- .filter(item => {
354
- const locationAddress = item.locationAddress;
355
- const location = locationAddress && locationAddress.location;
356
- return (
357
- location !== undefined &&
358
- location !== null &&
359
- location.latitude !== undefined &&
360
- location.latitude !== null &&
361
- location.longitude !== undefined &&
362
- location.longitude !== null
363
- );
364
- })
365
- .map(item => {
352
+ const markers = filterBrokenMarkers(items.items).map(item => {
366
353
  const location = item.locationAddress.location;
367
354
  return {
368
355
  location: {
package/pages/homePage.js CHANGED
@@ -2,6 +2,7 @@ const {
2
2
  debounce,
3
3
  getFilter,
4
4
  } = require('../public/filterUtils');
5
+ const { filterBrokenMarkers } = require('../public/utils');
5
6
  const { handleOnLocationClick } = require('../public/mapUtils');
6
7
  const { location } = require('@wix/site-location');
7
8
  let thisObjectVar;
@@ -24,18 +25,15 @@ async function homePageOnReady(_$w,thisObject) {
24
25
  _$w('#citiesDataset').onReady(async () => {
25
26
  const numOfItems = await _$w('#citiesDataset').getTotalCount();
26
27
  const items = await _$w('#citiesDataset').getItems(0, numOfItems);
27
- let baseUrl = await location.baseUrl();
28
- const markers = items.items.map(item => {
28
+ const markers=filterBrokenMarkers(items.items).map(item => {
29
29
  const location = item.locationAddress.location;
30
- const cityName = encodeURIComponent(item.title); // Use the city name from the item
31
- const cityLinkUrl = `${baseUrl}/positions?location=${cityName}`; // Add city as search parameter
32
30
  return {
33
31
  location: {
34
32
  latitude: location.latitude,
35
33
  longitude: location.longitude
36
34
  },
37
- address: item.locationAddress.formatted,
38
- title: item.title,
35
+ address: item.locationAddress.formatted,
36
+ title: item.title,
39
37
  link: cityLinkUrl,
40
38
  linkTitle:`View ${item.count} Open Positions`
41
39
  };
package/public/utils.js CHANGED
@@ -22,7 +22,24 @@ function htmlToText(html) {
22
22
  return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
23
23
  }
24
24
 
25
+ function filterBrokenMarkers(items) {
26
+ return items
27
+ .filter(item => {
28
+ const locationAddress = item.locationAddress;
29
+ const location = locationAddress && locationAddress.location;
30
+ return (
31
+ location !== undefined &&
32
+ location !== null &&
33
+ location.latitude !== undefined &&
34
+ location.latitude !== null &&
35
+ location.longitude !== undefined &&
36
+ location.longitude !== null
37
+ );
38
+ })
39
+ }
40
+
25
41
 
26
42
  module.exports = {
27
- htmlToText
43
+ htmlToText,
44
+ filterBrokenMarkers
28
45
  };