chayns-api 1.0.1 → 1.0.3
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/.babelrc +30 -30
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -0
- package/LICENSE +21 -21
- package/README.md +47 -47
- package/dist/cjs/calls/dialogs/alert.js +0 -2
- package/dist/cjs/calls/dialogs/chaynsDialog.js +2 -8
- package/dist/cjs/calls/dialogs/close.js +0 -2
- package/dist/cjs/calls/dialogs/communication.js +1 -16
- package/dist/cjs/calls/dialogs/confirm.js +0 -4
- package/dist/cjs/calls/dialogs/date.js +46 -63
- package/dist/cjs/calls/dialogs/dropUpAlert.js +0 -3
- package/dist/cjs/calls/dialogs/fileSelect.js +0 -10
- package/dist/cjs/calls/dialogs/iFrame.js +0 -8
- package/dist/cjs/calls/dialogs/index.js +0 -27
- package/dist/cjs/calls/dialogs/input.js +0 -6
- package/dist/cjs/calls/dialogs/mediaSelect.js +0 -7
- package/dist/cjs/calls/dialogs/open.js +0 -2
- package/dist/cjs/calls/dialogs/select.js +0 -9
- package/dist/cjs/calls/dialogs/signature.js +0 -5
- package/dist/cjs/calls/dialogs/toast.js +0 -3
- package/dist/cjs/calls/dialogs/utils/callback.js +0 -2
- package/dist/cjs/calls/dialogs/utils/is.js +0 -4
- package/dist/cjs/calls/getUserInfo.js +0 -11
- package/dist/cjs/calls/index.js +95 -247
- package/dist/cjs/calls/sendMessage.js +8 -34
- package/dist/cjs/calls/visibilityChangeListener.js +5 -16
- package/dist/cjs/components/ChaynsContext.js +2 -4
- package/dist/cjs/components/ChaynsProvider.js +6 -28
- package/dist/cjs/components/WaitUntil.js +0 -5
- package/dist/cjs/components/withCompatMode.js +1 -16
- package/dist/cjs/helper/apiListenerHelper.js +0 -9
- package/dist/cjs/hooks/geoLocationListener.js +6 -15
- package/dist/cjs/hooks/index.js +6 -16
- package/dist/cjs/hooks/scrollListener.js +12 -31
- package/dist/cjs/hooks/useAccessToken.js +2 -7
- package/dist/cjs/hooks/useCurrentPage.js +2 -6
- package/dist/cjs/hooks/useCustomData.js +2 -6
- package/dist/cjs/hooks/useDevice.js +2 -6
- package/dist/cjs/hooks/useEnvironment.js +2 -6
- package/dist/cjs/hooks/useFunctions.js +2 -6
- package/dist/cjs/hooks/useIsAdminMode.js +2 -7
- package/dist/cjs/hooks/useLanguage.js +2 -6
- package/dist/cjs/hooks/usePages.js +26 -18
- package/dist/cjs/hooks/useParameters.js +2 -6
- package/dist/cjs/hooks/useSite.js +2 -6
- package/dist/cjs/hooks/useUser.js +2 -7
- package/dist/cjs/hooks/useValues.js +2 -6
- package/dist/cjs/hooks/windowMetricsListener.js +6 -16
- package/dist/cjs/host/ChaynsHost.js +0 -10
- package/dist/cjs/host/iframe/HostIframe.js +23 -30
- package/dist/cjs/host/iframe/utils/useUpdateData.js +0 -3
- package/dist/cjs/host/module/ModuleHost.js +3 -13
- package/dist/cjs/host/module/utils/loadComponent.js +1 -18
- package/dist/cjs/host/module/utils/useDynamicScript.js +0 -18
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/types/IChaynsReact.js +27 -48
- package/dist/cjs/util/appCall.js +1 -4
- package/dist/cjs/util/deviceHelper.js +5 -22
- package/dist/cjs/util/heightHelper.js +0 -9
- package/dist/cjs/util/postIframeForm.js +0 -5
- package/dist/cjs/wrapper/AppWrapper.js +323 -159
- package/dist/cjs/wrapper/FrameWrapper.js +219 -248
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -27
- package/dist/cjs/wrapper/SsrWrapper.js +0 -8
- package/dist/esm/calls/dialogs/alert.js +4 -4
- package/dist/esm/calls/dialogs/chaynsDialog.js +7 -11
- package/dist/esm/calls/dialogs/communication.js +15 -26
- package/dist/esm/calls/dialogs/confirm.js +5 -8
- package/dist/esm/calls/dialogs/date.js +119 -128
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
- package/dist/esm/calls/dialogs/fileSelect.js +23 -62
- package/dist/esm/calls/dialogs/iFrame.js +7 -10
- package/dist/esm/calls/dialogs/input.js +2 -5
- package/dist/esm/calls/dialogs/mediaSelect.js +18 -55
- package/dist/esm/calls/dialogs/open.js +2 -2
- package/dist/esm/calls/dialogs/select.js +5 -9
- package/dist/esm/calls/dialogs/signature.js +0 -2
- package/dist/esm/calls/dialogs/toast.js +6 -11
- package/dist/esm/calls/dialogs/utils/callback.js +3 -5
- package/dist/esm/calls/dialogs/utils/is.js +1 -3
- package/dist/esm/calls/getUserInfo.js +32 -92
- package/dist/esm/calls/index.js +297 -449
- package/dist/esm/calls/sendMessage.js +99 -229
- package/dist/esm/calls/visibilityChangeListener.js +14 -19
- package/dist/esm/components/ChaynsContext.js +3 -3
- package/dist/esm/components/ChaynsProvider.js +45 -86
- package/dist/esm/components/WaitUntil.js +21 -86
- package/dist/esm/components/withCompatMode.js +35 -77
- package/dist/esm/helper/apiListenerHelper.js +10 -15
- package/dist/esm/hooks/geoLocationListener.js +24 -50
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/scrollListener.js +58 -94
- package/dist/esm/hooks/useAccessToken.js +8 -30
- package/dist/esm/hooks/useCurrentPage.js +4 -8
- package/dist/esm/hooks/useCustomData.js +4 -8
- package/dist/esm/hooks/useDevice.js +3 -8
- package/dist/esm/hooks/useEnvironment.js +3 -8
- package/dist/esm/hooks/useFunctions.js +4 -7
- package/dist/esm/hooks/useIsAdminMode.js +4 -8
- package/dist/esm/hooks/useLanguage.js +3 -8
- package/dist/esm/hooks/usePages.js +38 -31
- package/dist/esm/hooks/useParameters.js +3 -8
- package/dist/esm/hooks/useSite.js +3 -8
- package/dist/esm/hooks/useUser.js +3 -9
- package/dist/esm/hooks/useValues.js +4 -7
- package/dist/esm/hooks/windowMetricsListener.js +22 -48
- package/dist/esm/host/ChaynsHost.js +22 -29
- package/dist/esm/host/iframe/HostIframe.js +86 -142
- package/dist/esm/host/iframe/utils/useUpdateData.js +4 -6
- package/dist/esm/host/module/ModuleHost.js +42 -49
- package/dist/esm/host/module/utils/loadComponent.js +47 -85
- package/dist/esm/host/module/utils/useDynamicScript.js +27 -74
- package/dist/esm/types/IChaynsReact.js +37 -61
- package/dist/esm/util/appCall.js +2 -4
- package/dist/esm/util/deviceHelper.js +13 -37
- package/dist/esm/util/heightHelper.js +10 -13
- package/dist/esm/util/postIframeForm.js +25 -57
- package/dist/esm/wrapper/AppWrapper.js +385 -781
- package/dist/esm/wrapper/FrameWrapper.js +262 -1509
- package/dist/esm/wrapper/ModuleFederationWrapper.js +47 -284
- package/dist/esm/wrapper/SsrWrapper.js +19 -65
- package/dist/types/calls/dialogs/alert.d.ts +1 -1
- package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
- package/dist/types/calls/dialogs/close.d.ts +1 -1
- package/dist/types/calls/dialogs/communication.d.ts +3 -3
- package/dist/types/calls/dialogs/confirm.d.ts +13 -13
- package/dist/types/calls/dialogs/date.d.ts +96 -96
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
- package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
- package/dist/types/calls/dialogs/index.d.ts +14 -14
- package/dist/types/calls/dialogs/input.d.ts +15 -15
- package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
- package/dist/types/calls/dialogs/open.d.ts +1 -1
- package/dist/types/calls/dialogs/select.d.ts +6 -6
- package/dist/types/calls/dialogs/signature.d.ts +7 -7
- package/dist/types/calls/dialogs/toast.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
- package/dist/types/calls/getUserInfo.d.ts +9 -9
- package/dist/types/calls/index.d.ts +225 -231
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsProvider.d.ts +13 -13
- package/dist/types/components/WaitUntil.d.ts +7 -7
- package/dist/types/components/withCompatMode.d.ts +13 -13
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +16 -16
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +5 -5
- package/dist/types/hooks/useCurrentPage.d.ts +4 -4
- package/dist/types/hooks/useCustomData.d.ts +4 -4
- package/dist/types/hooks/useDevice.d.ts +5 -5
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +5 -5
- package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
- package/dist/types/hooks/useLanguage.d.ts +5 -5
- package/dist/types/hooks/usePages.d.ts +18 -14
- package/dist/types/hooks/useParameters.d.ts +5 -5
- package/dist/types/hooks/useSite.d.ts +5 -5
- package/dist/types/hooks/useUser.d.ts +5 -5
- package/dist/types/hooks/useValues.d.ts +5 -5
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +28 -28
- package/dist/types/host/iframe/HostIframe.d.ts +24 -24
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +23 -23
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
- package/dist/types/index.d.ts +16 -16
- package/dist/types/types/IChaynsReact.d.ts +622 -590
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/deviceHelper.d.ts +7 -7
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +18 -16
- package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
- package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
- package/package.json +76 -76
- package/toolkit.config.js +52 -52
- package/tsconfig.json +56 -56
- package/dist/cjs/bootstrap.js +0 -11
- package/dist/cjs/calls/abstractApiListener.js +0 -40
- package/dist/cjs/calls/apiEventListener.js +0 -40
- package/dist/cjs/calls/setVisibilityChangeListener.js +0 -1
- package/dist/cjs/calls/windowMetricsListener.js +0 -18
- package/dist/cjs/client.js +0 -93
- package/dist/cjs/components/App.js +0 -32
- package/dist/cjs/components/App.spec.js +0 -16
- package/dist/cjs/components/Button.js +0 -32
- package/dist/cjs/components/ChaynsModuleProvider.js +0 -457
- package/dist/cjs/components/ChaynsProviderExposed.js +0 -16
- package/dist/cjs/components/TestProvider.js +0 -236
- package/dist/cjs/components/Title.js +0 -162
- package/dist/cjs/functions/addApiListener.js +0 -37
- package/dist/cjs/functions/addGeoLocationListener.js +0 -26
- package/dist/cjs/functions/addScrollListener.js +0 -26
- package/dist/cjs/functions/addWindowMetricsListener.js +0 -37
- package/dist/cjs/helper/cssLoader.js +0 -28
- package/dist/cjs/hooks/addGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/addScrollListener.js +0 -26
- package/dist/cjs/hooks/addWindowMetricsListener.js +0 -37
- package/dist/cjs/hooks/geoLocation.js +0 -48
- package/dist/cjs/hooks/useAddGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/useAddScrollListener.js +0 -48
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +0 -45
- package/dist/cjs/hooks/useAdddScrollListener.js +0 -26
- package/dist/cjs/hooks/windowMetrics.js +0 -45
- package/dist/cjs/host/HostIframe.js +0 -157
- package/dist/cjs/host/ModuleHost.js +0 -11
- package/dist/cjs/host/module/utils.js +0 -25
- package/dist/cjs/index.example.js +0 -7
- package/dist/cjs/index2.js +0 -64
- package/dist/cjs/types/DynamicApiImport.d.js +0 -5
- package/dist/cjs/types/DynamicImport.d.js +0 -5
- package/dist/cjs/types/chayns-components.d.js +0 -1
- package/dist/cjs/types/chayns-logger.d.js +0 -1
- package/dist/cjs/types/chayns.d.js +0 -1
- package/dist/cjs/types/tobit-websocket-service-client.d.js +0 -1
- package/dist/cjs/types/toolkit-types.d.js +0 -1
- package/dist/cjs/util/useFunctionsContext.js +0 -16
- package/dist/cjs/util/useIsAdminMode.js +0 -18
- package/dist/cjs/util/useUser.js +0 -16
- package/dist/esm/bootstrap.js +0 -4
- package/dist/esm/client.js +0 -8
- package/dist/esm/components/App.js +0 -35
- package/dist/esm/components/App.spec.js +0 -9
- package/dist/esm/components/Button.js +0 -34
- package/dist/esm/components/ChaynsModuleProvider.js +0 -517
- package/dist/esm/components/ChaynsProviderExposed.js +0 -3
- package/dist/esm/components/TestProvider.js +0 -308
- package/dist/esm/components/Title.js +0 -210
- package/dist/esm/helper/cssLoader.js +0 -21
- package/dist/esm/hooks/useAddGeoLocationListener.js +0 -18
- package/dist/esm/hooks/useAddScrollListener.js +0 -18
- package/dist/esm/hooks/useAddWindowMetricsListener.js +0 -18
- package/dist/esm/host/HostIframe.js +0 -153
- package/dist/esm/index.example.js +0 -1
- package/dist/esm/index2.js +0 -5
- package/dist/esm/types/DynamicApiImport.d.js +0 -1
- package/dist/esm/types/DynamicImport.d.js +0 -1
- package/dist/esm/types/chayns-components.d.js +0 -0
- package/dist/esm/types/chayns-logger.d.js +0 -0
- package/dist/esm/types/chayns.d.js +0 -0
- package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
- package/dist/esm/types/toolkit-types.d.js +0 -0
- package/dist/esm/util/useIsAdminMode.js +0 -9
- package/dist/esm/util/useUser.js +0 -7
- package/dist/types/bootstrap.d.ts +0 -1
- package/dist/types/client.d.ts +0 -7
- package/dist/types/components/App.d.ts +0 -5
- package/dist/types/components/Button.d.ts +0 -8
- package/dist/types/components/ChaynsModuleProvider.d.ts +0 -170
- package/dist/types/components/ChaynsProviderExposed.d.ts +0 -13
- package/dist/types/components/Title.d.ts +0 -3
- package/dist/types/host/HostIframe.d.ts +0 -20
- package/dist/types/index.example.d.ts +0 -0
|
@@ -4,268 +4,247 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FrameWrapper = void 0;
|
|
7
|
-
|
|
8
7
|
var comlink = _interopRequireWildcard(require("comlink"));
|
|
9
|
-
|
|
10
8
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
11
|
-
|
|
12
9
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
13
|
-
|
|
14
10
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
15
|
-
|
|
16
11
|
var _sendMessage = require("../calls/sendMessage");
|
|
17
|
-
|
|
18
12
|
var _heightHelper = require("../util/heightHelper");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
27
17
|
|
|
28
18
|
class FrameWrapper {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
id,
|
|
56
|
-
shouldInitialize
|
|
57
|
-
} = (0, _apiListenerHelper.addApiListener)('windowMetricsListener', callback);
|
|
58
|
-
|
|
59
|
-
if (shouldInitialize) {
|
|
60
|
-
void this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
61
|
-
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', result);
|
|
62
|
-
}));
|
|
63
|
-
window.addEventListener('resize', this.resizeListener = () => {
|
|
64
|
-
void (async () => {
|
|
65
|
-
const metrics = await this.exposedFunctions.getWindowMetrics();
|
|
66
|
-
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', metrics);
|
|
67
|
-
})();
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return id;
|
|
72
|
-
},
|
|
73
|
-
customCallbackFunction: async (type, data) => {
|
|
74
|
-
if (!this.initialized) await this.ready;
|
|
75
|
-
return this.exposedFunctions.customCallbackFunction(type, data);
|
|
76
|
-
},
|
|
77
|
-
getAvailableSharingServices: async () => {
|
|
78
|
-
if (!this.initialized) await this.ready;
|
|
79
|
-
return this.exposedFunctions.getAvailableSharingServices();
|
|
80
|
-
},
|
|
81
|
-
getAccessToken: async accessToken => {
|
|
82
|
-
if (!this.initialized) await this.ready;
|
|
83
|
-
return this.exposedFunctions.getAccessToken(accessToken);
|
|
84
|
-
},
|
|
85
|
-
getGeoLocation: async value => {
|
|
86
|
-
if (!this.initialized) await this.ready;
|
|
87
|
-
return this.exposedFunctions.getGeoLocation(value);
|
|
88
|
-
},
|
|
89
|
-
getUserInfo: async query => {
|
|
90
|
-
if (!this.initialized) await this.ready;
|
|
91
|
-
return (0, _getUserInfo.default)(this, query);
|
|
92
|
-
},
|
|
93
|
-
getScrollPosition: async () => {
|
|
94
|
-
if (!this.initialized) await this.ready;
|
|
95
|
-
return this.exposedFunctions.getScrollPosition();
|
|
96
|
-
},
|
|
97
|
-
getWindowMetrics: async () => {
|
|
98
|
-
if (!this.initialized) await this.ready;
|
|
99
|
-
return this.exposedFunctions.getWindowMetrics();
|
|
100
|
-
},
|
|
101
|
-
invokeCall: async (value, callback) => {
|
|
102
|
-
if (!this.initialized) await this.ready;
|
|
103
|
-
return this.exposedFunctions.invokeCall(value, callback && comlink.proxy(result => callback(result)));
|
|
104
|
-
},
|
|
105
|
-
invokeDialogCall: async (value, callback) => {
|
|
106
|
-
if (!this.initialized) await this.ready;
|
|
107
|
-
return this.exposedFunctions.invokeDialogCall(value, callback && comlink.proxy(result => callback(result)));
|
|
108
|
-
},
|
|
109
|
-
login: async (value, callback, closeCallback) => {
|
|
110
|
-
if (!this.initialized) await this.ready;
|
|
111
|
-
return this.exposedFunctions.login(value, callback && comlink.proxy(result => callback(result)), closeCallback && comlink.proxy(() => closeCallback()));
|
|
112
|
-
},
|
|
113
|
-
logout: async () => {
|
|
114
|
-
if (!this.initialized) await this.ready;
|
|
115
|
-
return this.exposedFunctions.logout();
|
|
116
|
-
},
|
|
117
|
-
navigateBack: async () => {
|
|
118
|
-
if (!this.initialized) await this.ready;
|
|
119
|
-
return this.exposedFunctions.navigateBack();
|
|
120
|
-
},
|
|
121
|
-
openImage: async value => {
|
|
122
|
-
if (!this.initialized) await this.ready;
|
|
123
|
-
return this.exposedFunctions.openImage(value);
|
|
124
|
-
},
|
|
125
|
-
openUrl: async value => {
|
|
126
|
-
if (!this.initialized) await this.ready;
|
|
127
|
-
return this.exposedFunctions.openUrl(value);
|
|
128
|
-
},
|
|
129
|
-
openVideo: async value => {
|
|
130
|
-
if (!this.initialized) await this.ready;
|
|
131
|
-
return this.exposedFunctions.openVideo(value);
|
|
132
|
-
},
|
|
133
|
-
refreshAccessToken: async () => {
|
|
134
|
-
if (!this.initialized) await this.ready;
|
|
135
|
-
return this.exposedFunctions.refreshAccessToken();
|
|
136
|
-
},
|
|
137
|
-
refreshData: async value => {
|
|
138
|
-
if (!this.initialized) await this.ready;
|
|
139
|
-
return this.exposedFunctions.refreshData(value);
|
|
140
|
-
},
|
|
141
|
-
removeGeoLocationListener: async id => {
|
|
142
|
-
if (!this.initialized) await this.ready;
|
|
143
|
-
return this.exposedFunctions.removeGeoLocationListener(id);
|
|
144
|
-
},
|
|
145
|
-
removeScrollListener: async id => {
|
|
146
|
-
if (!this.initialized) await this.ready;
|
|
147
|
-
return this.exposedFunctions.removeScrollListener(id);
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
removeVisibilityChangeListener(number) {
|
|
151
|
-
(0, _visibilityChangeListener.removeVisibilityChangeListener)(number);
|
|
152
|
-
return Promise.resolve();
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
removeWindowMetricsListener: async id => {
|
|
156
|
-
if (!this.initialized) await this.ready;
|
|
157
|
-
const shouldRemove = (0, _apiListenerHelper.removeApiListener)('windowMetricsListener', id);
|
|
158
|
-
|
|
159
|
-
if (shouldRemove) {
|
|
160
|
-
void this.exposedFunctions.removeWindowMetricsListener(id);
|
|
161
|
-
if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
|
|
162
|
-
this.resizeListener = null;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
selectPage: async options => {
|
|
166
|
-
if (!this.initialized) await this.ready;
|
|
167
|
-
await this.exposedFunctions.selectPage(options);
|
|
168
|
-
},
|
|
169
|
-
scrollToY: async (position, duration) => {
|
|
170
|
-
if (!this.initialized) await this.ready;
|
|
171
|
-
await this.exposedFunctions.scrollToY(position, duration);
|
|
172
|
-
},
|
|
173
|
-
sendMessageToGroup: async (groupId, message) => {
|
|
174
|
-
if (!this.initialized) await this.ready;
|
|
175
|
-
return (0, _sendMessage.sendMessageToGroup)(this, message, groupId);
|
|
176
|
-
},
|
|
177
|
-
sendMessageToPage: async message => {
|
|
178
|
-
if (!this.initialized) await this.ready;
|
|
179
|
-
return (0, _sendMessage.sendMessageToPage)(this, message);
|
|
180
|
-
},
|
|
181
|
-
sendMessageToUser: async (userId, message) => {
|
|
182
|
-
if (!this.initialized) await this.ready;
|
|
183
|
-
return (0, _sendMessage.sendMessageToUser)(this, message, userId);
|
|
184
|
-
},
|
|
185
|
-
setAdminMode: async enabled => {
|
|
186
|
-
if (!this.initialized) await this.ready;
|
|
187
|
-
return this.exposedFunctions.setAdminMode(enabled);
|
|
188
|
-
},
|
|
189
|
-
setDisplayTimeout: async value => {
|
|
190
|
-
if (!this.initialized) await this.ready;
|
|
191
|
-
return this.exposedFunctions.setDisplayTimeout(value);
|
|
192
|
-
},
|
|
193
|
-
setFloatingButton: async (value, callback) => {
|
|
194
|
-
var _value$items;
|
|
195
|
-
|
|
196
|
-
if (!this.initialized) await this.ready;
|
|
197
|
-
value.items = (_value$items = value.items) !== null && _value$items !== void 0 ? _value$items : [];
|
|
198
|
-
const itemClickFunctions = value.items.map(x => x.onClick);
|
|
199
|
-
value.items = value.items.map(x => ({ ...x,
|
|
200
|
-
onClick: undefined
|
|
19
|
+
resolve = null;
|
|
20
|
+
exposedFunctions = null;
|
|
21
|
+
resizeListener = null;
|
|
22
|
+
ready = new Promise(res => {
|
|
23
|
+
this.resolve = res;
|
|
24
|
+
});
|
|
25
|
+
values = null;
|
|
26
|
+
functions = {
|
|
27
|
+
addGeoLocationListener: async (value, callback) => {
|
|
28
|
+
if (!this.initialized) await this.ready;
|
|
29
|
+
return this.exposedFunctions.addGeoLocationListener(value, callback && comlink.proxy(result => callback(result)));
|
|
30
|
+
},
|
|
31
|
+
addScrollListener: async (value, callback) => {
|
|
32
|
+
if (!this.initialized) await this.ready;
|
|
33
|
+
return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
|
|
34
|
+
},
|
|
35
|
+
addVisibilityChangeListener: async callback => (0, _visibilityChangeListener.addVisibilityChangeListener)(callback),
|
|
36
|
+
addWindowMetricsListener: async callback => {
|
|
37
|
+
if (!this.initialized) await this.ready;
|
|
38
|
+
const {
|
|
39
|
+
id,
|
|
40
|
+
shouldInitialize
|
|
41
|
+
} = (0, _apiListenerHelper.addApiListener)('windowMetricsListener', callback);
|
|
42
|
+
if (shouldInitialize) {
|
|
43
|
+
void this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
44
|
+
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', result);
|
|
201
45
|
}));
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
}); // @ts-ignore
|
|
209
|
-
|
|
210
|
-
return this.exposedFunctions.setFloatingButton(value, cb);
|
|
211
|
-
},
|
|
212
|
-
setHeight: async value => {
|
|
213
|
-
if (!this.initialized) await this.ready;
|
|
214
|
-
return this.exposedFunctions.setHeight(value);
|
|
215
|
-
},
|
|
216
|
-
setOverlay: async (value, callback) => {
|
|
217
|
-
if (!this.initialized) await this.ready;
|
|
218
|
-
return this.exposedFunctions.setOverlay(value, callback && comlink.proxy(() => callback()));
|
|
219
|
-
},
|
|
220
|
-
setRefreshScrollEnabled: async enabled => {
|
|
221
|
-
if (!this.initialized) await this.ready;
|
|
222
|
-
return this.exposedFunctions.setRefreshScrollEnabled(enabled);
|
|
223
|
-
},
|
|
224
|
-
setScanQrCode: async value => {
|
|
225
|
-
if (!this.initialized) await this.ready;
|
|
226
|
-
return this.exposedFunctions.setScanQrCode(value !== null && value !== void 0 ? value : {
|
|
227
|
-
cancel: false
|
|
46
|
+
window.addEventListener('resize', this.resizeListener = () => {
|
|
47
|
+
void (async () => {
|
|
48
|
+
const metrics = await this.exposedFunctions.getWindowMetrics();
|
|
49
|
+
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', metrics);
|
|
50
|
+
})();
|
|
228
51
|
});
|
|
229
|
-
},
|
|
230
|
-
setTempDesignSettings: async value => {
|
|
231
|
-
if (!this.initialized) await this.ready;
|
|
232
|
-
return this.exposedFunctions.setTempDesignSettings(value);
|
|
233
|
-
},
|
|
234
|
-
setWaitCursor: async value => {
|
|
235
|
-
if (!this.initialized) await this.ready;
|
|
236
|
-
return this.exposedFunctions.setWaitCursor(value);
|
|
237
|
-
},
|
|
238
|
-
storageGetItem: async (key, accessMode) => {
|
|
239
|
-
if (!this.initialized) await this.ready;
|
|
240
|
-
return this.exposedFunctions.storageGetItem(key, accessMode);
|
|
241
|
-
},
|
|
242
|
-
storageRemoveItem: async (key, accessMode) => {
|
|
243
|
-
if (!this.initialized) await this.ready;
|
|
244
|
-
return this.exposedFunctions.storageRemoveItem(key, accessMode);
|
|
245
|
-
},
|
|
246
|
-
storageSetItem: async (key, value, accessMode, tappIds) => {
|
|
247
|
-
if (!this.initialized) await this.ready;
|
|
248
|
-
return this.exposedFunctions.storageSetItem(key, value, accessMode, tappIds);
|
|
249
|
-
},
|
|
250
|
-
vibrate: async value => {
|
|
251
|
-
if (!this.initialized) await this.ready;
|
|
252
|
-
return this.exposedFunctions.vibrate(value);
|
|
253
52
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
53
|
+
return id;
|
|
54
|
+
},
|
|
55
|
+
customCallbackFunction: async (type, data) => {
|
|
56
|
+
if (!this.initialized) await this.ready;
|
|
57
|
+
return this.exposedFunctions.customCallbackFunction(type, data);
|
|
58
|
+
},
|
|
59
|
+
getAvailableSharingServices: async () => {
|
|
60
|
+
if (!this.initialized) await this.ready;
|
|
61
|
+
return this.exposedFunctions.getAvailableSharingServices();
|
|
62
|
+
},
|
|
63
|
+
getAccessToken: async accessToken => {
|
|
64
|
+
if (!this.initialized) await this.ready;
|
|
65
|
+
return this.exposedFunctions.getAccessToken(accessToken);
|
|
66
|
+
},
|
|
67
|
+
getGeoLocation: async value => {
|
|
68
|
+
if (!this.initialized) await this.ready;
|
|
69
|
+
return this.exposedFunctions.getGeoLocation(value);
|
|
70
|
+
},
|
|
71
|
+
getUserInfo: async query => {
|
|
72
|
+
if (!this.initialized) await this.ready;
|
|
73
|
+
return (0, _getUserInfo.default)(this, query);
|
|
74
|
+
},
|
|
75
|
+
getScrollPosition: async () => {
|
|
76
|
+
if (!this.initialized) await this.ready;
|
|
77
|
+
return this.exposedFunctions.getScrollPosition();
|
|
78
|
+
},
|
|
79
|
+
getWindowMetrics: async () => {
|
|
80
|
+
if (!this.initialized) await this.ready;
|
|
81
|
+
return this.exposedFunctions.getWindowMetrics();
|
|
82
|
+
},
|
|
83
|
+
invokeCall: async (value, callback) => {
|
|
84
|
+
if (!this.initialized) await this.ready;
|
|
85
|
+
return this.exposedFunctions.invokeCall(value, callback && comlink.proxy(result => callback(result)));
|
|
86
|
+
},
|
|
87
|
+
invokeDialogCall: async (value, callback) => {
|
|
88
|
+
if (!this.initialized) await this.ready;
|
|
89
|
+
return this.exposedFunctions.invokeDialogCall(value, callback && comlink.proxy(result => callback(result)));
|
|
90
|
+
},
|
|
91
|
+
login: async (value, callback, closeCallback) => {
|
|
92
|
+
if (!this.initialized) await this.ready;
|
|
93
|
+
return this.exposedFunctions.login(value, callback && comlink.proxy(result => callback(result)), closeCallback && comlink.proxy(() => closeCallback()));
|
|
94
|
+
},
|
|
95
|
+
logout: async () => {
|
|
96
|
+
if (!this.initialized) await this.ready;
|
|
97
|
+
return this.exposedFunctions.logout();
|
|
98
|
+
},
|
|
99
|
+
navigateBack: async () => {
|
|
100
|
+
if (!this.initialized) await this.ready;
|
|
101
|
+
return this.exposedFunctions.navigateBack();
|
|
102
|
+
},
|
|
103
|
+
openImage: async value => {
|
|
104
|
+
if (!this.initialized) await this.ready;
|
|
105
|
+
return this.exposedFunctions.openImage(value);
|
|
106
|
+
},
|
|
107
|
+
openUrl: async value => {
|
|
108
|
+
if (!this.initialized) await this.ready;
|
|
109
|
+
return this.exposedFunctions.openUrl(value);
|
|
110
|
+
},
|
|
111
|
+
openVideo: async value => {
|
|
112
|
+
if (!this.initialized) await this.ready;
|
|
113
|
+
return this.exposedFunctions.openVideo(value);
|
|
114
|
+
},
|
|
115
|
+
refreshAccessToken: async () => {
|
|
116
|
+
if (!this.initialized) await this.ready;
|
|
117
|
+
return this.exposedFunctions.refreshAccessToken();
|
|
118
|
+
},
|
|
119
|
+
refreshData: async value => {
|
|
120
|
+
if (!this.initialized) await this.ready;
|
|
121
|
+
return this.exposedFunctions.refreshData(value);
|
|
122
|
+
},
|
|
123
|
+
removeGeoLocationListener: async id => {
|
|
124
|
+
if (!this.initialized) await this.ready;
|
|
125
|
+
return this.exposedFunctions.removeGeoLocationListener(id);
|
|
126
|
+
},
|
|
127
|
+
removeScrollListener: async id => {
|
|
128
|
+
if (!this.initialized) await this.ready;
|
|
129
|
+
return this.exposedFunctions.removeScrollListener(id);
|
|
130
|
+
},
|
|
131
|
+
removeVisibilityChangeListener(number) {
|
|
132
|
+
(0, _visibilityChangeListener.removeVisibilityChangeListener)(number);
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
},
|
|
135
|
+
removeWindowMetricsListener: async id => {
|
|
136
|
+
if (!this.initialized) await this.ready;
|
|
137
|
+
const shouldRemove = (0, _apiListenerHelper.removeApiListener)('windowMetricsListener', id);
|
|
138
|
+
if (shouldRemove) {
|
|
139
|
+
void this.exposedFunctions.removeWindowMetricsListener(id);
|
|
140
|
+
if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
|
|
141
|
+
this.resizeListener = null;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
selectPage: async options => {
|
|
145
|
+
if (!this.initialized) await this.ready;
|
|
146
|
+
await this.exposedFunctions.selectPage(options);
|
|
147
|
+
},
|
|
148
|
+
scrollToY: async (position, duration) => {
|
|
149
|
+
if (!this.initialized) await this.ready;
|
|
150
|
+
await this.exposedFunctions.scrollToY(position, duration);
|
|
151
|
+
},
|
|
152
|
+
sendMessageToGroup: async (groupId, message) => {
|
|
153
|
+
if (!this.initialized) await this.ready;
|
|
154
|
+
return (0, _sendMessage.sendMessageToGroup)(this, message, groupId);
|
|
155
|
+
},
|
|
156
|
+
sendMessageToPage: async message => {
|
|
157
|
+
if (!this.initialized) await this.ready;
|
|
158
|
+
return (0, _sendMessage.sendMessageToPage)(this, message);
|
|
159
|
+
},
|
|
160
|
+
sendMessageToUser: async (userId, message) => {
|
|
161
|
+
if (!this.initialized) await this.ready;
|
|
162
|
+
return (0, _sendMessage.sendMessageToUser)(this, message, userId);
|
|
163
|
+
},
|
|
164
|
+
setAdminMode: async enabled => {
|
|
165
|
+
if (!this.initialized) await this.ready;
|
|
166
|
+
return this.exposedFunctions.setAdminMode(enabled);
|
|
167
|
+
},
|
|
168
|
+
setDisplayTimeout: async value => {
|
|
169
|
+
if (!this.initialized) await this.ready;
|
|
170
|
+
return this.exposedFunctions.setDisplayTimeout(value);
|
|
171
|
+
},
|
|
172
|
+
setFloatingButton: async (value, callback) => {
|
|
173
|
+
var _value$items;
|
|
174
|
+
if (!this.initialized) await this.ready;
|
|
175
|
+
value.items = (_value$items = value.items) !== null && _value$items !== void 0 ? _value$items : [];
|
|
176
|
+
const itemClickFunctions = value.items.map(x => x.onClick);
|
|
177
|
+
value.items = value.items.map(x => ({
|
|
178
|
+
...x,
|
|
179
|
+
onClick: undefined
|
|
180
|
+
}));
|
|
181
|
+
const cb = callback && comlink.proxy(data => {
|
|
182
|
+
if (data !== null && data !== void 0 && data.item && itemClickFunctions[data.index]) {
|
|
183
|
+
itemClickFunctions[data.index]();
|
|
184
|
+
} else {
|
|
185
|
+
callback();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
// @ts-ignore
|
|
189
|
+
return this.exposedFunctions.setFloatingButton(value, cb);
|
|
190
|
+
},
|
|
191
|
+
setHeight: async value => {
|
|
192
|
+
if (!this.initialized) await this.ready;
|
|
193
|
+
return this.exposedFunctions.setHeight(value);
|
|
194
|
+
},
|
|
195
|
+
setOverlay: async (value, callback) => {
|
|
196
|
+
if (!this.initialized) await this.ready;
|
|
197
|
+
return this.exposedFunctions.setOverlay(value, callback && comlink.proxy(() => callback()));
|
|
198
|
+
},
|
|
199
|
+
setRefreshScrollEnabled: async enabled => {
|
|
200
|
+
if (!this.initialized) await this.ready;
|
|
201
|
+
return this.exposedFunctions.setRefreshScrollEnabled(enabled);
|
|
202
|
+
},
|
|
203
|
+
setScanQrCode: async value => {
|
|
204
|
+
if (!this.initialized) await this.ready;
|
|
205
|
+
return this.exposedFunctions.setScanQrCode(value !== null && value !== void 0 ? value : {
|
|
206
|
+
cancel: false
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
setTempDesignSettings: async value => {
|
|
210
|
+
if (!this.initialized) await this.ready;
|
|
211
|
+
return this.exposedFunctions.setTempDesignSettings(value);
|
|
212
|
+
},
|
|
213
|
+
setWaitCursor: async value => {
|
|
214
|
+
if (!this.initialized) await this.ready;
|
|
215
|
+
return this.exposedFunctions.setWaitCursor(value);
|
|
216
|
+
},
|
|
217
|
+
storageGetItem: async (key, accessMode) => {
|
|
218
|
+
if (!this.initialized) await this.ready;
|
|
219
|
+
return this.exposedFunctions.storageGetItem(key, accessMode);
|
|
220
|
+
},
|
|
221
|
+
storageRemoveItem: async (key, accessMode) => {
|
|
222
|
+
if (!this.initialized) await this.ready;
|
|
223
|
+
return this.exposedFunctions.storageRemoveItem(key, accessMode);
|
|
224
|
+
},
|
|
225
|
+
storageSetItem: async (key, value, accessMode, tappIds) => {
|
|
226
|
+
if (!this.initialized) await this.ready;
|
|
227
|
+
return this.exposedFunctions.storageSetItem(key, value, accessMode, tappIds);
|
|
228
|
+
},
|
|
229
|
+
vibrate: async value => {
|
|
230
|
+
if (!this.initialized) await this.ready;
|
|
231
|
+
return this.exposedFunctions.vibrate(value);
|
|
232
|
+
},
|
|
233
|
+
scrollByY: async (value, duration) => {
|
|
234
|
+
if (!this.initialized) await this.ready;
|
|
235
|
+
return this.exposedFunctions.scrollByY(value, duration);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
initialized = false;
|
|
239
|
+
constructor() {
|
|
258
240
|
const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
|
|
259
|
-
|
|
260
241
|
if (initialDataTag) {
|
|
261
242
|
this.values = JSON.parse(initialDataTag.innerHTML);
|
|
262
243
|
}
|
|
263
244
|
}
|
|
264
|
-
|
|
265
245
|
async init() {
|
|
266
246
|
if (this.initialized) return;
|
|
267
247
|
const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
|
|
268
|
-
|
|
269
248
|
const dataListener = () => exposed.addDataListener(comlink.proxy(({
|
|
270
249
|
type,
|
|
271
250
|
value
|
|
@@ -273,7 +252,6 @@ class FrameWrapper {
|
|
|
273
252
|
if (this.initialized) {
|
|
274
253
|
this.values[type] = value;
|
|
275
254
|
}
|
|
276
|
-
|
|
277
255
|
this.values[type] = value;
|
|
278
256
|
document.dispatchEvent(new CustomEvent('chayns_api_data', {
|
|
279
257
|
detail: {
|
|
@@ -282,7 +260,6 @@ class FrameWrapper {
|
|
|
282
260
|
}
|
|
283
261
|
}));
|
|
284
262
|
}));
|
|
285
|
-
|
|
286
263
|
let hostReadyCallback = null;
|
|
287
264
|
await Promise.race([dataListener(), new Promise(resolve => {
|
|
288
265
|
window.addEventListener('message', hostReadyCallback = ev => {
|
|
@@ -298,24 +275,18 @@ class FrameWrapper {
|
|
|
298
275
|
this.resolve(null);
|
|
299
276
|
(0, _heightHelper.setTappHeight)(this.functions.setHeight);
|
|
300
277
|
}
|
|
301
|
-
|
|
302
278
|
addDataListener(cb) {
|
|
303
279
|
const listener = ev => ev.detail && cb(ev.detail);
|
|
304
|
-
|
|
305
280
|
document.addEventListener('chayns_api_data', listener);
|
|
306
281
|
return () => {
|
|
307
282
|
document.removeEventListener('chayns_api_data', listener);
|
|
308
283
|
};
|
|
309
284
|
}
|
|
310
|
-
|
|
311
285
|
getSSRData() {
|
|
312
286
|
return null;
|
|
313
287
|
}
|
|
314
|
-
|
|
315
288
|
getInitialData() {
|
|
316
289
|
return this.values;
|
|
317
290
|
}
|
|
318
|
-
|
|
319
291
|
}
|
|
320
|
-
|
|
321
292
|
exports.FrameWrapper = FrameWrapper;
|
|
@@ -4,83 +4,58 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ModuleFederationWrapper = void 0;
|
|
7
|
-
|
|
8
7
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
9
|
-
|
|
10
8
|
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
11
|
-
|
|
12
9
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
13
|
-
|
|
14
10
|
var _sendMessage = require("../calls/sendMessage");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
class ModuleFederationWrapper {
|
|
19
13
|
constructor(values, functions) {
|
|
20
14
|
this.values = values;
|
|
21
15
|
this.functions = {};
|
|
22
|
-
|
|
23
16
|
this.functions.addVisibilityChangeListener = async callback => (0, _visibilityChangeListener.addVisibilityChangeListener)(callback);
|
|
24
|
-
|
|
25
17
|
this.functions.removeVisibilityChangeListener = async id => (0, _visibilityChangeListener.removeVisibilityChangeListener)(id);
|
|
26
|
-
|
|
27
18
|
this.functions.getUserInfo = async query => (0, _getUserInfo.default)(this, query);
|
|
28
|
-
|
|
29
19
|
this.functions.sendMessageToGroup = async (groupId, object) => (0, _sendMessage.sendMessageToGroup)(this, object, groupId);
|
|
30
|
-
|
|
31
20
|
this.functions.sendMessageToPage = async object => (0, _sendMessage.sendMessageToPage)(this, object);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
this.functions.sendMessageToUser = async (userId, object) => (0, _sendMessage.sendMessageToUser)(this, object, userId);
|
|
22
|
+
// make all functions async to be consistent with frame wrapper
|
|
36
23
|
Object.entries(functions).forEach(([k, fn]) => {
|
|
37
24
|
// eslint-disable-next-line
|
|
38
25
|
this.functions[k] = async (...args) => fn(...args);
|
|
39
26
|
});
|
|
40
|
-
|
|
41
27
|
this.functions.addWindowMetricsListener = async callback => {
|
|
42
28
|
const {
|
|
43
29
|
id,
|
|
44
30
|
shouldInitialize
|
|
45
31
|
} = (0, _apiListenerHelper.addApiListener)('windowMetrics', callback);
|
|
46
|
-
|
|
47
32
|
if (shouldInitialize) {
|
|
48
33
|
void functions.addWindowMetricsListener(value => (0, _apiListenerHelper.dispatchApiEvent)('windowMetrics', value));
|
|
49
34
|
}
|
|
50
|
-
|
|
51
35
|
return id;
|
|
52
36
|
};
|
|
53
|
-
|
|
54
37
|
this.functions.removeWindowMetricsListener = async id => {
|
|
55
38
|
const shouldRemove = (0, _apiListenerHelper.removeApiListener)('windowMetrics', id);
|
|
56
|
-
|
|
57
39
|
if (shouldRemove) {
|
|
58
40
|
void functions.removeWindowMetricsListener(id);
|
|
59
41
|
}
|
|
60
42
|
};
|
|
61
43
|
}
|
|
62
|
-
|
|
63
44
|
async init() {
|
|
64
45
|
return undefined;
|
|
65
46
|
}
|
|
66
|
-
|
|
67
47
|
addDataListener(cb) {
|
|
68
48
|
const listener = ev => ev.detail && cb(ev.detail);
|
|
69
|
-
|
|
70
49
|
document.addEventListener('chayns_api_data', listener);
|
|
71
50
|
return () => {
|
|
72
51
|
document.removeEventListener('chayns_api_data', listener);
|
|
73
52
|
};
|
|
74
53
|
}
|
|
75
|
-
|
|
76
54
|
getSSRData() {
|
|
77
55
|
return null;
|
|
78
56
|
}
|
|
79
|
-
|
|
80
57
|
getInitialData() {
|
|
81
58
|
return this.values;
|
|
82
59
|
}
|
|
83
|
-
|
|
84
60
|
}
|
|
85
|
-
|
|
86
61
|
exports.ModuleFederationWrapper = ModuleFederationWrapper;
|
|
@@ -4,35 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SsrWrapper = void 0;
|
|
7
|
-
|
|
8
7
|
class SsrWrapper {
|
|
9
8
|
constructor(values, functions) {
|
|
10
9
|
this.initialData = values;
|
|
11
10
|
this.values = values;
|
|
12
11
|
this.functions = functions;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
async init() {
|
|
16
14
|
return undefined;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
addDataListener(cb) {
|
|
20
17
|
const listener = ev => ev.detail && cb(ev.detail);
|
|
21
|
-
|
|
22
18
|
document.addEventListener('chayns_api_data', listener);
|
|
23
19
|
return () => {
|
|
24
20
|
document.removeEventListener('chayns_api_data', listener);
|
|
25
21
|
};
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
getSSRData() {
|
|
29
24
|
return this.initialData;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
getInitialData() {
|
|
33
27
|
return this.values;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
exports.SsrWrapper = SsrWrapper;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { buttonText, buttonType, chaynsDialog } from './chaynsDialog';
|
|
2
2
|
export function alert() {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
let title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
4
|
+
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
5
5
|
return chaynsDialog({
|
|
6
6
|
'dialog': {
|
|
7
|
-
title
|
|
8
|
-
message
|
|
7
|
+
title,
|
|
8
|
+
message,
|
|
9
9
|
'buttons': [{
|
|
10
10
|
'text': buttonText.OK,
|
|
11
11
|
'buttonType': buttonType.POSITIVE
|