sr-npm 1.7.839 → 1.7.841
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.
- package/backend/index.js +0 -2
- package/backend/secretsData.js +3 -3
- package/eslint.config.mjs +1 -1
- package/package.json +1 -1
- package/pages/homePage.js +0 -1
- package/pages/index.js +1 -1
- package/pages/masterPage.js +6 -13
- package/backend/http-functions.js +0 -23
package/backend/index.js
CHANGED
package/backend/secretsData.js
CHANGED
|
@@ -4,7 +4,7 @@ const { items: wixData } = require('@wix/data');
|
|
|
4
4
|
const { COLLECTIONS,TOKEN_NAME } = require('./collectionConsts');
|
|
5
5
|
|
|
6
6
|
const getSecretValue = auth.elevate(secrets.getSecretValue);
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
async function retrieveSecretVal(tokenName)
|
|
10
10
|
{
|
|
@@ -20,7 +20,7 @@ const elevatedQuery = auth.elevate(wixData.query);
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async function getTokenFromCMS(tokenName) {
|
|
23
|
-
const result = await
|
|
23
|
+
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName',tokenName).find();
|
|
24
24
|
if (result.items.length > 0) {
|
|
25
25
|
return result.items[0].value;
|
|
26
26
|
} else {
|
|
@@ -28,7 +28,7 @@ const elevatedQuery = auth.elevate(wixData.query);
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
async function getTemplateTypeFromCMS() {
|
|
31
|
-
const result = await
|
|
31
|
+
const result = await wixData.query(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
|
|
32
32
|
if (result.items.length > 0) {
|
|
33
33
|
return result.items[0].templateType;
|
|
34
34
|
} else {
|
package/eslint.config.mjs
CHANGED
package/package.json
CHANGED
package/pages/homePage.js
CHANGED
package/pages/index.js
CHANGED
package/pages/masterPage.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
const { getApiKeys } = require('../backend/secretsData');
|
|
2
|
+
const { TEMPLATE_TYPE } = require('../backend/collectionConsts');
|
|
10
3
|
|
|
11
4
|
async function masterPageOnReady(_$w) {
|
|
12
|
-
|
|
5
|
+
({ companyId, templateType } = await getApiKeys());
|
|
13
6
|
console.log("companyId: ", companyId);
|
|
14
7
|
console.log("templateType: ", templateType);
|
|
15
8
|
if(templateType===TEMPLATE_TYPE.EXTERNAL){
|
|
@@ -18,8 +11,8 @@ async function masterPageOnReady(_$w) {
|
|
|
18
11
|
else{
|
|
19
12
|
console.log("templateType is internal");
|
|
20
13
|
}
|
|
21
|
-
}
|
|
14
|
+
}
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
module.exports = {
|
|
24
17
|
masterPageOnReady,
|
|
25
|
-
};
|
|
18
|
+
};
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
|