sr-npm 1.7.844 → 1.7.846

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.
@@ -31,6 +31,7 @@ const JOBS_COLLECTION_FIELDS = {
31
31
  MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
32
32
  EMPLOYMENT_TYPE: 'employmentType',
33
33
  RELEASED_DATE: 'releasedDate',
34
+ VISIBILITY: 'visibility',
34
35
  }
35
36
  const AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS = {
36
37
  TITLE: 'title',
@@ -93,6 +94,7 @@ const COLLECTIONS_FIELDS = {
93
94
  {key: 'image', type: 'IMAGE' },
94
95
  {key:'employmentType', type: 'TEXT'},
95
96
  {key:'releasedDate', type: 'TEXT'},
97
+ {key:'visibility', type: 'TEXT'},
96
98
  ],
97
99
  TEMPLATE_TYPE: [
98
100
  {key:'templateType', type: 'TEXT'},
package/backend/data.js CHANGED
@@ -4,7 +4,7 @@ const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend
4
4
  const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE,TOKEN_NAME,CUSTOM_VALUES_COLLECTION_FIELDS } = require('./collectionConsts');
5
5
  const { chunkedBulkOperation, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeString} = require('./utils');
6
6
  const { getAllPositions } = require('./queries');
7
- const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
7
+ const { retrieveSecretVal, getTokenFromCMS ,getApiKeys} = require('./secretsData');
8
8
 
9
9
 
10
10
 
@@ -68,6 +68,14 @@ function getLocation(position,basicJob) {
68
68
  locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
69
69
 
70
70
  }
71
+ function getVisibility(position,customFieldsValues) {
72
+ if (!customFieldsValues[JOBS_COLLECTION_FIELDS.VISIBILITY]) {
73
+ customFieldsValues[JOBS_COLLECTION_FIELDS.VISIBILITY] = {};
74
+ }
75
+ customFieldsValues[JOBS_COLLECTION_FIELDS.VISIBILITY][position.visibility.toLowerCase()] = position.visibility.toLowerCase();
76
+ customValuesToJobs[position.visibility.toLowerCase()] ? customValuesToJobs[position.visibility.toLowerCase()].push(position.id) : customValuesToJobs[position.visibility.toLowerCase()]=[position.id]
77
+ }
78
+
71
79
  function getEmploymentType(position,customFieldsValues) {
72
80
  if (!customFieldsValues["employmentType"]) {
73
81
  customFieldsValues["employmentType"] = {};
@@ -99,6 +107,9 @@ async function saveJobsDataToCMS() {
99
107
  const sourcePositions = await filterBasedOnBrand(positions);
100
108
  const customFieldsLabels = {}
101
109
  const customFieldsValues = {}
110
+
111
+ const {companyId,templateType} = await getApiKeys();
112
+ console.log("templateType: ", templateType);
102
113
 
103
114
  // bulk insert to jobs collection without descriptions first
104
115
  const jobsData = sourcePositions.map(position => {
@@ -126,12 +137,17 @@ async function saveJobsDataToCMS() {
126
137
  brand: getBrand(position.customField),
127
138
  jobDescription: null, // Will be filled later
128
139
  employmentType: position.typeOfEmployment.label,
129
- releasedDate: position.releasedDate
140
+ releasedDate: position.releasedDate
130
141
  };
131
142
 
132
143
  getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
133
144
  getEmploymentType(position,customFieldsValues);
134
145
  getLocation(position,basicJob);
146
+ if(templateType===TEMPLATE_TYPE.EXTERNAL){
147
+ console.log("change me lkater to internsal")
148
+ getVisibility(position,customFieldsValues);
149
+ }
150
+
135
151
  return basicJob;
136
152
  });
137
153
  if(siteconfig===undefined) {
@@ -183,8 +199,9 @@ async function insertJobsReference(valueId) {
183
199
  }
184
200
 
185
201
  async function populateCustomFieldsCollection(customFields) {
186
- fieldstoinsert=[]
202
+ let fieldstoinsert=[]
187
203
  customFields["employmentType"] = "Employment Type";
204
+ customFields["visibility"] = "Visibility";
188
205
  for(const ID of Object.keys(customFields)){
189
206
  fieldstoinsert.push({
190
207
  title: customFields[ID],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.844",
3
+ "version": "1.7.846",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -288,6 +288,7 @@ async function loadJobsRepeater(_$w) {
288
288
 
289
289
 
290
290
  }
291
+
291
292
  await refreshFacetCounts(_$w);
292
293
 
293
294
  } catch (err) {
package/pages/index.js CHANGED
@@ -6,6 +6,5 @@ module.exports = {
6
6
  ...require('./pagesUtils'),
7
7
  ...require('./brandPage'),
8
8
  ...require('./supportTeamsPage'),
9
- ...require('./masterPage'),
10
9
  };
11
10
 
@@ -1,25 +0,0 @@
1
- const{isElementExistOnPage} = require('psdev-utils');
2
- const { location } = require("@wix/site-location");
3
- async function masterPageOnReady(_$w) {
4
- if(isElementExistOnPage(_$w('#myApplicationButton'))){
5
- _$w('#myApplicationButton').onClick(()=>{
6
- location.to('https://www.smartrecruiters.com/app/employee-portal/68246e5512d84f4c00a19e62/job-applications');
7
- });
8
- }
9
- else{
10
- console.log("myApplicationButton not found");
11
- }
12
- if(isElementExistOnPage(_$w('#myReferralsButton'))){
13
- _$w('#myReferralsButton').onClick(()=>{
14
- location.to('https://www.smartrecruiters.com/app/referrals/');
15
- });
16
- }
17
-
18
- else{
19
- console.log("myReferralsButton not found");
20
- }
21
- }
22
-
23
- module.exports = {
24
- masterPageOnReady,
25
- };