sr-npm 2.0.17 → 2.0.19
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/.github/workflows/update-sites.yml +2 -2
- package/backend/careersMultiBoxesPageIds.js +61 -0
- package/backend/collectionConsts.js +43 -1
- package/backend/consts.js +68 -14
- package/backend/data.js +164 -29
- package/backend/fetchPositionsFromSRAPI.js +2 -1
- package/backend/index.js +2 -0
- package/backend/queries.js +9 -5
- package/backend/secretsData.js +3 -3
- package/backend/utils.js +2 -1
- package/eslint.config.mjs +26 -0
- package/package.json +7 -2
- package/pages/boardPeoplePage.js +28 -0
- package/pages/brandPage.js +12 -0
- package/pages/careersMultiBoxesPage.js +560 -0
- package/pages/careersPage.js +120 -102
- package/pages/homePage.js +79 -8
- package/pages/index.js +6 -0
- package/pages/masterPage.js +35 -0
- package/pages/pagesUtils.js +232 -0
- package/pages/positionPage.js +93 -7
- package/pages/supportTeamsPage.js +92 -0
- package/public/selectors.js +53 -0
- package/public/utils.js +2 -1
- package/tests/brandPageTest.spec.js +45 -0
- package/tests/mockJobBuilder.js +290 -0
- package/tests/multiSearchBoxCareers.spec.js +371 -0
- package/tests/positionPageTest.spec.js +140 -0
package/pages/careersPage.js
CHANGED
|
@@ -4,12 +4,11 @@ const { window } = require('@wix/site-window');
|
|
|
4
4
|
const { query,queryParams,onChange} = require("wix-location-frontend");
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
getFilter,
|
|
11
|
-
} = require('../public/filterUtils');
|
|
7
|
+
const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
|
|
8
|
+
const { debounce, getFilter} = require('../public/filterUtils');
|
|
9
|
+
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors');
|
|
12
10
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
|
+
|
|
13
12
|
let currentLoadedItems =100;
|
|
14
13
|
const itemsPerPage = 100;
|
|
15
14
|
let allJobs=[]
|
|
@@ -23,34 +22,46 @@ const {
|
|
|
23
22
|
let queryJobTypeVar;
|
|
24
23
|
let queryBrandVar;
|
|
25
24
|
let searchInputBlurredFirstTime=true;
|
|
26
|
-
let
|
|
27
|
-
async function careersPageOnReady(_$w,thisObject,queryParams) {
|
|
28
|
-
console.log("queryParams: ", queryParams);
|
|
29
|
-
const { page, keyWord, department, location,jobType,brand } = queryParams;
|
|
30
|
-
queryPageVar=page;
|
|
31
|
-
queryKeyWordVar=keyWord;
|
|
32
|
-
queryDepartmentVar=department;
|
|
33
|
-
queryLocationVar=location;
|
|
34
|
-
queryJobTypeVar=jobType;
|
|
35
|
-
queryBrandVar=brand;
|
|
36
|
-
thisObjectVar=thisObject;
|
|
37
|
-
allJobs=await getAllPositions();
|
|
38
|
-
await activateAutoLoad(_$w);
|
|
39
|
-
await bind(_$w);
|
|
40
|
-
await init(_$w);
|
|
41
|
-
await handleBrandDropdown(_$w);
|
|
42
|
-
await handleUrlParams(_$w);
|
|
25
|
+
let siteconfig;
|
|
43
26
|
|
|
27
|
+
async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
28
|
+
if(siteconfig===undefined) {
|
|
29
|
+
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
30
|
+
siteconfig = queryResult.items[0];
|
|
31
|
+
}
|
|
44
32
|
|
|
45
|
-
|
|
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
|
+
}
|
|
46
55
|
|
|
56
|
+
|
|
57
|
+
}
|
|
47
58
|
|
|
48
59
|
function activateAutoLoad(_$w)
|
|
49
60
|
{
|
|
50
|
-
_$w(
|
|
61
|
+
_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(() => {
|
|
51
62
|
updateCount(_$w);
|
|
52
|
-
_$w(
|
|
53
|
-
if (currentLoadedItems<_$w(
|
|
63
|
+
_$w(CAREERS_PAGE_SELECTORS.FOOTER).onViewportEnter(() => {
|
|
64
|
+
if (currentLoadedItems<_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount()) {
|
|
54
65
|
loadMoreJobs(_$w);
|
|
55
66
|
}
|
|
56
67
|
else {
|
|
@@ -70,10 +81,12 @@ async function loadMoreJobs(_$w) {
|
|
|
70
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
71
82
|
}
|
|
72
83
|
if (shouldLoad) {
|
|
73
|
-
_$w(
|
|
84
|
+
_$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).loadMore();
|
|
74
85
|
console.log("loading more jobs");
|
|
86
|
+
|
|
75
87
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
76
|
-
const data = _$w(
|
|
88
|
+
const data = _$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).data;
|
|
89
|
+
|
|
77
90
|
console.log("data length is : ", data.length);
|
|
78
91
|
setPageParamInUrl();
|
|
79
92
|
}
|
|
@@ -96,6 +109,9 @@ async function handleUrlParams(_$w) {
|
|
|
96
109
|
if (queryKeyWordVar) {
|
|
97
110
|
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
98
111
|
}
|
|
112
|
+
if (queryBrandVar && _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible) { //if it is not visible, ignore it
|
|
113
|
+
await handleBrandParam(_$w,queryBrandVar);
|
|
114
|
+
}
|
|
99
115
|
if (queryPageVar) {
|
|
100
116
|
await handlePageParam(_$w);
|
|
101
117
|
}
|
|
@@ -108,14 +124,11 @@ async function handleUrlParams(_$w) {
|
|
|
108
124
|
if (queryJobTypeVar) {
|
|
109
125
|
await handleJobTypeParam(_$w,queryJobTypeVar);
|
|
110
126
|
}
|
|
111
|
-
if (queryBrandVar && _$w('#dropdownBrand').isVisible) { //if it is not visible, ignore it
|
|
112
|
-
await handleBrandParam(_$w,queryBrandVar);
|
|
113
|
-
}
|
|
114
127
|
await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
|
|
115
128
|
}
|
|
116
129
|
|
|
117
130
|
async function handleKeyWordParam(_$w,keyWord) {
|
|
118
|
-
_$w(
|
|
131
|
+
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = keyWord;
|
|
119
132
|
// Use applyFilters to maintain consistency instead of directly setting filter
|
|
120
133
|
}
|
|
121
134
|
|
|
@@ -135,18 +148,18 @@ async function handlePageParam(_$w) {
|
|
|
135
148
|
//scrolls a bit to load the dataset data
|
|
136
149
|
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
137
150
|
for (let i = 2; i <= queryPageVar; i++) {
|
|
138
|
-
await _$w(
|
|
151
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).loadMore();
|
|
139
152
|
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
140
153
|
}
|
|
141
154
|
// the timeout is to wait for the repeater to render, then scroll to the last item.
|
|
142
155
|
setTimeout(() => {
|
|
143
|
-
const data = _$w(
|
|
156
|
+
const data = _$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).data;
|
|
144
157
|
if (data && data.length > 0) {
|
|
145
158
|
//the dataset each time it loads 100 items
|
|
146
159
|
const lastIndex = data.length - itemsPerPage;
|
|
147
|
-
_$w(
|
|
160
|
+
_$w(CAREERS_PAGE_SELECTORS.POSITIONS_REPEATER).forEachItem(async ($item, itemData, index) => {
|
|
148
161
|
if (index === lastIndex) {
|
|
149
|
-
await $item(
|
|
162
|
+
await $item(CAREERS_PAGE_SELECTORS.POSITION_ITEM).scrollTo();
|
|
150
163
|
console.log("finishied scrolling inside handlePageParam")
|
|
151
164
|
}
|
|
152
165
|
});
|
|
@@ -157,40 +170,40 @@ async function handlePageParam(_$w) {
|
|
|
157
170
|
}
|
|
158
171
|
|
|
159
172
|
async function bind(_$w) {
|
|
160
|
-
await _$w(
|
|
173
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).onReady(async () => {
|
|
161
174
|
await updateCount(_$w);
|
|
162
175
|
await updateMapMarkers(_$w);
|
|
163
176
|
|
|
164
177
|
});
|
|
165
178
|
|
|
166
179
|
if (await window.formFactor() === "Mobile") {
|
|
167
|
-
_$w(
|
|
180
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER).collapse();
|
|
168
181
|
}
|
|
169
182
|
|
|
170
183
|
}
|
|
171
184
|
|
|
172
185
|
function init(_$w) {
|
|
173
186
|
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
174
|
-
_$w(
|
|
175
|
-
_$w(
|
|
176
|
-
if(searchInputBlurredFirstTime && _$w(
|
|
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() !== '')
|
|
177
190
|
{
|
|
178
|
-
_$w(
|
|
191
|
+
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).focus();
|
|
179
192
|
searchInputBlurredFirstTime=false;
|
|
180
193
|
}
|
|
181
194
|
});
|
|
182
|
-
_$w(
|
|
195
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).onChange(()=>{
|
|
183
196
|
console.log("dropdown onChange is triggered");
|
|
184
197
|
applyFilters(_$w);
|
|
185
198
|
});
|
|
186
|
-
_$w(
|
|
199
|
+
_$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON, CAREERS_PAGE_SELECTORS.CLEAR_SEARCH).onClick(()=>resetFilters(_$w));
|
|
187
200
|
|
|
188
|
-
_$w(
|
|
189
|
-
_$w(
|
|
201
|
+
_$w(CAREERS_PAGE_SELECTORS.OPEN_FILTERS_BUTTON).onClick(()=>{
|
|
202
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER, CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).expand();
|
|
190
203
|
});
|
|
191
204
|
|
|
192
|
-
_$w(
|
|
193
|
-
_$w(
|
|
205
|
+
_$w(CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).onClick(()=>{
|
|
206
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_CONTAINER, CAREERS_PAGE_SELECTORS.CLOSE_FILTERS_BUTTON).collapse();
|
|
194
207
|
});
|
|
195
208
|
|
|
196
209
|
//URL onChange
|
|
@@ -209,7 +222,7 @@ async function handleBackAndForth(_$w){
|
|
|
209
222
|
else{
|
|
210
223
|
queryDepartmentVar=undefined;
|
|
211
224
|
deletedParam=true;
|
|
212
|
-
_$w(
|
|
225
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = '';
|
|
213
226
|
}
|
|
214
227
|
if(newQueryParams.location){
|
|
215
228
|
queryLocationVar=newQueryParams.location;
|
|
@@ -217,7 +230,7 @@ async function handleBackAndForth(_$w){
|
|
|
217
230
|
else{
|
|
218
231
|
queryLocationVar=undefined;
|
|
219
232
|
deletedParam=true
|
|
220
|
-
_$w(
|
|
233
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = '';
|
|
221
234
|
}
|
|
222
235
|
if(newQueryParams.keyWord){
|
|
223
236
|
queryKeyWordVar=newQueryParams.keyWord;
|
|
@@ -225,7 +238,7 @@ async function handleBackAndForth(_$w){
|
|
|
225
238
|
else{
|
|
226
239
|
queryKeyWordVar=undefined;
|
|
227
240
|
deletedParam=true;
|
|
228
|
-
_$w(
|
|
241
|
+
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = '';
|
|
229
242
|
}
|
|
230
243
|
if(newQueryParams.jobType){
|
|
231
244
|
queryJobTypeVar=newQueryParams.jobType;
|
|
@@ -233,16 +246,16 @@ async function handleBackAndForth(_$w){
|
|
|
233
246
|
else{
|
|
234
247
|
queryJobTypeVar=undefined;
|
|
235
248
|
deletedParam=true;
|
|
236
|
-
_$w(
|
|
249
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = '';
|
|
237
250
|
}
|
|
238
|
-
if(_$w(
|
|
251
|
+
if(_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible){
|
|
239
252
|
if(newQueryParams.brand){
|
|
240
253
|
queryBrandVar=newQueryParams.brand;
|
|
241
254
|
}
|
|
242
255
|
else{
|
|
243
256
|
queryBrandVar=undefined;
|
|
244
257
|
deletedParam=true;
|
|
245
|
-
_$w(
|
|
258
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
|
|
246
259
|
}
|
|
247
260
|
}
|
|
248
261
|
await handleUrlParams(_$w);
|
|
@@ -252,11 +265,11 @@ async function handleBackAndForth(_$w){
|
|
|
252
265
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
253
266
|
console.log("applying filters");
|
|
254
267
|
const dropdownFiltersMapping = [
|
|
255
|
-
|
|
256
|
-
{ elementId:
|
|
257
|
-
{ elementId:
|
|
258
|
-
{ elementId:
|
|
259
|
-
{ elementId:
|
|
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 }
|
|
260
273
|
];
|
|
261
274
|
console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
|
|
262
275
|
|
|
@@ -275,16 +288,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
275
288
|
// build filters
|
|
276
289
|
if (filter.value && filter.value.trim() !== '') {
|
|
277
290
|
if (!skipUrlUpdate) {
|
|
278
|
-
if(filter.field ===
|
|
291
|
+
if(filter.field === FILTER_FIELDS.SEARCH){
|
|
279
292
|
queryParams.add({ keyWord: filter.value });
|
|
280
293
|
}
|
|
281
|
-
if(filter.field ===
|
|
294
|
+
if(filter.field === FILTER_FIELDS.DEPARTMENT){
|
|
282
295
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
283
296
|
}
|
|
284
|
-
if(filter.field ===
|
|
297
|
+
if(filter.field === FILTER_FIELDS.LOCATION){
|
|
285
298
|
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
286
299
|
}
|
|
287
|
-
if(filter.field ===
|
|
300
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE){
|
|
288
301
|
if(filter.value === 'true'){
|
|
289
302
|
queryParams.add({ jobType: encodeURIComponent("remote") });
|
|
290
303
|
}
|
|
@@ -292,11 +305,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
292
305
|
queryParams.add({ jobType: encodeURIComponent("onsite") });
|
|
293
306
|
}
|
|
294
307
|
}
|
|
295
|
-
if(filter.field ===
|
|
308
|
+
if(filter.field === FILTER_FIELDS.BRAND){
|
|
296
309
|
queryParams.add({ brand: encodeURIComponent(filter.value) });
|
|
297
310
|
}
|
|
298
311
|
}
|
|
299
|
-
if(filter.field ===
|
|
312
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE) {
|
|
300
313
|
value = filter.value === 'true';
|
|
301
314
|
} else {
|
|
302
315
|
value = filter.value;
|
|
@@ -305,22 +318,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
305
318
|
}
|
|
306
319
|
else{
|
|
307
320
|
if (!skipUrlUpdate) {
|
|
308
|
-
if(filter.field ===
|
|
321
|
+
if(filter.field === FILTER_FIELDS.SEARCH){
|
|
309
322
|
queryParams.remove(["keyWord" ]);
|
|
310
323
|
}
|
|
311
|
-
if(filter.field ===
|
|
324
|
+
if(filter.field === FILTER_FIELDS.DEPARTMENT){
|
|
312
325
|
console.log("removing department from url")
|
|
313
326
|
queryParams.remove(["department" ]);
|
|
314
327
|
}
|
|
315
|
-
if(filter.field ===
|
|
328
|
+
if(filter.field === FILTER_FIELDS.LOCATION){
|
|
316
329
|
console.log("removing location from url")
|
|
317
330
|
queryParams.remove(["location" ]);
|
|
318
331
|
}
|
|
319
|
-
if(filter.field ===
|
|
332
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE){
|
|
320
333
|
console.log("removing jobType from url")
|
|
321
334
|
queryParams.remove(["jobType" ]);
|
|
322
335
|
}
|
|
323
|
-
if(filter.field ===
|
|
336
|
+
if(filter.field === FILTER_FIELDS.BRAND){
|
|
324
337
|
console.log("removing brand from url")
|
|
325
338
|
queryParams.remove(["brand" ]);
|
|
326
339
|
}
|
|
@@ -329,32 +342,32 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
329
342
|
});
|
|
330
343
|
|
|
331
344
|
const filter = await getFilter(filters, 'and');
|
|
332
|
-
await _$w(
|
|
333
|
-
await _$w(
|
|
345
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
346
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
334
347
|
|
|
335
348
|
const count = await updateCount(_$w);
|
|
336
349
|
console.log("updating map markers");
|
|
337
350
|
await updateMapMarkers(_$w);
|
|
338
351
|
console.log("updating map markers completed");
|
|
339
|
-
count ? _$w(
|
|
352
|
+
count ? _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results') : _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('noResults');
|
|
340
353
|
|
|
341
354
|
|
|
342
355
|
// Update reset button state
|
|
343
356
|
const hasActiveFilters = filters.length > 0;
|
|
344
|
-
hasActiveFilters? _$w(
|
|
357
|
+
hasActiveFilters? _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).enable() : _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
|
|
345
358
|
|
|
346
359
|
|
|
347
360
|
}
|
|
348
361
|
|
|
349
362
|
async function resetFilters(_$w) {
|
|
350
|
-
_$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 = '';
|
|
351
364
|
|
|
352
|
-
await _$w(
|
|
353
|
-
await _$w(
|
|
365
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
|
|
366
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
354
367
|
|
|
355
|
-
_$w(
|
|
368
|
+
_$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
|
|
356
369
|
|
|
357
|
-
_$w(
|
|
370
|
+
_$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
|
|
358
371
|
|
|
359
372
|
queryParams.remove(["keyWord", "department","page","location","jobType","brand"]);
|
|
360
373
|
|
|
@@ -366,7 +379,7 @@ async function resetFilters(_$w) {
|
|
|
366
379
|
}
|
|
367
380
|
|
|
368
381
|
async function updateCount(_$w) {
|
|
369
|
-
const count = await _$w(
|
|
382
|
+
const count = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
370
383
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
371
384
|
|
|
372
385
|
return count;
|
|
@@ -377,19 +390,19 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
377
390
|
|
|
378
391
|
|
|
379
392
|
|
|
380
|
-
let dropdownOptions = _$w(
|
|
393
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options;
|
|
381
394
|
console.log("dropdown options:", dropdownOptions);
|
|
382
395
|
const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
|
|
383
396
|
//+1 because of the "All" option
|
|
384
397
|
|
|
385
398
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
386
|
-
fixDropdownOptions(
|
|
399
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT,optionsFromCMS, _$w);
|
|
387
400
|
}
|
|
388
401
|
|
|
389
|
-
if (_$w(
|
|
402
|
+
if (_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options.find(option => option.value === departmentValue))
|
|
390
403
|
{
|
|
391
404
|
console.log("department value found in dropdown options ",departmentValue);
|
|
392
|
-
_$w(
|
|
405
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = departmentValue;
|
|
393
406
|
}
|
|
394
407
|
else{
|
|
395
408
|
console.warn("department value not found in dropdown options");
|
|
@@ -418,18 +431,18 @@ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
|
|
|
418
431
|
|
|
419
432
|
async function handleLocationParam(_$w,location) {
|
|
420
433
|
const locationValue = decodeURIComponent(location);
|
|
421
|
-
let dropdownOptions = _$w(
|
|
434
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options;
|
|
422
435
|
console.log("location dropdown options:", dropdownOptions);
|
|
423
436
|
const optionsFromCMS=await wixData.query("cities").find();
|
|
424
437
|
//+1 because of the "All" option
|
|
425
438
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
426
|
-
fixDropdownOptions(
|
|
439
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION,optionsFromCMS, _$w);
|
|
427
440
|
}
|
|
428
441
|
|
|
429
|
-
const option=_$w(
|
|
442
|
+
const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
|
|
430
443
|
|
|
431
444
|
if(option){
|
|
432
|
-
_$w(
|
|
445
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = option.value;
|
|
433
446
|
}
|
|
434
447
|
else{
|
|
435
448
|
console.warn("location value not found in dropdown options");
|
|
@@ -440,15 +453,15 @@ async function handleLocationParam(_$w,location) {
|
|
|
440
453
|
|
|
441
454
|
async function handleBrandParam(_$w,brand){
|
|
442
455
|
const brandValue = decodeURIComponent(brand);
|
|
443
|
-
let dropdownOptions = _$w(
|
|
456
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options;
|
|
444
457
|
console.log("brand dropdown options:", dropdownOptions);
|
|
445
458
|
const optionsFromCMS=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
446
459
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
447
|
-
fixDropdownOptions(
|
|
460
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND,optionsFromCMS, _$w);
|
|
448
461
|
}
|
|
449
|
-
const option=_$w(
|
|
462
|
+
const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
|
|
450
463
|
if(option){
|
|
451
|
-
_$w(
|
|
464
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = option.value;
|
|
452
465
|
}
|
|
453
466
|
else{
|
|
454
467
|
console.warn("brand value not found in dropdown options");
|
|
@@ -458,7 +471,7 @@ async function handleBrandParam(_$w,brand){
|
|
|
458
471
|
|
|
459
472
|
async function handleJobTypeParam(_$w,jobType) {
|
|
460
473
|
const jobTypeValue = decodeURIComponent(jobType);
|
|
461
|
-
let dropdownOptions = _$w(
|
|
474
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).options;
|
|
462
475
|
console.log("jobType dropdown options:", dropdownOptions);
|
|
463
476
|
let option;
|
|
464
477
|
if(jobTypeValue.toLowerCase()==="remote"){
|
|
@@ -468,7 +481,7 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
468
481
|
option="false";
|
|
469
482
|
}
|
|
470
483
|
if(option){
|
|
471
|
-
_$w(
|
|
484
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = option;
|
|
472
485
|
}
|
|
473
486
|
else{
|
|
474
487
|
console.warn("jobType value not found in dropdown options");
|
|
@@ -477,8 +490,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
477
490
|
}
|
|
478
491
|
|
|
479
492
|
async function updateMapMarkers(_$w){
|
|
480
|
-
const numOfItems = await _$w(
|
|
481
|
-
const items = await _$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);
|
|
482
495
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
483
496
|
const location = item.locationAddress.location;
|
|
484
497
|
return {
|
|
@@ -491,17 +504,22 @@ async function updateMapMarkers(_$w){
|
|
|
491
504
|
};
|
|
492
505
|
});
|
|
493
506
|
//@ts-ignore
|
|
494
|
-
_$w(
|
|
507
|
+
_$w(CAREERS_PAGE_SELECTORS.GOOGLE_MAPS).setMarkers(markers);
|
|
495
508
|
|
|
496
509
|
}
|
|
497
510
|
|
|
498
511
|
async function handleBrandDropdown(_$w){
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
512
|
+
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
|
+
}
|
|
503
518
|
}
|
|
504
|
-
|
|
519
|
+
else{
|
|
520
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).hide();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
505
523
|
module.exports = {
|
|
506
524
|
careersPageOnReady,
|
|
507
525
|
};
|
package/pages/homePage.js
CHANGED
|
@@ -5,23 +5,37 @@ const {
|
|
|
5
5
|
const { handleOnLocationClick } = require('../public/mapUtils');
|
|
6
6
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
7
7
|
const { location } = require('@wix/site-location');
|
|
8
|
+
const {wixData} = require('wix-data');
|
|
9
|
+
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
10
|
+
const { bindPrimarySearch,getAllRecords,loadPrimarySearchRepeater } = require('./pagesUtils');
|
|
8
11
|
let thisObjectVar;
|
|
9
12
|
let searchByCityFlag=false;
|
|
10
|
-
|
|
13
|
+
let loadedCategories=false;
|
|
14
|
+
async function homePageOnReady(_$w,thisObject=null) {
|
|
15
|
+
|
|
16
|
+
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
17
|
+
const siteconfig = queryResult.items[0];
|
|
18
|
+
if(siteconfig.categorySearch==="true") {
|
|
19
|
+
const allJobs=await getAllRecords(COLLECTIONS.JOBS);
|
|
20
|
+
const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
21
|
+
bindPrimarySearch(_$w,allvaluesobjects,allJobs);
|
|
22
|
+
loadPrimarySearchRepeater(_$w)
|
|
23
|
+
bindTeamRepeater(_$w)
|
|
24
|
+
bindViewAllButton(_$w)
|
|
25
|
+
}
|
|
26
|
+
else{
|
|
27
|
+
|
|
11
28
|
thisObjectVar=thisObject;
|
|
12
29
|
await bind(_$w);
|
|
13
30
|
await init(_$w);
|
|
31
|
+
}
|
|
14
32
|
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
function bind(_$w) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const department = encodeURIComponent(itemData.title);
|
|
22
|
-
location.to(`/positions?department=${department}`);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
36
|
+
|
|
37
|
+
bindTeamRepeater(_$w);
|
|
38
|
+
|
|
25
39
|
|
|
26
40
|
_$w('#citiesDataset').onReady(async () => {
|
|
27
41
|
const numOfItems = await _$w('#citiesDataset').getTotalCount();
|
|
@@ -47,6 +61,63 @@ async function homePageOnReady(_$w,thisObject) {
|
|
|
47
61
|
});
|
|
48
62
|
}
|
|
49
63
|
|
|
64
|
+
function bindTeamRepeater(_$w) {
|
|
65
|
+
_$w('#teamRepeater').onItemReady(($item, itemData) => {
|
|
66
|
+
$item('#teamButton').label = `View ${itemData.count} Open Positions`;
|
|
67
|
+
// const department = encodeURIComponent(itemData.title);
|
|
68
|
+
// if (itemData.customField) {
|
|
69
|
+
// [$item('#teamButton'), $item('#teamButton2')].forEach(btn => {
|
|
70
|
+
// btn.onClick(() => {
|
|
71
|
+
// location.to(`/search?category=${department}`);
|
|
72
|
+
// });
|
|
73
|
+
// });
|
|
74
|
+
|
|
75
|
+
// }
|
|
76
|
+
// else{
|
|
77
|
+
// $item('#teamButton').onClick(()=>{
|
|
78
|
+
// location.to(`/positions?department=${department}`);
|
|
79
|
+
// });
|
|
80
|
+
// }
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
_$w("#teamRepeaterItem").onClick((event) => {
|
|
84
|
+
|
|
85
|
+
const $item = _$w.at(event.context);
|
|
86
|
+
|
|
87
|
+
if(_$w("#categoriesDataset")) {
|
|
88
|
+
const clickedItemData = $item("#categoriesDataset").getCurrentItem();
|
|
89
|
+
const department = encodeURIComponent(clickedItemData.title);
|
|
90
|
+
location.to(`/search?category=${department}`);
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
{
|
|
94
|
+
console.log("check SR templates and do this ")
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function bindViewAllButton(_$w) {
|
|
103
|
+
|
|
104
|
+
_$w('#viewAllCategoriesButton').onClick(()=>{
|
|
105
|
+
if(!loadedCategories) {
|
|
106
|
+
loadedCategories=true;
|
|
107
|
+
_$w('#viewAllCategoriesButton').label = "View Less";
|
|
108
|
+
_$w("#categoriesDataset").loadMore();
|
|
109
|
+
}
|
|
110
|
+
else{
|
|
111
|
+
loadedCategories=false;
|
|
112
|
+
_$w('#viewAllCategoriesButton').label = "View All";
|
|
113
|
+
_$w("#categoriesDataset").loadPage(1);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
50
121
|
function init(_$w) {
|
|
51
122
|
const debouncedInput = debounce(()=>handleSearchInput(_$w), 400,thisObjectVar);
|
|
52
123
|
|
package/pages/index.js
CHANGED
|
@@ -2,5 +2,11 @@ module.exports = {
|
|
|
2
2
|
...require('./positionPage'),
|
|
3
3
|
...require('./homePage'),
|
|
4
4
|
...require('./careersPage'),
|
|
5
|
+
...require('./careersMultiBoxesPage'),
|
|
6
|
+
...require('./pagesUtils'),
|
|
7
|
+
...require('./brandPage'),
|
|
8
|
+
...require('./supportTeamsPage'),
|
|
9
|
+
...require('./masterPage'),
|
|
10
|
+
...require('./boardPeoplePage'),
|
|
5
11
|
};
|
|
6
12
|
|
|
@@ -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
|
+
};
|