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