sr-npm 1.2.14 → 1.2.16
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 +12 -9
- package/backend/data.js +5 -1
- package/backend/fetchPositionsFromSRAPI.js +2 -1
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +0 -39
- package/pages/careersPage.js +122 -124
- package/public/selectors.js +0 -53
package/backend/consts.js
CHANGED
|
@@ -89,6 +89,10 @@ const supportTeamsPageIds={
|
|
|
89
89
|
VIDEO_TITLE: "#videoTitle",
|
|
90
90
|
VIDEO_PLAYER: "#videoPlayer",
|
|
91
91
|
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
92
96
|
RECENTLEY_ADDED_JOBS_ITEM: "#recentleyAddedJobsItem",
|
|
93
97
|
JOB_LOCATION: "#jobLocation",
|
|
94
98
|
JOB_TITLE: "#jobTitle",
|
|
@@ -130,13 +134,12 @@ const supportTeamsPageSections={
|
|
|
130
134
|
VIDEO: "video",
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
supportTeamsPageSections,
|
|
137
|
+
module.exports = {
|
|
138
|
+
TASKS_NAMES,
|
|
139
|
+
TASK_TYPE,
|
|
140
|
+
TASKS,
|
|
141
|
+
QUERY_MAX_LIMIT,
|
|
142
|
+
supportTeamsPageIds,
|
|
143
|
+
LINKS,
|
|
144
|
+
supportTeamsPageSections,
|
|
142
145
|
};
|
package/backend/data.js
CHANGED
|
@@ -140,7 +140,8 @@ async function saveJobsDataToCMS() {
|
|
|
140
140
|
brand: siteconfig.disableMultiBrand==="false" ? getBrand(position.customField) : '',
|
|
141
141
|
jobDescription: null, // Will be filled later
|
|
142
142
|
employmentType: position.typeOfEmployment.label,
|
|
143
|
-
releasedDate: position.releasedDate
|
|
143
|
+
releasedDate: position.releasedDate,
|
|
144
|
+
refId: position.refNumber
|
|
144
145
|
};
|
|
145
146
|
|
|
146
147
|
getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
|
|
@@ -485,11 +486,14 @@ async function syncJobsFast() {
|
|
|
485
486
|
await createCollections();
|
|
486
487
|
await clearCollections();
|
|
487
488
|
await fillSecretManagerMirror();
|
|
489
|
+
|
|
488
490
|
console.log("saving jobs data to CMS");
|
|
489
491
|
await saveJobsDataToCMS();
|
|
490
492
|
console.log("saved jobs data to CMS successfully");
|
|
493
|
+
|
|
491
494
|
console.log("saving jobs descriptions and location apply url to CMS");
|
|
492
495
|
await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS();
|
|
496
|
+
|
|
493
497
|
console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
494
498
|
await aggregateJobs();
|
|
495
499
|
await referenceJobs();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { TEMPLATE_TYPE,TOKEN_NAME } = require('./collectionConsts');
|
|
3
3
|
const { getTokenFromCMS,getApiKeys } = require('./secretsData');
|
|
4
|
+
|
|
4
5
|
async function makeSmartRecruitersRequest(path,templateType) {
|
|
5
|
-
|
|
6
|
+
const baseUrl = 'https://api.smartrecruiters.com';
|
|
6
7
|
const fullUrl = `${baseUrl}${path}`;
|
|
7
8
|
|
|
8
9
|
try {
|
package/package.json
CHANGED
|
@@ -29,10 +29,6 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
29
29
|
loadSelectedValuesRepeater(_$w);
|
|
30
30
|
bindSearchInput(_$w);
|
|
31
31
|
loadPaginationButtons(_$w);
|
|
32
|
-
|
|
33
|
-
if (await window.formFactor() === "Mobile") {
|
|
34
|
-
handleFilterInMobile(_$w);
|
|
35
|
-
}
|
|
36
32
|
|
|
37
33
|
await handleUrlParams(_$w, urlParams);
|
|
38
34
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
|
|
@@ -56,41 +52,6 @@ async function clearAll(_$w) {
|
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
|
|
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
55
|
|
|
95
56
|
async function handleUrlParams(_$w,urlParams) {
|
|
96
57
|
try {
|
package/pages/careersPage.js
CHANGED
|
@@ -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
|
-
|
|
9
|
-
const {
|
|
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=[]
|
|
@@ -25,43 +27,41 @@ const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors')
|
|
|
25
27
|
let siteconfig;
|
|
26
28
|
|
|
27
29
|
async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if(siteconfig.customFields==="true") {
|
|
34
|
-
await careersMultiBoxesPageOnReady(_$w,queryParams);
|
|
35
|
-
}
|
|
36
|
-
else{
|
|
37
|
-
console.log("queryParams: ", queryParams);
|
|
38
|
-
const { page, keyWord, department, location,jobType,brand } = queryParams;
|
|
39
|
-
queryPageVar=page;
|
|
40
|
-
queryKeyWordVar=keyWord;
|
|
41
|
-
queryDepartmentVar=department;
|
|
42
|
-
queryLocationVar=location;
|
|
43
|
-
queryJobTypeVar=jobType;
|
|
44
|
-
queryBrandVar=brand;
|
|
45
|
-
thisObjectVar=thisObject;
|
|
46
|
-
allJobs = await getAllPositions();
|
|
47
|
-
|
|
48
|
-
activateAutoLoad(_$w);
|
|
49
|
-
await bind(_$w);
|
|
50
|
-
init(_$w);
|
|
51
|
-
await handleBrandDropdown(_$w);
|
|
52
|
-
await handleUrlParams(_$w);
|
|
53
|
-
|
|
54
|
-
}
|
|
30
|
+
if(siteconfig===undefined) {
|
|
31
|
+
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
32
|
+
siteconfig = queryResult.items[0];
|
|
33
|
+
}
|
|
55
34
|
|
|
35
|
+
if(siteconfig.customFields==="true") {
|
|
36
|
+
await careersMultiBoxesPageOnReady(_$w,queryParams);
|
|
37
|
+
}
|
|
38
|
+
else{
|
|
39
|
+
console.log("queryParams: ", queryParams);
|
|
40
|
+
const { page, keyWord, department, location,jobType,brand } = queryParams;
|
|
41
|
+
queryPageVar=page;
|
|
42
|
+
queryKeyWordVar=keyWord;
|
|
43
|
+
queryDepartmentVar=department;
|
|
44
|
+
queryLocationVar=location;
|
|
45
|
+
queryJobTypeVar=jobType;
|
|
46
|
+
queryBrandVar=brand;
|
|
47
|
+
thisObjectVar=thisObject;
|
|
48
|
+
allJobs=await getAllPositions();
|
|
49
|
+
await activateAutoLoad(_$w);
|
|
50
|
+
await bind(_$w);
|
|
51
|
+
await init(_$w);
|
|
52
|
+
await handleBrandDropdown(_$w);
|
|
53
|
+
await handleUrlParams(_$w);
|
|
56
54
|
|
|
57
55
|
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
58
|
|
|
59
59
|
function activateAutoLoad(_$w)
|
|
60
60
|
{
|
|
61
|
-
_$w(
|
|
61
|
+
_$w("#jobsDataset").onReady(() => {
|
|
62
62
|
updateCount(_$w);
|
|
63
|
-
_$w(
|
|
64
|
-
if (currentLoadedItems<_$w(
|
|
63
|
+
_$w("#section2").onViewportEnter(() => {
|
|
64
|
+
if (currentLoadedItems<_$w("#jobsDataset").getTotalCount()) {
|
|
65
65
|
loadMoreJobs(_$w);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
@@ -81,12 +81,10 @@ async function loadMoreJobs(_$w) {
|
|
|
81
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
82
82
|
}
|
|
83
83
|
if (shouldLoad) {
|
|
84
|
-
_$w(
|
|
84
|
+
_$w("#jobsDataset").loadMore();
|
|
85
85
|
console.log("loading more jobs");
|
|
86
|
-
|
|
87
86
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
88
|
-
const data = _$w(
|
|
89
|
-
|
|
87
|
+
const data = _$w("#positionsRepeater").data;
|
|
90
88
|
console.log("data length is : ", data.length);
|
|
91
89
|
setPageParamInUrl();
|
|
92
90
|
}
|
|
@@ -109,26 +107,26 @@ async function handleUrlParams(_$w) {
|
|
|
109
107
|
if (queryKeyWordVar) {
|
|
110
108
|
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
111
109
|
}
|
|
112
|
-
if (queryBrandVar && _$w(
|
|
110
|
+
if (queryBrandVar && _$w('#dropdownBrand').isVisible) { //if it is not visible, ignore it
|
|
113
111
|
await handleBrandParam(_$w,queryBrandVar);
|
|
114
112
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
if (queryPageVar) {
|
|
114
|
+
await handlePageParam(_$w);
|
|
115
|
+
}
|
|
116
|
+
if (queryDepartmentVar) {
|
|
117
|
+
await handleDepartmentParam(_$w,queryDepartmentVar);
|
|
118
|
+
}
|
|
119
|
+
if (queryLocationVar) {
|
|
120
|
+
await handleLocationParam(_$w,queryLocationVar);
|
|
121
|
+
}
|
|
122
|
+
if (queryJobTypeVar) {
|
|
123
|
+
await handleJobTypeParam(_$w,queryJobTypeVar);
|
|
124
|
+
}
|
|
127
125
|
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
async function handleKeyWordParam(_$w,keyWord) {
|
|
131
|
-
_$w(
|
|
129
|
+
_$w('#searchInput').value = keyWord;
|
|
132
130
|
// Use applyFilters to maintain consistency instead of directly setting filter
|
|
133
131
|
}
|
|
134
132
|
|
|
@@ -148,18 +146,18 @@ async function handlePageParam(_$w) {
|
|
|
148
146
|
//scrolls a bit to load the dataset data
|
|
149
147
|
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
150
148
|
for (let i = 2; i <= queryPageVar; i++) {
|
|
151
|
-
await _$w(
|
|
149
|
+
await _$w("#jobsDataset").loadMore();
|
|
152
150
|
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
153
151
|
}
|
|
154
152
|
// the timeout is to wait for the repeater to render, then scroll to the last item.
|
|
155
153
|
setTimeout(() => {
|
|
156
|
-
const data = _$w(
|
|
154
|
+
const data = _$w("#positionsRepeater").data;
|
|
157
155
|
if (data && data.length > 0) {
|
|
158
156
|
//the dataset each time it loads 100 items
|
|
159
157
|
const lastIndex = data.length - itemsPerPage;
|
|
160
|
-
_$w(
|
|
158
|
+
_$w("#positionsRepeater").forEachItem(async ($item, itemData, index) => {
|
|
161
159
|
if (index === lastIndex) {
|
|
162
|
-
await $item(
|
|
160
|
+
await $item("#positionItem").scrollTo();
|
|
163
161
|
console.log("finishied scrolling inside handlePageParam")
|
|
164
162
|
}
|
|
165
163
|
});
|
|
@@ -170,40 +168,40 @@ async function handlePageParam(_$w) {
|
|
|
170
168
|
}
|
|
171
169
|
|
|
172
170
|
async function bind(_$w) {
|
|
173
|
-
await _$w(
|
|
171
|
+
await _$w('#jobsDataset').onReady(async () => {
|
|
174
172
|
await updateCount(_$w);
|
|
175
173
|
await updateMapMarkers(_$w);
|
|
176
174
|
|
|
177
175
|
});
|
|
178
176
|
|
|
179
177
|
if (await window.formFactor() === "Mobile") {
|
|
180
|
-
_$w(
|
|
178
|
+
_$w('#dropdownsContainer').collapse();
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
function init(_$w) {
|
|
186
184
|
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
187
|
-
_$w(
|
|
188
|
-
_$w(
|
|
189
|
-
if(searchInputBlurredFirstTime && _$w(
|
|
185
|
+
_$w('#searchInput').onInput(debouncedSearch);
|
|
186
|
+
_$w('#searchInput').onBlur(()=>{
|
|
187
|
+
if(searchInputBlurredFirstTime && _$w('#searchInput').value.trim() !== '')
|
|
190
188
|
{
|
|
191
|
-
_$w(
|
|
189
|
+
_$w('#searchInput').focus();
|
|
192
190
|
searchInputBlurredFirstTime=false;
|
|
193
191
|
}
|
|
194
192
|
});
|
|
195
|
-
_$w(
|
|
193
|
+
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').onChange(()=>{
|
|
196
194
|
console.log("dropdown onChange is triggered");
|
|
197
195
|
applyFilters(_$w);
|
|
198
196
|
});
|
|
199
|
-
_$w(
|
|
197
|
+
_$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
|
|
200
198
|
|
|
201
|
-
_$w(
|
|
202
|
-
_$w(
|
|
199
|
+
_$w('#openFiltersButton').onClick(()=>{
|
|
200
|
+
_$w('#dropdownsContainer, #closeFiltersButton').expand();
|
|
203
201
|
});
|
|
204
202
|
|
|
205
|
-
_$w(
|
|
206
|
-
_$w(
|
|
203
|
+
_$w('#closeFiltersButton').onClick(()=>{
|
|
204
|
+
_$w('#dropdownsContainer, #closeFiltersButton').collapse();
|
|
207
205
|
});
|
|
208
206
|
|
|
209
207
|
//URL onChange
|
|
@@ -222,7 +220,7 @@ async function handleBackAndForth(_$w){
|
|
|
222
220
|
else{
|
|
223
221
|
queryDepartmentVar=undefined;
|
|
224
222
|
deletedParam=true;
|
|
225
|
-
_$w(
|
|
223
|
+
_$w('#dropdownDepartment').value = '';
|
|
226
224
|
}
|
|
227
225
|
if(newQueryParams.location){
|
|
228
226
|
queryLocationVar=newQueryParams.location;
|
|
@@ -230,7 +228,7 @@ async function handleBackAndForth(_$w){
|
|
|
230
228
|
else{
|
|
231
229
|
queryLocationVar=undefined;
|
|
232
230
|
deletedParam=true
|
|
233
|
-
_$w(
|
|
231
|
+
_$w('#dropdownLocation').value = '';
|
|
234
232
|
}
|
|
235
233
|
if(newQueryParams.keyWord){
|
|
236
234
|
queryKeyWordVar=newQueryParams.keyWord;
|
|
@@ -238,7 +236,7 @@ async function handleBackAndForth(_$w){
|
|
|
238
236
|
else{
|
|
239
237
|
queryKeyWordVar=undefined;
|
|
240
238
|
deletedParam=true;
|
|
241
|
-
_$w(
|
|
239
|
+
_$w('#searchInput').value = '';
|
|
242
240
|
}
|
|
243
241
|
if(newQueryParams.jobType){
|
|
244
242
|
queryJobTypeVar=newQueryParams.jobType;
|
|
@@ -246,16 +244,16 @@ async function handleBackAndForth(_$w){
|
|
|
246
244
|
else{
|
|
247
245
|
queryJobTypeVar=undefined;
|
|
248
246
|
deletedParam=true;
|
|
249
|
-
_$w(
|
|
247
|
+
_$w('#dropdownJobType').value = '';
|
|
250
248
|
}
|
|
251
|
-
if(_$w(
|
|
249
|
+
if(_$w('#dropdownBrand').isVisible){
|
|
252
250
|
if(newQueryParams.brand){
|
|
253
251
|
queryBrandVar=newQueryParams.brand;
|
|
254
252
|
}
|
|
255
253
|
else{
|
|
256
254
|
queryBrandVar=undefined;
|
|
257
255
|
deletedParam=true;
|
|
258
|
-
_$w(
|
|
256
|
+
_$w('#dropdownBrand').value = '';
|
|
259
257
|
}
|
|
260
258
|
}
|
|
261
259
|
await handleUrlParams(_$w);
|
|
@@ -265,11 +263,11 @@ async function handleBackAndForth(_$w){
|
|
|
265
263
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
266
264
|
console.log("applying filters");
|
|
267
265
|
const dropdownFiltersMapping = [
|
|
268
|
-
|
|
269
|
-
{ elementId:
|
|
270
|
-
{ elementId:
|
|
271
|
-
{ elementId:
|
|
272
|
-
{ elementId:
|
|
266
|
+
{ elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
|
|
267
|
+
{ elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
|
|
268
|
+
{ elementId: '#dropdownJobType', field: 'remote', value: _$w('#dropdownJobType').value},
|
|
269
|
+
{ elementId: '#dropdownBrand', field: 'brand', value: _$w('#dropdownBrand').value},
|
|
270
|
+
{ elementId: '#searchInput', field: 'title', value: _$w('#searchInput').value }
|
|
273
271
|
];
|
|
274
272
|
console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
|
|
275
273
|
|
|
@@ -288,16 +286,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
288
286
|
// build filters
|
|
289
287
|
if (filter.value && filter.value.trim() !== '') {
|
|
290
288
|
if (!skipUrlUpdate) {
|
|
291
|
-
if(filter.field ===
|
|
289
|
+
if(filter.field === 'title'){
|
|
292
290
|
queryParams.add({ keyWord: filter.value });
|
|
293
291
|
}
|
|
294
|
-
if(filter.field ===
|
|
292
|
+
if(filter.field === 'department'){
|
|
295
293
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
296
294
|
}
|
|
297
|
-
if(filter.field ===
|
|
295
|
+
if(filter.field === 'cityText'){
|
|
298
296
|
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
299
297
|
}
|
|
300
|
-
if(filter.field ===
|
|
298
|
+
if(filter.field === 'remote'){
|
|
301
299
|
if(filter.value === 'true'){
|
|
302
300
|
queryParams.add({ jobType: encodeURIComponent("remote") });
|
|
303
301
|
}
|
|
@@ -305,11 +303,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
305
303
|
queryParams.add({ jobType: encodeURIComponent("onsite") });
|
|
306
304
|
}
|
|
307
305
|
}
|
|
308
|
-
if(filter.field ===
|
|
306
|
+
if(filter.field === 'brand'){
|
|
309
307
|
queryParams.add({ brand: encodeURIComponent(filter.value) });
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
|
-
if(filter.field ===
|
|
310
|
+
if(filter.field === 'remote') {
|
|
313
311
|
value = filter.value === 'true';
|
|
314
312
|
} else {
|
|
315
313
|
value = filter.value;
|
|
@@ -318,22 +316,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
318
316
|
}
|
|
319
317
|
else{
|
|
320
318
|
if (!skipUrlUpdate) {
|
|
321
|
-
if(filter.field ===
|
|
319
|
+
if(filter.field === 'title'){
|
|
322
320
|
queryParams.remove(["keyWord" ]);
|
|
323
321
|
}
|
|
324
|
-
if(filter.field ===
|
|
322
|
+
if(filter.field === 'department'){
|
|
325
323
|
console.log("removing department from url")
|
|
326
324
|
queryParams.remove(["department" ]);
|
|
327
325
|
}
|
|
328
|
-
if(filter.field ===
|
|
326
|
+
if(filter.field === 'cityText'){
|
|
329
327
|
console.log("removing location from url")
|
|
330
328
|
queryParams.remove(["location" ]);
|
|
331
329
|
}
|
|
332
|
-
if(filter.field ===
|
|
330
|
+
if(filter.field === 'remote'){
|
|
333
331
|
console.log("removing jobType from url")
|
|
334
332
|
queryParams.remove(["jobType" ]);
|
|
335
333
|
}
|
|
336
|
-
if(filter.field ===
|
|
334
|
+
if(filter.field === 'brand'){
|
|
337
335
|
console.log("removing brand from url")
|
|
338
336
|
queryParams.remove(["brand" ]);
|
|
339
337
|
}
|
|
@@ -342,32 +340,32 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
342
340
|
});
|
|
343
341
|
|
|
344
342
|
const filter = await getFilter(filters, 'and');
|
|
345
|
-
await _$w(
|
|
346
|
-
await _$w(
|
|
343
|
+
await _$w('#jobsDataset').setFilter(filter);
|
|
344
|
+
await _$w('#jobsDataset').refresh();
|
|
347
345
|
|
|
348
346
|
const count = await updateCount(_$w);
|
|
349
347
|
console.log("updating map markers");
|
|
350
348
|
await updateMapMarkers(_$w);
|
|
351
349
|
console.log("updating map markers completed");
|
|
352
|
-
count ? _$w(
|
|
350
|
+
count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
|
|
353
351
|
|
|
354
352
|
|
|
355
353
|
// Update reset button state
|
|
356
354
|
const hasActiveFilters = filters.length > 0;
|
|
357
|
-
hasActiveFilters? _$w(
|
|
355
|
+
hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
|
|
358
356
|
|
|
359
357
|
|
|
360
358
|
}
|
|
361
359
|
|
|
362
360
|
async function resetFilters(_$w) {
|
|
363
|
-
_$w(
|
|
361
|
+
_$w('#searchInput, #dropdownDepartment, #dropdownLocation, #dropdownJobType, #dropdownBrand').value = '';
|
|
364
362
|
|
|
365
|
-
await _$w(
|
|
366
|
-
await _$w(
|
|
363
|
+
await _$w('#jobsDataset').setFilter(wixData.filter());
|
|
364
|
+
await _$w('#jobsDataset').refresh();
|
|
367
365
|
|
|
368
|
-
_$w(
|
|
366
|
+
_$w('#resultsMultiState').changeState('results');
|
|
369
367
|
|
|
370
|
-
_$w(
|
|
368
|
+
_$w('#resetFiltersButton').disable();
|
|
371
369
|
|
|
372
370
|
queryParams.remove(["keyWord", "department","page","location","jobType","brand"]);
|
|
373
371
|
|
|
@@ -379,7 +377,7 @@ async function resetFilters(_$w) {
|
|
|
379
377
|
}
|
|
380
378
|
|
|
381
379
|
async function updateCount(_$w) {
|
|
382
|
-
const count = await _$w(
|
|
380
|
+
const count = await _$w('#jobsDataset').getTotalCount();
|
|
383
381
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
384
382
|
|
|
385
383
|
return count;
|
|
@@ -390,19 +388,19 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
390
388
|
|
|
391
389
|
|
|
392
390
|
|
|
393
|
-
let dropdownOptions = _$w(
|
|
391
|
+
let dropdownOptions = _$w('#dropdownDepartment').options;
|
|
394
392
|
console.log("dropdown options:", dropdownOptions);
|
|
395
393
|
const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
|
|
396
394
|
//+1 because of the "All" option
|
|
397
395
|
|
|
398
396
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
399
|
-
fixDropdownOptions(
|
|
397
|
+
fixDropdownOptions('#dropdownDepartment',optionsFromCMS, _$w);
|
|
400
398
|
}
|
|
401
399
|
|
|
402
|
-
if (_$w(
|
|
400
|
+
if (_$w('#dropdownDepartment').options.find(option => option.value === departmentValue))
|
|
403
401
|
{
|
|
404
402
|
console.log("department value found in dropdown options ",departmentValue);
|
|
405
|
-
_$w(
|
|
403
|
+
_$w('#dropdownDepartment').value = departmentValue;
|
|
406
404
|
}
|
|
407
405
|
else{
|
|
408
406
|
console.warn("department value not found in dropdown options");
|
|
@@ -431,18 +429,18 @@ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
|
|
|
431
429
|
|
|
432
430
|
async function handleLocationParam(_$w,location) {
|
|
433
431
|
const locationValue = decodeURIComponent(location);
|
|
434
|
-
let dropdownOptions = _$w(
|
|
432
|
+
let dropdownOptions = _$w('#dropdownLocation').options;
|
|
435
433
|
console.log("location dropdown options:", dropdownOptions);
|
|
436
434
|
const optionsFromCMS=await wixData.query("cities").find();
|
|
437
435
|
//+1 because of the "All" option
|
|
438
436
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
439
|
-
fixDropdownOptions(
|
|
437
|
+
fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
|
|
440
438
|
}
|
|
441
439
|
|
|
442
|
-
const option=_$w(
|
|
440
|
+
const option=_$w('#dropdownLocation').options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
|
|
443
441
|
|
|
444
442
|
if(option){
|
|
445
|
-
_$w(
|
|
443
|
+
_$w('#dropdownLocation').value = option.value;
|
|
446
444
|
}
|
|
447
445
|
else{
|
|
448
446
|
console.warn("location value not found in dropdown options");
|
|
@@ -453,15 +451,15 @@ async function handleLocationParam(_$w,location) {
|
|
|
453
451
|
|
|
454
452
|
async function handleBrandParam(_$w,brand){
|
|
455
453
|
const brandValue = decodeURIComponent(brand);
|
|
456
|
-
let dropdownOptions = _$w(
|
|
454
|
+
let dropdownOptions = _$w('#dropdownBrand').options;
|
|
457
455
|
console.log("brand dropdown options:", dropdownOptions);
|
|
458
456
|
const optionsFromCMS=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
459
457
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
460
|
-
fixDropdownOptions(
|
|
458
|
+
fixDropdownOptions('#dropdownBrand',optionsFromCMS, _$w);
|
|
461
459
|
}
|
|
462
|
-
const option=_$w(
|
|
460
|
+
const option=_$w('#dropdownBrand').options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
|
|
463
461
|
if(option){
|
|
464
|
-
_$w(
|
|
462
|
+
_$w('#dropdownBrand').value = option.value;
|
|
465
463
|
}
|
|
466
464
|
else{
|
|
467
465
|
console.warn("brand value not found in dropdown options");
|
|
@@ -471,7 +469,7 @@ async function handleBrandParam(_$w,brand){
|
|
|
471
469
|
|
|
472
470
|
async function handleJobTypeParam(_$w,jobType) {
|
|
473
471
|
const jobTypeValue = decodeURIComponent(jobType);
|
|
474
|
-
let dropdownOptions = _$w(
|
|
472
|
+
let dropdownOptions = _$w('#dropdownJobType').options;
|
|
475
473
|
console.log("jobType dropdown options:", dropdownOptions);
|
|
476
474
|
let option;
|
|
477
475
|
if(jobTypeValue.toLowerCase()==="remote"){
|
|
@@ -481,7 +479,7 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
481
479
|
option="false";
|
|
482
480
|
}
|
|
483
481
|
if(option){
|
|
484
|
-
_$w(
|
|
482
|
+
_$w('#dropdownJobType').value = option;
|
|
485
483
|
}
|
|
486
484
|
else{
|
|
487
485
|
console.warn("jobType value not found in dropdown options");
|
|
@@ -490,8 +488,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
490
488
|
}
|
|
491
489
|
|
|
492
490
|
async function updateMapMarkers(_$w){
|
|
493
|
-
const numOfItems = await _$w(
|
|
494
|
-
const items = await _$w(
|
|
491
|
+
const numOfItems = await _$w('#jobsDataset').getTotalCount();
|
|
492
|
+
const items = await _$w('#jobsDataset').getItems(0, numOfItems);
|
|
495
493
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
496
494
|
const location = item.locationAddress.location;
|
|
497
495
|
return {
|
|
@@ -504,21 +502,21 @@ async function updateMapMarkers(_$w){
|
|
|
504
502
|
};
|
|
505
503
|
});
|
|
506
504
|
//@ts-ignore
|
|
507
|
-
_$w(
|
|
505
|
+
_$w('#googleMaps').setMarkers(markers);
|
|
508
506
|
|
|
509
507
|
}
|
|
510
508
|
|
|
511
509
|
async function handleBrandDropdown(_$w){
|
|
512
510
|
if(siteconfig.disableMultiBrand==="false"){
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
else{
|
|
520
|
-
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).hide();
|
|
511
|
+
const brands=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
512
|
+
if(brands.items.length>1){
|
|
513
|
+
console.log("showing brand dropdown");
|
|
514
|
+
_$w('#dropdownBrand').show();
|
|
521
515
|
}
|
|
516
|
+
}
|
|
517
|
+
else{
|
|
518
|
+
_$w('#dropdownBrand').hide();
|
|
519
|
+
}
|
|
522
520
|
}
|
|
523
521
|
module.exports = {
|
|
524
522
|
careersPageOnReady,
|
package/public/selectors.js
DELETED
|
@@ -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
|
-
}
|