sr-npm 1.7.885 → 1.7.888

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
 
@@ -41,7 +41,7 @@ const CUSTOM_VALUES_COLLECTION_FIELDS = {
41
41
  TITLE: 'title',
42
42
  CUSTOM_FIELD: 'customField',
43
43
  MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
44
- count: 'count',
44
+ TOTAL_JOBS: 'totalJobs',
45
45
  JOB_IDS: 'jobIds',
46
46
  }
47
47
  const CUSTOM_FIELDS_COLLECTION_FIELDS = {
@@ -112,7 +112,7 @@ const COLLECTIONS_FIELDS = {
112
112
  CUSTOM_VALUES: [
113
113
  {key:'title', type: 'TEXT'},
114
114
  {key:'customField', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.CUSTOM_FIELDS } } },
115
- {key:'count', type: 'NUMBER'},
115
+ {key:'totalJobs', type: 'NUMBER'},
116
116
  {key:'multiRefJobsCustomValues', type: 'MULTI_REFERENCE', typeMetadata: { multiReference: { referencedCollectionId: COLLECTIONS.JOBS,referencingFieldKey:CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,referencingDisplayName:CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES } } },
117
117
  {key:'jobIds', type: 'ARRAY'},
118
118
  ],
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,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.INTERNAL){
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],
@@ -202,7 +219,7 @@ async function populateCustomValuesCollection(customFieldsValues) {
202
219
  _id: valueId,
203
220
  title: valuesMap[valueId],
204
221
  customField: fieldId,
205
- count:customValuesToJobs[valueId].length,
222
+ totalJobs:customValuesToJobs[valueId].length,
206
223
  jobIds:customValuesToJobs[valueId],
207
224
  })
208
225
  }
package/backend/index.js CHANGED
@@ -5,4 +5,5 @@ module.exports = {
5
5
  ...require('./consts'),
6
6
  ...require('./data'),
7
7
  ...require('./careersMultiBoxesPageIds'),
8
+ ...require ('./secretsData'),
8
9
  };
@@ -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 wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
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 wixData.query(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.885",
3
+ "version": "1.7.888",
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={}
@@ -260,14 +255,13 @@ async function loadJobsRepeater(_$w) {
260
255
 
261
256
  optionsByFieldId.set(key, originalOptions);
262
257
  for (const val of allvaluesobjects) {
263
- counter[val.title]=val.count
258
+ counter[val.title]=val.totalJobs
264
259
  }
265
260
 
266
261
  countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
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;
@@ -111,7 +111,7 @@ async function handleUrlParams(_$w) {
111
111
  await handleBrandParam(_$w,queryBrandVar);
112
112
  }
113
113
 
114
- if (siteconfig.onlyBrandKeywordUrlParams==="false") { // it is something else that is not TWG
114
+
115
115
  if (queryPageVar) {
116
116
  await handlePageParam(_$w);
117
117
  }
@@ -125,7 +125,7 @@ async function handleUrlParams(_$w) {
125
125
  await handleJobTypeParam(_$w,queryJobTypeVar);
126
126
  }
127
127
 
128
- }
128
+
129
129
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
130
130
  }
131
131
 
package/pages/homePage.js CHANGED
@@ -10,7 +10,6 @@ const { COLLECTIONS } = require('../backend/collectionConsts');
10
10
  const { bindPrimarySearch,getAllRecords,loadPrimarySearchRepeater } = require('./pagesUtils');
11
11
  let thisObjectVar;
12
12
  let searchByCityFlag=false;
13
- let loadedCategories=false;
14
13
  async function homePageOnReady(_$w,thisObject=null) {
15
14
 
16
15
  const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
@@ -20,10 +19,7 @@ async function homePageOnReady(_$w,thisObject=null) {
20
19
  const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
21
20
  await Promise.all([
22
21
  bindPrimarySearch(_$w,allvaluesobjects,allJobs),
23
- loadPrimarySearchRepeater(_$w),
24
- bindTeamRepeater(_$w),
25
- bindViewAllButton(_$w),
26
-
22
+ loadPrimarySearchRepeater(_$w)
27
23
  ]);
28
24
  }
29
25
  else{
@@ -36,9 +32,13 @@ async function homePageOnReady(_$w,thisObject=null) {
36
32
  }
37
33
 
38
34
  function bind(_$w) {
39
-
40
- bindTeamRepeater(_$w);
41
-
35
+ _$w('#teamRepeater').onItemReady(($item, itemData) => {
36
+ $item('#teamButton').label = `View ${itemData.count} Open Positions`;
37
+ $item('#teamButton').onClick(()=>{
38
+ const department = encodeURIComponent(itemData.title);
39
+ location.to(`/positions?department=${department}`);
40
+ });
41
+ });
42
42
 
43
43
  _$w('#citiesDataset').onReady(async () => {
44
44
  const numOfItems = await _$w('#citiesDataset').getTotalCount();
@@ -64,48 +64,6 @@ async function homePageOnReady(_$w,thisObject=null) {
64
64
  });
65
65
  }
66
66
 
67
- function bindTeamRepeater(_$w) {
68
- _$w('#teamRepeater').onItemReady(($item, itemData) => {
69
- $item('#teamButton').label = `View ${itemData.count} Open Positions`;
70
- console.log("itemData: ", itemData);
71
- const department = encodeURIComponent(itemData.title);
72
- if (itemData.customField) {
73
- [$item('#teamButton'), $item('#teamButton2')].forEach(btn => {
74
- btn.onClick(() => {
75
- location.to(`/search?category=${department}`);
76
- });
77
- });
78
-
79
- }
80
- else{
81
- $item('#teamButton').onClick(()=>{
82
- location.to(`/positions?department=${department}`);
83
- });
84
- }
85
- });
86
- }
87
-
88
- function bindViewAllButton(_$w) {
89
-
90
- _$w('#viewAllCategoriesButton').onClick(()=>{
91
- if(!loadedCategories) {
92
- loadedCategories=true;
93
- _$w('#viewAllCategoriesButton').label = "View Less";
94
- _$w("#categoriesDataset").loadMore();
95
- console.log("categories loaded");
96
- }
97
- else{
98
- loadedCategories=false;
99
- _$w('#viewAllCategoriesButton').label = "View All";
100
- _$w("#categoriesDataset").loadPage(1);
101
- console.log("categories reseted");
102
- }
103
- });
104
- }
105
-
106
-
107
-
108
-
109
67
  function init(_$w) {
110
68
  const debouncedInput = debounce(()=>handleSearchInput(_$w), 400,thisObjectVar);
111
69
 
package/pages/index.js CHANGED
@@ -6,5 +6,6 @@ module.exports = {
6
6
  ...require('./pagesUtils'),
7
7
  ...require('./brandPage'),
8
8
  ...require('./supportTeamsPage'),
9
+ ...require('./masterPage'),
9
10
  };
10
11
 
@@ -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
+ };
@@ -141,7 +141,7 @@ async function loadCategoriesListPrimarySearch(_$w,allvaluesobjects) {
141
141
  let categoryValues=[]
142
142
  for(const value of allvaluesobjects) {
143
143
  if(value.customField===CATEGORY_CUSTOM_FIELD_ID_IN_CMS) {
144
- categoryValues.push({title:value.title+` (${value.count})` ,_id:value._id});
144
+ categoryValues.push({title:value.title+` (${value.totalJobs})` ,_id:value._id});
145
145
  }
146
146
  }
147
147
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
@@ -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
  }
@@ -37,9 +37,10 @@ async function getCategoryValueId(customValues) {
37
37
  const item = await _$w('#datasetJobsItem').getCurrentItem();
38
38
  const multiRefField=await getPositionWithMultiRefField(item._id);
39
39
  const categoryValueId=await getCategoryValueId(multiRefField);
40
+
40
41
  handleReferFriendButton(_$w,item);
42
+
41
43
  handleApplyButton(_$w,item);
42
-
43
44
 
44
45
  _$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
45
46
  _$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
@@ -51,12 +52,12 @@ async function getCategoryValueId(customValues) {
51
52
  }
52
53
  if(_$w('#relatedJobsRepNoDepartment')) // when there is no department, we filter based on category
53
54
  {
54
- const relatedJobs=await getRelatedJobs(categoryValueId,item._id,5);
55
+ const relatedJobs=await getRelatedJobs(categoryValueId,item._id);
55
56
  _$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
56
57
  $item('#relatedJobTitle').text = itemData.title;
57
58
  $item('#relatedJobLocation').text = itemData.location.fullLocation;
58
59
  });
59
- _$w('#relatedJobsRepNoDepartment').data = relatedJobs;
60
+ _$w('#relatedJobsRepNoDepartment').data = relatedJobs
60
61
 
61
62
 
62
63
  }
@@ -82,25 +83,19 @@ async function getCategoryValueId(customValues) {
82
83
 
83
84
  function handleReferFriendButton(_$w,item) {
84
85
  if(!item.referFriendLink && isElementExistOnPage(_$w('#referFriendButton'))){
86
+ console.log("hiding referFriendButton");
85
87
  _$w('#referFriendButton').hide();
86
88
  }
87
89
  }
88
90
 
89
91
  function handleApplyButton(_$w,item) {
90
- try{
91
92
  _$w('#applyButton').target="_blank";//so it can open in new tab
92
- const url=appendQueryParams(item.applyLink,query);
93
- _$w('#applyButton').link=url; //so it can be clicked
94
- }
95
- catch(error){
96
- console.warn("error in handleApplyButton: , using applyLink directly", error);
97
- _$w('#applyButton').target="_blank";
98
- _$w('#applyButton').link=item.applyLink;
99
- }
93
+ const url=appendQueryParams(item.applyLink,query);
94
+ _$w('#applyButton').link=url; //so it can be clicked
100
95
  }
101
96
 
102
- async function getRelatedJobs(categoryValueId,itemId,limit=1000) {
103
- const relatedJobs=await wixData.query(COLLECTIONS.JOBS).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES).hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,[categoryValueId]).ne("_id",itemId).limit(limit).find();
97
+ async function getRelatedJobs(categoryValueId,itemId) {
98
+ const relatedJobs=await wixData.query(COLLECTIONS.JOBS).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES).hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,[categoryValueId]).ne("_id",itemId).find();
104
99
  return relatedJobs.items;
105
100
  }
106
101
 
@@ -158,16 +158,15 @@ describe('primarySearch function tests', () => {
158
158
 
159
159
  await primarySearch(mockW, 'unicorn hunter',mockJobs);
160
160
 
161
-
162
161
  expect(mockprimarySearchMultiBox.changeState).toHaveBeenCalledWith('noResults');
163
162
  expect(mockprimarySearcJobResult.data).toBeNull();
164
163
  });
165
164
 
166
165
  it('should fill category repeater when clicking on empty primary search input', async () => {
167
166
  const mockCategoryValues = [
168
- { _id: 'cat1', title: 'Engineering', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, count: 5 },
169
- { _id: 'cat2', title: 'Marketing', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, count: 3 },
170
- { _id: 'cat3', title: 'Sales', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, count: 7 }
167
+ { _id: 'cat1', title: 'Engineering', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 5 },
168
+ { _id: 'cat2', title: 'Marketing', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 3 },
169
+ { _id: 'cat3', title: 'Sales', customField: CATEGORY_CUSTOM_FIELD_ID_IN_CMS, totalJobs: 7 }
171
170
  ];
172
171
 
173
172
  careersMultiBoxesPage.__set__('allvaluesobjects', mockCategoryValues);