sr-npm 1.7.315 → 1.7.316

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