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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/utils.js +35 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.312",
3
+ "version": "1.7.314",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
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 secrets.getSecretValue("serverless_auth")
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("htmlString **********",htmlString)
35
- const raw = JSON.stringify({
36
- "content": htmlString
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
- method: "post",
42
- headers: {
43
- "Content-Type": "application/json",
44
- "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
45
- "Authorization": "Bearer "+await getServerlessAuth()
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
- body: raw
49
- };
52
+ // },
53
+ // body: raw
54
+ // };
50
55
 
51
- console.log("requestOptions **********",requestOptions)
56
+ // console.log("requestOptions **********",requestOptions)
52
57
 
53
- try{
54
- const response = await fetch("https://www.wixapis.com/data-sync/v1/abmp-content-converter", requestOptions);
55
- if (response.ok) {
56
- const data = await response.json();
57
- console.log("data.richContent **********",data.richContent)
58
- return data.richContent;
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
- else
62
- {
63
- console.error(`error in fetching data, response: ${response}`);
66
+ // else
67
+ // {
68
+ // console.error(`error in fetching data, response: ${response}`);
64
69
 
65
- }
66
- }
67
- catch(error){
68
- console.error("error in fetching data",error);
69
- }
70
+ // }
71
+ // }
72
+ // catch(error){
73
+ // console.error("error in fetching data",error);
74
+ // }
70
75
  }
71
76
 
72
77
  function filterBrokenMarkers(items) {