chayns-api 2.3.3 → 2.4.0-beta.1
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.
|
@@ -7,7 +7,6 @@ exports.FrameWrapper = void 0;
|
|
|
7
7
|
var comlink = _interopRequireWildcard(require("comlink"));
|
|
8
8
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
9
9
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
10
|
-
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
11
10
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
12
11
|
var _sendMessage = require("../calls/sendMessage");
|
|
13
12
|
var _heightHelper = require("../util/heightHelper");
|
|
@@ -41,22 +40,9 @@ class FrameWrapper {
|
|
|
41
40
|
},
|
|
42
41
|
addWindowMetricsListener: async callback => {
|
|
43
42
|
if (!this.initialized) await this.ready;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = (0, _apiListenerHelper.addApiListener)('windowMetricsListener', callback);
|
|
48
|
-
if (shouldInitialize) {
|
|
49
|
-
void this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
50
|
-
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', result);
|
|
51
|
-
}));
|
|
52
|
-
window.addEventListener('resize', this.resizeListener = () => {
|
|
53
|
-
void (async () => {
|
|
54
|
-
const metrics = await this.exposedFunctions.getWindowMetrics();
|
|
55
|
-
(0, _apiListenerHelper.dispatchApiEvent)('windowMetricsListener', metrics);
|
|
56
|
-
})();
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return id;
|
|
43
|
+
return this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
44
|
+
callback(result);
|
|
45
|
+
}));
|
|
60
46
|
},
|
|
61
47
|
customCallbackFunction: async (type, data) => {
|
|
62
48
|
if (!this.initialized) await this.ready;
|
|
@@ -148,12 +134,7 @@ class FrameWrapper {
|
|
|
148
134
|
},
|
|
149
135
|
removeWindowMetricsListener: async id => {
|
|
150
136
|
if (!this.initialized) await this.ready;
|
|
151
|
-
|
|
152
|
-
if (shouldRemove) {
|
|
153
|
-
void this.exposedFunctions.removeWindowMetricsListener(id);
|
|
154
|
-
if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
|
|
155
|
-
this.resizeListener = null;
|
|
156
|
-
}
|
|
137
|
+
return this.exposedFunctions.removeWindowMetricsListener(id);
|
|
157
138
|
},
|
|
158
139
|
removeToolbarChangeListener: async id => {
|
|
159
140
|
if (!this.initialized) await this.ready;
|
|
@@ -284,23 +265,13 @@ class FrameWrapper {
|
|
|
284
265
|
},
|
|
285
266
|
addDialogHostEventListener: async callback => {
|
|
286
267
|
if (!this.initialized) await this.ready;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
shouldInitialize
|
|
291
|
-
} = (0, _apiListenerHelper.addApiListener)(listenerKey, callback);
|
|
292
|
-
if (shouldInitialize) {
|
|
293
|
-
this.exposedFunctions.addDialogHostEventListener(comlink.proxy(data => {
|
|
294
|
-
(0, _apiListenerHelper.dispatchApiEvent)(listenerKey, data);
|
|
295
|
-
}));
|
|
296
|
-
}
|
|
297
|
-
return id;
|
|
268
|
+
return this.exposedFunctions.addDialogHostEventListener(comlink.proxy(data => {
|
|
269
|
+
callback(data);
|
|
270
|
+
}));
|
|
298
271
|
},
|
|
299
272
|
removeDialogHostEventListener: async id => {
|
|
300
273
|
if (!this.initialized) await this.ready;
|
|
301
|
-
|
|
302
|
-
const shouldRemove = (0, _apiListenerHelper.removeApiListener)(listenerKey, id);
|
|
303
|
-
if (shouldRemove) {}
|
|
274
|
+
return this.exposedFunctions.removeDialogHostEventListener(id);
|
|
304
275
|
},
|
|
305
276
|
removeDialogClientEventListener: async () => {},
|
|
306
277
|
addAnonymousAccount: async () => {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ModuleFederationWrapper = void 0;
|
|
7
7
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
8
8
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
9
|
-
var _apiListenerHelper = require("../helper/apiListenerHelper");
|
|
10
9
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
11
10
|
var _sendMessage = require("../calls/sendMessage");
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -31,22 +30,6 @@ class ModuleFederationWrapper {
|
|
|
31
30
|
this.functions.createDialog = config => {
|
|
32
31
|
return new _DialogHandler.default(config, functions.openDialog, functions.closeDialog, functions.dispatchEventToDialogClient, functions.addDialogClientEventListener);
|
|
33
32
|
};
|
|
34
|
-
this.functions.addWindowMetricsListener = async callback => {
|
|
35
|
-
const {
|
|
36
|
-
id,
|
|
37
|
-
shouldInitialize
|
|
38
|
-
} = (0, _apiListenerHelper.addApiListener)('windowMetrics', callback);
|
|
39
|
-
if (shouldInitialize) {
|
|
40
|
-
void functions.addWindowMetricsListener(value => (0, _apiListenerHelper.dispatchApiEvent)('windowMetrics', value));
|
|
41
|
-
}
|
|
42
|
-
return id;
|
|
43
|
-
};
|
|
44
|
-
this.functions.removeWindowMetricsListener = async id => {
|
|
45
|
-
const shouldRemove = (0, _apiListenerHelper.removeApiListener)('windowMetrics', id);
|
|
46
|
-
if (shouldRemove) {
|
|
47
|
-
void functions.removeWindowMetricsListener(id);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
33
|
}
|
|
51
34
|
async init() {
|
|
52
35
|
return undefined;
|
|
@@ -4,7 +4,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
4
4
|
import * as comlink from 'comlink';
|
|
5
5
|
import DialogHandler from '../handler/DialogHandler';
|
|
6
6
|
import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
|
|
7
|
-
import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
|
|
8
7
|
import getUserInfo from '../calls/getUserInfo';
|
|
9
8
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
10
9
|
import { setTappHeight } from '../util/heightHelper';
|
|
@@ -37,22 +36,9 @@ export class FrameWrapper {
|
|
|
37
36
|
},
|
|
38
37
|
addWindowMetricsListener: async callback => {
|
|
39
38
|
if (!this.initialized) await this.ready;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} = addApiListener('windowMetricsListener', callback);
|
|
44
|
-
if (shouldInitialize) {
|
|
45
|
-
void this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
46
|
-
dispatchApiEvent('windowMetricsListener', result);
|
|
47
|
-
}));
|
|
48
|
-
window.addEventListener('resize', this.resizeListener = () => {
|
|
49
|
-
void (async () => {
|
|
50
|
-
const metrics = await this.exposedFunctions.getWindowMetrics();
|
|
51
|
-
dispatchApiEvent('windowMetricsListener', metrics);
|
|
52
|
-
})();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return id;
|
|
39
|
+
return this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
|
|
40
|
+
callback(result);
|
|
41
|
+
}));
|
|
56
42
|
},
|
|
57
43
|
customCallbackFunction: async (type, data) => {
|
|
58
44
|
if (!this.initialized) await this.ready;
|
|
@@ -144,12 +130,7 @@ export class FrameWrapper {
|
|
|
144
130
|
},
|
|
145
131
|
removeWindowMetricsListener: async id => {
|
|
146
132
|
if (!this.initialized) await this.ready;
|
|
147
|
-
|
|
148
|
-
if (shouldRemove) {
|
|
149
|
-
void this.exposedFunctions.removeWindowMetricsListener(id);
|
|
150
|
-
if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
|
|
151
|
-
this.resizeListener = null;
|
|
152
|
-
}
|
|
133
|
+
return this.exposedFunctions.removeWindowMetricsListener(id);
|
|
153
134
|
},
|
|
154
135
|
removeToolbarChangeListener: async id => {
|
|
155
136
|
if (!this.initialized) await this.ready;
|
|
@@ -280,23 +261,13 @@ export class FrameWrapper {
|
|
|
280
261
|
},
|
|
281
262
|
addDialogHostEventListener: async callback => {
|
|
282
263
|
if (!this.initialized) await this.ready;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
shouldInitialize
|
|
287
|
-
} = addApiListener(listenerKey, callback);
|
|
288
|
-
if (shouldInitialize) {
|
|
289
|
-
this.exposedFunctions.addDialogHostEventListener(comlink.proxy(data => {
|
|
290
|
-
dispatchApiEvent(listenerKey, data);
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
return id;
|
|
264
|
+
return this.exposedFunctions.addDialogHostEventListener(comlink.proxy(data => {
|
|
265
|
+
callback(data);
|
|
266
|
+
}));
|
|
294
267
|
},
|
|
295
268
|
removeDialogHostEventListener: async id => {
|
|
296
269
|
if (!this.initialized) await this.ready;
|
|
297
|
-
|
|
298
|
-
const shouldRemove = removeApiListener(listenerKey, id);
|
|
299
|
-
if (shouldRemove) {}
|
|
270
|
+
return this.exposedFunctions.removeDialogHostEventListener(id);
|
|
300
271
|
},
|
|
301
272
|
removeDialogClientEventListener: async () => {},
|
|
302
273
|
addAnonymousAccount: async () => {
|
|
@@ -3,7 +3,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
import DialogHandler from '../handler/DialogHandler';
|
|
5
5
|
import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
|
|
6
|
-
import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
|
|
7
6
|
import getUserInfo from '../calls/getUserInfo';
|
|
8
7
|
import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
|
|
9
8
|
export class ModuleFederationWrapper {
|
|
@@ -39,22 +38,6 @@ export class ModuleFederationWrapper {
|
|
|
39
38
|
this.functions.createDialog = config => {
|
|
40
39
|
return new DialogHandler(config, functions.openDialog, functions.closeDialog, functions.dispatchEventToDialogClient, functions.addDialogClientEventListener);
|
|
41
40
|
};
|
|
42
|
-
this.functions.addWindowMetricsListener = async callback => {
|
|
43
|
-
const {
|
|
44
|
-
id,
|
|
45
|
-
shouldInitialize
|
|
46
|
-
} = addApiListener('windowMetrics', callback);
|
|
47
|
-
if (shouldInitialize) {
|
|
48
|
-
void functions.addWindowMetricsListener(value => dispatchApiEvent('windowMetrics', value));
|
|
49
|
-
}
|
|
50
|
-
return id;
|
|
51
|
-
};
|
|
52
|
-
this.functions.removeWindowMetricsListener = async id => {
|
|
53
|
-
const shouldRemove = removeApiListener('windowMetrics', id);
|
|
54
|
-
if (shouldRemove) {
|
|
55
|
-
void functions.removeWindowMetricsListener(id);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
41
|
}
|
|
59
42
|
async init() {
|
|
60
43
|
return undefined;
|
|
@@ -99,6 +99,7 @@ export interface DialogModule<T = object> {
|
|
|
99
99
|
allowAnonymousUser?: boolean;
|
|
100
100
|
seamless?: boolean;
|
|
101
101
|
height?: string | number;
|
|
102
|
+
minHeight?: string | number;
|
|
102
103
|
}
|
|
103
104
|
export interface DialogIFrame<T = object> {
|
|
104
105
|
type: DialogType.IFRAME;
|
|
@@ -108,6 +109,7 @@ export interface DialogIFrame<T = object> {
|
|
|
108
109
|
allowAnonymousUser?: boolean;
|
|
109
110
|
seamless?: boolean;
|
|
110
111
|
height?: string | number;
|
|
112
|
+
minHeight?: string | number;
|
|
111
113
|
}
|
|
112
114
|
export declare enum DialogInputType {
|
|
113
115
|
NUMBER = "number",
|