sr-npm 1.7.867 → 1.7.869
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/careersMultiBoxesPageIds.js +0 -2
- package/backend/consts.js +6 -2
- package/backend/data.js +3 -20
- package/backend/index.js +1 -0
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +13 -4
- package/pages/index.js +1 -0
- package/pages/masterPage.js +38 -0
- package/pages/pagesUtils.js +2 -8
|
@@ -36,7 +36,6 @@ const CATEGORY_CUSTOM_FIELD_ID_IN_CMS='5cd8c873c9e77c0008aa7d23';
|
|
|
36
36
|
const fieldTitlesInCMS={
|
|
37
37
|
"brand": "Brands",
|
|
38
38
|
category: "Category",
|
|
39
|
-
visibility: "Visibility",
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
const FiltersIds={
|
|
@@ -47,7 +46,6 @@ const FiltersIds={
|
|
|
47
46
|
"Employment Type": 'employmentType',
|
|
48
47
|
"Contract Type": 'contractType',
|
|
49
48
|
Brands: 'Brands',
|
|
50
|
-
Visibility: 'Visibility',
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
|
package/backend/consts.js
CHANGED
|
@@ -107,8 +107,11 @@ const supportTeamsPageIds={
|
|
|
107
107
|
"Commercial":"CommercialSales",// this field doesnt exists in the database
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const LINKS={
|
|
111
|
+
Application:'https://www.smartrecruiters.com/app/employee-portal/68246e5512d84f4c00a19e62/job-applications',
|
|
112
|
+
Referrals:'https://www.smartrecruiters.com/app/referrals/',
|
|
113
|
+
login:'https://www.smartrecruiters.com/web-sso/saml/${companyId}/login',
|
|
114
|
+
}
|
|
112
115
|
|
|
113
116
|
module.exports = {
|
|
114
117
|
TASKS_NAMES,
|
|
@@ -116,4 +119,5 @@ const supportTeamsPageIds={
|
|
|
116
119
|
TASKS,
|
|
117
120
|
QUERY_MAX_LIMIT,
|
|
118
121
|
supportTeamsPageIds,
|
|
122
|
+
LINKS,
|
|
119
123
|
};
|
package/backend/data.js
CHANGED
|
@@ -4,7 +4,7 @@ const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend
|
|
|
4
4
|
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE,TOKEN_NAME,CUSTOM_VALUES_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
5
5
|
const { chunkedBulkOperation, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeString} = require('./utils');
|
|
6
6
|
const { getAllPositions } = require('./queries');
|
|
7
|
-
const { retrieveSecretVal, getTokenFromCMS
|
|
7
|
+
const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -68,16 +68,6 @@ function getLocation(position,basicJob) {
|
|
|
68
68
|
locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
|
|
69
69
|
|
|
70
70
|
}
|
|
71
|
-
function getVisibility(position,customFieldsValues) {
|
|
72
|
-
if (!customFieldsValues["Visibility"]) {
|
|
73
|
-
customFieldsValues["Visibility"] = {};
|
|
74
|
-
}
|
|
75
|
-
let visibility;
|
|
76
|
-
position.visibility.toLowerCase()==="public"? visibility="external" : visibility="internal";
|
|
77
|
-
customFieldsValues["Visibility"][visibility] = visibility;
|
|
78
|
-
customValuesToJobs[visibility] ? customValuesToJobs[visibility].push(position.id) : customValuesToJobs[visibility]=[position.id]
|
|
79
|
-
}
|
|
80
|
-
|
|
81
71
|
function getEmploymentType(position,customFieldsValues) {
|
|
82
72
|
if (!customFieldsValues["employmentType"]) {
|
|
83
73
|
customFieldsValues["employmentType"] = {};
|
|
@@ -109,8 +99,6 @@ async function saveJobsDataToCMS() {
|
|
|
109
99
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
110
100
|
const customFieldsLabels = {}
|
|
111
101
|
const customFieldsValues = {}
|
|
112
|
-
|
|
113
|
-
const {companyId,templateType} = await getApiKeys();
|
|
114
102
|
|
|
115
103
|
// bulk insert to jobs collection without descriptions first
|
|
116
104
|
const jobsData = sourcePositions.map(position => {
|
|
@@ -138,16 +126,12 @@ async function saveJobsDataToCMS() {
|
|
|
138
126
|
brand: getBrand(position.customField),
|
|
139
127
|
jobDescription: null, // Will be filled later
|
|
140
128
|
employmentType: position.typeOfEmployment.label,
|
|
141
|
-
releasedDate: position.releasedDate
|
|
129
|
+
releasedDate: position.releasedDate
|
|
142
130
|
};
|
|
143
131
|
|
|
144
132
|
getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
|
|
145
133
|
getEmploymentType(position,customFieldsValues);
|
|
146
134
|
getLocation(position,basicJob);
|
|
147
|
-
if(templateType===TEMPLATE_TYPE.EXTERNAL){
|
|
148
|
-
getVisibility(position,customFieldsValues);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
135
|
return basicJob;
|
|
152
136
|
});
|
|
153
137
|
if(siteconfig===undefined) {
|
|
@@ -199,9 +183,8 @@ async function insertJobsReference(valueId) {
|
|
|
199
183
|
}
|
|
200
184
|
|
|
201
185
|
async function populateCustomFieldsCollection(customFields) {
|
|
202
|
-
|
|
186
|
+
fieldstoinsert=[]
|
|
203
187
|
customFields["employmentType"] = "Employment Type";
|
|
204
|
-
customFields["Visibility"] = "Visibility";
|
|
205
188
|
for(const ID of Object.keys(customFields)){
|
|
206
189
|
fieldstoinsert.push({
|
|
207
190
|
title: customFields[ID],
|
package/backend/index.js
CHANGED
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ const pagination = {
|
|
|
21
21
|
currentPage: 1,
|
|
22
22
|
};
|
|
23
23
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
24
|
+
console.log("careersMultiBoxesPageOnReady urlParams: ", urlParams);
|
|
24
25
|
await loadData(_$w);
|
|
25
26
|
|
|
26
27
|
await Promise.all([
|
|
@@ -39,6 +40,7 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
async function clearAll(_$w) {
|
|
43
|
+
console.log("clear all button clicked");
|
|
42
44
|
if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
|
|
43
45
|
for(const field of allfields) {
|
|
44
46
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
@@ -56,12 +58,10 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
56
58
|
try {
|
|
57
59
|
let applyFiltering=false;
|
|
58
60
|
let keyword=false
|
|
61
|
+
console.log("handleUrlParams urlParams: ", urlParams);
|
|
59
62
|
if(urlParams.brand) {
|
|
60
63
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
61
64
|
}
|
|
62
|
-
if(urlParams.visibility) {
|
|
63
|
-
applyFiltering=await handleParams(_$w,"visibility",urlParams.visibility)
|
|
64
|
-
}
|
|
65
65
|
if(urlParams.category) {
|
|
66
66
|
applyFiltering=await handleParams(_$w,"category",urlParams.category)
|
|
67
67
|
}
|
|
@@ -71,6 +71,7 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
71
71
|
keyword=true;
|
|
72
72
|
if(applyFiltering)
|
|
73
73
|
{
|
|
74
|
+
console.log("delete me")
|
|
74
75
|
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -104,9 +105,12 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
104
105
|
|
|
105
106
|
async function handleParams(_$w,param,value) {
|
|
106
107
|
let applyFiltering=false;
|
|
108
|
+
console.log("handleParams param: ", param, " value: ", value);
|
|
107
109
|
const decodedValue = decodeURIComponent(value);
|
|
110
|
+
console.log("decodedValue: ", decodedValue);
|
|
108
111
|
const field=getFieldByTitle(fieldTitlesInCMS[param],allfields);
|
|
109
112
|
const options=optionsByFieldId.get(field._id);
|
|
113
|
+
console.log("all options availbe for this field: ", field.title, " are ", options);
|
|
110
114
|
const option=getCorrectOption(decodedValue,options);
|
|
111
115
|
if(option) {
|
|
112
116
|
const optionIndex=getOptionIndexFromCheckBox(_$w(`#${FiltersIds[field.title]}CheckBox`).options,option.value);
|
|
@@ -234,6 +238,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
234
238
|
// 2) Load all values once and group them by referenced field
|
|
235
239
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
236
240
|
valuesByFieldId.set("Location",cities)
|
|
241
|
+
|
|
237
242
|
// Build CheckboxGroup options for this field
|
|
238
243
|
|
|
239
244
|
const counter={}
|
|
@@ -262,6 +267,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
262
267
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
263
268
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
264
269
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
270
|
+
console.log(`#${FiltersIds[field.title]}CheckBox.selectedIndices: `, _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices);
|
|
265
271
|
dontUpdateThisCheckBox=field._id;
|
|
266
272
|
const selected = ev.target.value; // array of selected value IDs
|
|
267
273
|
if (selected && selected.length) {
|
|
@@ -272,11 +278,14 @@ async function loadJobsRepeater(_$w) {
|
|
|
272
278
|
await updateJobsAndNumbersAndFilters(_$w);
|
|
273
279
|
|
|
274
280
|
});
|
|
281
|
+
|
|
275
282
|
const runFilter = debounce(() => {
|
|
276
283
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
277
284
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
278
285
|
}, 150);
|
|
286
|
+
|
|
279
287
|
_$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
|
|
288
|
+
|
|
280
289
|
|
|
281
290
|
}
|
|
282
291
|
await refreshFacetCounts(_$w);
|
|
@@ -323,7 +332,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
323
332
|
const filtered = searchQuery
|
|
324
333
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
325
334
|
: withCounts;
|
|
326
|
-
|
|
335
|
+
|
|
327
336
|
// Preserve currently selected values that are still visible
|
|
328
337
|
let prevSelected=[]
|
|
329
338
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
package/pages/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const{isElementExistOnPage} = require('psdev-utils');
|
|
2
|
+
const { location } = require("@wix/site-location");
|
|
3
|
+
const { LINKS } = require('../backend/consts');
|
|
4
|
+
// const {getApiKeys} = require('../backend/secretsData');
|
|
5
|
+
|
|
6
|
+
let companyIdGlobal;
|
|
7
|
+
async function masterPageOnReady(_$w,getApiKeys) {
|
|
8
|
+
const {companyId,templateType} = await getApiKeys();
|
|
9
|
+
companyIdGlobal=companyId;
|
|
10
|
+
console.log("companyId: ", companyIdGlobal);
|
|
11
|
+
bindButton(_$w,"myApplication");
|
|
12
|
+
bindButton(_$w,"myReferrals");
|
|
13
|
+
bindButton(_$w,"login");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function bindButton(_$w,buttonName) {
|
|
17
|
+
if(isElementExistOnPage(_$w(`#${buttonName}Button`))){
|
|
18
|
+
if(buttonName==="login"){
|
|
19
|
+
|
|
20
|
+
_$w(`#${buttonName}Button`).onClick(()=>{
|
|
21
|
+
console.log("login button clicked");
|
|
22
|
+
location.to(LINKS[buttonName].replace("${companyId}",companyIdGlobal));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else{
|
|
26
|
+
_$w(`#${buttonName}Button`).onClick(()=>{
|
|
27
|
+
console.log(`${buttonName} button clicked`);
|
|
28
|
+
location.to(LINKS[buttonName]);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else{
|
|
33
|
+
console.log(`${buttonName} button not found`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
module.exports = {
|
|
37
|
+
masterPageOnReady,
|
|
38
|
+
};
|
package/pages/pagesUtils.js
CHANGED
|
@@ -152,21 +152,15 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
152
152
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
|
+
|
|
155
156
|
let filteredJobs=alljobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
156
157
|
if(filteredJobs.length>0) {
|
|
158
|
+
//currentJobs=filteredJobs;
|
|
157
159
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
158
160
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
159
161
|
return true;
|
|
160
162
|
}
|
|
161
163
|
else {
|
|
162
|
-
console.log("searching by location")
|
|
163
|
-
//search by location
|
|
164
|
-
filteredJobs=alljobs.filter(job=>job.location.fullLocation.toLowerCase().includes(query));
|
|
165
|
-
if(filteredJobs.length>0) {
|
|
166
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("jobResults");
|
|
167
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data = filteredJobs
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
164
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
171
165
|
return false;
|
|
172
166
|
}
|