chayns-api 2.1.10 → 2.2.0-beta.0
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/.github/workflows/publish.yml +7 -2
- package/dist/cjs/calls/index.js +24 -1
- package/dist/cjs/components/ChaynsProvider.js +1 -1
- package/dist/cjs/hooks/context.js +5 -21
- package/dist/cjs/hooks/index.js +8 -1
- package/dist/cjs/hooks/useSiteSettings.js +9 -0
- package/dist/cjs/host/ChaynsHost.js +6 -3
- package/dist/cjs/host/iframe/HostIframe.js +5 -2
- package/dist/cjs/host/module/ModuleHost.js +4 -2
- package/dist/cjs/types/IChaynsReact.js +9 -1
- package/dist/cjs/umd.index.js +89 -0
- package/dist/cjs/util/deviceHelper.js +1 -1
- package/dist/cjs/wrapper/AppWrapper.js +16 -0
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -0
- package/dist/esm/calls/index.js +22 -0
- package/dist/esm/components/ChaynsProvider.js +1 -1
- package/dist/esm/hooks/context.js +5 -18
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/useSiteSettings.js +2 -0
- package/dist/esm/host/ChaynsHost.js +6 -3
- package/dist/esm/host/iframe/HostIframe.js +5 -2
- package/dist/esm/host/module/ModuleHost.js +4 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/types/IChaynsReact.js +8 -0
- package/dist/esm/umd.index.js +9 -0
- package/dist/esm/util/deviceHelper.js +1 -1
- package/dist/esm/wrapper/AppWrapper.js +16 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +1 -0
- package/dist/types/calls/index.d.ts +1 -0
- package/dist/types/hooks/context.d.ts +3 -4
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useSiteSettings.d.ts +2 -0
- package/dist/types/host/ChaynsHost.d.ts +2 -1
- package/dist/types/host/iframe/HostIframe.d.ts +1 -0
- package/dist/types/host/module/ModuleHost.d.ts +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/types/IChaynsReact.d.ts +44 -3
- package/dist/types/umd.index.d.ts +8 -0
- package/dist/types/wrapper/AppWrapper.d.ts +2 -1
- package/dist/types/wrapper/StaticChaynsApi.d.ts +1 -1
- package/package.json +3 -2
- package/toolkit.config.js +18 -11
- package/dist/cjs/components/AppDialogWrapper.js +0 -42
- package/dist/esm/components/AppDialogWrapper.js +0 -34
- package/dist/types/components/AppDialogWrapper.d.ts +0 -5
|
@@ -6,6 +6,11 @@ on:
|
|
|
6
6
|
tags:
|
|
7
7
|
- 'v*'
|
|
8
8
|
|
|
9
|
+
env:
|
|
10
|
+
TAG: >-
|
|
11
|
+
${{ contains(github.ref_name, 'alpha') && 'alpha' || (contains(github.ref_name, '-') &&
|
|
12
|
+
'beta' || 'latest') }}
|
|
13
|
+
|
|
9
14
|
jobs:
|
|
10
15
|
build:
|
|
11
16
|
runs-on: ubuntu-latest
|
|
@@ -13,9 +18,9 @@ jobs:
|
|
|
13
18
|
- uses: actions/checkout@v2
|
|
14
19
|
- uses: actions/setup-node@v1
|
|
15
20
|
with:
|
|
16
|
-
node-version: '
|
|
21
|
+
node-version: '20.18.2'
|
|
17
22
|
registry-url: https://registry.npmjs.org/
|
|
18
23
|
- run: npm install
|
|
19
|
-
- run: npm publish
|
|
24
|
+
- run: npm publish --tag ${{ env.TAG }}
|
|
20
25
|
env:
|
|
21
26
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/dist/cjs/calls/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCustomFunction = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = void 0;
|
|
6
|
+
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSiteSettings = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCustomFunction = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
8
|
const addGeoLocationListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addGeoLocationListener(...args);
|
|
9
9
|
exports.addGeoLocationListener = addGeoLocationListener;
|
|
@@ -119,11 +119,16 @@ const getPages = () => _moduleWrapper.moduleWrapper.current.values.pages;
|
|
|
119
119
|
exports.getPages = getPages;
|
|
120
120
|
const getEnvironment = () => _moduleWrapper.moduleWrapper.current.values.environment;
|
|
121
121
|
exports.getEnvironment = getEnvironment;
|
|
122
|
+
const getSiteSettings = () => _moduleWrapper.moduleWrapper.current.values.siteSettings;
|
|
123
|
+
exports.getSiteSettings = getSiteSettings;
|
|
122
124
|
const getCustomFunction = key => _moduleWrapper.moduleWrapper.current.customFunctions[key];
|
|
123
125
|
exports.getCustomFunction = getCustomFunction;
|
|
124
126
|
const user = exports.user = new Proxy({}, {
|
|
125
127
|
get: (target, prop) => {
|
|
126
128
|
var _moduleWrapper$curren;
|
|
129
|
+
if (prop === '$$typeof') {
|
|
130
|
+
return 'object';
|
|
131
|
+
}
|
|
127
132
|
console.warn('Deprecated user import');
|
|
128
133
|
return (_moduleWrapper$curren = _moduleWrapper.moduleWrapper.current.values.user) === null || _moduleWrapper$curren === void 0 ? void 0 : _moduleWrapper$curren[prop];
|
|
129
134
|
}
|
|
@@ -131,6 +136,9 @@ const user = exports.user = new Proxy({}, {
|
|
|
131
136
|
const site = exports.site = new Proxy({}, {
|
|
132
137
|
get: (target, prop) => {
|
|
133
138
|
var _moduleWrapper$curren2;
|
|
139
|
+
if (prop === '$$typeof') {
|
|
140
|
+
return 'object';
|
|
141
|
+
}
|
|
134
142
|
console.warn('Deprecated site import');
|
|
135
143
|
return (_moduleWrapper$curren2 = _moduleWrapper.moduleWrapper.current.values.site) === null || _moduleWrapper$curren2 === void 0 ? void 0 : _moduleWrapper$curren2[prop];
|
|
136
144
|
}
|
|
@@ -138,6 +146,9 @@ const site = exports.site = new Proxy({}, {
|
|
|
138
146
|
const device = exports.device = new Proxy({}, {
|
|
139
147
|
get: (target, prop) => {
|
|
140
148
|
var _moduleWrapper$curren3;
|
|
149
|
+
if (prop === '$$typeof') {
|
|
150
|
+
return 'object';
|
|
151
|
+
}
|
|
141
152
|
console.warn('Deprecated device import');
|
|
142
153
|
return (_moduleWrapper$curren3 = _moduleWrapper.moduleWrapper.current.values.device) === null || _moduleWrapper$curren3 === void 0 ? void 0 : _moduleWrapper$curren3[prop];
|
|
143
154
|
}
|
|
@@ -145,6 +156,9 @@ const device = exports.device = new Proxy({}, {
|
|
|
145
156
|
const language = exports.language = new Proxy({}, {
|
|
146
157
|
get: (target, prop) => {
|
|
147
158
|
var _moduleWrapper$curren4;
|
|
159
|
+
if (prop === '$$typeof') {
|
|
160
|
+
return 'object';
|
|
161
|
+
}
|
|
148
162
|
console.warn('Deprecated language import');
|
|
149
163
|
return (_moduleWrapper$curren4 = _moduleWrapper.moduleWrapper.current.values.language) === null || _moduleWrapper$curren4 === void 0 ? void 0 : _moduleWrapper$curren4[prop];
|
|
150
164
|
}
|
|
@@ -152,6 +166,9 @@ const language = exports.language = new Proxy({}, {
|
|
|
152
166
|
const parameters = exports.parameters = new Proxy({}, {
|
|
153
167
|
get: (target, prop) => {
|
|
154
168
|
var _moduleWrapper$curren5;
|
|
169
|
+
if (prop === '$$typeof') {
|
|
170
|
+
return 'object';
|
|
171
|
+
}
|
|
155
172
|
console.warn('Deprecated parameters import');
|
|
156
173
|
return (_moduleWrapper$curren5 = _moduleWrapper.moduleWrapper.current.values.parameters) === null || _moduleWrapper$curren5 === void 0 ? void 0 : _moduleWrapper$curren5[prop];
|
|
157
174
|
}
|
|
@@ -159,6 +176,9 @@ const parameters = exports.parameters = new Proxy({}, {
|
|
|
159
176
|
const pages = exports.pages = new Proxy({}, {
|
|
160
177
|
get: (target, prop) => {
|
|
161
178
|
var _moduleWrapper$curren6;
|
|
179
|
+
if (prop === '$$typeof') {
|
|
180
|
+
return 'object';
|
|
181
|
+
}
|
|
162
182
|
console.warn('Deprecated pages import');
|
|
163
183
|
return (_moduleWrapper$curren6 = _moduleWrapper.moduleWrapper.current.values.pages) === null || _moduleWrapper$curren6 === void 0 ? void 0 : _moduleWrapper$curren6[prop];
|
|
164
184
|
}
|
|
@@ -166,6 +186,9 @@ const pages = exports.pages = new Proxy({}, {
|
|
|
166
186
|
const environment = exports.environment = new Proxy({}, {
|
|
167
187
|
get: (target, prop) => {
|
|
168
188
|
var _moduleWrapper$curren7;
|
|
189
|
+
if (prop === '$$typeof') {
|
|
190
|
+
return 'object';
|
|
191
|
+
}
|
|
169
192
|
console.warn('Deprecated environment import');
|
|
170
193
|
return (_moduleWrapper$curren7 = _moduleWrapper.moduleWrapper.current.values.environment) === null || _moduleWrapper$curren7 === void 0 ? void 0 : _moduleWrapper$curren7[prop];
|
|
171
194
|
}
|
|
@@ -59,7 +59,7 @@ const ChaynsProvider = ({
|
|
|
59
59
|
} else {
|
|
60
60
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
61
61
|
const deviceInfo = (0, _deviceHelper.default)(navigator.userAgent, '');
|
|
62
|
-
if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat, _IChaynsReact.AppName.Team].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
62
|
+
if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat, _IChaynsReact.AppName.Team, _IChaynsReact.AppName.CityApp].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
63
63
|
customWrapper.current = new _AppWrapper.AppWrapper();
|
|
64
64
|
} else {
|
|
65
65
|
customWrapper.current = new _FrameWrapper.FrameWrapper();
|
|
@@ -7,30 +7,14 @@ exports.useValuesSelector = exports.useFunctionsSelector = exports.useCustomFunc
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _shim = require("use-sync-external-store/shim");
|
|
9
9
|
var _ChaynsContext = require("../components/ChaynsContext");
|
|
10
|
-
const
|
|
10
|
+
const useChaynsSelector = key => selector => {
|
|
11
11
|
const store = (0, _react.useContext)(_ChaynsContext.ChaynsContext);
|
|
12
12
|
if (!store) {
|
|
13
13
|
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
14
14
|
}
|
|
15
|
-
const getSnapshot = () => selector(store
|
|
15
|
+
const getSnapshot = () => selector(store[key]);
|
|
16
16
|
return (0, _shim.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
|
|
17
17
|
};
|
|
18
|
-
exports.useValuesSelector =
|
|
19
|
-
const useFunctionsSelector =
|
|
20
|
-
|
|
21
|
-
if (!store) {
|
|
22
|
-
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
23
|
-
}
|
|
24
|
-
const getSnapshot = () => selector(store.functions);
|
|
25
|
-
return (0, _shim.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
|
|
26
|
-
};
|
|
27
|
-
exports.useFunctionsSelector = useFunctionsSelector;
|
|
28
|
-
const useCustomFunctionsSelector = selector => {
|
|
29
|
-
const store = (0, _react.useContext)(_ChaynsContext.ChaynsContext);
|
|
30
|
-
if (!store) {
|
|
31
|
-
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
32
|
-
}
|
|
33
|
-
const getSnapshot = () => selector(store.customFunctions);
|
|
34
|
-
return (0, _shim.useSyncExternalStore)(store.subscribe, getSnapshot, getSnapshot);
|
|
35
|
-
};
|
|
36
|
-
exports.useCustomFunctionsSelector = useCustomFunctionsSelector;
|
|
18
|
+
const useValuesSelector = exports.useValuesSelector = useChaynsSelector('values');
|
|
19
|
+
const useFunctionsSelector = exports.useFunctionsSelector = useChaynsSelector('functions');
|
|
20
|
+
const useCustomFunctionsSelector = exports.useCustomFunctionsSelector = useChaynsSelector('customFunctions');
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -141,6 +141,12 @@ Object.defineProperty(exports, "useSite", {
|
|
|
141
141
|
return _useSite.useSite;
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
|
+
Object.defineProperty(exports, "useSiteSettings", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _useSiteSettings.useSiteSettings;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
144
150
|
Object.defineProperty(exports, "useUser", {
|
|
145
151
|
enumerable: true,
|
|
146
152
|
get: function () {
|
|
@@ -183,4 +189,5 @@ var _useCurrentPage = require("./useCurrentPage");
|
|
|
183
189
|
var _useCustomData = require("./useCustomData");
|
|
184
190
|
var _useDialogState = require("./useDialogState");
|
|
185
191
|
var _useCustomCallbackFunction = require("./useCustomCallbackFunction");
|
|
186
|
-
var _useCustomFunction = require("./useCustomFunction");
|
|
192
|
+
var _useCustomFunction = require("./useCustomFunction");
|
|
193
|
+
var _useSiteSettings = require("./useSiteSettings");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSiteSettings = void 0;
|
|
7
|
+
var _context = require("./context");
|
|
8
|
+
const useSiteSettings = () => (0, _context.useValuesSelector)(state => state.siteSettings);
|
|
9
|
+
exports.useSiteSettings = useSiteSettings;
|
|
@@ -30,7 +30,8 @@ const ChaynsHost = ({
|
|
|
30
30
|
customData,
|
|
31
31
|
environment,
|
|
32
32
|
preventStagingReplacement,
|
|
33
|
-
dialog
|
|
33
|
+
dialog,
|
|
34
|
+
siteSettings
|
|
34
35
|
}) => {
|
|
35
36
|
const [isVisible, setIsVisible] = (0, _react.useState)(type !== 'client-module' && (type !== 'server-module' || !!(system !== null && system !== void 0 && system.serverUrl)));
|
|
36
37
|
(0, _react.useEffect)(() => {
|
|
@@ -67,7 +68,8 @@ const ChaynsHost = ({
|
|
|
67
68
|
environment: environment,
|
|
68
69
|
customData: customData,
|
|
69
70
|
preventStagingReplacement: preventStagingReplacement,
|
|
70
|
-
dialog: dialog
|
|
71
|
+
dialog: dialog,
|
|
72
|
+
siteSettings: siteSettings
|
|
71
73
|
});
|
|
72
74
|
case 'client-module':
|
|
73
75
|
case 'server-module':
|
|
@@ -87,7 +89,8 @@ const ChaynsHost = ({
|
|
|
87
89
|
customData: customData,
|
|
88
90
|
environment: environment,
|
|
89
91
|
preventStagingReplacement: preventStagingReplacement,
|
|
90
|
-
dialog: dialog
|
|
92
|
+
dialog: dialog,
|
|
93
|
+
siteSettings: siteSettings
|
|
91
94
|
});
|
|
92
95
|
default:
|
|
93
96
|
return null;
|
|
@@ -31,7 +31,8 @@ const HostIframe = ({
|
|
|
31
31
|
environment,
|
|
32
32
|
customData,
|
|
33
33
|
preventStagingReplacement,
|
|
34
|
-
dialog
|
|
34
|
+
dialog,
|
|
35
|
+
siteSettings
|
|
35
36
|
}) => {
|
|
36
37
|
const eventTarget = (0, _react.useRef)();
|
|
37
38
|
const ref = (0, _react.useRef)();
|
|
@@ -57,7 +58,8 @@ const HostIframe = ({
|
|
|
57
58
|
parameters,
|
|
58
59
|
environment,
|
|
59
60
|
customData,
|
|
60
|
-
dialog
|
|
61
|
+
dialog,
|
|
62
|
+
siteSettings
|
|
61
63
|
};
|
|
62
64
|
currentDataRef.current = initialData;
|
|
63
65
|
(0, _react.useEffect)(() => {
|
|
@@ -112,6 +114,7 @@ const HostIframe = ({
|
|
|
112
114
|
(0, _useUpdateData.default)(eventTarget.current, 'environment', environment);
|
|
113
115
|
(0, _useUpdateData.default)(eventTarget.current, 'customData', customData);
|
|
114
116
|
(0, _useUpdateData.default)(eventTarget.current, 'dialog', dialog);
|
|
117
|
+
(0, _useUpdateData.default)(eventTarget.current, 'siteSettings', siteSettings);
|
|
115
118
|
return _react.default.createElement("iframe", _extends({
|
|
116
119
|
ref: r => {
|
|
117
120
|
ref.current = r;
|
|
@@ -36,7 +36,8 @@ const ModuleHost = ({
|
|
|
36
36
|
customData,
|
|
37
37
|
dialog,
|
|
38
38
|
environment,
|
|
39
|
-
preventStagingReplacement
|
|
39
|
+
preventStagingReplacement,
|
|
40
|
+
siteSettings
|
|
40
41
|
}) => {
|
|
41
42
|
const initialData = {
|
|
42
43
|
site,
|
|
@@ -47,7 +48,8 @@ const ModuleHost = ({
|
|
|
47
48
|
language,
|
|
48
49
|
parameters,
|
|
49
50
|
customData,
|
|
50
|
-
environment
|
|
51
|
+
environment,
|
|
52
|
+
siteSettings
|
|
51
53
|
};
|
|
52
54
|
if (user) {
|
|
53
55
|
initialData.user = user;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
6
|
+
exports.WeekDayType = exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.IconStyle = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.FloatingButtonAnimation = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogIconType = exports.DialogButtonType = exports.DialogAnimation = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
|
|
7
7
|
let DateType = exports.DateType = function (DateType) {
|
|
8
8
|
DateType[DateType["DATE"] = 0] = "DATE";
|
|
9
9
|
DateType[DateType["TIME"] = 1] = "TIME";
|
|
@@ -48,6 +48,14 @@ let DialogButtonType = exports.DialogButtonType = function (DialogButtonType) {
|
|
|
48
48
|
DialogButtonType[DialogButtonType["NEGATIVE"] = 0] = "NEGATIVE";
|
|
49
49
|
return DialogButtonType;
|
|
50
50
|
}({});
|
|
51
|
+
let IconStyle = exports.IconStyle = function (IconStyle) {
|
|
52
|
+
IconStyle[IconStyle["SOLID"] = 0] = "SOLID";
|
|
53
|
+
IconStyle[IconStyle["REGULAR"] = 1] = "REGULAR";
|
|
54
|
+
IconStyle[IconStyle["LIGHT"] = 2] = "LIGHT";
|
|
55
|
+
IconStyle[IconStyle["DUOTONE"] = 3] = "DUOTONE";
|
|
56
|
+
IconStyle[IconStyle["SHARP"] = 4] = "SHARP";
|
|
57
|
+
return IconStyle;
|
|
58
|
+
}({});
|
|
51
59
|
let ScreenSize = exports.ScreenSize = function (ScreenSize) {
|
|
52
60
|
ScreenSize[ScreenSize["XS"] = 0] = "XS";
|
|
53
61
|
ScreenSize[ScreenSize["SM"] = 1] = "SM";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
getDeviceInfo: true,
|
|
8
|
+
getScreenSize: true,
|
|
9
|
+
getClientDeviceInfo: true,
|
|
10
|
+
StaticChaynsApi: true,
|
|
11
|
+
DialogHandler: true,
|
|
12
|
+
dialog: true
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "DialogHandler", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _DialogHandler.default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "StaticChaynsApi", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _StaticChaynsApi.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
exports.dialog = void 0;
|
|
27
|
+
Object.defineProperty(exports, "getClientDeviceInfo", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _deviceHelper.getClientDeviceInfo;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "getDeviceInfo", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _deviceHelper.default;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "getScreenSize", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _deviceHelper.getScreenSize;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
require("./util/transferNestedFunctions");
|
|
46
|
+
var _deviceHelper = _interopRequireWildcard(require("./util/deviceHelper"));
|
|
47
|
+
var _calls = require("./calls");
|
|
48
|
+
Object.keys(_calls).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
+
if (key in exports && exports[key] === _calls[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _calls[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
var _IChaynsReact = require("./types/IChaynsReact");
|
|
60
|
+
Object.keys(_IChaynsReact).forEach(function (key) {
|
|
61
|
+
if (key === "default" || key === "__esModule") return;
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
63
|
+
if (key in exports && exports[key] === _IChaynsReact[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _IChaynsReact[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
var _is = require("./util/is");
|
|
72
|
+
Object.keys(_is).forEach(function (key) {
|
|
73
|
+
if (key === "default" || key === "__esModule") return;
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
75
|
+
if (key in exports && exports[key] === _is[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _is[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _StaticChaynsApi = _interopRequireDefault(require("./wrapper/StaticChaynsApi"));
|
|
84
|
+
var _DialogHandler = _interopRequireDefault(require("./handler/DialogHandler"));
|
|
85
|
+
var _dialog = _interopRequireWildcard(require("./calls/dialogs/index"));
|
|
86
|
+
exports.dialog = _dialog;
|
|
87
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
88
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
89
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -13,7 +13,7 @@ const getDeviceInfo = (userAgent, acceptHeader, {
|
|
|
13
13
|
const uaParser = new _uaParserJs.UAParser(userAgent);
|
|
14
14
|
let appName = _IChaynsReact.AppName.Unknown;
|
|
15
15
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
16
|
-
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
16
|
+
const customMatch = /\s(?<name>intercom|sidekick|team|cityApp)\/(?<version>\d+)/i.exec(userAgent);
|
|
17
17
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
18
18
|
appName = _IChaynsReact.AppName.TobitChat;
|
|
19
19
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -23,6 +23,21 @@ class AppWrapper {
|
|
|
23
23
|
accessToken = '';
|
|
24
24
|
listeners = [];
|
|
25
25
|
customFunctions = {};
|
|
26
|
+
async loadSiteSettings(siteId) {
|
|
27
|
+
try {
|
|
28
|
+
var _AbortSignal$timeout, _AbortSignal;
|
|
29
|
+
const res = await fetch(`https://style.tobit.cloud/css/${siteId}/components`, {
|
|
30
|
+
signal: (_AbortSignal$timeout = (_AbortSignal = AbortSignal).timeout) === null || _AbortSignal$timeout === void 0 ? void 0 : _AbortSignal$timeout.call(_AbortSignal, 5000)
|
|
31
|
+
});
|
|
32
|
+
if (res.status === 200) {
|
|
33
|
+
return await res.json();
|
|
34
|
+
}
|
|
35
|
+
console.error(`[chayns-api] failed to load site settings with status code: ${res.status}`);
|
|
36
|
+
} catch (ex) {
|
|
37
|
+
console.error('[chayns-api] failed to load site settings', ex);
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
26
41
|
mapOldApiToNew(retVal) {
|
|
27
42
|
var _window, _window2, _AppInfo$TappSelected;
|
|
28
43
|
const {
|
|
@@ -586,6 +601,7 @@ class AppWrapper {
|
|
|
586
601
|
dialogs = [];
|
|
587
602
|
async init() {
|
|
588
603
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
604
|
+
this.values.siteSettings = await this.loadSiteSettings(this.values.site.id);
|
|
589
605
|
document.documentElement.classList.add('chayns-api--app');
|
|
590
606
|
this.appCall(66, {
|
|
591
607
|
enabled: true
|
|
@@ -39,6 +39,7 @@ class StaticChaynsApi {
|
|
|
39
39
|
getParameters = () => this._wrapper.values.parameters;
|
|
40
40
|
getPages = () => this._wrapper.values.pages;
|
|
41
41
|
getEnvironment = () => this._wrapper.values.environment;
|
|
42
|
+
getSiteSettings = () => this._wrapper.values.siteSettings;
|
|
42
43
|
getCustomFunction = key => this._wrapper.customFunctions[key];
|
|
43
44
|
}
|
|
44
45
|
var _default = exports.default = StaticChaynsApi;
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -150,10 +150,14 @@ export const getLanguage = () => moduleWrapper.current.values.language;
|
|
|
150
150
|
export const getParameters = () => moduleWrapper.current.values.parameters;
|
|
151
151
|
export const getPages = () => moduleWrapper.current.values.pages;
|
|
152
152
|
export const getEnvironment = () => moduleWrapper.current.values.environment;
|
|
153
|
+
export const getSiteSettings = () => moduleWrapper.current.values.siteSettings;
|
|
153
154
|
export const getCustomFunction = key => moduleWrapper.current.customFunctions[key];
|
|
154
155
|
export const user = new Proxy({}, {
|
|
155
156
|
get: (target, prop) => {
|
|
156
157
|
var _moduleWrapper$curren;
|
|
158
|
+
if (prop === '$$typeof') {
|
|
159
|
+
return 'object';
|
|
160
|
+
}
|
|
157
161
|
console.warn('Deprecated user import');
|
|
158
162
|
return (_moduleWrapper$curren = moduleWrapper.current.values.user) === null || _moduleWrapper$curren === void 0 ? void 0 : _moduleWrapper$curren[prop];
|
|
159
163
|
}
|
|
@@ -161,6 +165,9 @@ export const user = new Proxy({}, {
|
|
|
161
165
|
export const site = new Proxy({}, {
|
|
162
166
|
get: (target, prop) => {
|
|
163
167
|
var _moduleWrapper$curren2;
|
|
168
|
+
if (prop === '$$typeof') {
|
|
169
|
+
return 'object';
|
|
170
|
+
}
|
|
164
171
|
console.warn('Deprecated site import');
|
|
165
172
|
return (_moduleWrapper$curren2 = moduleWrapper.current.values.site) === null || _moduleWrapper$curren2 === void 0 ? void 0 : _moduleWrapper$curren2[prop];
|
|
166
173
|
}
|
|
@@ -168,6 +175,9 @@ export const site = new Proxy({}, {
|
|
|
168
175
|
export const device = new Proxy({}, {
|
|
169
176
|
get: (target, prop) => {
|
|
170
177
|
var _moduleWrapper$curren3;
|
|
178
|
+
if (prop === '$$typeof') {
|
|
179
|
+
return 'object';
|
|
180
|
+
}
|
|
171
181
|
console.warn('Deprecated device import');
|
|
172
182
|
return (_moduleWrapper$curren3 = moduleWrapper.current.values.device) === null || _moduleWrapper$curren3 === void 0 ? void 0 : _moduleWrapper$curren3[prop];
|
|
173
183
|
}
|
|
@@ -175,6 +185,9 @@ export const device = new Proxy({}, {
|
|
|
175
185
|
export const language = new Proxy({}, {
|
|
176
186
|
get: (target, prop) => {
|
|
177
187
|
var _moduleWrapper$curren4;
|
|
188
|
+
if (prop === '$$typeof') {
|
|
189
|
+
return 'object';
|
|
190
|
+
}
|
|
178
191
|
console.warn('Deprecated language import');
|
|
179
192
|
return (_moduleWrapper$curren4 = moduleWrapper.current.values.language) === null || _moduleWrapper$curren4 === void 0 ? void 0 : _moduleWrapper$curren4[prop];
|
|
180
193
|
}
|
|
@@ -182,6 +195,9 @@ export const language = new Proxy({}, {
|
|
|
182
195
|
export const parameters = new Proxy({}, {
|
|
183
196
|
get: (target, prop) => {
|
|
184
197
|
var _moduleWrapper$curren5;
|
|
198
|
+
if (prop === '$$typeof') {
|
|
199
|
+
return 'object';
|
|
200
|
+
}
|
|
185
201
|
console.warn('Deprecated parameters import');
|
|
186
202
|
return (_moduleWrapper$curren5 = moduleWrapper.current.values.parameters) === null || _moduleWrapper$curren5 === void 0 ? void 0 : _moduleWrapper$curren5[prop];
|
|
187
203
|
}
|
|
@@ -189,6 +205,9 @@ export const parameters = new Proxy({}, {
|
|
|
189
205
|
export const pages = new Proxy({}, {
|
|
190
206
|
get: (target, prop) => {
|
|
191
207
|
var _moduleWrapper$curren6;
|
|
208
|
+
if (prop === '$$typeof') {
|
|
209
|
+
return 'object';
|
|
210
|
+
}
|
|
192
211
|
console.warn('Deprecated pages import');
|
|
193
212
|
return (_moduleWrapper$curren6 = moduleWrapper.current.values.pages) === null || _moduleWrapper$curren6 === void 0 ? void 0 : _moduleWrapper$curren6[prop];
|
|
194
213
|
}
|
|
@@ -196,6 +215,9 @@ export const pages = new Proxy({}, {
|
|
|
196
215
|
export const environment = new Proxy({}, {
|
|
197
216
|
get: (target, prop) => {
|
|
198
217
|
var _moduleWrapper$curren7;
|
|
218
|
+
if (prop === '$$typeof') {
|
|
219
|
+
return 'object';
|
|
220
|
+
}
|
|
199
221
|
console.warn('Deprecated environment import');
|
|
200
222
|
return (_moduleWrapper$curren7 = moduleWrapper.current.values.environment) === null || _moduleWrapper$curren7 === void 0 ? void 0 : _moduleWrapper$curren7[prop];
|
|
201
223
|
}
|
|
@@ -52,7 +52,7 @@ const ChaynsProvider = _ref2 => {
|
|
|
52
52
|
} else {
|
|
53
53
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
54
54
|
const deviceInfo = getDeviceInfo(navigator.userAgent, '');
|
|
55
|
-
if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat, AppName.Team].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
55
|
+
if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat, AppName.Team, AppName.CityApp].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
56
56
|
customWrapper.current = new AppWrapper();
|
|
57
57
|
} else {
|
|
58
58
|
customWrapper.current = new FrameWrapper();
|
|
@@ -1,27 +1,14 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
3
3
|
import { ChaynsContext } from '../components/ChaynsContext';
|
|
4
|
-
|
|
4
|
+
const useChaynsSelector = key => selector => {
|
|
5
5
|
const store = useContext(ChaynsContext);
|
|
6
6
|
if (!store) {
|
|
7
7
|
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
8
8
|
}
|
|
9
|
-
const getSnapshot = () => selector(store
|
|
9
|
+
const getSnapshot = () => selector(store[key]);
|
|
10
10
|
return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
11
11
|
};
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
16
|
-
}
|
|
17
|
-
const getSnapshot = () => selector(store.functions);
|
|
18
|
-
return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
19
|
-
};
|
|
20
|
-
export const useCustomFunctionsSelector = selector => {
|
|
21
|
-
const store = useContext(ChaynsContext);
|
|
22
|
-
if (!store) {
|
|
23
|
-
throw new Error('Could not find chayns context. Did you forget to add ChaynsProvider?');
|
|
24
|
-
}
|
|
25
|
-
const getSnapshot = () => selector(store.customFunctions);
|
|
26
|
-
return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
27
|
-
};
|
|
12
|
+
export const useValuesSelector = useChaynsSelector('values');
|
|
13
|
+
export const useFunctionsSelector = useChaynsSelector('functions');
|
|
14
|
+
export const useCustomFunctionsSelector = useChaynsSelector('customFunctions');
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export { useCurrentPage } from './useCurrentPage';
|
|
|
16
16
|
export { useCustomData } from './useCustomData';
|
|
17
17
|
export { useDialogState, useDialogData } from './useDialogState';
|
|
18
18
|
export { useCustomCallbackFunction } from './useCustomCallbackFunction';
|
|
19
|
-
export { useCustomFunction } from './useCustomFunction';
|
|
19
|
+
export { useCustomFunction } from './useCustomFunction';
|
|
20
|
+
export { useSiteSettings } from './useSiteSettings';
|
|
@@ -22,7 +22,8 @@ const ChaynsHost = _ref => {
|
|
|
22
22
|
customData,
|
|
23
23
|
environment,
|
|
24
24
|
preventStagingReplacement,
|
|
25
|
-
dialog
|
|
25
|
+
dialog,
|
|
26
|
+
siteSettings
|
|
26
27
|
} = _ref;
|
|
27
28
|
const [isVisible, setIsVisible] = useState(type !== 'client-module' && (type !== 'server-module' || !!(system !== null && system !== void 0 && system.serverUrl)));
|
|
28
29
|
useEffect(() => {
|
|
@@ -59,7 +60,8 @@ const ChaynsHost = _ref => {
|
|
|
59
60
|
environment: environment,
|
|
60
61
|
customData: customData,
|
|
61
62
|
preventStagingReplacement: preventStagingReplacement,
|
|
62
|
-
dialog: dialog
|
|
63
|
+
dialog: dialog,
|
|
64
|
+
siteSettings: siteSettings
|
|
63
65
|
});
|
|
64
66
|
case 'client-module':
|
|
65
67
|
case 'server-module':
|
|
@@ -79,7 +81,8 @@ const ChaynsHost = _ref => {
|
|
|
79
81
|
customData: customData,
|
|
80
82
|
environment: environment,
|
|
81
83
|
preventStagingReplacement: preventStagingReplacement,
|
|
82
|
-
dialog: dialog
|
|
84
|
+
dialog: dialog,
|
|
85
|
+
siteSettings: siteSettings
|
|
83
86
|
});
|
|
84
87
|
default:
|
|
85
88
|
return null;
|
|
@@ -23,7 +23,8 @@ const HostIframe = _ref => {
|
|
|
23
23
|
environment,
|
|
24
24
|
customData,
|
|
25
25
|
preventStagingReplacement,
|
|
26
|
-
dialog
|
|
26
|
+
dialog,
|
|
27
|
+
siteSettings
|
|
27
28
|
} = _ref;
|
|
28
29
|
const eventTarget = useRef();
|
|
29
30
|
const ref = useRef();
|
|
@@ -49,7 +50,8 @@ const HostIframe = _ref => {
|
|
|
49
50
|
parameters,
|
|
50
51
|
environment,
|
|
51
52
|
customData,
|
|
52
|
-
dialog
|
|
53
|
+
dialog,
|
|
54
|
+
siteSettings
|
|
53
55
|
};
|
|
54
56
|
currentDataRef.current = initialData;
|
|
55
57
|
useEffect(() => {
|
|
@@ -104,6 +106,7 @@ const HostIframe = _ref => {
|
|
|
104
106
|
useUpdateData(eventTarget.current, 'environment', environment);
|
|
105
107
|
useUpdateData(eventTarget.current, 'customData', customData);
|
|
106
108
|
useUpdateData(eventTarget.current, 'dialog', dialog);
|
|
109
|
+
useUpdateData(eventTarget.current, 'siteSettings', siteSettings);
|
|
107
110
|
return React.createElement("iframe", _extends({
|
|
108
111
|
ref: r => {
|
|
109
112
|
ref.current = r;
|
|
@@ -29,7 +29,8 @@ const ModuleHost = _ref2 => {
|
|
|
29
29
|
customData,
|
|
30
30
|
dialog,
|
|
31
31
|
environment,
|
|
32
|
-
preventStagingReplacement
|
|
32
|
+
preventStagingReplacement,
|
|
33
|
+
siteSettings
|
|
33
34
|
} = _ref2;
|
|
34
35
|
const initialData = {
|
|
35
36
|
site,
|
|
@@ -40,7 +41,8 @@ const ModuleHost = _ref2 => {
|
|
|
40
41
|
language,
|
|
41
42
|
parameters,
|
|
42
43
|
customData,
|
|
43
|
-
environment
|
|
44
|
+
environment,
|
|
45
|
+
siteSettings
|
|
44
46
|
};
|
|
45
47
|
if (user) {
|
|
46
48
|
initialData.user = user;
|
package/dist/esm/index.js
CHANGED
|
@@ -16,6 +16,5 @@ export { default as loadComponent, loadModule } from './host/module/utils/loadCo
|
|
|
16
16
|
export { default as DialogHandler } from './handler/DialogHandler';
|
|
17
17
|
import * as _dialog from './calls/dialogs/index';
|
|
18
18
|
export { _dialog as dialog };
|
|
19
|
-
export * from './types/IChaynsReact';
|
|
20
19
|
export * from './util/initModuleFederationSharing';
|
|
21
20
|
export * from './util/bindChaynsApi';
|
|
@@ -42,6 +42,14 @@ export let DialogButtonType = function (DialogButtonType) {
|
|
|
42
42
|
DialogButtonType[DialogButtonType["NEGATIVE"] = 0] = "NEGATIVE";
|
|
43
43
|
return DialogButtonType;
|
|
44
44
|
}({});
|
|
45
|
+
export let IconStyle = function (IconStyle) {
|
|
46
|
+
IconStyle[IconStyle["SOLID"] = 0] = "SOLID";
|
|
47
|
+
IconStyle[IconStyle["REGULAR"] = 1] = "REGULAR";
|
|
48
|
+
IconStyle[IconStyle["LIGHT"] = 2] = "LIGHT";
|
|
49
|
+
IconStyle[IconStyle["DUOTONE"] = 3] = "DUOTONE";
|
|
50
|
+
IconStyle[IconStyle["SHARP"] = 4] = "SHARP";
|
|
51
|
+
return IconStyle;
|
|
52
|
+
}({});
|
|
45
53
|
export let ScreenSize = function (ScreenSize) {
|
|
46
54
|
ScreenSize[ScreenSize["XS"] = 0] = "XS";
|
|
47
55
|
ScreenSize[ScreenSize["SM"] = 1] = "SM";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './util/transferNestedFunctions';
|
|
2
|
+
export { default as getDeviceInfo, getScreenSize, getClientDeviceInfo } from './util/deviceHelper';
|
|
3
|
+
export * from './calls';
|
|
4
|
+
export * from './types/IChaynsReact';
|
|
5
|
+
export * from './util/is';
|
|
6
|
+
export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
|
|
7
|
+
export { default as DialogHandler } from './handler/DialogHandler';
|
|
8
|
+
import * as _dialog from './calls/dialogs/index';
|
|
9
|
+
export { _dialog as dialog };
|
|
@@ -8,7 +8,7 @@ const getDeviceInfo = function (userAgent, acceptHeader) {
|
|
|
8
8
|
const uaParser = new UAParser(userAgent);
|
|
9
9
|
let appName = AppName.Unknown;
|
|
10
10
|
const match = /(?:my)?chayns\/(?<version>\d+).*(?<siteId>\d{5}-\d{5})/i.exec(userAgent);
|
|
11
|
-
const customMatch = /\s(?<name>intercom|sidekick|team)\/(?<version>\d+)/i.exec(userAgent);
|
|
11
|
+
const customMatch = /\s(?<name>intercom|sidekick|team|cityApp)\/(?<version>\d+)/i.exec(userAgent);
|
|
12
12
|
if (/\sintercom\/\d+/i.test(userAgent)) {
|
|
13
13
|
appName = AppName.TobitChat;
|
|
14
14
|
} else if (/\ssidekick\/\d+/i.test(userAgent)) {
|
|
@@ -13,6 +13,21 @@ import { DeviceLanguage } from '../constants/languages';
|
|
|
13
13
|
import { isAppCallSupported } from '../util/is';
|
|
14
14
|
let appWrapperDialogId = 0;
|
|
15
15
|
export class AppWrapper {
|
|
16
|
+
async loadSiteSettings(siteId) {
|
|
17
|
+
try {
|
|
18
|
+
var _AbortSignal$timeout, _AbortSignal;
|
|
19
|
+
const res = await fetch(`https://style.tobit.cloud/css/${siteId}/components`, {
|
|
20
|
+
signal: (_AbortSignal$timeout = (_AbortSignal = AbortSignal).timeout) === null || _AbortSignal$timeout === void 0 ? void 0 : _AbortSignal$timeout.call(_AbortSignal, 5000)
|
|
21
|
+
});
|
|
22
|
+
if (res.status === 200) {
|
|
23
|
+
return await res.json();
|
|
24
|
+
}
|
|
25
|
+
console.error(`[chayns-api] failed to load site settings with status code: ${res.status}`);
|
|
26
|
+
} catch (ex) {
|
|
27
|
+
console.error('[chayns-api] failed to load site settings', ex);
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
16
31
|
mapOldApiToNew(retVal) {
|
|
17
32
|
var _window, _window2, _AppInfo$TappSelected;
|
|
18
33
|
const {
|
|
@@ -596,6 +611,7 @@ export class AppWrapper {
|
|
|
596
611
|
}
|
|
597
612
|
async init() {
|
|
598
613
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
614
|
+
this.values.siteSettings = await this.loadSiteSettings(this.values.site.id);
|
|
599
615
|
document.documentElement.classList.add('chayns-api--app');
|
|
600
616
|
this.appCall(66, {
|
|
601
617
|
enabled: true
|
|
@@ -18,6 +18,7 @@ class StaticChaynsApi {
|
|
|
18
18
|
_defineProperty(this, "getParameters", () => this._wrapper.values.parameters);
|
|
19
19
|
_defineProperty(this, "getPages", () => this._wrapper.values.pages);
|
|
20
20
|
_defineProperty(this, "getEnvironment", () => this._wrapper.values.environment);
|
|
21
|
+
_defineProperty(this, "getSiteSettings", () => this._wrapper.values.siteSettings);
|
|
21
22
|
_defineProperty(this, "getCustomFunction", key => this._wrapper.customFunctions[key]);
|
|
22
23
|
let wrapper;
|
|
23
24
|
const deviceInfo = getDeviceInfo(navigator.userAgent, '');
|
|
@@ -236,6 +236,7 @@ export declare const getEnvironment: () => {
|
|
|
236
236
|
buildEnvironment: import("../types/IChaynsReact").Environment;
|
|
237
237
|
runtimeEnvironment: import("../types/IChaynsReact").RuntimeEnviroment | string;
|
|
238
238
|
};
|
|
239
|
+
export declare const getSiteSettings: () => import("../types/IChaynsReact").ChaynsSiteSettings | undefined;
|
|
239
240
|
/**
|
|
240
241
|
* Returns the customFunction. Prefer usage via useCustomFunction when possible
|
|
241
242
|
* @param key functionName
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const useCustomFunctionsSelector: <Result>(selector: (value: IChaynsReact["customFunctions"]) => Result) => Result;
|
|
1
|
+
export declare const useValuesSelector: <Result>(selector: (value: import("../types/IChaynsReact").ChaynsReactValues) => Result) => Result;
|
|
2
|
+
export declare const useFunctionsSelector: <Result>(selector: (value: import("../types/IChaynsReact").ChaynsReactFunctions) => Result) => Result;
|
|
3
|
+
export declare const useCustomFunctionsSelector: <Result>(selector: (value: import("../types/IChaynsReact").ChaynsReactCustomFunctions) => Result) => Result;
|
|
@@ -17,3 +17,4 @@ export { useCustomData } from './useCustomData';
|
|
|
17
17
|
export { useDialogState, useDialogData } from './useDialogState';
|
|
18
18
|
export { useCustomCallbackFunction } from './useCustomCallbackFunction';
|
|
19
19
|
export { useCustomFunction } from './useCustomFunction';
|
|
20
|
+
export { useSiteSettings } from './useSiteSettings';
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TypeSystem } from './module/ModuleHost';
|
|
3
3
|
import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, IChaynsReact, Page } from '../types/IChaynsReact';
|
|
4
4
|
type ChaynsHostType = {
|
|
5
|
-
type:
|
|
5
|
+
type: `${'client' | 'server'}-${'iframe' | 'module'}`;
|
|
6
6
|
iFrameProps?: {
|
|
7
7
|
[key: string]: unknown;
|
|
8
8
|
name: string;
|
|
@@ -25,6 +25,7 @@ type ChaynsHostType = {
|
|
|
25
25
|
environment: ChaynsReactValues["environment"];
|
|
26
26
|
preventStagingReplacement?: boolean;
|
|
27
27
|
dialog: ChaynsReactValues["dialog"];
|
|
28
|
+
siteSettings?: ChaynsReactValues["siteSettings"];
|
|
28
29
|
};
|
|
29
30
|
declare const ChaynsHost: FC<ChaynsHostType>;
|
|
30
31
|
export default ChaynsHost;
|
|
@@ -22,6 +22,7 @@ type HostIframeProps = {
|
|
|
22
22
|
customData: ChaynsReactValues["customData"];
|
|
23
23
|
preventStagingReplacement?: boolean;
|
|
24
24
|
dialog: ChaynsReactValues["dialog"];
|
|
25
|
+
siteSettings: ChaynsReactValues["siteSettings"];
|
|
25
26
|
};
|
|
26
27
|
declare const HostIframe: FC<HostIframeProps>;
|
|
27
28
|
export default HostIframe;
|
|
@@ -24,6 +24,7 @@ type ModulePropTypes = {
|
|
|
24
24
|
preventStagingReplacement?: boolean;
|
|
25
25
|
dialog: ChaynsReactValues["dialog"];
|
|
26
26
|
children?: ReactNode;
|
|
27
|
+
siteSettings: ChaynsReactValues["siteSettings"];
|
|
27
28
|
};
|
|
28
29
|
declare const ModuleHost: FC<ModulePropTypes>;
|
|
29
30
|
export default ModuleHost;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,6 +15,5 @@ export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
|
|
|
15
15
|
export { default as loadComponent, loadModule } from './host/module/utils/loadComponent';
|
|
16
16
|
export { default as DialogHandler } from './handler/DialogHandler';
|
|
17
17
|
export * as dialog from './calls/dialogs/index';
|
|
18
|
-
export * from './types/IChaynsReact';
|
|
19
18
|
export * from './util/initModuleFederationSharing';
|
|
20
19
|
export * from './util/bindChaynsApi';
|
|
@@ -185,6 +185,45 @@ export type ChaynsApiSite = {
|
|
|
185
185
|
urlHash: string;
|
|
186
186
|
originSiteId?: string;
|
|
187
187
|
};
|
|
188
|
+
export declare enum IconStyle {
|
|
189
|
+
SOLID = 0,
|
|
190
|
+
REGULAR = 1,
|
|
191
|
+
LIGHT = 2,
|
|
192
|
+
DUOTONE = 3,
|
|
193
|
+
SHARP = 4
|
|
194
|
+
}
|
|
195
|
+
export interface DesignSettings {
|
|
196
|
+
siteId?: string;
|
|
197
|
+
color: string;
|
|
198
|
+
secondaryColor?: string;
|
|
199
|
+
colorMode: ColorMode;
|
|
200
|
+
fontSize: number;
|
|
201
|
+
iconStyle: IconStyle;
|
|
202
|
+
headlineFontId?: number;
|
|
203
|
+
backgroundType?: number;
|
|
204
|
+
backgroundColor?: string;
|
|
205
|
+
headerBarColor?: string;
|
|
206
|
+
accordionIcon?: number;
|
|
207
|
+
accordionLines?: boolean;
|
|
208
|
+
cardBorderRadius?: number;
|
|
209
|
+
cardBackgroundOpacity?: number;
|
|
210
|
+
cardShadow?: number;
|
|
211
|
+
}
|
|
212
|
+
export interface ParagraphFormat {
|
|
213
|
+
selector: string;
|
|
214
|
+
fontSizePx?: number;
|
|
215
|
+
lineHeight?: number;
|
|
216
|
+
marginBeforePx?: number;
|
|
217
|
+
marginAfterPx?: number;
|
|
218
|
+
color?: string;
|
|
219
|
+
fontId?: number;
|
|
220
|
+
buttonDesignType?: number;
|
|
221
|
+
backgroundColor?: string;
|
|
222
|
+
}
|
|
223
|
+
export type ChaynsSiteSettings = {
|
|
224
|
+
designSettings: DesignSettings;
|
|
225
|
+
paragraphFormats: ParagraphFormat[];
|
|
226
|
+
};
|
|
188
227
|
export declare enum ScreenSize {
|
|
189
228
|
/** screen width smaller than or equal 556px */
|
|
190
229
|
XS = 0,
|
|
@@ -262,6 +301,7 @@ export interface ChaynsReactValues {
|
|
|
262
301
|
dialogInput: any;
|
|
263
302
|
isClosingRequested: boolean;
|
|
264
303
|
};
|
|
304
|
+
siteSettings?: ChaynsSiteSettings;
|
|
265
305
|
}
|
|
266
306
|
export interface DialogResultFile {
|
|
267
307
|
blockDownload?: boolean;
|
|
@@ -358,6 +398,9 @@ export interface ChaynsReactFunctions {
|
|
|
358
398
|
removeDialogHostEventListener: (id: number) => Promise<void>;
|
|
359
399
|
addAnonymousAccount: () => Promise<AnonymousAccountResult>;
|
|
360
400
|
}
|
|
401
|
+
export type ChaynsReactCustomFunctions = {
|
|
402
|
+
[key: string]: <A extends Array<any>, O>(...args: A) => Promise<O>;
|
|
403
|
+
};
|
|
361
404
|
export type DialogResult = {
|
|
362
405
|
open: () => Promise<any>;
|
|
363
406
|
close: (buttonType: DialogButtonType, data: any) => Promise<void>;
|
|
@@ -553,9 +596,7 @@ interface DesignSettingsUpdateItem {
|
|
|
553
596
|
export interface IChaynsReact {
|
|
554
597
|
values: ChaynsReactValues;
|
|
555
598
|
functions: ChaynsReactFunctions;
|
|
556
|
-
customFunctions:
|
|
557
|
-
[key: string]: <A extends Array<any>, O>(...args: A) => Promise<O>;
|
|
558
|
-
};
|
|
599
|
+
customFunctions: ChaynsReactCustomFunctions;
|
|
559
600
|
addDataListener: (cb: DataChangeCallback) => CleanupCallback;
|
|
560
601
|
getSSRData: () => ChaynsReactValues | null;
|
|
561
602
|
init: () => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './util/transferNestedFunctions';
|
|
2
|
+
export { default as getDeviceInfo, getScreenSize, getClientDeviceInfo } from './util/deviceHelper';
|
|
3
|
+
export * from './calls';
|
|
4
|
+
export * from './types/IChaynsReact';
|
|
5
|
+
export * from './util/is';
|
|
6
|
+
export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
|
|
7
|
+
export { default as DialogHandler } from './handler/DialogHandler';
|
|
8
|
+
export * as dialog from './calls/dialogs/index';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ChaynsReactFunctions, ChaynsReactValues, CleanupCallback, DataChangeCallback, IChaynsReact } from '../types/IChaynsReact';
|
|
1
|
+
import { ChaynsReactFunctions, ChaynsReactValues, ChaynsSiteSettings, CleanupCallback, DataChangeCallback, IChaynsReact } from '../types/IChaynsReact';
|
|
2
2
|
export declare class AppWrapper implements IChaynsReact {
|
|
3
3
|
values: ChaynsReactValues;
|
|
4
4
|
accessToken: string;
|
|
5
5
|
listeners: (() => void)[];
|
|
6
6
|
customFunctions: {};
|
|
7
|
+
loadSiteSettings(siteId: string): Promise<ChaynsSiteSettings | undefined>;
|
|
7
8
|
mapOldApiToNew(retVal: any): ChaynsReactValues;
|
|
8
9
|
constructor();
|
|
9
10
|
notImplemented(call: string): void;
|
|
@@ -3,7 +3,6 @@ declare class StaticChaynsApi {
|
|
|
3
3
|
ready: Promise<void>;
|
|
4
4
|
addDataListener: (cb: DataChangeCallback) => () => void;
|
|
5
5
|
private _wrapper;
|
|
6
|
-
private customFunctions;
|
|
7
6
|
constructor(values: any, functions: any);
|
|
8
7
|
getUser: () => any;
|
|
9
8
|
getSite: () => any;
|
|
@@ -13,6 +12,7 @@ declare class StaticChaynsApi {
|
|
|
13
12
|
getParameters: () => any;
|
|
14
13
|
getPages: () => any;
|
|
15
14
|
getEnvironment: () => any;
|
|
15
|
+
getSiteSettings: () => any;
|
|
16
16
|
getCustomFunction: (key: string) => any;
|
|
17
17
|
}
|
|
18
18
|
export default StaticChaynsApi;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chayns-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-beta.0",
|
|
4
4
|
"description": "new chayns api",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@babel/preset-react": "^7.26.3",
|
|
58
58
|
"@babel/preset-typescript": "^7.26.0",
|
|
59
59
|
"@chayns-toolkit/eslint-config": "^2.0.0",
|
|
60
|
+
"@rsbuild/plugin-umd": "^1.0.4",
|
|
60
61
|
"@types/htmlescape": "^1.1.3",
|
|
61
62
|
"@types/lodash.throttle": "^4.1.9",
|
|
62
63
|
"@types/prop-types": "^15.7.12",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"@types/ua-parser-js": "^0.7.39",
|
|
66
67
|
"@types/use-sync-external-store": "^0.0.6",
|
|
67
68
|
"@typescript-eslint/parser": "^7.6.0",
|
|
68
|
-
"chayns-toolkit": "^
|
|
69
|
+
"chayns-toolkit": "^3.1.3",
|
|
69
70
|
"concurrently": "^9.1.2",
|
|
70
71
|
"cross-env": "^7.0.3",
|
|
71
72
|
"prettier": "^3.4.2",
|
package/toolkit.config.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { buildToolkitConfig } = require('chayns-toolkit');
|
|
2
|
+
const { pluginUmd } = require('@rsbuild/plugin-umd');
|
|
2
3
|
|
|
3
|
-
module.exports = {
|
|
4
|
+
module.exports = buildToolkitConfig({
|
|
4
5
|
development: {
|
|
5
|
-
host:
|
|
6
|
+
host: '0.0.0.0',
|
|
6
7
|
port: 8081,
|
|
7
8
|
},
|
|
8
9
|
output: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
filename: {
|
|
11
|
+
js: '[name].js',
|
|
12
|
+
},
|
|
13
|
+
entryPoints: {
|
|
14
|
+
['chayns-api']: {
|
|
15
|
+
pathIndex: './src/umd.index.js',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
path: 'dist',
|
|
12
19
|
},
|
|
13
20
|
webpack(config) {
|
|
14
|
-
config.
|
|
21
|
+
config.plugins.push(pluginUmd({
|
|
15
22
|
name: 'ChaynsApi',
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
}));
|
|
24
|
+
config.output.sourceMap = false;
|
|
18
25
|
return config;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ChaynsHost = _interopRequireDefault(require("../host/ChaynsHost"));
|
|
9
|
-
var _hooks = require("../hooks");
|
|
10
|
-
var _ErrorBoundary = _interopRequireDefault(require("./ErrorBoundary"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
-
const AppDialogWrapper = ({
|
|
16
|
-
dialogEventTarget
|
|
17
|
-
}) => {
|
|
18
|
-
const functions = (0, _hooks.useFunctions)();
|
|
19
|
-
const data = (0, _hooks.useValues)();
|
|
20
|
-
const [dialogData, setDialogData] = (0, _react.useState)({
|
|
21
|
-
dialogs: []
|
|
22
|
-
});
|
|
23
|
-
(0, _react.useEffect)(() => {
|
|
24
|
-
dialogEventTarget.addEventListener('change', e => {
|
|
25
|
-
setDialogData({
|
|
26
|
-
dialogs: e.detail
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}, []);
|
|
30
|
-
return _react.default.createElement(_ErrorBoundary.default, null, _react.default.createElement(_ChaynsHost.default, _extends({
|
|
31
|
-
type: "client-module",
|
|
32
|
-
system: {
|
|
33
|
-
module: './AppWrapper',
|
|
34
|
-
url: 'https://tapp.chayns-static.space/api/dialog-v2/v1/remoteEntry.js',
|
|
35
|
-
scope: 'dialog_v2'
|
|
36
|
-
}
|
|
37
|
-
}, data, {
|
|
38
|
-
functions: functions,
|
|
39
|
-
customData: dialogData
|
|
40
|
-
})));
|
|
41
|
-
};
|
|
42
|
-
var _default = exports.default = AppDialogWrapper;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import ChaynsHost from '../host/ChaynsHost';
|
|
4
|
-
import { useFunctions, useValues } from '../hooks';
|
|
5
|
-
import ErrorBoundary from "./ErrorBoundary";
|
|
6
|
-
const AppDialogWrapper = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
dialogEventTarget
|
|
9
|
-
} = _ref;
|
|
10
|
-
const functions = useFunctions();
|
|
11
|
-
const data = useValues();
|
|
12
|
-
const [dialogData, setDialogData] = useState({
|
|
13
|
-
dialogs: []
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
dialogEventTarget.addEventListener('change', e => {
|
|
17
|
-
setDialogData({
|
|
18
|
-
dialogs: e.detail
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}, []);
|
|
22
|
-
return React.createElement(ErrorBoundary, null, React.createElement(ChaynsHost, _extends({
|
|
23
|
-
type: "client-module",
|
|
24
|
-
system: {
|
|
25
|
-
module: './AppWrapper',
|
|
26
|
-
url: 'https://tapp.chayns-static.space/api/dialog-v2/v1/remoteEntry.js',
|
|
27
|
-
scope: 'dialog_v2'
|
|
28
|
-
}
|
|
29
|
-
}, data, {
|
|
30
|
-
functions: functions,
|
|
31
|
-
customData: dialogData
|
|
32
|
-
})));
|
|
33
|
-
};
|
|
34
|
-
export default AppDialogWrapper;
|