sr-npm 1.7.318 → 1.7.320
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 +1 -9
- package/package.json +1 -1
- package/public/utils.js +27 -44
package/backend/secretsData.js
CHANGED
|
@@ -16,15 +16,7 @@ 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
|
module.exports = {
|
|
27
20
|
getSmartToken,
|
|
28
|
-
getCompanyId
|
|
29
|
-
getServerlessAuth
|
|
21
|
+
getCompanyId
|
|
30
22
|
};
|
package/package.json
CHANGED
package/public/utils.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
|
-
const { getServerlessAuth } = require('../backend/secretsData');
|
|
3
|
-
// const { secrets } = require("wix-secrets-backend.v2");
|
|
4
|
-
// const { elevate } = require("wix-auth");
|
|
5
|
-
|
|
6
|
-
// const elevatedGetSecretValue = elevate(secrets.getSecretValue);
|
|
7
|
-
|
|
8
|
-
// async function getServerlessAuth() {
|
|
9
|
-
// console.log("i am here")
|
|
10
|
-
// const serverlessAuth = await elevatedGetSecretValue("serverless_auth")
|
|
11
|
-
// console.log("serverlessAuth **********",serverlessAuth)
|
|
12
|
-
// return serverlessAuth.value;
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
2
|
|
|
16
3
|
function htmlToText(html) {
|
|
17
4
|
if (!html) return '';
|
|
@@ -35,42 +22,38 @@ function htmlToText(html) {
|
|
|
35
22
|
}
|
|
36
23
|
|
|
37
24
|
async function htmlToRichContent(htmlString) {
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// "content": htmlString
|
|
43
|
-
// });
|
|
44
|
-
|
|
25
|
+
|
|
26
|
+
const raw = JSON.stringify({
|
|
27
|
+
"content": htmlString
|
|
28
|
+
});
|
|
45
29
|
|
|
46
|
-
// const requestOptions = {
|
|
47
|
-
// method: "post",
|
|
48
|
-
// headers: {
|
|
49
|
-
// "Content-Type": "application/json",
|
|
50
|
-
// "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
|
|
51
|
-
// "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
31
|
+
const requestOptions = {
|
|
32
|
+
method: "post",
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
"Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
|
|
36
|
+
"Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
|
|
56
37
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
}
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
else
|
|
49
|
+
{
|
|
50
|
+
console.error(`error in fetching data, response: ${response}`);
|
|
68
51
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch(error){
|
|
55
|
+
console.error("error in fetching data",error);
|
|
56
|
+
}
|
|
74
57
|
}
|
|
75
58
|
|
|
76
59
|
function filterBrokenMarkers(items) {
|