sr-npm 3.0.0 → 3.1.0
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 +17 -17
- package/backend/careersMultiBoxesPageIds.js +77 -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 +8 -3
- package/pages/boardPeoplePage.js +26 -0
- package/pages/brandPage.js +13 -0
- package/pages/careersMultiBoxesPage.js +623 -0
- package/pages/careersPage.js +120 -107
- package/pages/homePage.js +79 -8
- package/pages/index.js +6 -0
- package/pages/masterPage.js +35 -0
- package/pages/pagesUtils.js +241 -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 +394 -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
|
|
@@ -208,41 +221,36 @@ async function handleBackAndForth(_$w){
|
|
|
208
221
|
}
|
|
209
222
|
else{
|
|
210
223
|
queryDepartmentVar=undefined;
|
|
211
|
-
|
|
212
|
-
_$w('#dropdownDepartment').value = '';
|
|
224
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = '';
|
|
213
225
|
}
|
|
214
226
|
if(newQueryParams.location){
|
|
215
227
|
queryLocationVar=newQueryParams.location;
|
|
216
228
|
}
|
|
217
229
|
else{
|
|
218
230
|
queryLocationVar=undefined;
|
|
219
|
-
|
|
220
|
-
_$w('#dropdownLocation').value = '';
|
|
231
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = '';
|
|
221
232
|
}
|
|
222
233
|
if(newQueryParams.keyWord){
|
|
223
234
|
queryKeyWordVar=newQueryParams.keyWord;
|
|
224
235
|
}
|
|
225
236
|
else{
|
|
226
237
|
queryKeyWordVar=undefined;
|
|
227
|
-
|
|
228
|
-
_$w('#searchInput').value = '';
|
|
238
|
+
_$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value = '';
|
|
229
239
|
}
|
|
230
240
|
if(newQueryParams.jobType){
|
|
231
241
|
queryJobTypeVar=newQueryParams.jobType;
|
|
232
242
|
}
|
|
233
243
|
else{
|
|
234
244
|
queryJobTypeVar=undefined;
|
|
235
|
-
|
|
236
|
-
_$w('#dropdownJobType').value = '';
|
|
245
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = '';
|
|
237
246
|
}
|
|
238
|
-
if(_$w(
|
|
247
|
+
if(_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).isVisible){
|
|
239
248
|
if(newQueryParams.brand){
|
|
240
249
|
queryBrandVar=newQueryParams.brand;
|
|
241
250
|
}
|
|
242
251
|
else{
|
|
243
252
|
queryBrandVar=undefined;
|
|
244
|
-
|
|
245
|
-
_$w('#dropdownBrand').value = '';
|
|
253
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = '';
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
await handleUrlParams(_$w);
|
|
@@ -252,11 +260,11 @@ async function handleBackAndForth(_$w){
|
|
|
252
260
|
async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
253
261
|
console.log("applying filters");
|
|
254
262
|
const dropdownFiltersMapping = [
|
|
255
|
-
|
|
256
|
-
{ elementId:
|
|
257
|
-
{ elementId:
|
|
258
|
-
{ elementId:
|
|
259
|
-
{ elementId:
|
|
263
|
+
{ elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT, field: 'department', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value },
|
|
264
|
+
{ elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION, field: 'cityText', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value },
|
|
265
|
+
{ elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE, field: 'remote', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value},
|
|
266
|
+
{ elementId: CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND, field: 'brand', value: _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value},
|
|
267
|
+
{ elementId: CAREERS_PAGE_SELECTORS.SEARCH_INPUT, field: 'title', value: _$w(CAREERS_PAGE_SELECTORS.SEARCH_INPUT).value }
|
|
260
268
|
];
|
|
261
269
|
console.log("dropdownFiltersMapping: ", dropdownFiltersMapping);
|
|
262
270
|
|
|
@@ -275,16 +283,16 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
275
283
|
// build filters
|
|
276
284
|
if (filter.value && filter.value.trim() !== '') {
|
|
277
285
|
if (!skipUrlUpdate) {
|
|
278
|
-
if(filter.field ===
|
|
286
|
+
if(filter.field === FILTER_FIELDS.SEARCH){
|
|
279
287
|
queryParams.add({ keyWord: filter.value });
|
|
280
288
|
}
|
|
281
|
-
if(filter.field ===
|
|
289
|
+
if(filter.field === FILTER_FIELDS.DEPARTMENT){
|
|
282
290
|
queryParams.add({ department: encodeURIComponent(filter.value) });
|
|
283
291
|
}
|
|
284
|
-
if(filter.field ===
|
|
292
|
+
if(filter.field === FILTER_FIELDS.LOCATION){
|
|
285
293
|
queryParams.add({ location: encodeURIComponent(filter.value) });
|
|
286
294
|
}
|
|
287
|
-
if(filter.field ===
|
|
295
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE){
|
|
288
296
|
if(filter.value === 'true'){
|
|
289
297
|
queryParams.add({ jobType: encodeURIComponent("remote") });
|
|
290
298
|
}
|
|
@@ -292,11 +300,11 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
292
300
|
queryParams.add({ jobType: encodeURIComponent("onsite") });
|
|
293
301
|
}
|
|
294
302
|
}
|
|
295
|
-
if(filter.field ===
|
|
303
|
+
if(filter.field === FILTER_FIELDS.BRAND){
|
|
296
304
|
queryParams.add({ brand: encodeURIComponent(filter.value) });
|
|
297
305
|
}
|
|
298
306
|
}
|
|
299
|
-
if(filter.field ===
|
|
307
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE) {
|
|
300
308
|
value = filter.value === 'true';
|
|
301
309
|
} else {
|
|
302
310
|
value = filter.value;
|
|
@@ -305,22 +313,22 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
305
313
|
}
|
|
306
314
|
else{
|
|
307
315
|
if (!skipUrlUpdate) {
|
|
308
|
-
if(filter.field ===
|
|
316
|
+
if(filter.field === FILTER_FIELDS.SEARCH){
|
|
309
317
|
queryParams.remove(["keyWord" ]);
|
|
310
318
|
}
|
|
311
|
-
if(filter.field ===
|
|
319
|
+
if(filter.field === FILTER_FIELDS.DEPARTMENT){
|
|
312
320
|
console.log("removing department from url")
|
|
313
321
|
queryParams.remove(["department" ]);
|
|
314
322
|
}
|
|
315
|
-
if(filter.field ===
|
|
323
|
+
if(filter.field === FILTER_FIELDS.LOCATION){
|
|
316
324
|
console.log("removing location from url")
|
|
317
325
|
queryParams.remove(["location" ]);
|
|
318
326
|
}
|
|
319
|
-
if(filter.field ===
|
|
327
|
+
if(filter.field === FILTER_FIELDS.JOB_TYPE){
|
|
320
328
|
console.log("removing jobType from url")
|
|
321
329
|
queryParams.remove(["jobType" ]);
|
|
322
330
|
}
|
|
323
|
-
if(filter.field ===
|
|
331
|
+
if(filter.field === FILTER_FIELDS.BRAND){
|
|
324
332
|
console.log("removing brand from url")
|
|
325
333
|
queryParams.remove(["brand" ]);
|
|
326
334
|
}
|
|
@@ -329,32 +337,32 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
329
337
|
});
|
|
330
338
|
|
|
331
339
|
const filter = await getFilter(filters, 'and');
|
|
332
|
-
await _$w(
|
|
333
|
-
await _$w(
|
|
340
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
341
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
334
342
|
|
|
335
343
|
const count = await updateCount(_$w);
|
|
336
344
|
console.log("updating map markers");
|
|
337
345
|
await updateMapMarkers(_$w);
|
|
338
346
|
console.log("updating map markers completed");
|
|
339
|
-
count ? _$w(
|
|
347
|
+
count ? _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results') : _$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('noResults');
|
|
340
348
|
|
|
341
349
|
|
|
342
350
|
// Update reset button state
|
|
343
351
|
const hasActiveFilters = filters.length > 0;
|
|
344
|
-
hasActiveFilters? _$w(
|
|
352
|
+
hasActiveFilters? _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).enable() : _$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
|
|
345
353
|
|
|
346
354
|
|
|
347
355
|
}
|
|
348
356
|
|
|
349
357
|
async function resetFilters(_$w) {
|
|
350
|
-
_$w(
|
|
358
|
+
_$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
359
|
|
|
352
|
-
await _$w(
|
|
353
|
-
await _$w(
|
|
360
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
|
|
361
|
+
await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).refresh();
|
|
354
362
|
|
|
355
|
-
_$w(
|
|
363
|
+
_$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
|
|
356
364
|
|
|
357
|
-
_$w(
|
|
365
|
+
_$w(CAREERS_PAGE_SELECTORS.RESET_FILTERS_BUTTON).disable();
|
|
358
366
|
|
|
359
367
|
queryParams.remove(["keyWord", "department","page","location","jobType","brand"]);
|
|
360
368
|
|
|
@@ -366,7 +374,7 @@ async function resetFilters(_$w) {
|
|
|
366
374
|
}
|
|
367
375
|
|
|
368
376
|
async function updateCount(_$w) {
|
|
369
|
-
const count = await _$w(
|
|
377
|
+
const count = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
370
378
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
371
379
|
|
|
372
380
|
return count;
|
|
@@ -377,19 +385,19 @@ async function handleDepartmentParam(_$w,department) {
|
|
|
377
385
|
|
|
378
386
|
|
|
379
387
|
|
|
380
|
-
let dropdownOptions = _$w(
|
|
388
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options;
|
|
381
389
|
console.log("dropdown options:", dropdownOptions);
|
|
382
390
|
const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
|
|
383
391
|
//+1 because of the "All" option
|
|
384
392
|
|
|
385
393
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
386
|
-
fixDropdownOptions(
|
|
394
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT,optionsFromCMS, _$w);
|
|
387
395
|
}
|
|
388
396
|
|
|
389
|
-
if (_$w(
|
|
397
|
+
if (_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).options.find(option => option.value === departmentValue))
|
|
390
398
|
{
|
|
391
399
|
console.log("department value found in dropdown options ",departmentValue);
|
|
392
|
-
_$w(
|
|
400
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_DEPARTMENT).value = departmentValue;
|
|
393
401
|
}
|
|
394
402
|
else{
|
|
395
403
|
console.warn("department value not found in dropdown options");
|
|
@@ -418,18 +426,18 @@ function fixDropdownOptions(dropdown,optionsFromCMS, _$w){
|
|
|
418
426
|
|
|
419
427
|
async function handleLocationParam(_$w,location) {
|
|
420
428
|
const locationValue = decodeURIComponent(location);
|
|
421
|
-
let dropdownOptions = _$w(
|
|
429
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options;
|
|
422
430
|
console.log("location dropdown options:", dropdownOptions);
|
|
423
431
|
const optionsFromCMS=await wixData.query("cities").find();
|
|
424
432
|
//+1 because of the "All" option
|
|
425
433
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
426
|
-
fixDropdownOptions(
|
|
434
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION,optionsFromCMS, _$w);
|
|
427
435
|
}
|
|
428
436
|
|
|
429
|
-
const option=_$w(
|
|
437
|
+
const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).options.find(option => option.value.toLowerCase() === locationValue.toLowerCase())
|
|
430
438
|
|
|
431
439
|
if(option){
|
|
432
|
-
_$w(
|
|
440
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_LOCATION).value = option.value;
|
|
433
441
|
}
|
|
434
442
|
else{
|
|
435
443
|
console.warn("location value not found in dropdown options");
|
|
@@ -440,15 +448,15 @@ async function handleLocationParam(_$w,location) {
|
|
|
440
448
|
|
|
441
449
|
async function handleBrandParam(_$w,brand){
|
|
442
450
|
const brandValue = decodeURIComponent(brand);
|
|
443
|
-
let dropdownOptions = _$w(
|
|
451
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options;
|
|
444
452
|
console.log("brand dropdown options:", dropdownOptions);
|
|
445
453
|
const optionsFromCMS=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
446
454
|
if(dropdownOptions.length!==optionsFromCMS.items.length+1){
|
|
447
|
-
fixDropdownOptions(
|
|
455
|
+
fixDropdownOptions(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND,optionsFromCMS, _$w);
|
|
448
456
|
}
|
|
449
|
-
const option=_$w(
|
|
457
|
+
const option=_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).options.find(option => option.value.toLowerCase() === brandValue.toLowerCase())
|
|
450
458
|
if(option){
|
|
451
|
-
_$w(
|
|
459
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).value = option.value;
|
|
452
460
|
}
|
|
453
461
|
else{
|
|
454
462
|
console.warn("brand value not found in dropdown options");
|
|
@@ -458,7 +466,7 @@ async function handleBrandParam(_$w,brand){
|
|
|
458
466
|
|
|
459
467
|
async function handleJobTypeParam(_$w,jobType) {
|
|
460
468
|
const jobTypeValue = decodeURIComponent(jobType);
|
|
461
|
-
let dropdownOptions = _$w(
|
|
469
|
+
let dropdownOptions = _$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).options;
|
|
462
470
|
console.log("jobType dropdown options:", dropdownOptions);
|
|
463
471
|
let option;
|
|
464
472
|
if(jobTypeValue.toLowerCase()==="remote"){
|
|
@@ -468,7 +476,7 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
468
476
|
option="false";
|
|
469
477
|
}
|
|
470
478
|
if(option){
|
|
471
|
-
_$w(
|
|
479
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_JOB_TYPE).value = option;
|
|
472
480
|
}
|
|
473
481
|
else{
|
|
474
482
|
console.warn("jobType value not found in dropdown options");
|
|
@@ -477,8 +485,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
477
485
|
}
|
|
478
486
|
|
|
479
487
|
async function updateMapMarkers(_$w){
|
|
480
|
-
const numOfItems = await _$w(
|
|
481
|
-
const items = await _$w(
|
|
488
|
+
const numOfItems = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
489
|
+
const items = await _$w(CAREERS_PAGE_SELECTORS.JOBS_DATASET).getItems(0, numOfItems);
|
|
482
490
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
483
491
|
const location = item.locationAddress.location;
|
|
484
492
|
return {
|
|
@@ -491,17 +499,22 @@ async function updateMapMarkers(_$w){
|
|
|
491
499
|
};
|
|
492
500
|
});
|
|
493
501
|
//@ts-ignore
|
|
494
|
-
_$w(
|
|
502
|
+
_$w(CAREERS_PAGE_SELECTORS.GOOGLE_MAPS).setMarkers(markers);
|
|
495
503
|
|
|
496
504
|
}
|
|
497
505
|
|
|
498
506
|
async function handleBrandDropdown(_$w){
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
507
|
+
if(siteconfig.disableMultiBrand==="false"){
|
|
508
|
+
const brands=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
509
|
+
if(brands.items.length>1){
|
|
510
|
+
console.log("showing brand dropdown");
|
|
511
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).show();
|
|
512
|
+
}
|
|
503
513
|
}
|
|
504
|
-
|
|
514
|
+
else{
|
|
515
|
+
_$w(CAREERS_PAGE_SELECTORS.DROPDOWN_BRAND).hide();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
505
518
|
module.exports = {
|
|
506
519
|
careersPageOnReady,
|
|
507
520
|
};
|
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
|
+
};
|