sr-npm 1.7.316 → 1.7.317

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