sr-npm 1.7.566 → 1.7.568

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.
@@ -89,7 +89,7 @@ const COLLECTIONS_FIELDS = {
89
89
  {key:'templateType', type: 'TEXT'},
90
90
  ],
91
91
  SITE_CONFIGS: [
92
- {key:'urlParams', type: 'TEXT'},
92
+ {key:'onlyBrandKeywordUrlParams', type: 'TEXT'},
93
93
  {key:'customFields', type: 'TEXT'},
94
94
  ],
95
95
  SECRET_MANAGER_MIRROR: [
package/backend/data.js CHANGED
@@ -10,6 +10,7 @@ const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
10
10
  let jobToCustomValues = {}
11
11
  let customValuesToJobs = {}
12
12
  let siteconfig;
13
+ const EXCLUDED_CUSTOM_FIELDS = new Set(["Country", "Department", "Brands"]);
13
14
 
14
15
  function getBrand(customField) {
15
16
  return customField.find(field => field.fieldLabel === 'Brands')?.valueLabel;
@@ -18,6 +19,7 @@ function getBrand(customField) {
18
19
  async function getSiteConfig() {
19
20
  const queryresult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
20
21
  siteconfig = queryresult.items[0];
22
+ console.log("siteconfig: ", siteconfig);
21
23
  }
22
24
  function validatePosition(position) {
23
25
  if (!position.id) {
@@ -64,10 +66,9 @@ function validateSingleDesiredBrand(desiredBrand) {
64
66
  function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues) {
65
67
  const customFieldsArray = Array.isArray(position?.customField) ? position.customField : [];
66
68
  for (const field of customFieldsArray) {
67
- if(field.fieldLabel==="Country" || field.fieldLabel==="Department" || field.fieldLabel==="Brands") continue; //country and department are not custom fields, they are already in the job object
68
- const label = field.fieldLabel
69
+ if(EXCLUDED_CUSTOM_FIELDS.has(field.fieldLabel)) continue; //country and department are not custom fields, they are already in the job object
69
70
  const fieldId=normalizeString(field.fieldId)
70
- const fieldLabel = label;
71
+ const fieldLabel = field.fieldLabel;
71
72
  const valueId=normalizeString(field.valueId)
72
73
  const valueLabel = field.valueLabel
73
74
  customFieldsLabels[fieldId] = fieldLabel
@@ -119,8 +120,9 @@ async function saveJobsDataToCMS() {
119
120
  return basicJob;
120
121
  });
121
122
  if(siteconfig===undefined) {
122
- siteconfig = await getSiteConfig();
123
+ await getSiteConfig();
123
124
  }
125
+ console.log("siteconfig is @#!#!@!@$##!@: ", siteconfig);
124
126
  if (siteconfig.customFields==="true") {
125
127
  await populateCustomFieldsCollection(customFieldsLabels);
126
128
  await populateCustomValuesCollection(customFieldsValues);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.566",
3
+ "version": "1.7.568",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,9 +27,10 @@ const {
27
27
 
28
28
  async function careersPageOnReady(_$w,thisObject,queryParams) {
29
29
  if(siteconfig===undefined) {
30
- siteconfig = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
31
- siteconfig = siteconfig.items[0];
30
+ const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
31
+ siteconfig = queryResult.items[0];
32
32
  }
33
+ console.log("siteconfig: ", siteconfig);
33
34
  console.log("queryParams: ", queryParams);
34
35
  const { page, keyWord, department, location,jobType,brand } = queryParams;
35
36
  queryPageVar=page;
@@ -102,7 +103,7 @@ async function handleUrlParams(_$w) {
102
103
  await handleKeyWordParam(_$w,queryKeyWordVar);
103
104
  }
104
105
 
105
- if (siteconfig.handleCareersUrlParams==="true") { // it is something else that is not TWG
106
+ if (siteconfig.onlyBrandKeywordUrlParams==="true") { // it is something else that is not TWG
106
107
  if (queryPageVar) {
107
108
  await handlePageParam(_$w);
108
109
  }