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