sr-npm 1.2.19 → 1.2.21
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/collectionConsts.js +2 -0
- package/backend/data.js +12 -4
- package/backend/utils.js +7 -1
- package/package.json +1 -1
- package/pages/boardPeoplePage.js +2 -4
- package/pages/brandPage.js +1 -0
- package/pages/careersMultiBoxesPage.js +15 -11
- package/pages/careersPage.js +1 -10
|
@@ -14,6 +14,7 @@ const COLLECTIONS = {
|
|
|
14
14
|
const JOBS_COLLECTION_FIELDS = {
|
|
15
15
|
LOCATION: 'location',
|
|
16
16
|
TITLE: 'title',
|
|
17
|
+
SLUG: 'slug',
|
|
17
18
|
LOCATION_ADDRESS: 'locationAddress',
|
|
18
19
|
COUNTRY: 'country',
|
|
19
20
|
DEPARTMENT: 'department',
|
|
@@ -77,6 +78,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
77
78
|
JOBS: [
|
|
78
79
|
{key:'location', type: 'OBJECT'},
|
|
79
80
|
{key:'title', type: 'TEXT'},
|
|
81
|
+
{key:'slug', type: 'TEXT'},
|
|
80
82
|
{key:'locationAddress', type: 'ADDRESS'},
|
|
81
83
|
{key:'country', type: 'TEXT'},
|
|
82
84
|
{key:'department', type: 'TEXT'},
|
package/backend/data.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
2
|
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
4
|
-
|
|
5
|
-
const { chunkedBulkOperation, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeString} = require('./utils');
|
|
4
|
+
|
|
6
5
|
const { getAllPositions } = require('./queries');
|
|
7
6
|
const { retrieveSecretVal, getTokenFromCMS ,getApiKeys} = require('./secretsData');
|
|
7
|
+
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE,TOKEN_NAME,CUSTOM_VALUES_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
8
|
+
const { chunkedBulkOperation,
|
|
9
|
+
countJobsPerGivenField,
|
|
10
|
+
fillCityLocationAndLocationAddress,
|
|
11
|
+
prepareToSaveArray,
|
|
12
|
+
normalizeString,
|
|
13
|
+
generateSlug}
|
|
14
|
+
= require('./utils');
|
|
8
15
|
|
|
9
16
|
let customValuesToJobs = {}
|
|
10
17
|
let locationToJobs = {}
|
|
@@ -41,7 +48,7 @@ async function filterBasedOnBrand(positions) {
|
|
|
41
48
|
|
|
42
49
|
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
43
50
|
validateSingleDesiredBrand(desiredBrand);
|
|
44
|
-
console.log("filtering positions based on brand: ", desiredBrand)
|
|
51
|
+
console.log("filtering positions based on brand: ", desiredBrand);
|
|
45
52
|
return positions.content.filter(position => {
|
|
46
53
|
const brand = getBrand(position.customField);
|
|
47
54
|
if (!brand) return false;
|
|
@@ -110,7 +117,7 @@ async function saveJobsDataToCMS() {
|
|
|
110
117
|
const customFieldsLabels = {}
|
|
111
118
|
const customFieldsValues = {}
|
|
112
119
|
|
|
113
|
-
const {companyId,templateType} = await getApiKeys();
|
|
120
|
+
const {companyId ,templateType} = await getApiKeys();
|
|
114
121
|
if(siteconfig===undefined) {
|
|
115
122
|
await getSiteConfig();
|
|
116
123
|
}
|
|
@@ -120,6 +127,7 @@ async function saveJobsDataToCMS() {
|
|
|
120
127
|
const basicJob = {
|
|
121
128
|
_id: position.id,
|
|
122
129
|
title: position.name || '',
|
|
130
|
+
slug: generateSlug(position.name || ''),
|
|
123
131
|
department: position.department?.label || 'Other',
|
|
124
132
|
cityText: normalizeString(position.location?.city),
|
|
125
133
|
location: position.location && Object.keys(position.location).length > 0
|
package/backend/utils.js
CHANGED
|
@@ -65,6 +65,12 @@ function normalizeString(str) {
|
|
|
65
65
|
.trim();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function generateSlug(title){
|
|
69
|
+
return title
|
|
70
|
+
.replace(/[^a-z0-9-]+/g, "-")
|
|
71
|
+
.replace(/-+/g, "-")
|
|
72
|
+
.replace(/^-|-$/g, "");
|
|
73
|
+
}
|
|
68
74
|
|
|
69
75
|
|
|
70
76
|
module.exports = {
|
|
@@ -74,5 +80,5 @@ module.exports = {
|
|
|
74
80
|
fillCityLocationAndLocationAddress,
|
|
75
81
|
prepareToSaveArray,
|
|
76
82
|
normalizeString,
|
|
77
|
-
|
|
83
|
+
generateSlug,
|
|
78
84
|
};
|
package/package.json
CHANGED
package/pages/boardPeoplePage.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
const { location } = require("@wix/site-location");
|
|
3
|
-
async function boardPeoplePageOnReady(_$w,) {
|
|
4
3
|
|
|
4
|
+
async function boardPeoplePageOnReady(_$w,) {
|
|
5
5
|
await bindBoardPeopleRepeaters(_$w);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
6
|
+
}
|
|
9
7
|
|
|
10
8
|
async function bindBoardPeopleRepeaters(_$w) {
|
|
11
9
|
|
package/pages/brandPage.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
2
|
+
const { CAREERS_PAGE_SELECTORS } = require('../public/selectors');
|
|
2
3
|
|
|
4
|
+
const { window } = require('@wix/site-window');
|
|
3
5
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
4
6
|
const { location } = require("@wix/site-location");
|
|
5
7
|
const {CAREERS_MULTI_BOXES_PAGE_CONSTS,FiltersIds,fieldTitlesInCMS,possibleUrlParams} = require('../backend/careersMultiBoxesPageIds');
|
|
6
8
|
const { groupValuesByField, debounce, getAllRecords, getFieldById, getFieldByTitle,getCorrectOption,getOptionIndexFromCheckBox,loadPrimarySearchRepeater,bindPrimarySearch,primarySearch } = require('./pagesUtils');
|
|
7
9
|
|
|
10
|
+
|
|
8
11
|
let dontUpdateThisCheckBox;
|
|
9
12
|
const selectedByField = new Map(); // fieldId -> array of selected value IDs
|
|
10
13
|
const optionsByFieldId = new Map(); // fieldId -> [{label, value}] array of objects with label which is the valueLabel and value which is the valueId
|
|
@@ -22,28 +25,29 @@ const pagination = {
|
|
|
22
25
|
pageSize: 10,
|
|
23
26
|
currentPage: 1,
|
|
24
27
|
};
|
|
28
|
+
|
|
25
29
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
26
30
|
//to handle back and forth , url changes
|
|
27
31
|
onChange(async ()=>{
|
|
28
32
|
await handleBackAndForth(_$w);
|
|
29
33
|
});
|
|
30
34
|
|
|
31
|
-
bindSearchInput(_$w);
|
|
32
|
-
loadPaginationButtons(_$w);
|
|
33
35
|
await loadData(_$w);
|
|
34
36
|
loadJobsRepeater(_$w);
|
|
35
37
|
loadPrimarySearchRepeater(_$w);
|
|
36
38
|
await loadFilters(_$w);
|
|
37
39
|
loadSelectedValuesRepeater(_$w);
|
|
40
|
+
bindSearchInput(_$w);
|
|
41
|
+
loadPaginationButtons(_$w);
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
if (await window.formFactor() === "Mobile") {
|
|
44
|
+
handleFilterInMobile(_$w);
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
await handleUrlParams(_$w, urlParams);
|
|
48
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
|
|
49
|
+
await clearAll(_$w);
|
|
50
|
+
});
|
|
47
51
|
|
|
48
52
|
}
|
|
49
53
|
|
|
@@ -273,7 +277,6 @@ async function loadData() {
|
|
|
273
277
|
console.error('Failed to load data:', error);
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
|
-
|
|
277
280
|
async function loadJobsRepeater(_$w) {
|
|
278
281
|
try {
|
|
279
282
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
|
|
@@ -305,7 +308,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
305
308
|
async function loadFilters(_$w) {
|
|
306
309
|
try {
|
|
307
310
|
// 1) Load all categories (fields)
|
|
308
|
-
const cities
|
|
311
|
+
const cities=await getAllRecords(COLLECTIONS.CITIES);
|
|
309
312
|
for(const city of cities) {
|
|
310
313
|
valueToJobs[city._id]=city.jobIds;
|
|
311
314
|
}
|
|
@@ -367,6 +370,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
367
370
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
368
371
|
}, 150);
|
|
369
372
|
_$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
|
|
373
|
+
|
|
370
374
|
}
|
|
371
375
|
await refreshFacetCounts(_$w);
|
|
372
376
|
|
package/pages/careersPage.js
CHANGED
|
@@ -7,7 +7,7 @@ const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
|
7
7
|
const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
|
|
8
8
|
const { debounce, getFilter} = require('../public/filterUtils');
|
|
9
9
|
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors');
|
|
10
|
-
|
|
10
|
+
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
11
|
|
|
12
12
|
let currentLoadedItems =100;
|
|
13
13
|
const itemsPerPage = 100;
|
|
@@ -29,10 +29,6 @@ async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
|
29
29
|
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
30
30
|
siteconfig = queryResult.items[0];
|
|
31
31
|
}
|
|
32
|
-
if(siteconfig===undefined) {
|
|
33
|
-
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
34
|
-
siteconfig = queryResult.items[0];
|
|
35
|
-
}
|
|
36
32
|
|
|
37
33
|
if(siteconfig.customFields==="true") {
|
|
38
34
|
await careersMultiBoxesPageOnReady(_$w,queryParams);
|
|
@@ -225,7 +221,6 @@ async function handleBackAndForth(_$w){
|
|
|
225
221
|
}
|
|
226
222
|
else{
|
|
227
223
|
queryDepartmentVar=undefined;
|
|
228
|
-
deletedParam=true;
|
|
229
224
|
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = '';
|
|
230
225
|
}
|
|
231
226
|
if(newQueryParams.location){
|
|
@@ -233,7 +228,6 @@ async function handleBackAndForth(_$w){
|
|
|
233
228
|
}
|
|
234
229
|
else{
|
|
235
230
|
queryLocationVar=undefined;
|
|
236
|
-
deletedParam=true
|
|
237
231
|
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = '';
|
|
238
232
|
}
|
|
239
233
|
if(newQueryParams.keyWord){
|
|
@@ -241,7 +235,6 @@ async function handleBackAndForth(_$w){
|
|
|
241
235
|
}
|
|
242
236
|
else{
|
|
243
237
|
queryKeyWordVar=undefined;
|
|
244
|
-
deletedParam=true;
|
|
245
238
|
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = '';
|
|
246
239
|
}
|
|
247
240
|
if(newQueryParams.jobType){
|
|
@@ -249,7 +242,6 @@ async function handleBackAndForth(_$w){
|
|
|
249
242
|
}
|
|
250
243
|
else{
|
|
251
244
|
queryJobTypeVar=undefined;
|
|
252
|
-
deletedParam=true;
|
|
253
245
|
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = '';
|
|
254
246
|
}
|
|
255
247
|
if(_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible){
|
|
@@ -258,7 +250,6 @@ async function handleBackAndForth(_$w){
|
|
|
258
250
|
}
|
|
259
251
|
else{
|
|
260
252
|
queryBrandVar=undefined;
|
|
261
|
-
deletedParam=true;
|
|
262
253
|
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
|
|
263
254
|
}
|
|
264
255
|
}
|