sr-npm 1.7.251 → 1.7.253
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/data.js +7 -0
- package/backend/utils.js +11 -1
- package/package.json +1 -1
- package/pages/careersPage.js +37 -22
package/backend/data.js
CHANGED
|
@@ -54,6 +54,13 @@ async function saveJobsDataToCMS() {
|
|
|
54
54
|
return basicJob;
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
58
|
+
jobsData.sort((a, b) => {
|
|
59
|
+
const titleA = a.title || '';
|
|
60
|
+
const titleB = b.title || '';
|
|
61
|
+
return titleA.localeCompare(titleB, undefined, { sensitivity: 'base', numeric: true });
|
|
62
|
+
});
|
|
63
|
+
|
|
57
64
|
const chunkSize = 1000;
|
|
58
65
|
let totalSaved = 0;
|
|
59
66
|
const totalChunks = Math.ceil(jobsData.length / chunkSize);
|
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
|
|
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
package/pages/careersPage.js
CHANGED
|
@@ -51,7 +51,6 @@ function activateAutoLoad(_$w)
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
async function loadMoreJobs(_$w) {
|
|
54
|
-
//const query = await location.query();
|
|
55
54
|
let shouldLoad = false;
|
|
56
55
|
if (pageParamSet == 0) {
|
|
57
56
|
shouldLoad = true;
|
|
@@ -84,7 +83,6 @@ async function setPageParamInUrl() {
|
|
|
84
83
|
|
|
85
84
|
}
|
|
86
85
|
async function handleUrlParams(_$w) {
|
|
87
|
-
// const query = await location.query();
|
|
88
86
|
if (queryKeyWordVar) {
|
|
89
87
|
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
90
88
|
}
|
|
@@ -145,10 +143,11 @@ async function handlePageParam(_$w) {
|
|
|
145
143
|
async function bind(_$w) {
|
|
146
144
|
await _$w('#jobsDataset').onReady(async () => {
|
|
147
145
|
await updateCount(_$w);
|
|
146
|
+
await updateMapMarkers(_$w);
|
|
148
147
|
|
|
149
148
|
});
|
|
150
149
|
|
|
151
|
-
if (await window.formFactor === "Mobile") {
|
|
150
|
+
if (await window.formFactor() === "Mobile") {
|
|
152
151
|
_$w('#dropdownsContainer').collapse();
|
|
153
152
|
}
|
|
154
153
|
|
|
@@ -174,15 +173,18 @@ function init(_$w) {
|
|
|
174
173
|
_$w('#closeFiltersButton').onClick(()=>{
|
|
175
174
|
_$w('#dropdownsContainer, #closeFiltersButton').collapse();
|
|
176
175
|
});
|
|
176
|
+
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
180
|
+
console.log("applying filters");
|
|
180
181
|
const dropdownFiltersMapping = [
|
|
181
182
|
{ elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
|
|
182
183
|
{ elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
|
|
183
184
|
{ elementId: '#dropdownJobType', field: 'remote', value: _$w('#dropdownJobType').value},
|
|
184
185
|
{ elementId: '#searchInput', field: 'title', value: _$w('#searchInput').value }
|
|
185
186
|
];
|
|
187
|
+
console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
|
|
186
188
|
|
|
187
189
|
|
|
188
190
|
|
|
@@ -240,7 +242,7 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
240
242
|
|
|
241
243
|
const count = await updateCount(_$w);
|
|
242
244
|
console.log("updating map markers");
|
|
243
|
-
await updateMapMarkers(_$w
|
|
245
|
+
await updateMapMarkers(_$w);
|
|
244
246
|
console.log("updating map markers completed");
|
|
245
247
|
count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
|
|
246
248
|
|
|
@@ -260,9 +262,13 @@ async function resetFilters(_$w) {
|
|
|
260
262
|
|
|
261
263
|
_$w('#resetFiltersButton').disable();
|
|
262
264
|
|
|
263
|
-
queryParams.remove(["keyWord", "department","page"]);
|
|
265
|
+
queryParams.remove(["keyWord", "department","page","location"]);
|
|
266
|
+
|
|
264
267
|
|
|
265
268
|
await updateCount(_$w);
|
|
269
|
+
console.log("reseting map markers");
|
|
270
|
+
await updateMapMarkers(_$w);
|
|
271
|
+
console.log("reseting map markers completed");
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
async function updateCount(_$w) {
|
|
@@ -340,27 +346,36 @@ async function handleLocationParam(_$w,location) {
|
|
|
340
346
|
|
|
341
347
|
}
|
|
342
348
|
|
|
343
|
-
async function updateMapMarkers(_$w
|
|
344
|
-
if(count>0){
|
|
349
|
+
async function updateMapMarkers(_$w){
|
|
345
350
|
const numOfItems = await _$w('#jobsDataset').getTotalCount();
|
|
346
351
|
const items = await _$w('#jobsDataset').getItems(0, numOfItems);
|
|
347
|
-
const markers = items.items
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
location
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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 => {
|
|
366
|
+
const location = item.locationAddress.location;
|
|
367
|
+
return {
|
|
368
|
+
location: {
|
|
369
|
+
latitude: location.latitude,
|
|
370
|
+
longitude: location.longitude
|
|
371
|
+
},
|
|
372
|
+
address: item.locationAddress.formatted,
|
|
373
|
+
title: item.title
|
|
374
|
+
};
|
|
375
|
+
});
|
|
358
376
|
//@ts-ignore
|
|
359
377
|
_$w('#googleMaps').setMarkers(markers);
|
|
360
|
-
|
|
361
|
-
else{
|
|
362
|
-
_$w('#googleMaps').setMarkers([]);
|
|
363
|
-
}
|
|
378
|
+
|
|
364
379
|
}
|
|
365
380
|
|
|
366
381
|
|