sr-npm 3.1.4 → 3.1.5
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/backend/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
|
5
5
|
const { getAllPositions } = require('./queries');
|
|
@@ -269,7 +269,7 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
269
269
|
|
|
270
270
|
const API_CHUNK_SIZE = 80;
|
|
271
271
|
const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
272
|
-
|
|
272
|
+
const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
|
|
273
273
|
await chunkedBulkOperation({
|
|
274
274
|
items: jobsWithNoDescriptions.items,
|
|
275
275
|
chunkSize: API_CHUNK_SIZE,
|
|
@@ -278,14 +278,13 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
278
278
|
const chunkPromises = chunk.map(async job => {
|
|
279
279
|
try {
|
|
280
280
|
const jobDetails = await fetchJobDescription(job._id);
|
|
281
|
+
const richContentDescription=await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
281
282
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
282
283
|
const {applyLink , referFriendLink} = fetchApplyAndReferFriendLink(jobDetails);
|
|
283
|
-
|
|
284
|
-
|
|
285
284
|
const updatedJob = {
|
|
286
285
|
...job,
|
|
287
286
|
locationAddress: jobLocation,
|
|
288
|
-
jobDescription:
|
|
287
|
+
jobDescription: richContentDescription,
|
|
289
288
|
applyLink: applyLink,
|
|
290
289
|
referFriendLink: referFriendLink,
|
|
291
290
|
};
|
|
@@ -114,11 +114,44 @@ async function fetchJobDescription(jobId,testObject=undefined) {
|
|
|
114
114
|
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,templateType);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
async function htmlRichContentConverter(sections,richContentConverterToken) {
|
|
118
|
+
const richContentObject = {}
|
|
119
|
+
for (const [sectionTitle, sectionData] of Object.entries(sections)) {
|
|
120
|
+
if (sectionData.text) {
|
|
121
|
+
const raw = JSON.stringify({
|
|
122
|
+
content: sectionData.text,
|
|
123
|
+
});
|
|
124
|
+
const requestOptions = {
|
|
125
|
+
method: 'post',
|
|
126
|
+
headers: {
|
|
127
|
+
'Content-Type': 'application/json',
|
|
128
|
+
Cookie: 'XSRF-TOKEN=1753949844|p--a7HsuVjR4',
|
|
129
|
+
Authorization: 'Bearer '+richContentConverterToken,
|
|
130
|
+
},
|
|
131
|
+
body: raw,
|
|
132
|
+
};
|
|
133
|
+
const response = await fetch(
|
|
134
|
+
'https://www.wixapis.com/data-sync/v1/abmp-content-converter',
|
|
135
|
+
requestOptions
|
|
136
|
+
);
|
|
137
|
+
if (response.ok) {
|
|
138
|
+
const data = await response.json();
|
|
139
|
+
richContentObject[sectionTitle] = data.richContent.richContent;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
throw new Error("Error converting html to rich content response: "+response);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return richContentObject;
|
|
147
|
+
}
|
|
148
|
+
|
|
117
149
|
|
|
118
150
|
|
|
119
151
|
|
|
120
152
|
module.exports = {
|
|
121
153
|
fetchPositionsFromSRAPI,
|
|
122
154
|
fetchJobDescription,
|
|
123
|
-
makeSmartRecruitersRequest
|
|
155
|
+
makeSmartRecruitersRequest,
|
|
156
|
+
htmlRichContentConverter
|
|
124
157
|
};
|
package/package.json
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -5,7 +5,6 @@ const { items: wixData } = require('@wix/data');
|
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
6
|
const{isElementExistOnPage} = require('psdev-utils');
|
|
7
7
|
const {
|
|
8
|
-
htmlToText,
|
|
9
8
|
appendQueryParams
|
|
10
9
|
} = require('../public/utils');
|
|
11
10
|
|
|
@@ -40,17 +39,14 @@ async function getCategoryValue(customValues) {
|
|
|
40
39
|
|
|
41
40
|
handleReferFriendButton(_$w,item);
|
|
42
41
|
handleApplyButton(_$w,item);
|
|
43
|
-
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_$w('#
|
|
48
|
-
_$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
|
|
49
|
-
_$w('#qualificationsText').text = htmlToText(item.jobDescription.qualifications.text);
|
|
43
|
+
_$w('#companyDescriptionText').content = item.jobDescription.companyDescription;
|
|
44
|
+
_$w('#responsibilitiesText').content = item.jobDescription.jobDescription;
|
|
45
|
+
_$w('#qualificationsText').content = item.jobDescription.qualifications;
|
|
50
46
|
_$w('#relatedJobsTitleText').text = `More ${item.department} Positions`;
|
|
51
47
|
if(isElementExistOnPage(_$w('#additionalInfoText')))
|
|
52
48
|
{
|
|
53
|
-
_$w('#additionalInfoText').
|
|
49
|
+
_$w('#additionalInfoText').content = item.jobDescription.additionalInformation;
|
|
54
50
|
}
|
|
55
51
|
if(isElementExistOnPage(_$w('#relatedJobsRepNoDepartment'))) // when there is no department, we filter based on category
|
|
56
52
|
{
|