sr-npm 3.1.14 → 3.1.15
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.
|
@@ -31,16 +31,11 @@ const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
|
31
31
|
PRIMARY_SEARCH_CATEGORY_BUTTON: '#primarySearchCategoryButton',
|
|
32
32
|
RESULTS_CONTAINER: '#resultsContainer',
|
|
33
33
|
PRIMARY_SEARCH_BUTTON: '#primarySearchButton',
|
|
34
|
-
}
|
|
35
34
|
|
|
36
|
-
const TWG_JOBS_COLLECTION_FIELDS={
|
|
37
|
-
LINK_JOBS_TITLE: 'link-jobs-title',
|
|
38
|
-
LINK_JOBS_REF_ID_SLUG: 'link-jobs-refId-slug',
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
const CATEGORY_CUSTOM_FIELD_ID_IN_CMS='5cd8c873c9e77c0008aa7d23';
|
|
42
38
|
|
|
43
|
-
// used for filters - don't add anything else here
|
|
44
39
|
const fieldTitlesInCMS={
|
|
45
40
|
"brand": "Brands",
|
|
46
41
|
category: "Category",
|
|
@@ -74,11 +69,16 @@ const possibleUrlParams=[
|
|
|
74
69
|
"storename",
|
|
75
70
|
]
|
|
76
71
|
|
|
72
|
+
|
|
73
|
+
const LINK_JOBS_TITLE = "link-jobs-title";
|
|
74
|
+
const LINK_JOBS_REF_ID_SLUG = "link-jobs-refId-slug";
|
|
75
|
+
|
|
77
76
|
module.exports = {
|
|
78
77
|
CAREERS_MULTI_BOXES_PAGE_CONSTS,
|
|
79
78
|
FiltersIds,
|
|
80
79
|
fieldTitlesInCMS,
|
|
81
80
|
CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
82
81
|
possibleUrlParams,
|
|
83
|
-
|
|
82
|
+
LINK_JOBS_TITLE,
|
|
83
|
+
LINK_JOBS_REF_ID_SLUG,
|
|
84
84
|
}
|
package/package.json
CHANGED
|
@@ -4,13 +4,7 @@ const { CAREERS_PAGE_SELECTORS } = require('../public/selectors');
|
|
|
4
4
|
const { window } = require('@wix/site-window');
|
|
5
5
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
6
6
|
const { location } = require("@wix/site-location");
|
|
7
|
-
const {
|
|
8
|
-
CAREERS_MULTI_BOXES_PAGE_CONSTS,
|
|
9
|
-
FiltersIds,
|
|
10
|
-
fieldTitlesInCMS,
|
|
11
|
-
possibleUrlParams,
|
|
12
|
-
TWG_JOBS_COLLECTION_FIELDS
|
|
13
|
-
} = require('../backend/careersMultiBoxesPageIds');
|
|
7
|
+
const {CAREERS_MULTI_BOXES_PAGE_CONSTS,FiltersIds,fieldTitlesInCMS,possibleUrlParams} = require('../backend/careersMultiBoxesPageIds');
|
|
14
8
|
const { groupValuesByField,
|
|
15
9
|
debounce,
|
|
16
10
|
getAllRecords,
|
|
@@ -318,7 +312,7 @@ async function loadJobsRepeater(_$w) {
|
|
|
318
312
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).onItemReady(($item, itemData) => {
|
|
319
313
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).text = itemData.title;
|
|
320
314
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).onClick(() => {
|
|
321
|
-
location.to(itemData[
|
|
315
|
+
location.to(itemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_TITLE] || itemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_REF_ID_SLUG]);
|
|
322
316
|
});
|
|
323
317
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_LOCATION).text=itemData.location.fullLocation
|
|
324
318
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_EMPLOYMENT_TYPE).text=itemData.employmentType
|
|
@@ -441,16 +435,20 @@ function getValueFromValueId(valueIds, value) {
|
|
|
441
435
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
442
436
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
443
437
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
444
|
-
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
438
|
+
if(dontUpdateThisCheckBox===fieldId && !clearAll && selectedByField.has(fieldId) )
|
|
445
439
|
{
|
|
446
|
-
|
|
447
|
-
|
|
440
|
+
dontUpdateThisCheckBox=null;
|
|
441
|
+
return;
|
|
448
442
|
}
|
|
449
443
|
let filteredbase=[]
|
|
450
444
|
for (const element of base)
|
|
451
445
|
{
|
|
452
446
|
if(countsMap.get(element.value))
|
|
453
447
|
{
|
|
448
|
+
if(countsMap.get(element.value)==-1)
|
|
449
|
+
{
|
|
450
|
+
countsMap.set(element.value,0);
|
|
451
|
+
}
|
|
454
452
|
filteredbase.push(element)
|
|
455
453
|
}
|
|
456
454
|
}
|
|
@@ -468,19 +466,31 @@ function getValueFromValueId(valueIds, value) {
|
|
|
468
466
|
: withCounts;
|
|
469
467
|
|
|
470
468
|
// Preserve currently selected values that are still visible
|
|
471
|
-
|
|
472
|
-
|
|
469
|
+
// let prevSelected=[]
|
|
470
|
+
// clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
473
471
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
474
|
-
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
472
|
+
//const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
475
473
|
if(filtered.length===0) {
|
|
476
474
|
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}NoResults`);
|
|
477
475
|
}
|
|
478
476
|
else{
|
|
479
477
|
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}Results`);
|
|
480
478
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
481
|
-
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value =
|
|
479
|
+
clearAll?_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value=[]:_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = visibleSet
|
|
480
|
+
if(visibleSet.size>0 && selectedByField.has(fieldId)) {
|
|
481
|
+
let selectedindices=[];
|
|
482
|
+
for(const value of selectedByField.get(fieldId)) {
|
|
483
|
+
const options = optionsByFieldId.get(fieldId) || [];
|
|
484
|
+
const option = getCorrectOption(value,options,fieldTitle);
|
|
485
|
+
if(option) {
|
|
486
|
+
const optionIndex = getOptionIndexFromCheckBox(_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options,option.value);
|
|
487
|
+
selectedindices.push(optionIndex);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).selectedIndices = selectedindices;
|
|
482
491
|
}
|
|
483
492
|
}
|
|
493
|
+
}
|
|
484
494
|
|
|
485
495
|
async function applyJobFilters(_$w) {
|
|
486
496
|
let tempFilteredJobs=[];
|
|
@@ -593,7 +603,18 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
593
603
|
counter.set(option.value, (counter.get(option.value) || 0) + 1);
|
|
594
604
|
}
|
|
595
605
|
}
|
|
606
|
+
|
|
607
|
+
}
|
|
608
|
+
if(selectedByField.has(fieldId)) {
|
|
609
|
+
for (const value of selectedByField.get(fieldId)) {
|
|
610
|
+
console.log("value: ",value)
|
|
611
|
+
if(counter.get(value)===undefined)
|
|
612
|
+
{
|
|
613
|
+
//it is -1 as a flag, so in case it was selected and after selecting more filters from different field and suddenly no more jobs have it, we will show 0
|
|
614
|
+
counter.set(value, -1);
|
|
615
|
+
}
|
|
596
616
|
}
|
|
617
|
+
}
|
|
597
618
|
countsByFieldId.set(fieldId, counter);
|
|
598
619
|
}
|
|
599
620
|
}
|
package/pages/pagesUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
2
|
const { JOBS_COLLECTION_FIELDS,COLLECTIONS } = require('../backend/collectionConsts');
|
|
3
|
-
const { CAREERS_MULTI_BOXES_PAGE_CONSTS,
|
|
3
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS,CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
|
|
4
4
|
const { location } = require("@wix/site-location");
|
|
5
5
|
const { normalizeString } = require('../backend/utils');
|
|
6
6
|
const { getFilter } = require('../public/filterUtils');
|
|
@@ -81,10 +81,12 @@ function getFieldByTitle(title,allFields) {
|
|
|
81
81
|
|
|
82
82
|
function getCorrectOption(value,options,param) {
|
|
83
83
|
const standardizedValue = normalizeString(value.toLowerCase())
|
|
84
|
-
if(param==="employmenttype") //employmenttype have a problematic value
|
|
84
|
+
if(param==="employmenttype" || param==="Employment Type" || param==="Store Name") //employmenttype have a problematic value, added Employment Type for updateOptionsUI fuinction, added Store Name because Store name and location have for example Blenheim
|
|
85
85
|
{
|
|
86
|
+
//option.value is the id,
|
|
86
87
|
return options.find(option=>normalizeString(option.value.toLowerCase())===standardizedValue);
|
|
87
88
|
}
|
|
89
|
+
//option.label is what we see live in the UI
|
|
88
90
|
return options.find(option=>normalizeString(option.label.toLowerCase())===standardizedValue);
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -109,12 +111,12 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
109
111
|
(item) => item._id === event.context.itemId,
|
|
110
112
|
|
|
111
113
|
);
|
|
112
|
-
if(!clickedItemData[
|
|
114
|
+
if(!clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_TITLE] && !clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_REF_ID_SLUG]) {
|
|
113
115
|
console.error("clickedItemData does not have link-jobs-title or link-jobs-refId-slug");
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
location.to(
|
|
119
|
+
location.to(clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_TITLE]||clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_REF_ID_SLUG]);
|
|
118
120
|
|
|
119
121
|
|
|
120
122
|
});
|
package/pages/positionPage.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { query } = require("wix-location-frontend");
|
|
2
2
|
const { getPositionWithMultiRefField } = require('../backend/queries');
|
|
3
3
|
const { COLLECTIONS,JOBS_COLLECTION_FIELDS,CUSTOM_FIELDS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
4
|
-
const {
|
|
4
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS } = require('../backend/careersMultiBoxesPageIds');
|
|
5
5
|
const { items: wixData } = require('@wix/data');
|
|
6
6
|
const { location } = require("@wix/site-location");
|
|
7
7
|
const{isElementExistOnPage} = require('psdev-utils');
|
|
@@ -74,7 +74,7 @@ async function getCategoryValue(customValues) {
|
|
|
74
74
|
const clickedItemData = data.find(
|
|
75
75
|
(item) => item._id === event.context.itemId,
|
|
76
76
|
);
|
|
77
|
-
location.to(clickedItemData[
|
|
77
|
+
location.to(clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_TITLE] || clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_REF_ID_SLUG]);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
if(isElementExistOnPage(_$w('#relatedJobsDataset')))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { getLatestJobsByValue, getValueFromValueId } = require('./pagesUtils');
|
|
2
2
|
const { location } = require("@wix/site-location");
|
|
3
3
|
const { supportTeamsPageIds,supportTeamsPageSections } = require('../backend/consts');
|
|
4
|
-
const {
|
|
4
|
+
const { CAREERS_MULTI_BOXES_PAGE_CONSTS } = require('../backend/careersMultiBoxesPageIds');
|
|
5
5
|
const { getAllRecordsWithoutMultiRef } = require('./pagesUtils');
|
|
6
6
|
|
|
7
7
|
let currentItem;
|
|
@@ -61,7 +61,7 @@ async function handleRecentJobsSection(_$w) {
|
|
|
61
61
|
const clickedItemData = data.find(
|
|
62
62
|
(item) => item._id === event.context.itemId,
|
|
63
63
|
);
|
|
64
|
-
location.to(clickedItemData[
|
|
64
|
+
location.to(clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_TITLE] || clickedItemData[CAREERS_MULTI_BOXES_PAGE_CONSTS.LINK_JOBS_REF_ID_SLUG]);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
_$w(supportTeamsPageIds.RECENT_JOBS_BUTTON).onClick( () => {
|