UNPKG

2.24 kBPlain TextView Raw
1export type RedirectEvent = {
2 url: string;
3};
4
5export type WebBrowserWindowFeatures = Record<string, number | boolean | string>;
6
7export type WebBrowserOpenOptions = {
8 /**
9 * Color of the toolbar in either #AARRGGBB or #RRGGBB format.
10 */
11 toolbarColor?: string;
12 browserPackage?: string;
13 /**
14 * Whether the toolbar should be hiding when a user scrolls the website.
15 */
16 enableBarCollapsing?: boolean;
17
18 /** Android only */
19
20 /**
21 * Color of the secondary toolbar in either #AARRGGBB or #RRGGBB format.
22 */
23 secondaryToolbarColor?: string;
24 /**
25 * Whether the browser should show the title of website on the toolbar.
26 */
27 showTitle?: boolean;
28 enableDefaultShareMenuItem?: boolean;
29 /**
30 * Whether browsed website should be shown as separate entry in Android recents/multitasking view.
31 * Default: `false`
32 */
33 showInRecents?: boolean;
34
35 /** iOS only */
36 controlsColor?: string;
37 dismissButtonStyle?: 'done' | 'close' | 'cancel';
38 readerMode?: boolean;
39
40 /**
41 * **Web:** name to assign to the popup window.
42 */
43 windowName?: string;
44 /**
45 * **Web:** features to use with `window.open()`
46 */
47 windowFeatures?: string | WebBrowserWindowFeatures;
48};
49
50export type WebBrowserAuthSessionResult = WebBrowserRedirectResult | WebBrowserResult;
51
52export type WebBrowserCustomTabsResults = {
53 defaultBrowserPackage?: string;
54 preferredBrowserPackage?: string;
55 browserPackages: string[];
56 servicePackages: string[];
57};
58
59export const WebBrowserResultType = {
60 /**
61 * iOS only
62 */
63 CANCEL: 'cancel',
64 /**
65 * iOS only
66 */
67 DISMISS: 'dismiss',
68 /**
69 * Android only
70 */
71 OPENED: 'opened',
72 LOCKED: 'locked',
73} as const;
74
75export type WebBrowserResultType = typeof WebBrowserResultType[keyof typeof WebBrowserResultType];
76
77export type WebBrowserResult = {
78 // cancel and dismiss are iOS only, opened is Android only
79 type: WebBrowserResultType;
80};
81
82export type WebBrowserRedirectResult = {
83 type: 'success';
84 url: string;
85};
86
87export type ServiceActionResult = {
88 servicePackage?: string;
89};
90
91export type WebBrowserMayInitWithUrlResult = ServiceActionResult;
92export type WebBrowserWarmUpResult = ServiceActionResult;
93export type WebBrowserCoolDownResult = ServiceActionResult;