sr-npm 1.2.76 → 1.2.77
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.
|
@@ -34,6 +34,12 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
34
34
|
RESULTS_MULTI_STATE_BOX: '#multiStateBox1',
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const PRIMARY_SEARCH_STATES={
|
|
38
|
+
CATEGORY_RESULTS: 'categoryResults',
|
|
39
|
+
JOB_RESULTS: 'jobResults',
|
|
40
|
+
NO_RESULTS: 'noResults',
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
const TWG_JOBS_COLLECTION_FIELDS={
|
|
38
44
|
LINK_JOBS_TITLE: 'link-jobs-title',
|
|
39
45
|
LINK_JOBS_REF_ID_SLUG: 'link-jobs-refId-slug',
|
|
@@ -82,4 +88,5 @@ module.exports = {
|
|
|
82
88
|
CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
83
89
|
possibleUrlParams,
|
|
84
90
|
TWG_JOBS_COLLECTION_FIELDS,
|
|
91
|
+
PRIMARY_SEARCH_STATES,
|
|
85
92
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
2
|
-
const { CAREERS_PAGE_SELECTORS } = require('../public/selectors');
|
|
2
|
+
const { CAREERS_PAGE_SELECTORS, GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
3
3
|
|
|
4
4
|
const { window } = require('@wix/site-window');
|
|
5
5
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
@@ -147,7 +147,7 @@ async function handleUrlParams(_$w,urlParams,handleBackAndForth=false) {
|
|
|
147
147
|
applyFiltering = await queryPrimarySearchResults(_$w, decodeURIComponent(urlParams.keyword));
|
|
148
148
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value = decodeURIComponent(urlParams.keyword);
|
|
149
149
|
|
|
150
|
-
const items = await getAllDatasetItems(_$w,
|
|
150
|
+
const items = await getAllDatasetItems(_$w, GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET);
|
|
151
151
|
|
|
152
152
|
currentJobs = items;
|
|
153
153
|
keywordAllJobs = items;
|
package/pages/careersPage.js
CHANGED
|
@@ -6,7 +6,7 @@ const { location } = require("@wix/site-location");
|
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
7
|
const { careersMultiBoxesPageOnReady } = require('./careersMultiBoxesPage');
|
|
8
8
|
const { debounce, getFilter} = require('../public/filterUtils');
|
|
9
|
-
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS } = require('../public/selectors');
|
|
9
|
+
const { CAREERS_PAGE_SELECTORS, FILTER_FIELDS, GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
10
10
|
const { filterBrokenMarkers } = require('../public/utils');
|
|
11
11
|
|
|
12
12
|
let currentLoadedItems =100;
|
|
@@ -58,10 +58,10 @@ async function careersPageOnReady(_$w,thisObject=null,queryParams=null) {
|
|
|
58
58
|
|
|
59
59
|
function activateAutoLoad(_$w)
|
|
60
60
|
{
|
|
61
|
-
_$w(
|
|
61
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReady(() => {
|
|
62
62
|
updateCount(_$w);
|
|
63
63
|
_$w(CAREERS_PAGE_SELECTORS.FOOTER).onViewportEnter(() => {
|
|
64
|
-
if (currentLoadedItems<_$w(
|
|
64
|
+
if (currentLoadedItems<_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount()) {
|
|
65
65
|
loadMoreJobs(_$w);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
@@ -81,7 +81,7 @@ async function loadMoreJobs(_$w) {
|
|
|
81
81
|
pageParamSet = Number(pageParamSet) + 1;
|
|
82
82
|
}
|
|
83
83
|
if (shouldLoad) {
|
|
84
|
-
_$w(
|
|
84
|
+
_$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).loadMore();
|
|
85
85
|
console.log("loading more jobs");
|
|
86
86
|
|
|
87
87
|
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
@@ -148,7 +148,7 @@ async function handlePageParam(_$w) {
|
|
|
148
148
|
//scrolls a bit to load the dataset data
|
|
149
149
|
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
150
150
|
for (let i = 2; i <= queryPageVar; i++) {
|
|
151
|
-
await _$w(
|
|
151
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).loadMore();
|
|
152
152
|
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
153
153
|
}
|
|
154
154
|
// the timeout is to wait for the repeater to render, then scroll to the last item.
|
|
@@ -170,7 +170,7 @@ async function handlePageParam(_$w) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
async function bind(_$w) {
|
|
173
|
-
await _$w(
|
|
173
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReady(async () => {
|
|
174
174
|
await updateCount(_$w);
|
|
175
175
|
await updateMapMarkers(_$w);
|
|
176
176
|
|
|
@@ -337,8 +337,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
const filter = await getFilter(filters, 'and');
|
|
340
|
-
await _$w(
|
|
341
|
-
await _$w(
|
|
340
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
341
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
342
342
|
|
|
343
343
|
const count = await updateCount(_$w);
|
|
344
344
|
console.log("updating map markers");
|
|
@@ -357,8 +357,8 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
|
|
|
357
357
|
async function resetFilters(_$w) {
|
|
358
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 = '';
|
|
359
359
|
|
|
360
|
-
await _$w(
|
|
361
|
-
await _$w(
|
|
360
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(wixData.filter());
|
|
361
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
362
362
|
|
|
363
363
|
_$w(CAREERS_PAGE_SELECTORS.RESULTS_MULTI_STATE).changeState('results');
|
|
364
364
|
|
|
@@ -374,7 +374,7 @@ async function resetFilters(_$w) {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
async function updateCount(_$w) {
|
|
377
|
-
const count = await _$w(
|
|
377
|
+
const count = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
378
378
|
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
379
379
|
|
|
380
380
|
return count;
|
|
@@ -485,8 +485,8 @@ async function handleJobTypeParam(_$w,jobType) {
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
async function updateMapMarkers(_$w){
|
|
488
|
-
const numOfItems = await _$w(
|
|
489
|
-
const items = await _$w(
|
|
488
|
+
const numOfItems = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
489
|
+
const items = await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getItems(0, numOfItems);
|
|
490
490
|
const markers = filterBrokenMarkers(items.items).map(item => {
|
|
491
491
|
const location = item.locationAddress.location;
|
|
492
492
|
return {
|
package/pages/homePage.js
CHANGED
|
@@ -6,6 +6,7 @@ const {wixData} = require('wix-data');
|
|
|
6
6
|
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
7
7
|
const { getAllRecords } = require('./pagesUtils');
|
|
8
8
|
const { handlePrimarySearch } = require('../public/primarySearchUtils');
|
|
9
|
+
const { GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
9
10
|
|
|
10
11
|
let thisObjectVar;
|
|
11
12
|
let searchByCityFlag=false;
|
|
@@ -161,10 +162,10 @@ async function handleSearchInput(_$w) {
|
|
|
161
162
|
|
|
162
163
|
let filter = await getFilter(searchByTitle);
|
|
163
164
|
|
|
164
|
-
await _$w(
|
|
165
|
-
await _$w(
|
|
165
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
166
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
166
167
|
|
|
167
|
-
count = _$w(
|
|
168
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
168
169
|
|
|
169
170
|
if (count > 0) {
|
|
170
171
|
searchByCityFlag = false;
|
|
@@ -172,9 +173,9 @@ async function handleSearchInput(_$w) {
|
|
|
172
173
|
_$w('#searchMultiStateBox').changeState('results');
|
|
173
174
|
} else {
|
|
174
175
|
filter = await getFilter(searchByCity);
|
|
175
|
-
await _$w(
|
|
176
|
-
await _$w(
|
|
177
|
-
count = _$w(
|
|
176
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
177
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
178
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
178
179
|
if( count > 0 )
|
|
179
180
|
{
|
|
180
181
|
searchByCityFlag = true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { location } = require("@wix/site-location");
|
|
2
2
|
|
|
3
|
-
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
|
|
3
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS, PRIMARY_SEARCH_STATES } = require('../backend/careersMultiBoxesPageIds');
|
|
4
|
+
const { GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
4
5
|
const { getFilter } = require('../public/filterUtils');
|
|
5
6
|
const { debounce } = require('../pages/pagesUtils');
|
|
6
7
|
|
|
@@ -9,7 +10,7 @@ async function handlePrimarySearch(_$w, allvaluesobjects) {
|
|
|
9
10
|
loadCategoryRepeaterData(_$w, allvaluesobjects);
|
|
10
11
|
|
|
11
12
|
// wait for the jobs dataset to be ready
|
|
12
|
-
await _$w(
|
|
13
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).onReadyAsync();
|
|
13
14
|
|
|
14
15
|
await bindPrimarySearch(_$w);
|
|
15
16
|
}
|
|
@@ -72,7 +73,7 @@ function getSearchQuery(_$w) {
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
async function handleSearchInput(_$w) {
|
|
75
|
-
_$w(
|
|
76
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).enable();
|
|
76
77
|
|
|
77
78
|
// on Input call the queryPrimarySearchResults function
|
|
78
79
|
const callQueryPrimarySearchResults = async () => {
|
|
@@ -91,7 +92,7 @@ async function handleSearchInput(_$w) {
|
|
|
91
92
|
await queryPrimarySearchResults(_$w, searchQuery);
|
|
92
93
|
}
|
|
93
94
|
else {
|
|
94
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
95
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(PRIMARY_SEARCH_STATES.CATEGORY_RESULTS);
|
|
95
96
|
}
|
|
96
97
|
});
|
|
97
98
|
|
|
@@ -114,36 +115,36 @@ async function handleSearchInput(_$w) {
|
|
|
114
115
|
|
|
115
116
|
async function queryPrimarySearchResults(_$w, query) {
|
|
116
117
|
if(query === undefined || query === '') {
|
|
117
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
118
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(PRIMARY_SEARCH_STATES.CATEGORY_RESULTS);
|
|
118
119
|
return false;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
const searchByTitle = [{field: 'title', searchTerm: query}];
|
|
122
123
|
const searchByCity = [{field: 'location.fullLocation', searchTerm: query}];
|
|
123
124
|
|
|
124
|
-
let filter = await getFilter(searchByTitle);
|
|
125
|
+
let filter = await getFilter(searchByTitle);
|
|
125
126
|
|
|
126
|
-
await _$w(
|
|
127
|
-
await _$w(
|
|
127
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
128
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
128
129
|
|
|
129
|
-
let count = _$w(
|
|
130
|
+
let count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
130
131
|
|
|
131
132
|
if( count > 0 ) {
|
|
132
133
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
133
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
134
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(PRIMARY_SEARCH_STATES.JOB_RESULTS);
|
|
134
135
|
}
|
|
135
136
|
else {
|
|
136
137
|
filter = await getFilter(searchByCity);
|
|
137
|
-
await _$w(
|
|
138
|
-
await _$w(
|
|
138
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).setFilter(filter);
|
|
139
|
+
await _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).refresh();
|
|
139
140
|
|
|
140
|
-
count = _$w(
|
|
141
|
+
count = _$w(GLOBAL_SECTIONS_SELECTORS.JOBS_DATASET).getTotalCount();
|
|
141
142
|
if (count > 0) {
|
|
142
143
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
143
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
144
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(PRIMARY_SEARCH_STATES.JOB_RESULTS);
|
|
144
145
|
}
|
|
145
146
|
else{
|
|
146
|
-
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(
|
|
147
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState(PRIMARY_SEARCH_STATES.NO_RESULTS);
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
package/public/selectors.js
CHANGED
|
@@ -26,19 +26,22 @@ const CAREERS_PAGE_SELECTORS = {
|
|
|
26
26
|
OPEN_FILTERS_BUTTON: '#openFiltersButton',
|
|
27
27
|
CLOSE_FILTERS_BUTTON: '#closeFiltersButton',
|
|
28
28
|
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
29
|
-
RESET_FILTERS_BUTTON: '#resetFiltersButton',
|
|
30
29
|
|
|
31
30
|
RESULTS_MULTI_STATE: '#resultsMultiState',
|
|
32
31
|
BRANDS_DATASET: '#brandsDataset',
|
|
33
32
|
DEPARTMENTS_DATASET: '#departmentsDataset',
|
|
34
33
|
LOCATIONS_DATASET: '#locationsDataset',
|
|
35
34
|
JOB_TYPES_DATASET: '#jobTypesDataset',
|
|
36
|
-
JOBS_DATASET: '#jobsDataset',
|
|
37
35
|
|
|
38
36
|
GOOGLE_MAPS: '#googleMaps',
|
|
39
37
|
FOOTER: '#footer',
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
const GLOBAL_SECTIONS_SELECTORS = {
|
|
41
|
+
JOBS_DATASET: '#jobsDataset',
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
42
45
|
const FILTER_FIELDS = {
|
|
43
46
|
DEPARTMENT: 'department',
|
|
44
47
|
LOCATION: 'cityText',
|
|
@@ -49,5 +52,6 @@ const FILTER_FIELDS = {
|
|
|
49
52
|
|
|
50
53
|
module.exports = {
|
|
51
54
|
CAREERS_PAGE_SELECTORS,
|
|
55
|
+
GLOBAL_SECTIONS_SELECTORS,
|
|
52
56
|
FILTER_FIELDS,
|
|
53
57
|
}
|