sr-npm 1.7.859 → 1.7.861
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/package.json
CHANGED
|
@@ -21,7 +21,6 @@ const pagination = {
|
|
|
21
21
|
currentPage: 1,
|
|
22
22
|
};
|
|
23
23
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
24
|
-
console.log("careersMultiBoxesPageOnReady urlParams: ", urlParams);
|
|
25
24
|
await loadData(_$w);
|
|
26
25
|
|
|
27
26
|
await Promise.all([
|
|
@@ -40,7 +39,6 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
async function clearAll(_$w) {
|
|
43
|
-
console.log("clear all button clicked");
|
|
44
42
|
if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
|
|
45
43
|
for(const field of allfields) {
|
|
46
44
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = [];
|
|
@@ -58,10 +56,12 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
58
56
|
try {
|
|
59
57
|
let applyFiltering=false;
|
|
60
58
|
let keyword=false
|
|
61
|
-
console.log("handleUrlParams urlParams: ", urlParams);
|
|
62
59
|
if(urlParams.brand) {
|
|
63
60
|
applyFiltering=await handleParams(_$w,"brand",urlParams.brand)
|
|
64
61
|
}
|
|
62
|
+
if(urlParams.visibility) {
|
|
63
|
+
applyFiltering=await handleParams(_$w,"visibility",urlParams.visibility)
|
|
64
|
+
}
|
|
65
65
|
if(urlParams.category) {
|
|
66
66
|
applyFiltering=await handleParams(_$w,"category",urlParams.category)
|
|
67
67
|
}
|
|
@@ -71,7 +71,6 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
71
71
|
keyword=true;
|
|
72
72
|
if(applyFiltering)
|
|
73
73
|
{
|
|
74
|
-
console.log("delete me")
|
|
75
74
|
currentJobs=_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).data;
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -105,12 +104,9 @@ async function handleUrlParams(_$w,urlParams) {
|
|
|
105
104
|
|
|
106
105
|
async function handleParams(_$w,param,value) {
|
|
107
106
|
let applyFiltering=false;
|
|
108
|
-
console.log("handleParams param: ", param, " value: ", value);
|
|
109
107
|
const decodedValue = decodeURIComponent(value);
|
|
110
|
-
console.log("decodedValue: ", decodedValue);
|
|
111
108
|
const field=getFieldByTitle(fieldTitlesInCMS[param],allfields);
|
|
112
109
|
const options=optionsByFieldId.get(field._id);
|
|
113
|
-
console.log("all options availbe for this field: ", field.title, " are ", options);
|
|
114
110
|
const option=getCorrectOption(decodedValue,options);
|
|
115
111
|
if(option) {
|
|
116
112
|
const optionIndex=getOptionIndexFromCheckBox(_$w(`#${FiltersIds[field.title]}CheckBox`).options,option.value);
|
|
@@ -238,10 +234,6 @@ async function loadJobsRepeater(_$w) {
|
|
|
238
234
|
// 2) Load all values once and group them by referenced field
|
|
239
235
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
240
236
|
valuesByFieldId.set("Location",cities)
|
|
241
|
-
console.log("valuesByFieldId: ", valuesByFieldId);
|
|
242
|
-
console.log("allvaluesobjects: ", allvaluesobjects);
|
|
243
|
-
console.log("allfields: ", allfields);
|
|
244
|
-
|
|
245
237
|
// Build CheckboxGroup options for this field
|
|
246
238
|
|
|
247
239
|
const counter={}
|
|
@@ -267,15 +259,9 @@ async function loadJobsRepeater(_$w) {
|
|
|
267
259
|
}
|
|
268
260
|
|
|
269
261
|
countsByFieldId.set(key, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
270
|
-
console.log("i am here 0 , field: ", field);
|
|
271
|
-
console.log("countsByFieldId: ", countsByFieldId);
|
|
272
|
-
console.log("optionsByFieldId: ", optionsByFieldId);
|
|
273
262
|
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
274
|
-
console.log("after updateoptionUI");
|
|
275
263
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
276
|
-
console.log("i am here 1 , field.title: ", field.title);
|
|
277
264
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
278
|
-
console.log(`#${FiltersIds[field.title]}CheckBox.selectedIndices: `, _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices);
|
|
279
265
|
dontUpdateThisCheckBox=field._id;
|
|
280
266
|
const selected = ev.target.value; // array of selected value IDs
|
|
281
267
|
if (selected && selected.length) {
|
|
@@ -286,19 +272,14 @@ async function loadJobsRepeater(_$w) {
|
|
|
286
272
|
await updateJobsAndNumbersAndFilters(_$w);
|
|
287
273
|
|
|
288
274
|
});
|
|
289
|
-
console.log("i am here 2 , field.title: ", field.title);
|
|
290
275
|
const runFilter = debounce(() => {
|
|
291
276
|
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
292
277
|
updateOptionsUI(_$w, field.title, field._id, query);
|
|
293
278
|
}, 150);
|
|
294
|
-
console.log("i am here 3 , field.title: ", field.title);
|
|
295
279
|
_$w(`#${FiltersIds[field.title]}input`).onInput(runFilter);
|
|
296
|
-
console.log("i am here 4 , field.title: ", field.title);
|
|
297
280
|
|
|
298
281
|
}
|
|
299
|
-
console.log("i am here 5 ");
|
|
300
282
|
await refreshFacetCounts(_$w);
|
|
301
|
-
console.log("i am here 6 ");
|
|
302
283
|
|
|
303
284
|
} catch (err) {
|
|
304
285
|
console.error('Failed to load filters:', err);
|
|
@@ -316,13 +297,7 @@ console.log("i am here 5 ");
|
|
|
316
297
|
|
|
317
298
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
318
299
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
319
|
-
console.log("fieldTitle :", fieldTitle);
|
|
320
|
-
console.log("fieldId :", fieldId);
|
|
321
|
-
console.log("base :", base);
|
|
322
300
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
323
|
-
console.log("countsMap :", countsMap);
|
|
324
|
-
console.log("searchQuery :", searchQuery);
|
|
325
|
-
console.log("clearAll :", clearAll);
|
|
326
301
|
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
327
302
|
{
|
|
328
303
|
dontUpdateThisCheckBox=null;
|
|
@@ -344,21 +319,16 @@ console.log("i am here 5 ");
|
|
|
344
319
|
value: o.value
|
|
345
320
|
};
|
|
346
321
|
});
|
|
347
|
-
console.log("withCounts :", withCounts);
|
|
348
322
|
// Apply search
|
|
349
323
|
const filtered = searchQuery
|
|
350
324
|
? withCounts.filter(o => (o.label || '').toLowerCase().includes(searchQuery))
|
|
351
325
|
: withCounts;
|
|
352
|
-
console.log("filtered :", filtered);
|
|
353
326
|
|
|
354
327
|
// Preserve currently selected values that are still visible
|
|
355
328
|
let prevSelected=[]
|
|
356
|
-
console.log("FiltersIds[fieldTitle] :", FiltersIds[fieldTitle]);
|
|
357
329
|
clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
358
330
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
359
|
-
console.log("visibleSet :", visibleSet);
|
|
360
331
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
361
|
-
console.log("preserved :", preserved);
|
|
362
332
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
363
333
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = preserved;
|
|
364
334
|
}
|
package/pages/pagesUtils.js
CHANGED
|
@@ -152,7 +152,7 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
152
152
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
console.log("all jobs: ", alljobs);
|
|
156
156
|
let filteredJobs=alljobs.filter(job=>job.title.toLowerCase().includes(query));
|
|
157
157
|
if(filteredJobs.length>0) {
|
|
158
158
|
//currentJobs=filteredJobs;
|
|
@@ -161,6 +161,7 @@ async function primarySearch(_$w,query,alljobs) {
|
|
|
161
161
|
return true;
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
164
|
+
|
|
164
165
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("noResults");
|
|
165
166
|
return false;
|
|
166
167
|
}
|