sr-npm 1.7.620 → 1.7.622

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.
@@ -0,0 +1,7 @@
1
+ import globals from "globals";
2
+ import { defineConfig } from "eslint/config";
3
+
4
+ export default defineConfig([
5
+ { files: ["**/*.js"], languageOptions: { sourceType: "commonjs" } },
6
+ { files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.browser } },
7
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.620",
3
+ "version": "1.7.622",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,6 +28,8 @@
28
28
  "tests-utils": "^1.0.7"
29
29
  },
30
30
  "devDependencies": {
31
+ "eslint": "^9.38.0",
32
+ "globals": "^16.4.0",
31
33
  "prettier": "^3.6.2"
32
34
  }
33
35
  }
@@ -3,11 +3,11 @@ const { items: wixData } = require('@wix/data');
3
3
  const {CAREERS_MULTI_BOXES_PAGE_CONSTS} = require('../backend/careersMultiBoxesPageIds');
4
4
 
5
5
  const selectedByField = new Map(); // fieldId -> array of selected value IDs
6
- const optionsByFieldId = new Map(); // fieldId -> [{label, value}]
7
- const countsByFieldId = new Map();
6
+ const optionsByFieldId = new Map(); // fieldId -> [{label, value}] array of objects with label which is the valueLabel and value which is the valueId
7
+ const countsByFieldId = new Map(); // fieldId -> {valueId: count} map of counts for each valueId
8
8
  let alljobs=[] // all jobs in the database
9
9
  let allvaluesobjects=[] // all values in the database
10
- let valueToJobs={} // valueId -> array of jobIds
10
+ let valueToJobs={} // valueId -> array of jobIdsxw
11
11
  let currentJobs=[] // current jobs that are displayed in the jobs repeater
12
12
  async function careersMultiBoxesPageOnReady(_$w) {
13
13
  if(alljobs.length===0) {
@@ -23,6 +23,7 @@ async function careersMultiBoxesPageOnReady(_$w) {
23
23
 
24
24
  await loadJobs(_$w);
25
25
  await loadFilters(_$w);
26
+ //selected values repeater on item ready
26
27
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
27
28
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
28
29
 
@@ -70,6 +71,8 @@ async function loadJobs(_$w) {
70
71
  }
71
72
 
72
73
  function updateTotalJobsCountText(_$w) {
74
+ console.log("updating total jobs count text")
75
+ console.log("currentJobs.length: ",currentJobs.length)
73
76
  _$w('#totalJobsCountText').text = `${currentJobs.length} Jobs`;
74
77
  }
75
78
 
@@ -98,8 +101,8 @@ async function loadJobs(_$w) {
98
101
  // Build CheckboxGroup options for this field
99
102
  const fieldValues = valuesByFieldId.get(fieldId) || [];
100
103
  const originalOptions = fieldValues.map(v => ({
101
- label: v.title ,
102
- value: v._id
104
+ valueLabel: v.title ,
105
+ valueId: v._id
103
106
  }));
104
107
  optionsByFieldId.set(fieldId, originalOptions);
105
108
  console.log("optionsByFieldId: ",optionsByFieldId)
@@ -254,13 +257,12 @@ async function refreshFacetCounts(_$w) {
254
257
  const selectedItems = [];
255
258
  for (const [fieldId, valueIds] of selectedByField.entries()) {
256
259
  const opts = optionsByFieldId.get(fieldId) || [];
257
- const byId = new Map(opts.map(o => [o.value, o.label]));
260
+ //const byId = new Map(opts.map(o => [o.value, o.label]));
258
261
  for (const id of valueIds) {
259
- const label = byId.get(id);
260
- if (label) {
262
+ const found = opts.find((option) => option.valueId === id);
263
+ const label = found.valueLabel;
261
264
  //selectedItems.push({ _id: `${fieldId}:${id}`, label, fieldId, valueId: id });
262
- selectedItems.push({ label, fieldId, valueId: id });
263
- }
265
+ selectedItems.push({ label, fieldId, _id: id }); //_id is the valueId
264
266
  }
265
267
  }
266
268
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;