sr-npm 1.7.1067 → 1.7.1071
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/.github/workflows/update-sites.yml +1 -1
- package/backend/careersMultiBoxesPageIds.js +0 -16
- package/backend/collectionConsts.js +0 -2
- package/backend/consts.js +15 -9
- package/backend/data.js +23 -28
- package/backend/fetchPositionsFromSRAPI.js +39 -3
- package/package.json +1 -1
- package/pages/brandPage.js +0 -1
- package/pages/careersMultiBoxesPage.js +51 -154
- package/pages/careersPage.js +127 -124
- package/pages/pagesUtils.js +5 -14
- package/tests/multiSearchBoxCareers.spec.js +5 -28
- package/public/selectors.js +0 -53
|
@@ -39,11 +39,6 @@ const fieldTitlesInCMS={
|
|
|
39
39
|
"brand": "Brands",
|
|
40
40
|
category: "Category",
|
|
41
41
|
visibility: "Visibility",
|
|
42
|
-
location: "Location",
|
|
43
|
-
employmenttype: "Employment Type",
|
|
44
|
-
contracttype: "Contract Type",
|
|
45
|
-
companysegment: "Company Segment",
|
|
46
|
-
storename: "Store Name",
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
const FiltersIds={
|
|
@@ -57,21 +52,10 @@ const FiltersIds={
|
|
|
57
52
|
Visibility: 'Visibility',
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
const possibleUrlParams=[
|
|
61
|
-
"brand",
|
|
62
|
-
"location",
|
|
63
|
-
"employmenttype",
|
|
64
|
-
"contracttype",
|
|
65
|
-
"visibility",
|
|
66
|
-
"category",
|
|
67
|
-
"companysegment",
|
|
68
|
-
"storename",
|
|
69
|
-
]
|
|
70
55
|
|
|
71
56
|
module.exports = {
|
|
72
57
|
CAREERS_MULTI_BOXES_PAGE_CONSTS,
|
|
73
58
|
FiltersIds,
|
|
74
59
|
fieldTitlesInCMS,
|
|
75
60
|
CATEGORY_CUSTOM_FIELD_ID_IN_CMS,
|
|
76
|
-
possibleUrlParams,
|
|
77
61
|
}
|
|
@@ -31,7 +31,6 @@ const JOBS_COLLECTION_FIELDS = {
|
|
|
31
31
|
MULTI_REF_JOBS_CUSTOM_VALUES: 'multiRefJobsCustomValues',
|
|
32
32
|
EMPLOYMENT_TYPE: 'employmentType',
|
|
33
33
|
RELEASED_DATE: 'releasedDate',
|
|
34
|
-
REF_ID: 'refId',
|
|
35
34
|
}
|
|
36
35
|
const AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS = {
|
|
37
36
|
TITLE: 'title',
|
|
@@ -94,7 +93,6 @@ const COLLECTIONS_FIELDS = {
|
|
|
94
93
|
{key: 'image', type: 'IMAGE' },
|
|
95
94
|
{key:'employmentType', type: 'TEXT'},
|
|
96
95
|
{key:'releasedDate', type: 'TEXT'},
|
|
97
|
-
{key:'refId', type: 'TEXT'},
|
|
98
96
|
],
|
|
99
97
|
TEMPLATE_TYPE: [
|
|
100
98
|
{key:'templateType', type: 'TEXT'},
|
package/backend/consts.js
CHANGED
|
@@ -72,6 +72,9 @@ const TASKS = {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
75
78
|
const TASK_TYPE = {
|
|
76
79
|
SCHEDULED: 'scheduled',
|
|
77
80
|
EVENT: 'event',
|
|
@@ -89,6 +92,10 @@ const supportTeamsPageIds={
|
|
|
89
92
|
VIDEO_TITLE: "#videoTitle",
|
|
90
93
|
VIDEO_PLAYER: "#videoPlayer",
|
|
91
94
|
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
92
99
|
RECENTLEY_ADDED_JOBS_ITEM: "#recentleyAddedJobsItem",
|
|
93
100
|
JOB_LOCATION: "#jobLocation",
|
|
94
101
|
JOB_TITLE: "#jobTitle",
|
|
@@ -130,13 +137,12 @@ const supportTeamsPageSections={
|
|
|
130
137
|
VIDEO: "video",
|
|
131
138
|
}
|
|
132
139
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
supportTeamsPageSections,
|
|
140
|
+
module.exports = {
|
|
141
|
+
TASKS_NAMES,
|
|
142
|
+
TASK_TYPE,
|
|
143
|
+
TASKS,
|
|
144
|
+
QUERY_MAX_LIMIT,
|
|
145
|
+
supportTeamsPageIds,
|
|
146
|
+
LINKS,
|
|
147
|
+
supportTeamsPageSections,
|
|
142
148
|
};
|
package/backend/data.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
|
-
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
2
|
+
const { fetchPositionsFromSRAPI, fetchJobDescription, htmlRichContentConverter } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
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
7
|
const { retrieveSecretVal, getTokenFromCMS ,getApiKeys} = require('./secretsData');
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
|
|
9
11
|
let customValuesToJobs = {}
|
|
10
12
|
let locationToJobs = {}
|
|
11
13
|
let siteconfig;
|
|
@@ -19,7 +21,6 @@ async function getSiteConfig() {
|
|
|
19
21
|
const queryresult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
20
22
|
siteconfig = queryresult.items[0];
|
|
21
23
|
}
|
|
22
|
-
|
|
23
24
|
function validatePosition(position) {
|
|
24
25
|
if (!position.id) {
|
|
25
26
|
throw new Error('Position id is required');
|
|
@@ -39,22 +40,22 @@ function validatePosition(position) {
|
|
|
39
40
|
async function filterBasedOnBrand(positions) {
|
|
40
41
|
try{
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
throw error;
|
|
43
|
+
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
44
|
+
validateSingleDesiredBrand(desiredBrand);
|
|
45
|
+
console.log("filtering positions based on brand: ", desiredBrand);
|
|
46
|
+
return positions.content.filter(position => {
|
|
47
|
+
const brand = getBrand(position.customField);
|
|
48
|
+
if (!brand) return false;
|
|
49
|
+
return brand === desiredBrand;
|
|
50
|
+
});
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if(error.message==="[getTokenFromCMS], No desiredBrand found")
|
|
53
|
+
{
|
|
54
|
+
console.log("no desiredBrand found, fetching all positions")
|
|
55
|
+
return positions.content;
|
|
57
56
|
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
function validateSingleDesiredBrand(desiredBrand) {
|
|
@@ -62,12 +63,11 @@ function validateSingleDesiredBrand(desiredBrand) {
|
|
|
62
63
|
throw new Error("Desired brand must be a single brand");
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
|
|
66
66
|
function getLocation(position,basicJob) {
|
|
67
|
+
|
|
67
68
|
locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
|
|
68
69
|
|
|
69
70
|
}
|
|
70
|
-
|
|
71
71
|
function getVisibility(position,customFieldsValues) {
|
|
72
72
|
if (!customFieldsValues["Visibility"]) {
|
|
73
73
|
customFieldsValues["Visibility"] = {};
|
|
@@ -99,8 +99,8 @@ function getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,custom
|
|
|
99
99
|
if (!customFieldsValues[fieldId]) {
|
|
100
100
|
customFieldsValues[fieldId] = {};
|
|
101
101
|
}
|
|
102
|
-
|
|
103
102
|
customFieldsValues[fieldId][valueId] = valueLabel;
|
|
103
|
+
|
|
104
104
|
customValuesToJobs[valueId] ? customValuesToJobs[valueId].add(position.id) : customValuesToJobs[valueId]=new Set([position.id])
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -140,8 +140,7 @@ async function saveJobsDataToCMS() {
|
|
|
140
140
|
brand: siteconfig.disableMultiBrand==="false" ? getBrand(position.customField) : '',
|
|
141
141
|
jobDescription: null, // Will be filled later
|
|
142
142
|
employmentType: position.typeOfEmployment.label,
|
|
143
|
-
releasedDate: position.releasedDate
|
|
144
|
-
refId: position.refNumber
|
|
143
|
+
releasedDate: position.releasedDate
|
|
145
144
|
};
|
|
146
145
|
|
|
147
146
|
getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues);
|
|
@@ -270,14 +269,13 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
270
269
|
const chunkPromises = chunk.map(async job => {
|
|
271
270
|
try {
|
|
272
271
|
const jobDetails = await fetchJobDescription(job._id);
|
|
272
|
+
const richContentDescription=await htmlRichContentConverter(jobDetails.jobAd.sections);
|
|
273
273
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
274
274
|
const {applyLink , referFriendLink} = fetchApplyAndReferFriendLink(jobDetails);
|
|
275
|
-
|
|
276
|
-
|
|
277
275
|
const updatedJob = {
|
|
278
276
|
...job,
|
|
279
277
|
locationAddress: jobLocation,
|
|
280
|
-
jobDescription:
|
|
278
|
+
jobDescription: richContentDescription,
|
|
281
279
|
applyLink: applyLink,
|
|
282
280
|
referFriendLink: referFriendLink,
|
|
283
281
|
};
|
|
@@ -486,14 +484,11 @@ async function syncJobsFast() {
|
|
|
486
484
|
await createCollections();
|
|
487
485
|
await clearCollections();
|
|
488
486
|
await fillSecretManagerMirror();
|
|
489
|
-
|
|
490
487
|
console.log("saving jobs data to CMS");
|
|
491
488
|
await saveJobsDataToCMS();
|
|
492
489
|
console.log("saved jobs data to CMS successfully");
|
|
493
|
-
|
|
494
490
|
console.log("saving jobs descriptions and location apply url to CMS");
|
|
495
491
|
await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS();
|
|
496
|
-
|
|
497
492
|
console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
498
493
|
await aggregateJobs();
|
|
499
494
|
await referenceJobs();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { TEMPLATE_TYPE,TOKEN_NAME } = require('./collectionConsts');
|
|
3
3
|
const { getTokenFromCMS,getApiKeys } = require('./secretsData');
|
|
4
|
-
|
|
5
4
|
async function makeSmartRecruitersRequest(path,templateType) {
|
|
6
|
-
|
|
5
|
+
const baseUrl = 'https://api.smartrecruiters.com';
|
|
7
6
|
const fullUrl = `${baseUrl}${path}`;
|
|
8
7
|
|
|
9
8
|
try {
|
|
@@ -114,11 +113,48 @@ async function fetchJobDescription(jobId,testObject=undefined) {
|
|
|
114
113
|
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,templateType);
|
|
115
114
|
}
|
|
116
115
|
|
|
116
|
+
async function htmlRichContentConverter(sections) {
|
|
117
|
+
console.log("sections: are ",sections);
|
|
118
|
+
const richContentObject = {}
|
|
119
|
+
for (const [sectionTitle, sectionData] of Object.entries(sections)) {
|
|
120
|
+
console.log("section: is ",sectionTitle);
|
|
121
|
+
if (sectionData.text) {
|
|
122
|
+
const raw = JSON.stringify({
|
|
123
|
+
content: sectionData.text,
|
|
124
|
+
});
|
|
125
|
+
const requestOptions = {
|
|
126
|
+
method: 'post',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
Cookie: 'XSRF-TOKEN=1753949844|p--a7HsuVjR4',
|
|
130
|
+
Authorization: 'Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641',
|
|
131
|
+
},
|
|
132
|
+
body: raw,
|
|
133
|
+
};
|
|
134
|
+
const response = await fetch(
|
|
135
|
+
'https://www.wixapis.com/data-sync/v1/abmp-content-converter',
|
|
136
|
+
requestOptions
|
|
137
|
+
);
|
|
138
|
+
if (response.ok) {
|
|
139
|
+
const data = await response.json();
|
|
140
|
+
console.log("response is ok")
|
|
141
|
+
richContentObject[sectionTitle] = data.richContent.richContent;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
throw new Error("Error converting html to rich content response: "+response);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
console.log("richContentObject: are ",richContentObject);
|
|
149
|
+
return richContentObject;
|
|
150
|
+
}
|
|
151
|
+
|
|
117
152
|
|
|
118
153
|
|
|
119
154
|
|
|
120
155
|
module.exports = {
|
|
121
156
|
fetchPositionsFromSRAPI,
|
|
122
157
|
fetchJobDescription,
|
|
123
|
-
makeSmartRecruitersRequest
|
|
158
|
+
makeSmartRecruitersRequest,
|
|
159
|
+
htmlRichContentConverter
|
|
124
160
|
};
|
package/package.json
CHANGED