sr-npm 1.7.625 → 1.7.627
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
|
@@ -2,6 +2,7 @@ const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = r
|
|
|
2
2
|
const { items: wixData } = require('@wix/data');
|
|
3
3
|
const {CAREERS_MULTI_BOXES_PAGE_CONSTS} = require('../backend/careersMultiBoxesPageIds');
|
|
4
4
|
|
|
5
|
+
let valuesByFieldIdGlobal = null;
|
|
5
6
|
const selectedByField = new Map(); // fieldId -> array of selected value IDs
|
|
6
7
|
const optionsByFieldId = new Map(); // fieldId -> [{label, value}] array of objects with label which is the valueLabel and value which is the valueId
|
|
7
8
|
const countsByFieldId = new Map(); // fieldId -> {valueId: count} map of counts for each valueId
|
|
@@ -29,7 +30,6 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
29
30
|
|
|
30
31
|
// Deselect this value from both the selected map and the multibox
|
|
31
32
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.DESELECT_BUTTON_ID).onClick(async () => {
|
|
32
|
-
console.log("deselecting value: ",itemData)
|
|
33
33
|
const fieldId = itemData.fieldId;
|
|
34
34
|
const valueId = itemData.valueId;
|
|
35
35
|
if (!fieldId || !valueId) return;
|
|
@@ -38,7 +38,6 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
38
38
|
const updated = existing.filter(v => v !== valueId);
|
|
39
39
|
if (updated.length) {
|
|
40
40
|
selectedByField.set(fieldId, updated);
|
|
41
|
-
console.log("selectedByField: ",selectedByField)
|
|
42
41
|
} else {
|
|
43
42
|
selectedByField.delete(fieldId);
|
|
44
43
|
}
|
|
@@ -72,8 +71,6 @@ async function loadJobs(_$w) {
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
function updateTotalJobsCountText(_$w) {
|
|
75
|
-
console.log("updating total jobs count text")
|
|
76
|
-
console.log("currentJobs.length: ",currentJobs.length)
|
|
77
74
|
_$w('#totalJobsCountText').text = `${currentJobs.length} Jobs`;
|
|
78
75
|
}
|
|
79
76
|
|
|
@@ -106,7 +103,6 @@ async function loadJobs(_$w) {
|
|
|
106
103
|
value: v._id
|
|
107
104
|
}));
|
|
108
105
|
optionsByFieldId.set(fieldId, originalOptions);
|
|
109
|
-
console.log("optionsByFieldId: ",optionsByFieldId)
|
|
110
106
|
const counter={}
|
|
111
107
|
|
|
112
108
|
for (const val of allvaluesobjects) {
|
|
@@ -114,7 +110,6 @@ async function loadJobs(_$w) {
|
|
|
114
110
|
}
|
|
115
111
|
|
|
116
112
|
countsByFieldId.set(fieldId, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
|
|
117
|
-
console.log("countsByFieldId: ",countsByFieldId)
|
|
118
113
|
|
|
119
114
|
// Initialize UI
|
|
120
115
|
updateOptionsUI($item, fieldId, ''); // no search query
|
|
@@ -222,7 +217,6 @@ async function loadJobs(_$w) {
|
|
|
222
217
|
|
|
223
218
|
|
|
224
219
|
async function refreshFacetCounts(_$w) {
|
|
225
|
-
console.log("current countsByFieldId: ",countsByFieldId)
|
|
226
220
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
227
221
|
for (const fieldId of fieldIds) {
|
|
228
222
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
@@ -258,15 +252,14 @@ async function refreshFacetCounts(_$w) {
|
|
|
258
252
|
const selectedItems = [];
|
|
259
253
|
for (const [fieldId, valueIds] of selectedByField.entries()) {
|
|
260
254
|
const opts = optionsByFieldId.get(fieldId) || [];
|
|
261
|
-
|
|
255
|
+
const byId = new Map(opts.map(o => [o.value, o.label]));
|
|
262
256
|
for (const id of valueIds) {
|
|
263
|
-
const
|
|
264
|
-
|
|
257
|
+
const label = byId.get(id);
|
|
258
|
+
if (label) {
|
|
265
259
|
selectedItems.push({ _id: `${fieldId}:${id}`, label, fieldId, valueId: id });
|
|
266
|
-
|
|
260
|
+
}
|
|
267
261
|
}
|
|
268
262
|
}
|
|
269
|
-
console.log("selectedItems inside updateSelectedValuesRepeater: ",selectedItems)
|
|
270
263
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;
|
|
271
264
|
}
|
|
272
265
|
|
|
@@ -277,9 +270,7 @@ async function refreshFacetCounts(_$w) {
|
|
|
277
270
|
res = await res.next();
|
|
278
271
|
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
279
272
|
}
|
|
280
|
-
console.log("newcurrentJobs inisde new function: ",newcurrentJobs)
|
|
281
273
|
currentJobs = newcurrentJobs;
|
|
282
|
-
console.log("updated currentJobs inisde new function: ",currentJobs)
|
|
283
274
|
}
|
|
284
275
|
|
|
285
276
|
module.exports = {
|