sr-npm 1.7.837 → 1.7.839

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.
@@ -0,0 +1,23 @@
1
+ const { getApiKeys } = require('./secretsData');
2
+ const { ok, badRequest } = require('wix-http-functions');
3
+
4
+ export async function get_getApiKeys(request) {
5
+ try {
6
+ const data = await getApiKeys();
7
+ return ok({
8
+ body: data,
9
+ headers: {
10
+ "Content-Type": "application/json"
11
+ }
12
+ });
13
+ } catch (error) {
14
+ console.error('Error in get_getApiKeys:', error);
15
+ return badRequest({
16
+ body: { error: error.message },
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ });
21
+ }
22
+ }
23
+
package/eslint.config.mjs CHANGED
@@ -19,7 +19,7 @@ export default defineConfig([
19
19
  {
20
20
  files: ["pages/**/*.js", "public/**/*.js"],
21
21
  languageOptions: {
22
- sourceType: "commonjs",
22
+ sourceType: "module",
23
23
  globals: { ...globals.browser },
24
24
  },
25
25
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.837",
3
+ "version": "1.7.839",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/pages/index.js CHANGED
@@ -6,6 +6,6 @@ module.exports = {
6
6
  ...require('./pagesUtils'),
7
7
  ...require('./brandPage'),
8
8
  ...require('./supportTeamsPage'),
9
- ...require('./masterPage'),
9
+ ...require('./masterPage').default,
10
10
  };
11
11
 
@@ -1,5 +1,12 @@
1
- const { getApiKeys } = require('../backend/secretsData');
2
- const {TEMPLATE_TYPE} = require('../backend/collectionConsts');
1
+ import { TEMPLATE_TYPE } from '../backend/collectionConsts';
2
+
3
+ async function getApiKeys() {
4
+ const response = await fetch('/_functions/getApiKeys');
5
+ if (!response.ok) {
6
+ throw new Error('Failed to fetch API keys');
7
+ }
8
+ return await response.json();
9
+ }
3
10
 
4
11
  async function masterPageOnReady(_$w) {
5
12
  const { companyId, templateType } = await getApiKeys();
@@ -11,8 +18,8 @@ async function masterPageOnReady(_$w) {
11
18
  else{
12
19
  console.log("templateType is internal");
13
20
  }
14
- }
21
+ }
15
22
 
16
- module.exports = {
23
+ export default {
17
24
  masterPageOnReady,
18
- };
25
+ };