chayns-api 3.6.0-beta.2 → 3.6.0-beta.4
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/dist/cjs/hooks/useFunctionsWithOverrides.js +61 -27
- package/dist/cjs/plugins/TrustedDomainsPlugins.js +13 -3
- package/dist/cjs/utils/loadTrustedDomains.js +26 -0
- package/dist/cjs/wrapper/AppWrapper.js +2 -19
- package/dist/esm/hooks/useFunctionsWithOverrides.js +61 -27
- package/dist/esm/plugins/TrustedDomainsPlugins.js +13 -3
- package/dist/esm/utils/loadTrustedDomains.js +19 -0
- package/dist/esm/wrapper/AppWrapper.js +2 -19
- package/dist/types/utils/loadTrustedDomains.d.ts +1 -0
- package/dist/types/wrapper/AppWrapper.d.ts +0 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _useFunctions = require("./useFunctions");
|
|
10
10
|
const useFunctionsWithOverrides = overrideFactory => {
|
|
11
|
-
const $ = (0, _reactCompilerRuntime.c)(
|
|
11
|
+
const $ = (0, _reactCompilerRuntime.c)(21);
|
|
12
12
|
const base = (0, _useFunctions.useFunctions)();
|
|
13
13
|
let t0;
|
|
14
14
|
if ($[0] !== base || $[1] !== overrideFactory) {
|
|
@@ -21,53 +21,87 @@ const useFunctionsWithOverrides = overrideFactory => {
|
|
|
21
21
|
}
|
|
22
22
|
const overrides = t0;
|
|
23
23
|
let t1;
|
|
24
|
-
if ($[3] !== base
|
|
25
|
-
t1 =
|
|
26
|
-
base,
|
|
27
|
-
overrides
|
|
28
|
-
};
|
|
24
|
+
if ($[3] !== base) {
|
|
25
|
+
t1 = Object.keys(base);
|
|
29
26
|
$[3] = base;
|
|
30
|
-
$[4] =
|
|
31
|
-
$[5] = t1;
|
|
27
|
+
$[4] = t1;
|
|
32
28
|
} else {
|
|
33
|
-
t1 = $[
|
|
29
|
+
t1 = $[4];
|
|
34
30
|
}
|
|
35
|
-
const stateRef = (0, _react.useRef)(t1);
|
|
36
31
|
let t2;
|
|
32
|
+
if ($[5] !== overrides) {
|
|
33
|
+
t2 = Object.keys(overrides);
|
|
34
|
+
$[5] = overrides;
|
|
35
|
+
$[6] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
t2 = $[6];
|
|
38
|
+
}
|
|
37
39
|
let t3;
|
|
38
|
-
if ($[
|
|
39
|
-
|
|
40
|
+
if ($[7] !== t1 || $[8] !== t2) {
|
|
41
|
+
t3 = new Set([...t1, ...t2]);
|
|
42
|
+
$[7] = t1;
|
|
43
|
+
$[8] = t2;
|
|
44
|
+
$[9] = t3;
|
|
45
|
+
} else {
|
|
46
|
+
t3 = $[9];
|
|
47
|
+
}
|
|
48
|
+
let t4;
|
|
49
|
+
if ($[10] !== t3) {
|
|
50
|
+
t4 = [...t3];
|
|
51
|
+
$[10] = t3;
|
|
52
|
+
$[11] = t4;
|
|
53
|
+
} else {
|
|
54
|
+
t4 = $[11];
|
|
55
|
+
}
|
|
56
|
+
const functionNames = t4;
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[12] !== base || $[13] !== overrides) {
|
|
59
|
+
t5 = {
|
|
60
|
+
base,
|
|
61
|
+
overrides
|
|
62
|
+
};
|
|
63
|
+
$[12] = base;
|
|
64
|
+
$[13] = overrides;
|
|
65
|
+
$[14] = t5;
|
|
66
|
+
} else {
|
|
67
|
+
t5 = $[14];
|
|
68
|
+
}
|
|
69
|
+
const stateRef = (0, _react.useRef)(t5);
|
|
70
|
+
let t6;
|
|
71
|
+
let t7;
|
|
72
|
+
if ($[15] !== base || $[16] !== overrides) {
|
|
73
|
+
t6 = () => {
|
|
40
74
|
stateRef.current = {
|
|
41
75
|
base,
|
|
42
76
|
overrides
|
|
43
77
|
};
|
|
44
78
|
};
|
|
45
|
-
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
79
|
+
t7 = [base, overrides];
|
|
80
|
+
$[15] = base;
|
|
81
|
+
$[16] = overrides;
|
|
82
|
+
$[17] = t6;
|
|
83
|
+
$[18] = t7;
|
|
50
84
|
} else {
|
|
51
|
-
|
|
52
|
-
|
|
85
|
+
t6 = $[17];
|
|
86
|
+
t7 = $[18];
|
|
53
87
|
}
|
|
54
|
-
(0, _react.useEffect)(
|
|
88
|
+
(0, _react.useEffect)(t6, t7);
|
|
55
89
|
let functions;
|
|
56
|
-
if ($[
|
|
90
|
+
if ($[19] !== functionNames) {
|
|
57
91
|
functions = {};
|
|
58
|
-
for (const key of
|
|
59
|
-
functions[key] = (...
|
|
92
|
+
for (const key of functionNames) {
|
|
93
|
+
functions[key] = (...t8) => {
|
|
60
94
|
var _stateRef$current$ove;
|
|
61
|
-
const args =
|
|
95
|
+
const args = t8;
|
|
62
96
|
const functionKey = key;
|
|
63
97
|
const implementation = (_stateRef$current$ove = stateRef.current.overrides[functionKey]) !== null && _stateRef$current$ove !== void 0 ? _stateRef$current$ove : stateRef.current.base[functionKey];
|
|
64
98
|
return implementation(...args);
|
|
65
99
|
};
|
|
66
100
|
}
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
101
|
+
$[19] = functionNames;
|
|
102
|
+
$[20] = functions;
|
|
69
103
|
} else {
|
|
70
|
-
functions = $[
|
|
104
|
+
functions = $[20];
|
|
71
105
|
}
|
|
72
106
|
return functions;
|
|
73
107
|
};
|
|
@@ -5,20 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TrustedDomainsPlugin = void 0;
|
|
7
7
|
exports.isTrustedDomainsError = isTrustedDomainsError;
|
|
8
|
+
var _loadTrustedDomains = require("../utils/loadTrustedDomains");
|
|
8
9
|
class TrustedDomainsError extends Error {
|
|
9
10
|
name = 'TrustedDomainsError';
|
|
10
11
|
constructor(entry) {
|
|
11
12
|
super('Remote entry ' + entry + ' is not in trusted domains');
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
const TrustedDomainsPlugin =
|
|
15
|
+
const TrustedDomainsPlugin = trustedDomains => {
|
|
16
|
+
let trustedDomainsPromise;
|
|
17
|
+
const getTrustedDomains = () => {
|
|
18
|
+
if (trustedDomains) {
|
|
19
|
+
return trustedDomains;
|
|
20
|
+
}
|
|
21
|
+
trustedDomainsPromise !== null && trustedDomainsPromise !== void 0 ? trustedDomainsPromise : trustedDomainsPromise = (0, _loadTrustedDomains.loadTrustedDomains)();
|
|
22
|
+
return trustedDomainsPromise;
|
|
23
|
+
};
|
|
15
24
|
return {
|
|
16
25
|
name: 'trusted-domains',
|
|
17
|
-
beforeRequest(args) {
|
|
26
|
+
async beforeRequest(args) {
|
|
27
|
+
const domains = await getTrustedDomains();
|
|
18
28
|
args.options.remotes.forEach(remote => {
|
|
19
29
|
if ('entry' in remote) {
|
|
20
30
|
const parsed = new URL(remote.entry);
|
|
21
|
-
if (!
|
|
31
|
+
if (!domains.some(domain => parsed.hostname.endsWith(domain))) {
|
|
22
32
|
throw new TrustedDomainsError(remote.entry);
|
|
23
33
|
}
|
|
24
34
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.loadTrustedDomains = void 0;
|
|
7
|
+
var _trustedDomains = require("../constants/trustedDomains");
|
|
8
|
+
const TRUSTED_DOMAINS_URL = 'https://service-rpc.chayns.net/ConfigurationSettings/TrustedDomains';
|
|
9
|
+
const loadTrustedDomains = async () => {
|
|
10
|
+
try {
|
|
11
|
+
var _AbortSignal$timeout, _AbortSignal;
|
|
12
|
+
const response = await fetch(TRUSTED_DOMAINS_URL, {
|
|
13
|
+
signal: (_AbortSignal$timeout = (_AbortSignal = AbortSignal).timeout) === null || _AbortSignal$timeout === void 0 ? void 0 : _AbortSignal$timeout.call(_AbortSignal, 5000)
|
|
14
|
+
});
|
|
15
|
+
if (response.status === 200) {
|
|
16
|
+
const {
|
|
17
|
+
trustedDomains
|
|
18
|
+
} = await response.json();
|
|
19
|
+
return trustedDomains;
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
return _trustedDomains.DefaultTrustedDomains;
|
|
23
|
+
}
|
|
24
|
+
return _trustedDomains.DefaultTrustedDomains;
|
|
25
|
+
};
|
|
26
|
+
exports.loadTrustedDomains = loadTrustedDomains;
|
|
@@ -9,6 +9,7 @@ var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
|
9
9
|
var _sendMessage = require("../calls/sendMessage");
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
var _trustedDomains = require("../constants/trustedDomains");
|
|
12
|
+
var _loadTrustedDomains = require("../utils/loadTrustedDomains");
|
|
12
13
|
var _languages = require("../constants/languages");
|
|
13
14
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
14
15
|
var _apiListener = require("../utils/apiListener");
|
|
@@ -43,24 +44,6 @@ class AppWrapper {
|
|
|
43
44
|
}
|
|
44
45
|
return undefined;
|
|
45
46
|
}
|
|
46
|
-
async loadTrustedDomains() {
|
|
47
|
-
try {
|
|
48
|
-
var _AbortSignal$timeout2, _AbortSignal2;
|
|
49
|
-
const res = await fetch('https://service-rpc.chayns.net/ConfigurationSettings/TrustedDomains', {
|
|
50
|
-
signal: (_AbortSignal$timeout2 = (_AbortSignal2 = AbortSignal).timeout) === null || _AbortSignal$timeout2 === void 0 ? void 0 : _AbortSignal$timeout2.call(_AbortSignal2, 5000)
|
|
51
|
-
});
|
|
52
|
-
if (res.status === 200) {
|
|
53
|
-
const {
|
|
54
|
-
trustedDomains
|
|
55
|
-
} = await res.json();
|
|
56
|
-
return trustedDomains;
|
|
57
|
-
}
|
|
58
|
-
console.error(`[chayns-api] failed to load trusted domains with status code: ${res.status}`);
|
|
59
|
-
} catch (ex) {
|
|
60
|
-
console.error('[chayns-api] failed to load trusted domains', ex);
|
|
61
|
-
}
|
|
62
|
-
return _trustedDomains.DefaultTrustedDomains;
|
|
63
|
-
}
|
|
64
47
|
mapOldApiToNew(retVal) {
|
|
65
48
|
var _window, _window2, _AppInfo$TappSelected;
|
|
66
49
|
const {
|
|
@@ -793,7 +776,7 @@ class AppWrapper {
|
|
|
793
776
|
dialogs = [];
|
|
794
777
|
async init() {
|
|
795
778
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
796
|
-
[this.values.styleSettings, this.trustedDomains] = await Promise.all([this.loadStyleSettings(this.values.site.id),
|
|
779
|
+
[this.values.styleSettings, this.trustedDomains] = await Promise.all([this.loadStyleSettings(this.values.site.id), (0, _loadTrustedDomains.loadTrustedDomains)()]);
|
|
797
780
|
document.documentElement.classList.add('chayns-api--app');
|
|
798
781
|
this.appCall(66, {
|
|
799
782
|
enabled: true
|
|
@@ -2,7 +2,7 @@ import { c as _c } from "react-compiler-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useFunctions } from './useFunctions';
|
|
4
4
|
export const useFunctionsWithOverrides = overrideFactory => {
|
|
5
|
-
const $ = _c(
|
|
5
|
+
const $ = _c(21);
|
|
6
6
|
const base = useFunctions();
|
|
7
7
|
let t0;
|
|
8
8
|
if ($[0] !== base || $[1] !== overrideFactory) {
|
|
@@ -15,53 +15,87 @@ export const useFunctionsWithOverrides = overrideFactory => {
|
|
|
15
15
|
}
|
|
16
16
|
const overrides = t0;
|
|
17
17
|
let t1;
|
|
18
|
-
if ($[3] !== base
|
|
19
|
-
t1 =
|
|
20
|
-
base,
|
|
21
|
-
overrides
|
|
22
|
-
};
|
|
18
|
+
if ($[3] !== base) {
|
|
19
|
+
t1 = Object.keys(base);
|
|
23
20
|
$[3] = base;
|
|
24
|
-
$[4] =
|
|
25
|
-
$[5] = t1;
|
|
21
|
+
$[4] = t1;
|
|
26
22
|
} else {
|
|
27
|
-
t1 = $[
|
|
23
|
+
t1 = $[4];
|
|
28
24
|
}
|
|
29
|
-
const stateRef = useRef(t1);
|
|
30
25
|
let t2;
|
|
26
|
+
if ($[5] !== overrides) {
|
|
27
|
+
t2 = Object.keys(overrides);
|
|
28
|
+
$[5] = overrides;
|
|
29
|
+
$[6] = t2;
|
|
30
|
+
} else {
|
|
31
|
+
t2 = $[6];
|
|
32
|
+
}
|
|
31
33
|
let t3;
|
|
32
|
-
if ($[
|
|
33
|
-
|
|
34
|
+
if ($[7] !== t1 || $[8] !== t2) {
|
|
35
|
+
t3 = new Set([...t1, ...t2]);
|
|
36
|
+
$[7] = t1;
|
|
37
|
+
$[8] = t2;
|
|
38
|
+
$[9] = t3;
|
|
39
|
+
} else {
|
|
40
|
+
t3 = $[9];
|
|
41
|
+
}
|
|
42
|
+
let t4;
|
|
43
|
+
if ($[10] !== t3) {
|
|
44
|
+
t4 = [...t3];
|
|
45
|
+
$[10] = t3;
|
|
46
|
+
$[11] = t4;
|
|
47
|
+
} else {
|
|
48
|
+
t4 = $[11];
|
|
49
|
+
}
|
|
50
|
+
const functionNames = t4;
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[12] !== base || $[13] !== overrides) {
|
|
53
|
+
t5 = {
|
|
54
|
+
base,
|
|
55
|
+
overrides
|
|
56
|
+
};
|
|
57
|
+
$[12] = base;
|
|
58
|
+
$[13] = overrides;
|
|
59
|
+
$[14] = t5;
|
|
60
|
+
} else {
|
|
61
|
+
t5 = $[14];
|
|
62
|
+
}
|
|
63
|
+
const stateRef = useRef(t5);
|
|
64
|
+
let t6;
|
|
65
|
+
let t7;
|
|
66
|
+
if ($[15] !== base || $[16] !== overrides) {
|
|
67
|
+
t6 = () => {
|
|
34
68
|
stateRef.current = {
|
|
35
69
|
base,
|
|
36
70
|
overrides
|
|
37
71
|
};
|
|
38
72
|
};
|
|
39
|
-
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
73
|
+
t7 = [base, overrides];
|
|
74
|
+
$[15] = base;
|
|
75
|
+
$[16] = overrides;
|
|
76
|
+
$[17] = t6;
|
|
77
|
+
$[18] = t7;
|
|
44
78
|
} else {
|
|
45
|
-
|
|
46
|
-
|
|
79
|
+
t6 = $[17];
|
|
80
|
+
t7 = $[18];
|
|
47
81
|
}
|
|
48
|
-
useEffect(
|
|
82
|
+
useEffect(t6, t7);
|
|
49
83
|
let functions;
|
|
50
|
-
if ($[
|
|
84
|
+
if ($[19] !== functionNames) {
|
|
51
85
|
functions = {};
|
|
52
|
-
for (const key of
|
|
53
|
-
functions[key] = (...
|
|
86
|
+
for (const key of functionNames) {
|
|
87
|
+
functions[key] = (...t8) => {
|
|
54
88
|
var _stateRef$current$ove;
|
|
55
|
-
const args =
|
|
89
|
+
const args = t8;
|
|
56
90
|
const functionKey = key;
|
|
57
91
|
const implementation = (_stateRef$current$ove = stateRef.current.overrides[functionKey]) !== null && _stateRef$current$ove !== void 0 ? _stateRef$current$ove : stateRef.current.base[functionKey];
|
|
58
92
|
return implementation(...args);
|
|
59
93
|
};
|
|
60
94
|
}
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
95
|
+
$[19] = functionNames;
|
|
96
|
+
$[20] = functions;
|
|
63
97
|
} else {
|
|
64
|
-
functions = $[
|
|
98
|
+
functions = $[20];
|
|
65
99
|
}
|
|
66
100
|
return functions;
|
|
67
101
|
};
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import { loadTrustedDomains } from '../utils/loadTrustedDomains';
|
|
4
5
|
class TrustedDomainsError extends Error {
|
|
5
6
|
constructor(entry) {
|
|
6
7
|
super('Remote entry ' + entry + ' is not in trusted domains');
|
|
7
8
|
_defineProperty(this, "name", 'TrustedDomainsError');
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export const TrustedDomainsPlugin =
|
|
11
|
+
export const TrustedDomainsPlugin = trustedDomains => {
|
|
12
|
+
let trustedDomainsPromise;
|
|
13
|
+
const getTrustedDomains = () => {
|
|
14
|
+
if (trustedDomains) {
|
|
15
|
+
return trustedDomains;
|
|
16
|
+
}
|
|
17
|
+
trustedDomainsPromise !== null && trustedDomainsPromise !== void 0 ? trustedDomainsPromise : trustedDomainsPromise = loadTrustedDomains();
|
|
18
|
+
return trustedDomainsPromise;
|
|
19
|
+
};
|
|
11
20
|
return {
|
|
12
21
|
name: 'trusted-domains',
|
|
13
|
-
beforeRequest(args) {
|
|
22
|
+
async beforeRequest(args) {
|
|
23
|
+
const domains = await getTrustedDomains();
|
|
14
24
|
args.options.remotes.forEach(remote => {
|
|
15
25
|
if ('entry' in remote) {
|
|
16
26
|
const parsed = new URL(remote.entry);
|
|
17
|
-
if (!
|
|
27
|
+
if (!domains.some(domain => parsed.hostname.endsWith(domain))) {
|
|
18
28
|
throw new TrustedDomainsError(remote.entry);
|
|
19
29
|
}
|
|
20
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DefaultTrustedDomains } from '../constants/trustedDomains';
|
|
2
|
+
const TRUSTED_DOMAINS_URL = 'https://service-rpc.chayns.net/ConfigurationSettings/TrustedDomains';
|
|
3
|
+
export const loadTrustedDomains = async () => {
|
|
4
|
+
try {
|
|
5
|
+
var _AbortSignal$timeout, _AbortSignal;
|
|
6
|
+
const response = await fetch(TRUSTED_DOMAINS_URL, {
|
|
7
|
+
signal: (_AbortSignal$timeout = (_AbortSignal = AbortSignal).timeout) === null || _AbortSignal$timeout === void 0 ? void 0 : _AbortSignal$timeout.call(_AbortSignal, 5000)
|
|
8
|
+
});
|
|
9
|
+
if (response.status === 200) {
|
|
10
|
+
const {
|
|
11
|
+
trustedDomains
|
|
12
|
+
} = await response.json();
|
|
13
|
+
return trustedDomains;
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
return DefaultTrustedDomains;
|
|
17
|
+
}
|
|
18
|
+
return DefaultTrustedDomains;
|
|
19
|
+
};
|
|
@@ -6,6 +6,7 @@ import getUserInfo from '../calls/getUserInfo';
|
|
|
6
6
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
7
7
|
import { DefaultLoginDialogOptions } from '../constants';
|
|
8
8
|
import { DefaultTrustedDomains } from '../constants/trustedDomains';
|
|
9
|
+
import { loadTrustedDomains } from '../utils/loadTrustedDomains';
|
|
9
10
|
import { DeviceLanguage } from '../constants/languages';
|
|
10
11
|
import DialogHandler from '../handler/DialogHandler';
|
|
11
12
|
import { addApiListener, dispatchApiEvent, removeApiListener } from '../utils/apiListener';
|
|
@@ -30,24 +31,6 @@ export class AppWrapper {
|
|
|
30
31
|
}
|
|
31
32
|
return undefined;
|
|
32
33
|
}
|
|
33
|
-
async loadTrustedDomains() {
|
|
34
|
-
try {
|
|
35
|
-
var _AbortSignal$timeout2, _AbortSignal2;
|
|
36
|
-
const res = await fetch('https://service-rpc.chayns.net/ConfigurationSettings/TrustedDomains', {
|
|
37
|
-
signal: (_AbortSignal$timeout2 = (_AbortSignal2 = AbortSignal).timeout) === null || _AbortSignal$timeout2 === void 0 ? void 0 : _AbortSignal$timeout2.call(_AbortSignal2, 5000)
|
|
38
|
-
});
|
|
39
|
-
if (res.status === 200) {
|
|
40
|
-
const {
|
|
41
|
-
trustedDomains
|
|
42
|
-
} = await res.json();
|
|
43
|
-
return trustedDomains;
|
|
44
|
-
}
|
|
45
|
-
console.error(`[chayns-api] failed to load trusted domains with status code: ${res.status}`);
|
|
46
|
-
} catch (ex) {
|
|
47
|
-
console.error('[chayns-api] failed to load trusted domains', ex);
|
|
48
|
-
}
|
|
49
|
-
return DefaultTrustedDomains;
|
|
50
|
-
}
|
|
51
34
|
mapOldApiToNew(retVal) {
|
|
52
35
|
var _window, _window2, _AppInfo$TappSelected;
|
|
53
36
|
const {
|
|
@@ -799,7 +782,7 @@ export class AppWrapper {
|
|
|
799
782
|
}
|
|
800
783
|
async init() {
|
|
801
784
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
802
|
-
[this.values.styleSettings, this.trustedDomains] = await Promise.all([this.loadStyleSettings(this.values.site.id),
|
|
785
|
+
[this.values.styleSettings, this.trustedDomains] = await Promise.all([this.loadStyleSettings(this.values.site.id), loadTrustedDomains()]);
|
|
803
786
|
document.documentElement.classList.add('chayns-api--app');
|
|
804
787
|
this.appCall(66, {
|
|
805
788
|
enabled: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadTrustedDomains: () => Promise<string[]>;
|
|
@@ -9,7 +9,6 @@ export declare class AppWrapper implements IChaynsReact {
|
|
|
9
9
|
customFunctions: {};
|
|
10
10
|
nextDialogEventId: number;
|
|
11
11
|
loadStyleSettings(siteId: string): Promise<ChaynsStyleSettings | undefined>;
|
|
12
|
-
loadTrustedDomains(): Promise<string[]>;
|
|
13
12
|
mapOldApiToNew(retVal: any): ChaynsReactValues;
|
|
14
13
|
constructor();
|
|
15
14
|
chaynsApiId: string;
|