sr-npm 3.1.31 → 3.1.33

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/data.js CHANGED
@@ -18,7 +18,8 @@ let locationToJobs = {}
18
18
  let siteconfig;
19
19
  let customFieldsLabels = {}
20
20
  let customFieldsValues = {}
21
- const EXCLUDED_CUSTOM_FIELDS = new Set(["Department","Country"]);
21
+ const EXCLUDED_CUSTOM_FIELDS = new Set(["Country/Region"]); //these are IDs, id:COUNTRY label:Country/Region ,
22
+
22
23
 
23
24
  function getBrand(customField) {
24
25
  return customField.find(field => field.fieldLabel === 'Brands')?.valueLabel;
@@ -98,7 +99,7 @@ function getCustomFieldsAndValuesFromPosition(position, customFieldsLabels, cust
98
99
  const customFieldsArray = Array.isArray(position?.customField) ? position.customField : [];
99
100
 
100
101
  for (const field of customFieldsArray) {
101
- if(EXCLUDED_CUSTOM_FIELDS.has(field.fieldLabel)) continue; //country and department are not custom fields, they are already in the job object
102
+ if(EXCLUDED_CUSTOM_FIELDS.has(field.fieldId)) continue; //country and department are not custom fields, they are already in the job object
102
103
 
103
104
  const fieldId = normalizeString(field.fieldId)
104
105
  const fieldLabel = field.fieldLabel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "3.1.31",
3
+ "version": "3.1.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -207,7 +207,7 @@ async function handleUrlParams(_$w,urlParams,handleBackAndForth=false) {
207
207
  applyFiltering = await queryPrimarySearchResults(_$w, decodeURIComponent(urlParams.keyword));
208
208
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value = decodeURIComponent(urlParams.keyword);
209
209
 
210
- const items = await getAllDatasetItems(_$w, GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET);
210
+ const items = await getAllDatasetItems(_$w, GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET);
211
211
 
212
212
  currentJobs = items;
213
213
  keywordAllJobs = items;
@@ -10,7 +10,7 @@ async function handlePrimarySearch(_$w, allvaluesobjects) {
10
10
  loadCategoryRepeaterData(_$w, allvaluesobjects);
11
11
 
12
12
  // wait for the jobs dataset to be ready
13
- await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReadyAsync();
13
+ await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).onReadyAsync();
14
14
 
15
15
  await bindPrimarySearch(_$w);
16
16
  }
@@ -80,10 +80,10 @@ async function handleSearchInput(_$w) {
80
80
  const callQueryPrimarySearchResults = async () => {
81
81
  await queryPrimarySearchResults(_$w, getSearchQuery(_$w));
82
82
  }
83
+
84
+ const primarySearchDebounced = debounce(() => callQueryPrimarySearchResults(), 300);
83
85
 
84
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
85
- await debounce(() => callQueryPrimarySearchResults(), 300)();
86
- });
86
+ _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(primarySearchDebounced);
87
87
 
88
88
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
89
89
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
@@ -125,14 +125,15 @@ async function queryPrimarySearchResults(_$w, query) {
125
125
 
126
126
  let filter = await getFilter(searchByTitle);
127
127
 
128
- await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
129
- await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
128
+ await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).setFilter(filter);
129
+ await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).refresh();
130
130
 
131
+
131
132
  let count=0
132
- try{
133
- count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
134
- }
135
- catch (error) {
133
+ try{
134
+ count = await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).getTotalCount();
135
+ }
136
+ catch (error) {
136
137
  if(error.message==="Cannot read properties of undefined (reading 'total')")
137
138
  {
138
139
  console.warn('failed to get total count due to known error, using 0')
@@ -149,12 +150,12 @@ catch (error) {
149
150
  }
150
151
  else {
151
152
  filter = await getFilter(searchByCity);
152
- await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
153
- await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
153
+ await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).setFilter(filter);
154
+ await _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).refresh();
154
155
 
155
156
 
156
157
  try{
157
- count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
158
+ count = _$w(GLOBAL_SECTIONS_SELECTORS.PRIMARY_SEARCH_JOBS_DATASET).getTotalCount();
158
159
  }
159
160
  catch (error) {
160
161
  if(error.message==="Cannot read properties of undefined (reading 'total')")
@@ -39,6 +39,7 @@ const CAREERS_PAGE_SELECTORS = {
39
39
 
40
40
  const GLOBAL_SECTIONS_SELECTORS = {
41
41
  JOBS_DATASET: '#jobsDataset',
42
+ PRIMARY_SEARCH_JOBS_DATASET: '#primarySearchJobsDataset',
42
43
 
43
44
  }
44
45