sr-npm 1.7.312 → 1.7.314
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/public/utils.js +35 -30
package/package.json
CHANGED
package/public/utils.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { secrets } = require("@wix/secrets");
|
|
3
|
+
const { auth } = require('@wix/essentials');
|
|
3
4
|
|
|
5
|
+
const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
4
6
|
|
|
5
7
|
async function getServerlessAuth() {
|
|
6
|
-
const serverlessAuth = await
|
|
8
|
+
const serverlessAuth = await getSecretValue("serverless_auth")
|
|
7
9
|
console.log("serverlessAuth **********",serverlessAuth)
|
|
8
10
|
return serverlessAuth;
|
|
9
11
|
|
|
@@ -31,42 +33,45 @@ function htmlToText(html) {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
async function htmlToRichContent(htmlString) {
|
|
34
|
-
console.log("
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
console.log("i am here")
|
|
37
|
+
const serverlessAuth = await getServerlessAuth()
|
|
38
|
+
console.log("serverlessAuth **********",serverlessAuth)
|
|
39
|
+
// console.log("htmlString **********",htmlString)
|
|
40
|
+
// const raw = JSON.stringify({
|
|
41
|
+
// "content": htmlString
|
|
42
|
+
// });
|
|
38
43
|
|
|
39
44
|
|
|
40
|
-
const requestOptions = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// const requestOptions = {
|
|
46
|
+
// method: "post",
|
|
47
|
+
// headers: {
|
|
48
|
+
// "Content-Type": "application/json",
|
|
49
|
+
// "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
|
|
50
|
+
// "Authorization": "Bearer "+await getServerlessAuth()
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
52
|
+
// },
|
|
53
|
+
// body: raw
|
|
54
|
+
// };
|
|
50
55
|
|
|
51
|
-
console.log("requestOptions **********",requestOptions)
|
|
56
|
+
// console.log("requestOptions **********",requestOptions)
|
|
52
57
|
|
|
53
|
-
try{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// try{
|
|
59
|
+
// const response = await fetch("https://www.wixapis.com/data-sync/v1/abmp-content-converter", requestOptions);
|
|
60
|
+
// if (response.ok) {
|
|
61
|
+
// const data = await response.json();
|
|
62
|
+
// console.log("data.richContent **********",data.richContent)
|
|
63
|
+
// return data.richContent;
|
|
64
|
+
// }
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
// else
|
|
67
|
+
// {
|
|
68
|
+
// console.error(`error in fetching data, response: ${response}`);
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
catch(error){
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// catch(error){
|
|
73
|
+
// console.error("error in fetching data",error);
|
|
74
|
+
// }
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
function filterBrokenMarkers(items) {
|