sr-npm 1.2.15 → 1.2.17

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/consts.js CHANGED
@@ -72,6 +72,9 @@ const TASKS = {
72
72
  }
73
73
  }
74
74
 
75
+
76
+
77
+
75
78
  const TASK_TYPE = {
76
79
  SCHEDULED: 'scheduled',
77
80
  EVENT: 'event',
@@ -89,6 +92,10 @@ const supportTeamsPageIds={
89
92
  VIDEO_TITLE: "#videoTitle",
90
93
  VIDEO_PLAYER: "#videoPlayer",
91
94
 
95
+
96
+
97
+
98
+
92
99
  RECENTLEY_ADDED_JOBS_ITEM: "#recentleyAddedJobsItem",
93
100
  JOB_LOCATION: "#jobLocation",
94
101
  JOB_TITLE: "#jobTitle",
@@ -130,13 +137,12 @@ const supportTeamsPageSections={
130
137
  VIDEO: "video",
131
138
  }
132
139
 
133
-
134
- module.exports = {
135
- TASKS_NAMES,
136
- TASK_TYPE,
137
- TASKS,
138
- QUERY_MAX_LIMIT,
139
- supportTeamsPageIds,
140
- LINKS,
141
- supportTeamsPageSections,
140
+ module.exports = {
141
+ TASKS_NAMES,
142
+ TASK_TYPE,
143
+ TASKS,
144
+ QUERY_MAX_LIMIT,
145
+ supportTeamsPageIds,
146
+ LINKS,
147
+ supportTeamsPageSections,
142
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,23 +22,22 @@ const pagination = {
22
22
  currentPage: 1,
23
23
  };
24
24
  async function careersMultiBoxesPageOnReady(_$w,urlParams) {
25
- await loadData(_$w);
26
- loadJobsRepeater(_$w);
27
- loadPrimarySearchRepeater(_$w);
28
- await loadFilters(_$w);
29
- loadSelectedValuesRepeater(_$w);
30
- bindSearchInput(_$w);
31
- loadPaginationButtons(_$w);
32
-
33
- if (await window.formFactor() === "Mobile") {
34
- handleFilterInMobile(_$w);
35
- }
36
-
37
- await handleUrlParams(_$w, urlParams);
38
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
39
- await clearAll(_$w);
40
- });
25
+ bindSearchInput(_$w);
26
+ // loadPrimarySearchRepeater(_$w);
27
+
28
+ // await loadData(_$w);
29
+
30
+ // loadJobsRepeater(_$w);
31
+
32
+ // await loadFilters(_$w);
33
+ // loadSelectedValuesRepeater(_$w);
41
34
 
35
+ // loadPaginationButtons(_$w);
36
+
37
+ // await handleUrlParams(_$w, urlParams);
38
+ // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
39
+ // await clearAll(_$w);
40
+ // });
42
41
  }
43
42
 
44
43
  async function clearAll(_$w) {
@@ -56,41 +55,6 @@ async function clearAll(_$w) {
56
55
  }
57
56
  }
58
57
 
59
- function handleFilterInMobile(_$w) {
60
- const searchResultsSelectors = [
61
- CAREERS_PAGE_SELECTORS.RESULT_BOX,
62
- CAREERS_PAGE_SELECTORS.PAGINATION_BTN,
63
- CAREERS_PAGE_SELECTORS.HEAD_BTNS,
64
- CAREERS_PAGE_SELECTORS.SELECTED_VALUES_REPEATER,
65
- CAREERS_PAGE_SELECTORS.BUTTOM_TXT,
66
- CAREERS_PAGE_SELECTORS.SECTION_24,
67
- CAREERS_PAGE_SELECTORS.SECTION_3,
68
- CAREERS_PAGE_SELECTORS.LINE_3,
69
- CAREERS_PAGE_SELECTORS.FILTER_ICON];
70
-
71
- _$w(CAREERS_PAGE_SELECTORS.FILTER_ICON).onClick(()=>{
72
- _$w(CAREERS_PAGE_SELECTORS.FILTER_BOX).expand();
73
- searchResultsSelectors.forEach(selector => {
74
- _$w(selector).collapse();
75
- });
76
- });
77
-
78
- const exitFilterBox = () => {
79
- _$w(CAREERS_PAGE_SELECTORS.FILTER_BOX).collapse();
80
- searchResultsSelectors.forEach(selector => {
81
- _$w(selector).expand();
82
- });
83
- }
84
-
85
- _$w(CAREERS_PAGE_SELECTORS.EXIT_BUTTON).onClick(()=>{
86
- exitFilterBox();
87
- });
88
-
89
- _$w(CAREERS_PAGE_SELECTORS.REFINE_SEARCH_BUTTON).onClick(()=>{
90
- exitFilterBox();
91
- });
92
- }
93
-
94
58
 
95
59
  async function handleUrlParams(_$w,urlParams) {
96
60
  try {
@@ -233,6 +197,7 @@ async function loadData() {
233
197
  console.error('Failed to load data:', error);
234
198
  }
235
199
  }
200
+
236
201
  async function loadJobsRepeater(_$w) {
237
202
  try {
238
203
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
@@ -264,7 +229,7 @@ async function loadJobsRepeater(_$w) {
264
229
  async function loadFilters(_$w) {
265
230
  try {
266
231
  // 1) Load all categories (fields)
267
- const cities=await getAllRecords(COLLECTIONS.CITIES);
232
+ const cities = await getAllRecords(COLLECTIONS.CITIES);
268
233
  for(const city of cities) {
269
234
  valueToJobs[city._id]=city.jobIds;
270
235
  }
@@ -299,27 +264,24 @@ async function loadJobsRepeater(_$w) {
299
264
  updateOptionsUI(_$w,field.title, field._id, ''); // no search query
300
265
  _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
301
266
  _$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
302
- console.log("i am here !!!!!")
303
- console.log("field.title: ",field.title)
304
- console.log("value: ",value)
305
- dontUpdateThisCheckBox=field._id;
306
- const selected = ev.target.value; // array of selected value IDs
307
- console.log("ev: ",ev)
308
- console.log("ev.target: ",ev.target)
309
- if (selected && selected.length) {
310
- selectedByField.set(field._id, selected);
311
- } else {
312
- selectedByField.delete(field._id);
313
- }
314
- await updateJobsAndNumbersAndFilters(_$w);
315
-
316
- });
317
- const runFilter = debounce(() => {
318
- const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
319
- updateOptionsUI(_$w, field.title, field._id, query);
267
+ dontUpdateThisCheckBox=field._id;
268
+ const selected = ev.target.value; // array of selected value IDs
269
+ console.log("ev: ",ev)
270
+ console.log("ev.target: ",ev.target)
271
+ if (selected && selected.length) {
272
+ selectedByField.set(field._id, selected);
273
+ } else {
274
+ selectedByField.delete(field._id);
275
+ }
276
+ await updateJobsAndNumbersAndFilters(_$w);
277
+ });
278
+
279
+ const runFilter = debounce(() => {
280
+ const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
281
+ updateOptionsUI(_$w, field.title, field._id, query);
282
+
320
283
  }, 150);
321
284
  _$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
322
-
323
285
  }
324
286
  await refreshFacetCounts(_$w);
325
287
 
@@ -5,10 +5,12 @@ const { query,queryParams,onChange} = require("wix-location-frontend");
5
5
  const { location } = require("@wix/site-location");
6
6
  const { COLLECTIONS } = require('../backend/collectionConsts');
7
7
  const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
8
- const { debounce, getFilter} = require('../public/filterUtils');
9
- const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors');
8
+
9
+ const {
10
+ debounce,
11
+ getFilter,
12
+ } = require('../public/filterUtils');
10
13
  const { filterBrokenMarkers } = require('../public/utils');
11
-
12
14
  let currentLoadedItems =100;
13
15
  const itemsPerPage = 100;
14
16
  let allJobs=[]
@@ -43,25 +45,22 @@ async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
43
45
  queryJobTypeVar=jobType;
44
46
  queryBrandVar=brand;
45
47
  thisObjectVar=thisObject;
46
- allJobs = await getAllPositions();
47
-
48
+ allJobs=await getAllPositions();
48
49
  activateAutoLoad(_$w);
49
50
  await bind(_$w);
50
51
  init(_$w);
51
52
  await handleBrandDropdown(_$w);
52
53
  await handleUrlParams(_$w);
53
-
54
54
  }
55
-
56
-
57
55
  }
56
+
58
57
 
59
58
  function activateAutoLoad(_$w)
60
59
  {
61
- _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(() => {
60
+ _$w("#jobsDataset").onReady(() => {
62
61
  updateCount(_$w);
63
- _$w(CAREERS_PAGE_SELECTORS.FOOTER).onViewportEnter(() => {
64
- if (currentLoadedItems<_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount()) {
62
+ _$w("#section2").onViewportEnter(() => {
63
+ if (currentLoadedItems<_$w("#jobsDataset").getTotalCount()) {
65
64
  loadMoreJobs(_$w);
66
65
  }
67
66
  else {
@@ -81,12 +80,10 @@ async function loadMoreJobs(_$w) {
81
80
  pageParamSet = Number(pageParamSet) + 1;
82
81
  }
83
82
  if (shouldLoad) {
84
- _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).loadMore();
83
+ _$w("#jobsDataset").loadMore();
85
84
  console.log("loading more jobs");
86
-
87
85
  currentLoadedItems = currentLoadedItems + itemsPerPage;
88
- const data = _$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).data;
89
-
86
+ const data = _$w("#positionsRepeater").data;
90
87
  console.log("data length is : ", data.length);
91
88
  setPageParamInUrl();
92
89
  }
@@ -109,26 +106,26 @@ async function handleUrlParams(_$w) {
109
106
  if (queryKeyWordVar) {
110
107
  await handleKeyWordParam(_$w,queryKeyWordVar);
111
108
  }
112
- if (queryBrandVar && _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible) { //if it is not visible, ignore it
109
+ if (queryBrandVar && _$w('#dropdownBrand').isVisible) { //if it is not visible, ignore it
113
110
  await handleBrandParam(_$w,queryBrandVar);
114
111
  }
115
- if (queryPageVar) {
116
- await handlePageParam(_$w);
117
- }
118
- if (queryDepartmentVar) {
119
- await handleDepartmentParam(_$w,queryDepartmentVar);
120
- }
121
- if (queryLocationVar) {
122
- await handleLocationParam(_$w,queryLocationVar);
123
- }
124
- if (queryJobTypeVar) {
125
- await handleJobTypeParam(_$w,queryJobTypeVar);
126
- }
112
+ if (queryPageVar) {
113
+ await handlePageParam(_$w);
114
+ }
115
+ if (queryDepartmentVar) {
116
+ await handleDepartmentParam(_$w,queryDepartmentVar);
117
+ }
118
+ if (queryLocationVar) {
119
+ await handleLocationParam(_$w,queryLocationVar);
120
+ }
121
+ if (queryJobTypeVar) {
122
+ await handleJobTypeParam(_$w,queryJobTypeVar);
123
+ }
127
124
  await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
128
125
  }
129
126
 
130
127
  async function handleKeyWordParam(_$w,keyWord) {
131
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = keyWord;
128
+ _$w('#searchInput').value = keyWord;
132
129
  // Use applyFilters to maintain consistency instead of directly setting filter
133
130
  }
134
131
 
@@ -148,18 +145,18 @@ async function handlePageParam(_$w) {
148
145
  //scrolls a bit to load the dataset data
149
146
  await window.scrollTo(0, 200,{scrollAnimation:false});
150
147
  for (let i = 2; i <= queryPageVar; i++) {
151
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).loadMore();
148
+ await _$w("#jobsDataset").loadMore();
152
149
  currentLoadedItems=currentLoadedItems+itemsPerPage
153
150
  }
154
151
  // the timeout is to wait for the repeater to render, then scroll to the last item.
155
152
  setTimeout(() => {
156
- const data = _$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).data;
153
+ const data = _$w("#positionsRepeater").data;
157
154
  if (data && data.length > 0) {
158
155
  //the dataset each time it loads 100 items
159
156
  const lastIndex = data.length - itemsPerPage;
160
- _$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).forEachItem(async ($item, itemData, index) => {
157
+ _$w("#positionsRepeater").forEachItem(async ($item, itemData, index) => {
161
158
  if (index === lastIndex) {
162
- await $item(CAREERS_PAGE_SELECTORS.POSITION_ITEM).scrollTo();
159
+ await $item("#positionItem").scrollTo();
163
160
  console.log("finishied scrolling inside handlePageParam")
164
161
  }
165
162
  });
@@ -170,40 +167,40 @@ async function handlePageParam(_$w) {
170
167
  }
171
168
 
172
169
  async function bind(_$w) {
173
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(async () => {
170
+ await _$w('#jobsDataset').onReady(async () => {
174
171
  await updateCount(_$w);
175
172
  await updateMapMarkers(_$w);
176
173
 
177
174
  });
178
175
 
179
176
  if (await window.formFactor() === "Mobile") {
180
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER).collapse();
177
+ _$w('#dropdownsContainer').collapse();
181
178
  }
182
179
 
183
180
  }
184
181
 
185
182
  function init(_$w) {
186
183
  const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
187
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).onInput(debouncedSearch);
188
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).onBlur(()=>{
189
- if(searchInputBlurredFirstTime && _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value.trim() !== '')
184
+ _$w('#searchInput').onInput(debouncedSearch);
185
+ _$w('#searchInput').onBlur(()=>{
186
+ if(searchInputBlurredFirstTime && _$w('#searchInput').value.trim() !== '')
190
187
  {
191
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).focus();
192
- searchInputBlurredFirstTime=false;
188
+ _$w('#searchInput').focus();
189
+ searchInputBlurredFirstTime=false;
193
190
  }
194
191
  });
195
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).onChange(()=>{
192
+ _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').onChange(()=>{
196
193
  console.log("dropdown onChange is triggered");
197
194
  applyFilters(_$w);
198
195
  });
199
- _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON, CAREERS_PAGE_SELECTORS.CLEAR_SEARCH).onClick(()=>resetFilters(_$w));
196
+ _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
200
197
 
201
- _$w(CAREERS_PAGE_SELECTORS.OPEN_FILTERS_BUTTON).onClick(()=>{
202
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER, CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).expand();
198
+ _$w('#openFiltersButton').onClick(()=>{
199
+ _$w('#dropdownsContainer, #closeFiltersButton').expand();
203
200
  });
204
201
 
205
- _$w(CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).onClick(()=>{
206
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER, CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).collapse();
202
+ _$w('#closeFiltersButton').onClick(()=>{
203
+ _$w('#dropdownsContainer, #closeFiltersButton').collapse();
207
204
  });
208
205
 
209
206
  //URL onChange
@@ -222,7 +219,7 @@ async function handleBackAndForth(_$w){
222
219
  else{
223
220
  queryDepartmentVar=undefined;
224
221
  deletedParam=true;
225
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = '';
222
+ _$w('#dropdownDepartment').value = '';
226
223
  }
227
224
  if(newQueryParams.location){
228
225
  queryLocationVar=newQueryParams.location;
@@ -230,7 +227,7 @@ async function handleBackAndForth(_$w){
230
227
  else{
231
228
  queryLocationVar=undefined;
232
229
  deletedParam=true
233
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = '';
230
+ _$w('#dropdownLocation').value = '';
234
231
  }
235
232
  if(newQueryParams.keyWord){
236
233
  queryKeyWordVar=newQueryParams.keyWord;
@@ -238,7 +235,7 @@ async function handleBackAndForth(_$w){
238
235
  else{
239
236
  queryKeyWordVar=undefined;
240
237
  deletedParam=true;
241
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = '';
238
+ _$w('#searchInput').value = '';
242
239
  }
243
240
  if(newQueryParams.jobType){
244
241
  queryJobTypeVar=newQueryParams.jobType;
@@ -246,16 +243,16 @@ async function handleBackAndForth(_$w){
246
243
  else{
247
244
  queryJobTypeVar=undefined;
248
245
  deletedParam=true;
249
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = '';
246
+ _$w('#dropdownJobType').value = '';
250
247
  }
251
- if(_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible){
248
+ if(_$w('#dropdownBrand').isVisible){
252
249
  if(newQueryParams.brand){
253
250
  queryBrandVar=newQueryParams.brand;
254
251
  }
255
252
  else{
256
253
  queryBrandVar=undefined;
257
254
  deletedParam=true;
258
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
255
+ _$w('#dropdownBrand').value = '';
259
256
  }
260
257
  }
261
258
  await handleUrlParams(_$w);
@@ -265,11 +262,11 @@ async function handleBackAndForth(_$w){
265
262
  async function applyFilters(_$w, skipUrlUpdate = false) {
266
263
  console.log("applying filters");
267
264
  const dropdownFiltersMapping = [
268
- { elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, field: 'department', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value },
269
- { elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, field: 'cityText', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value },
270
- { elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, field: 'remote', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value},
271
- { elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND, field: 'brand', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value},
272
- { elementId: CAREERS_PAGE_SELECTORS.SEARCH_INPUT, field: 'title', value: _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value }
265
+ { elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
266
+ { elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
267
+ { elementId: '#dropdownJobType', field: 'remote', value: _$w('#dropdownJobType').value},
268
+ { elementId: '#dropdownBrand', field: 'brand', value: _$w('#dropdownBrand').value},
269
+ { elementId: '#searchInput', field: 'title', value: _$w('#searchInput').value }
273
270
  ];
274
271
  console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
275
272
 
@@ -288,16 +285,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
288
285
  // build filters
289
286
  if (filter.value && filter.value.trim() !== '') {
290
287
  if (!skipUrlUpdate) {
291
- if(filter.field === FILTER_FIELDS.SEARCH){
288
+ if(filter.field === 'title'){
292
289
  queryParams.add({ keyWord: filter.value });
293
290
  }
294
- if(filter.field === FILTER_FIELDS.DEPARTMENT){
291
+ if(filter.field === 'department'){
295
292
  queryParams.add({ department: encodeURIComponent(filter.value) });
296
293
  }
297
- if(filter.field === FILTER_FIELDS.LOCATION){
294
+ if(filter.field === 'cityText'){
298
295
  queryParams.add({ location: encodeURIComponent(filter.value) });
299
296
  }
300
- if(filter.field === FILTER_FIELDS.JOB_TYPE){
297
+ if(filter.field === 'remote'){
301
298
  if(filter.value === 'true'){
302
299
  queryParams.add({ jobType: encodeURIComponent("remote") });
303
300
  }
@@ -305,11 +302,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
305
302
  queryParams.add({ jobType: encodeURIComponent("onsite") });
306
303
  }
307
304
  }
308
- if(filter.field === FILTER_FIELDS.BRAND){
305
+ if(filter.field === 'brand'){
309
306
  queryParams.add({ brand: encodeURIComponent(filter.value) });
310
307
  }
311
308
  }
312
- if(filter.field === FILTER_FIELDS.JOB_TYPE) {
309
+ if(filter.field === 'remote') {
313
310
  value = filter.value === 'true';
314
311
  } else {
315
312
  value = filter.value;
@@ -318,22 +315,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
318
315
  }
319
316
  else{
320
317
  if (!skipUrlUpdate) {
321
- if(filter.field === FILTER_FIELDS.SEARCH){
318
+ if(filter.field === 'title'){
322
319
  queryParams.remove(["keyWord" ]);
323
320
  }
324
- if(filter.field === FILTER_FIELDS.DEPARTMENT){
321
+ if(filter.field === 'department'){
325
322
  console.log("removing department from url")
326
323
  queryParams.remove(["department" ]);
327
324
  }
328
- if(filter.field === FILTER_FIELDS.LOCATION){
325
+ if(filter.field === 'cityText'){
329
326
  console.log("removing location from url")
330
327
  queryParams.remove(["location" ]);
331
328
  }
332
- if(filter.field === FILTER_FIELDS.JOB_TYPE){
329
+ if(filter.field === 'remote'){
333
330
  console.log("removing jobType from url")
334
331
  queryParams.remove(["jobType" ]);
335
332
  }
336
- if(filter.field === FILTER_FIELDS.BRAND){
333
+ if(filter.field === 'brand'){
337
334
  console.log("removing brand from url")
338
335
  queryParams.remove(["brand" ]);
339
336
  }
@@ -342,32 +339,32 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
342
339
  });
343
340
 
344
341
  const filter = await getFilter(filters, 'and');
345
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(filter);
346
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
342
+ await _$w('#jobsDataset').setFilter(filter);
343
+ await _$w('#jobsDataset').refresh();
347
344
 
348
345
  const count = await updateCount(_$w);
349
346
  console.log("updating map markers");
350
347
  await updateMapMarkers(_$w);
351
348
  console.log("updating map markers completed");
352
- count ? _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results') : _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('noResults');
349
+ count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
353
350
 
354
351
 
355
352
  // Update reset button state
356
353
  const hasActiveFilters = filters.length > 0;
357
- hasActiveFilters? _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).enable() : _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
354
+ hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
358
355
 
359
356
 
360
357
  }
361
358
 
362
359
  async function resetFilters(_$w) {
363
- _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT, CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
360
+ _$w('#searchInput, #dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').value = '';
364
361
 
365
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
366
- await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
362
+ await _$w('#jobsDataset').setFilter(wixData.filter());
363
+ await _$w('#jobsDataset').refresh();
367
364
 
368
- _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
365
+ _$w('#resultsMultiState').changeState('results');
369
366
 
370
- _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
367
+ _$w('#resetFiltersButton').disable();
371
368
 
372
369
  queryParams.remove(["keyWord", "department","page","location","jobType","brand"]);
373
370
 
@@ -379,7 +376,7 @@ async function resetFilters(_$w) {
379
376
  }
380
377
 
381
378
  async function updateCount(_$w) {
382
- const count = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
379
+ const count = await _$w('#jobsDataset').getTotalCount();
383
380
  _$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
384
381
 
385
382
  return count;
@@ -390,19 +387,19 @@ async function handleDepartmentParam(_$w,department) {
390
387
 
391
388
 
392
389
 
393
- let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options;
390
+ let dropdownOptions = _$w('#dropdownDepartment').options;
394
391
  console.log("dropdown options:", dropdownOptions);
395
392
  const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
396
393
  //+1 because of the "All" option
397
394
 
398
395
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
399
- fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT,optionsFromCMS, _$w);
396
+ fixDropdownOptions('#dropdownDepartment',optionsFromCMS, _$w);
400
397
  }
401
398
 
402
- if (_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options.find(option => option.value === departmentValue))
399
+ if (_$w('#dropdownDepartment').options.find(option => option.value === departmentValue))
403
400
  {
404
401
  console.log("department value found in dropdown options ",departmentValue);
405
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = departmentValue;
402
+ _$w('#dropdownDepartment').value = departmentValue;
406
403
  }
407
404
  else{
408
405
  console.warn("department value not found in dropdown options");
@@ -431,18 +428,18 @@ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
431
428
 
432
429
  async function handleLocationParam(_$w,location) {
433
430
  const locationValue = decodeURIComponent(location);
434
- let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options;
431
+ let dropdownOptions = _$w('#dropdownLocation').options;
435
432
  console.log("location dropdown options:", dropdownOptions);
436
433
  const optionsFromCMS=await wixData.query("cities").find();
437
434
  //+1 because of the "All" option
438
435
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
439
- fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION,optionsFromCMS, _$w);
436
+ fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
440
437
  }
441
438
 
442
- const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
439
+ const option=_$w('#dropdownLocation').options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
443
440
 
444
441
  if(option){
445
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = option.value;
442
+ _$w('#dropdownLocation').value = option.value;
446
443
  }
447
444
  else{
448
445
  console.warn("location value not found in dropdown options");
@@ -453,15 +450,15 @@ async function handleLocationParam(_$w,location) {
453
450
 
454
451
  async function handleBrandParam(_$w,brand){
455
452
  const brandValue = decodeURIComponent(brand);
456
- let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options;
453
+ let dropdownOptions = _$w('#dropdownBrand').options;
457
454
  console.log("brand dropdown options:", dropdownOptions);
458
455
  const optionsFromCMS=await wixData.query(COLLECTIONS.BRANDS).find();
459
456
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
460
- fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND,optionsFromCMS, _$w);
457
+ fixDropdownOptions('#dropdownBrand',optionsFromCMS, _$w);
461
458
  }
462
- const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
459
+ const option=_$w('#dropdownBrand').options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
463
460
  if(option){
464
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = option.value;
461
+ _$w('#dropdownBrand').value = option.value;
465
462
  }
466
463
  else{
467
464
  console.warn("brand value not found in dropdown options");
@@ -471,7 +468,7 @@ async function handleBrandParam(_$w,brand){
471
468
 
472
469
  async function handleJobTypeParam(_$w,jobType) {
473
470
  const jobTypeValue = decodeURIComponent(jobType);
474
- let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).options;
471
+ let dropdownOptions = _$w('#dropdownJobType').options;
475
472
  console.log("jobType dropdown options:", dropdownOptions);
476
473
  let option;
477
474
  if(jobTypeValue.toLowerCase()==="remote"){
@@ -481,7 +478,7 @@ async function handleJobTypeParam(_$w,jobType) {
481
478
  option="false";
482
479
  }
483
480
  if(option){
484
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = option;
481
+ _$w('#dropdownJobType').value = option;
485
482
  }
486
483
  else{
487
484
  console.warn("jobType value not found in dropdown options");
@@ -490,8 +487,8 @@ async function handleJobTypeParam(_$w,jobType) {
490
487
  }
491
488
 
492
489
  async function updateMapMarkers(_$w){
493
- const numOfItems = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
494
- const items = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getItems(0, numOfItems);
490
+ const numOfItems = await _$w('#jobsDataset').getTotalCount();
491
+ const items = await _$w('#jobsDataset').getItems(0, numOfItems);
495
492
  const markers = filterBrokenMarkers(items.items).map(item => {
496
493
  const location = item.locationAddress.location;
497
494
  return {
@@ -504,21 +501,21 @@ async function updateMapMarkers(_$w){
504
501
  };
505
502
  });
506
503
  //@ts-ignore
507
- _$w(CAREERS_PAGE_SELECTORS.GOOGLE_MAPS).setMarkers(markers);
504
+ _$w('#googleMaps').setMarkers(markers);
508
505
 
509
506
  }
510
507
 
511
508
  async function handleBrandDropdown(_$w){
512
509
  if(siteconfig.disableMultiBrand==="false"){
513
- const brands=await wixData.query(COLLECTIONS.BRANDS).find();
514
- if(brands.items.length>1){
515
- console.log("showing brand dropdown");
516
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).show();
517
- }
518
- }
519
- else{
520
- _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).hide();
510
+ const brands=await wixData.query(COLLECTIONS.BRANDS).find();
511
+ if(brands.items.length>1){
512
+ console.log("showing brand dropdown");
513
+ _$w('#dropdownBrand').show();
521
514
  }
515
+ }
516
+ else{
517
+ _$w('#dropdownBrand').hide();
518
+ }
522
519
  }
523
520
  module.exports = {
524
521
  careersPageOnReady,
@@ -1,53 +0,0 @@
1
- const CAREERS_PAGE_SELECTORS = {
2
- FILTER_ICON: '#filterIcon',
3
- FILTER_BOX: '#filterBox',
4
- RESULT_BOX: '#resultBox',
5
- PAGINATION_BTN: '#paginationBtn',
6
- HEAD_BTNS: '#headBtns',
7
- SELECTED_VALUES_REPEATER: '#selectedValuesReapter',
8
- BUTTOM_TXT: '#buttomTxt',
9
- SECTION_24: '#section24',
10
- SECTION_3: '#section3',
11
- LINE_3: '#line3',
12
- EXIT_BUTTON: '#exitBtn',
13
- REFINE_SEARCH_BUTTON: '#refineSearchBtn',
14
-
15
- POSITIONS_REPEATER: '#positionsRepeater',
16
- POSITION_ITEM: '#positionItem',
17
- SEARCH_INPUT: '#searchInput',
18
- CLEAR_SEARCH: '#clearSearch',
19
-
20
- DROPDOWN_BRAND: '#dropdownBrand',
21
- DROPDOWN_CONTAINER: '#dropdownsContainer',
22
- DROPDOWN_DEPARTMENT: '#dropdownDepartment',
23
- DROPDOWN_LOCATION: '#dropdownLocation',
24
- DROPDOWN_JOB_TYPE: '#dropdownJobType',
25
-
26
- OPEN_FILTERS_BUTTON: '#openFiltersButton',
27
- CLOSE_FILTERS_BUTTON: '#closeFiltersButton',
28
- RESET_FILTERS_BUTTON: '#resetFiltersButton',
29
- RESET_FILTERS_BUTTON: '#resetFiltersButton',
30
-
31
- RESULTS_MULTI_STATE: '#resultsMultiState',
32
- BRANDS_DATASET: '#brandsDataset',
33
- DEPARTMENTS_DATASET: '#departmentsDataset',
34
- LOCATIONS_DATASET: '#locationsDataset',
35
- JOB_TYPES_DATASET: '#jobTypesDataset',
36
- JOBS_DATASET: '#jobsDataset',
37
-
38
- GOOGLE_MAPS: '#googleMaps',
39
- FOOTER: '#footer',
40
- }
41
-
42
- const FILTER_FIELDS = {
43
- DEPARTMENT: 'department',
44
- LOCATION: 'cityText',
45
- JOB_TYPE: 'remote',
46
- BRAND: 'brand',
47
- SEARCH: 'title',
48
- }
49
-
50
- module.exports = {
51
- CAREERS_PAGE_SELECTORS,
52
- FILTER_FIELDS,
53
- }