sr-npm 1.7.359 → 1.7.360
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/package.json +1 -1
- package/pages/positionPage.js +1 -3
- package/public/utils.js +1 -36
package/package.json
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const {
|
|
2
|
-
htmlToText
|
|
3
|
-
htmlToRichContent
|
|
2
|
+
htmlToText
|
|
4
3
|
} = require('../public/utils');
|
|
5
4
|
|
|
6
5
|
async function positionPageOnReady(_$w) {
|
|
@@ -16,7 +15,6 @@ const {
|
|
|
16
15
|
_$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
|
|
17
16
|
_$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
|
|
18
17
|
_$w('#qualificationsText').text = htmlToText(item.jobDescription.qualifications.text);
|
|
19
|
-
_$w('#richContent').content = await htmlToRichContent(item.jobDescription.jobDescription.text);
|
|
20
18
|
_$w('#relatedJobsTitleText').text = `More ${item.department} Positions`;
|
|
21
19
|
});
|
|
22
20
|
|
package/public/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const { fetch } = require('wix-fetch');
|
|
2
1
|
|
|
3
2
|
function htmlToText(html) {
|
|
4
3
|
if (!html) return '';
|
|
@@ -21,41 +20,8 @@ function htmlToText(html) {
|
|
|
21
20
|
return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
async function htmlToRichContent(htmlString) {
|
|
25
|
-
|
|
26
|
-
const raw = JSON.stringify({
|
|
27
|
-
"content": htmlString
|
|
28
|
-
});
|
|
29
23
|
|
|
30
24
|
|
|
31
|
-
const requestOptions = {
|
|
32
|
-
method: "post",
|
|
33
|
-
headers: {
|
|
34
|
-
"Content-Type": "application/json",
|
|
35
|
-
"Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
|
|
36
|
-
"Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
body: raw
|
|
40
|
-
};
|
|
41
|
-
try{
|
|
42
|
-
const response = await fetch("https://www.wixapis.com/data-sync/v1/abmp-content-converter", requestOptions);
|
|
43
|
-
if (response.ok) {
|
|
44
|
-
const data = await response.json();
|
|
45
|
-
return data.richContent;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
else
|
|
49
|
-
{
|
|
50
|
-
console.error(`error in fetching data, response: ${response}`);
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch(error){
|
|
55
|
-
console.error("error in fetching data",error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
25
|
function filterBrokenMarkers(items) {
|
|
60
26
|
return items
|
|
61
27
|
.filter(item => {
|
|
@@ -75,6 +41,5 @@ function filterBrokenMarkers(items) {
|
|
|
75
41
|
|
|
76
42
|
module.exports = {
|
|
77
43
|
htmlToText,
|
|
78
|
-
filterBrokenMarkers
|
|
79
|
-
htmlToRichContent
|
|
44
|
+
filterBrokenMarkers
|
|
80
45
|
};
|