sr-npm 2.0.17 → 2.0.19

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.
@@ -4,7 +4,7 @@ const { items: wixData } = require('@wix/data');
4
4
  const { COLLECTIONS,TOKEN_NAME } = require('./collectionConsts');
5
5
 
6
6
  const getSecretValue = auth.elevate(secrets.getSecretValue);
7
-
7
+ const elevatedQuery = auth.elevate(wixData.query);
8
8
 
9
9
  async function retrieveSecretVal(tokenName)
10
10
  {
@@ -20,7 +20,7 @@ const getSecretValue = auth.elevate(secrets.getSecretValue);
20
20
  }
21
21
 
22
22
  async function getTokenFromCMS(tokenName) {
23
- const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
23
+ const result = await elevatedQuery(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
24
24
  if (result.items.length > 0) {
25
25
  return result.items[0].value;
26
26
  } else {
@@ -28,7 +28,7 @@ const getSecretValue = auth.elevate(secrets.getSecretValue);
28
28
  }
29
29
  }
30
30
  async function getTemplateTypeFromCMS() {
31
- const result = await wixData.query(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
31
+ const result = await elevatedQuery(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
32
32
  if (result.items.length > 0) {
33
33
  return result.items[0].templateType;
34
34
  } else {
package/backend/utils.js CHANGED
@@ -30,7 +30,7 @@ function fillCityLocationAndLocationAddress(jobs, cityLocations,citylocationAddr
30
30
  }
31
31
  }
32
32
 
33
- function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress) {
33
+ function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress,customValuesToJobs=null) {
34
34
  if (field === 'cityText') {
35
35
  return Object.entries(jobsPerField).map(([value, amount]) => {
36
36
  const loc = cityLocations[value] || {};
@@ -43,6 +43,7 @@ function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddre
43
43
  locationAddress: locAddress,
44
44
  country: loc.country,
45
45
  city: loc.city,
46
+ jobIds: customValuesToJobs[value],
46
47
  };
47
48
  });
48
49
  } else {
@@ -0,0 +1,26 @@
1
+ import globals from "globals";
2
+ import js from "@eslint/js";
3
+ import { defineConfig } from "eslint/config";
4
+
5
+ export default defineConfig([
6
+ // Core recommended rules (includes no-undef, no-unused-vars, etc.)
7
+ js.configs.recommended,
8
+
9
+ // Node backend files
10
+ {
11
+ files: ["backend/**/*.js"],
12
+ languageOptions: {
13
+ sourceType: "commonjs",
14
+ globals: { ...globals.node },
15
+ },
16
+ },
17
+
18
+ // Browser/frontend files
19
+ {
20
+ files: ["pages/**/*.js", "public/**/*.js"],
21
+ languageOptions: {
22
+ sourceType: "commonjs",
23
+ globals: { ...globals.browser },
24
+ },
25
+ },
26
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,9 +25,14 @@
25
25
  "@wix/site-window": "^1.0.0",
26
26
  "axios": "^1.11.0",
27
27
  "jest": "^30.0.5",
28
+ "psdev-utils": "1.7.3",
28
29
  "tests-utils": "^1.0.7"
29
30
  },
30
31
  "devDependencies": {
31
- "prettier": "^3.6.2"
32
+ "@eslint/js": "^9.39.0",
33
+ "eslint": "^9.38.0",
34
+ "globals": "^16.4.0",
35
+ "prettier": "^3.6.2",
36
+ "rewire": "^9.0.1"
32
37
  }
33
38
  }
@@ -0,0 +1,28 @@
1
+
2
+ const { location } = require("@wix/site-location");
3
+ async function boardPeoplePageOnReady(_$w,) {
4
+
5
+ await bindBoardPeopleRepeaters(_$w);
6
+
7
+
8
+ }
9
+
10
+ async function bindBoardPeopleRepeaters(_$w) {
11
+
12
+ _$w('#directorsRepeaterItem').onClick((event) => {
13
+ const $item = _$w.at(event.context);
14
+ const clickedItemData = $item('#dynamicDataset').getCurrentItem();
15
+ location.to(`/${clickedItemData['link-board-people-title_fld']}`);
16
+
17
+ });
18
+
19
+ _$w('#executivesRepeaterItem').onClick((event) => {
20
+ const $item = _$w.at(event.context);
21
+ const clickedItemData = $item('#dataset1').getCurrentItem();
22
+ location.to(`/${clickedItemData['link-board-people-title_fld']}`);
23
+
24
+ });
25
+ }
26
+ module.exports = {
27
+ boardPeoplePageOnReady,
28
+ };
@@ -0,0 +1,12 @@
1
+
2
+ const { location } = require("@wix/site-location");
3
+ async function brandPageOnReady(_$w,brand) {
4
+ const decodedBrand = decodeURIComponent(brand);
5
+ _$w('#seeJobsButton').onClick(() => {
6
+ location.to(`/search?brand=${decodedBrand}`);
7
+ });
8
+ }
9
+
10
+ module.exports = {
11
+ brandPageOnReady,
12
+ };