sr-npm 1.7.319 → 1.7.321

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,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/backend/utils.js CHANGED
@@ -1,5 +1,3 @@
1
- const { getServerlessAuth } = require('./secretsData');
2
-
3
1
  async function chunkedBulkOperation({ items, chunkSize, processChunk }) {
4
2
  for (let i = 0; i < items.length; i += chunkSize) {
5
3
  const chunk = items.slice(i, i + chunkSize);
@@ -74,12 +72,6 @@ function sanitizeId(input) {
74
72
  return withAnd.replace(/[^A-Za-z0-9-]/g, '');
75
73
  }
76
74
 
77
- function htmlToRichContent(htmlString) {
78
- console.log("htmlString **********",htmlString)
79
- const serverlessAuth = getServerlessAuth()
80
- console.log("serverlessAuth **********",serverlessAuth)
81
- }
82
-
83
75
  module.exports = {
84
76
  chunkedBulkOperation,
85
77
  delay,
@@ -88,5 +80,4 @@ module.exports = {
88
80
  prepareToSaveArray,
89
81
  normalizeCityName,
90
82
  sanitizeId,
91
- htmlToRichContent
92
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.319",
3
+ "version": "1.7.321",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,7 @@
1
1
  const { getAllPositions } = require('../backend/queries');
2
2
  const {wixData} = require('wix-data');
3
- //const { location } = require('@wix/site-location');
4
3
  const { window } = require('@wix/site-window');
5
- const { query,queryParams} = require("wix-location-frontend");
4
+ const { query,queryParams,wixLocationFrontend} = require("wix-location-frontend");
6
5
  const {
7
6
  debounce,
8
7
  getFilter,
@@ -174,6 +173,11 @@ function init(_$w) {
174
173
  _$w('#closeFiltersButton').onClick(()=>{
175
174
  _$w('#dropdownsContainer, #closeFiltersButton').collapse();
176
175
  });
176
+
177
+ wixLocationFrontend.onChange(()=>{
178
+ console.log("wixLocationFrontend.onChange");
179
+ });
180
+
177
181
 
178
182
  }
179
183
 
@@ -1,7 +1,8 @@
1
1
  const {
2
- htmlToText
2
+ htmlToText,
3
+ htmlToRichContent
3
4
  } = require('../public/utils');
4
- const { htmlToRichContent } = require('../backend/utils');
5
+
5
6
  async function positionPageOnReady(_$w) {
6
7
 
7
8
  await bind(_$w);
package/public/utils.js CHANGED
@@ -1,16 +1,4 @@
1
- // Note: Do NOT import backend modules here. This file runs on the client.
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
-
1
+ const { fetch } = require('wix-fetch');
14
2
 
15
3
  function htmlToText(html) {
16
4
  if (!html) return '';
@@ -33,7 +21,40 @@ function htmlToText(html) {
33
21
  return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
34
22
  }
35
23
 
36
- // htmlToRichContent moved to backend web module to avoid exposing secrets.
24
+ async function htmlToRichContent(htmlString) {
25
+
26
+ const raw = JSON.stringify({
27
+ "content": htmlString
28
+ });
29
+
30
+
31
+ const requestOptions = {
32
+ method: "post",
33
+ headers: {
34
+ "Content-Type": "application/json",
35
+ "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
36
+ "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
37
+
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
+ }
47
+
48
+ else
49
+ {
50
+ console.error(`error in fetching data, response: ${response}`);
51
+
52
+ }
53
+ }
54
+ catch(error){
55
+ console.error("error in fetching data",error);
56
+ }
57
+ }
37
58
 
38
59
  function filterBrokenMarkers(items) {
39
60
  return items
@@ -54,5 +75,6 @@ function filterBrokenMarkers(items) {
54
75
 
55
76
  module.exports = {
56
77
  htmlToText,
57
- filterBrokenMarkers
78
+ filterBrokenMarkers,
79
+ htmlToRichContent
58
80
  };
@@ -1,31 +0,0 @@
1
- import { secrets } from '@wix/secrets';
2
- import { auth } from '@wix/essentials';
3
- import { fetch } from 'wix-fetch';
4
-
5
- const elevatedGetSecretValue = auth.elevate(secrets.getSecretValue);
6
-
7
- export async function htmlToRichContent(htmlString) {
8
- if (!htmlString) {
9
- return null;
10
- }
11
-
12
- const serverlessAuthSecret = await elevatedGetSecretValue('serverless_auth');
13
- const token = serverlessAuthSecret && (serverlessAuthSecret.value || serverlessAuthSecret);
14
-
15
- const requestOptions = {
16
- method: 'post',
17
- headers: {
18
- 'Content-Type': 'application/json',
19
- 'Authorization': `Bearer ${token}`
20
- },
21
- body: JSON.stringify({ content: htmlString })
22
- };
23
-
24
- const response = await fetch('https://www.wixapis.com/data-sync/v1/abmp-content-converter', requestOptions);
25
- if (!response.ok) {
26
- throw new Error(`content-converter failed with status ${response.status}`);
27
- }
28
- const data = await response.json();
29
- return data.richContent || null;
30
- }
31
-
@@ -1,11 +0,0 @@
1
- const secretsData = require('./secretsData');
2
-
3
- // Expose only what the client needs via web module
4
- export async function getServerlessAuth() {
5
- return await secretsData.getServerlessAuth();
6
- }
7
-
8
- export async function getCompanyId() {
9
- return await secretsData.getCompanyId();
10
- }
11
-