1 | declare type CONTEXT = {
|
2 | app_version: string;
|
3 | immersive: boolean;
|
4 | appearance: 'light' | 'dark';
|
5 | currency: string;
|
6 | locale: string;
|
7 | platform: 'iOS' | 'Android' | 'Desktop';
|
8 | conversation_id: string;
|
9 | [props: string]: any;
|
10 | };
|
11 | interface MESSAGERS {
|
12 | getContext: () => CONTEXT;
|
13 | playlist: (audios: string[]) => any;
|
14 | reloadTheme: (args?: string) => void;
|
15 | showToast: (msg: string) => void;
|
16 | }
|
17 | declare global {
|
18 | interface Window {
|
19 | webkit?: {
|
20 | messageHandlers?: {
|
21 | MixinContext?: any;
|
22 | playlist?: {
|
23 | postMessage: MESSAGERS['playlist'];
|
24 | };
|
25 | reloadTheme?: {
|
26 | postMessage: MESSAGERS['reloadTheme'];
|
27 | };
|
28 | };
|
29 | };
|
30 | MixinContext?: {
|
31 | getContext?: MESSAGERS['getContext'];
|
32 | playlist?: MESSAGERS['playlist'];
|
33 | reloadTheme?: MESSAGERS['reloadTheme'];
|
34 | showToast?: MESSAGERS['showToast'];
|
35 | };
|
36 | }
|
37 | }
|
38 | export declare function messager<T extends keyof MESSAGERS>(type: T): MESSAGERS[T];
|
39 | export default messager;
|