sr-npm 1.7.316 → 1.7.318

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.
@@ -16,7 +16,15 @@ 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
+ }
19
26
  module.exports = {
20
27
  getSmartToken,
21
- getCompanyId
28
+ getCompanyId,
29
+ getServerlessAuth
22
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.316",
3
+ "version": "1.7.318",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/utils.js CHANGED
@@ -1,4 +1,17 @@
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
+
2
15
 
3
16
  function htmlToText(html) {
4
17
  if (!html) return '';
@@ -22,40 +35,42 @@ function htmlToText(html) {
22
35
  }
23
36
 
24
37
  async function htmlToRichContent(htmlString) {
25
-
26
- const raw = JSON.stringify({
27
- "content": htmlString
28
- });
38
+ console.log("htmlString **********",htmlString)
39
+ const serverlessAuth = getServerlessAuth()
40
+ console.log("serverlessAuth **********",serverlessAuth)
41
+ // const raw = JSON.stringify({
42
+ // "content": htmlString
43
+ // });
29
44
 
30
45
 
31
- const requestOptions = {
32
- method: "post",
33
- headers: {
34
- "Content-Type": "application/json",
35
- "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
36
- "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
46
+ // const requestOptions = {
47
+ // method: "post",
48
+ // headers: {
49
+ // "Content-Type": "application/json",
50
+ // "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
51
+ // "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
37
52
 
38
- },
39
- body: raw
40
- };
53
+ // },
54
+ // body: raw
55
+ // };
41
56
 
42
57
 
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
- }
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
+ // return data.richContent;
63
+ // }
49
64
 
50
- else
51
- {
52
- console.error(`error in fetching data, response: ${response}`);
65
+ // else
66
+ // {
67
+ // console.error(`error in fetching data, response: ${response}`);
53
68
 
54
- }
55
- }
56
- catch(error){
57
- console.error("error in fetching data",error);
58
- }
69
+ // }
70
+ // }
71
+ // catch(error){
72
+ // console.error("error in fetching data",error);
73
+ // }
59
74
  }
60
75
 
61
76
  function filterBrokenMarkers(items) {