sr-npm 1.7.865 → 1.7.867

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.
@@ -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,11 +107,8 @@ const supportTeamsPageIds={
107
107
  "Commercial":"CommercialSales",// this field doesnt exists in the database
108
108
  }
109
109
  }
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
- }
110
+
111
+
115
112
 
116
113
  module.exports = {
117
114
  TASKS_NAMES,
@@ -119,5 +116,4 @@ const LINKS={
119
116
  TASKS,
120
117
  QUERY_MAX_LIMIT,
121
118
  supportTeamsPageIds,
122
- LINKS,
123
119
  };
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,16 @@ 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.EXTERNAL){
148
+ getVisibility(position,customFieldsValues);
149
+ }
150
+
135
151
  return basicJob;
136
152
  });
137
153
  if(siteconfig===undefined) {
@@ -183,8 +199,9 @@ async function insertJobsReference(valueId) {
183
199
  }
184
200
 
185
201
  async function populateCustomFieldsCollection(customFields) {
186
- fieldstoinsert=[]
202
+ let fieldstoinsert=[]
187
203
  customFields["employmentType"] = "Employment Type";
204
+ customFields["Visibility"] = "Visibility";
188
205
  for(const ID of Object.keys(customFields)){
189
206
  fieldstoinsert.push({
190
207
  title: customFields[ID],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.865",
3
+ "version": "1.7.867",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
@@ -6,6 +6,5 @@ module.exports = {
6
6
  ...require('./pagesUtils'),
7
7
  ...require('./brandPage'),
8
8
  ...require('./supportTeamsPage'),
9
- ...require('./masterPage'),
10
9
  };
11
10
 
@@ -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
  }
@@ -1,38 +0,0 @@
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 companyId;
7
- async function masterPageOnReady(_$w) {
8
- const {companyId,templateType} = await getApiKeys();
9
- this.companyId=companyId;
10
- console.log("companyId: ", this.companyId);
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}",this.companyId));
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
- };