@capawesome/capacitor-in-app-browser 0.0.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.
- package/CapawesomeCapacitorInAppBrowser.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +690 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/InAppBrowser.java +242 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/InAppBrowserPlugin.java +289 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/CustomException.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/CustomExceptions.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/WebViewDialog.java +343 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/events/BrowserPageNavigationCompletedEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/events/MessageReceivedEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/ExecuteScriptOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/GetCookiesOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/OpenInExternalBrowserOptions.java +30 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/OpenInSystemBrowserOptions.java +74 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/OpenInWebViewOptions.java +112 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/PostMessageOptions.java +30 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/options/WebViewToolbarOptions.java +87 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/results/ExecuteScriptResult.java +25 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/classes/results/GetCookiesResult.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/inappbrowser/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +1173 -0
- package/dist/esm/definitions.d.ts +540 -0
- package/dist/esm/definitions.js +19 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +14 -0
- package/dist/esm/web.js +35 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +68 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +71 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/Events/BrowserPageNavigationCompletedEvent.swift +16 -0
- package/ios/Plugin/Classes/Events/MessageReceivedEvent.swift +24 -0
- package/ios/Plugin/Classes/Options/ExecuteScriptOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/GetCookiesOptions.swift +20 -0
- package/ios/Plugin/Classes/Options/OpenInExternalBrowserOptions.swift +20 -0
- package/ios/Plugin/Classes/Options/OpenInSystemBrowserOptions.swift +52 -0
- package/ios/Plugin/Classes/Options/OpenInWebViewOptions.swift +48 -0
- package/ios/Plugin/Classes/Options/PostMessageOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/WebViewToolbarOptions.swift +37 -0
- package/ios/Plugin/Classes/Results/ExecuteScriptResult.swift +25 -0
- package/ios/Plugin/Classes/Results/GetCookiesResult.swift +20 -0
- package/ios/Plugin/Classes/WebViewController.swift +224 -0
- package/ios/Plugin/Enums/CustomError.swift +49 -0
- package/ios/Plugin/InAppBrowser.swift +194 -0
- package/ios/Plugin/InAppBrowserHelper.swift +49 -0
- package/ios/Plugin/InAppBrowserPlugin.swift +191 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +5 -0
- package/package.json +91 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
export interface InAppBrowserPlugin {
|
|
3
|
+
/**
|
|
4
|
+
* Clear the cache of the web view.
|
|
5
|
+
*
|
|
6
|
+
* Only available on Android and iOS.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.1.0
|
|
9
|
+
*/
|
|
10
|
+
clearCache(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Clear the session data (cookies and web storage) of the web view.
|
|
13
|
+
*
|
|
14
|
+
* Only available on Android and iOS.
|
|
15
|
+
*
|
|
16
|
+
* @since 0.1.0
|
|
17
|
+
*/
|
|
18
|
+
clearSessionData(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Close the currently open browser.
|
|
21
|
+
*
|
|
22
|
+
* This closes browsers opened with `openInWebView(...)` or
|
|
23
|
+
* `openInSystemBrowser(...)`.
|
|
24
|
+
*
|
|
25
|
+
* Only available on Android and iOS.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.1.0
|
|
28
|
+
*/
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Execute a JavaScript script in the currently open web view.
|
|
32
|
+
*
|
|
33
|
+
* This method is only available for browsers opened with
|
|
34
|
+
* `openInWebView(...)`.
|
|
35
|
+
*
|
|
36
|
+
* Only available on Android and iOS.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
*/
|
|
40
|
+
executeScript(options: ExecuteScriptOptions): Promise<ExecuteScriptResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Get the cookies for a specific URL.
|
|
43
|
+
*
|
|
44
|
+
* On iOS, only cookies from the shared data store are returned. Cookies from
|
|
45
|
+
* a web view opened with `dataStore: 'isolated'` are not included.
|
|
46
|
+
*
|
|
47
|
+
* Only available on Android and iOS.
|
|
48
|
+
*
|
|
49
|
+
* @since 0.1.0
|
|
50
|
+
*/
|
|
51
|
+
getCookies(options: GetCookiesOptions): Promise<GetCookiesResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Open a URL in the default browser app of the device.
|
|
54
|
+
*
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
*/
|
|
57
|
+
openInExternalBrowser(options: OpenInExternalBrowserOptions): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Open a URL in the system browser (Custom Tabs on Android,
|
|
60
|
+
* `SFSafariViewController` on iOS).
|
|
61
|
+
*
|
|
62
|
+
* Only available on Android and iOS.
|
|
63
|
+
*
|
|
64
|
+
* @since 0.1.0
|
|
65
|
+
*/
|
|
66
|
+
openInSystemBrowser(options: OpenInSystemBrowserOptions): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Open a URL in an embedded web view with a native toolbar.
|
|
69
|
+
*
|
|
70
|
+
* Only available on Android and iOS.
|
|
71
|
+
*
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
*/
|
|
74
|
+
openInWebView(options: OpenInWebViewOptions): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Post a message to the currently open web view.
|
|
77
|
+
*
|
|
78
|
+
* The web page receives the message by listening for the
|
|
79
|
+
* `capacitorInAppBrowserMessage` window event. The message data is
|
|
80
|
+
* available in the `detail` property of the event.
|
|
81
|
+
*
|
|
82
|
+
* This method is only available for browsers opened with
|
|
83
|
+
* `openInWebView(...)`.
|
|
84
|
+
*
|
|
85
|
+
* Only available on Android and iOS.
|
|
86
|
+
*
|
|
87
|
+
* @since 0.1.0
|
|
88
|
+
*/
|
|
89
|
+
postMessage(options: PostMessageOptions): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Called when the browser is closed.
|
|
92
|
+
*
|
|
93
|
+
* Only available on Android and iOS.
|
|
94
|
+
*
|
|
95
|
+
* @since 0.1.0
|
|
96
|
+
*/
|
|
97
|
+
addListener(eventName: 'browserClosed', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
98
|
+
/**
|
|
99
|
+
* Called when the initial page of the browser has finished loading.
|
|
100
|
+
*
|
|
101
|
+
* On Android, this event is only emitted for browsers opened with
|
|
102
|
+
* `openInWebView(...)`.
|
|
103
|
+
*
|
|
104
|
+
* Only available on Android and iOS.
|
|
105
|
+
*
|
|
106
|
+
* @since 0.1.0
|
|
107
|
+
*/
|
|
108
|
+
addListener(eventName: 'browserPageLoaded', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
109
|
+
/**
|
|
110
|
+
* Called when a page navigation has been completed in the web view.
|
|
111
|
+
*
|
|
112
|
+
* This event is only emitted for browsers opened with `openInWebView(...)`.
|
|
113
|
+
*
|
|
114
|
+
* Only available on Android and iOS.
|
|
115
|
+
*
|
|
116
|
+
* @since 0.1.0
|
|
117
|
+
*/
|
|
118
|
+
addListener(eventName: 'browserPageNavigationCompleted', listenerFunc: (event: BrowserPageNavigationCompletedEvent) => void): Promise<PluginListenerHandle>;
|
|
119
|
+
/**
|
|
120
|
+
* Called when the web page posts a message to the app using the injected
|
|
121
|
+
* `window.CapacitorInAppBrowser.postMessage(...)` function.
|
|
122
|
+
*
|
|
123
|
+
* This event is only emitted for browsers opened with `openInWebView(...)`.
|
|
124
|
+
*
|
|
125
|
+
* Only available on Android and iOS.
|
|
126
|
+
*
|
|
127
|
+
* @since 0.1.0
|
|
128
|
+
*/
|
|
129
|
+
addListener(eventName: 'messageReceived', listenerFunc: (event: MessageReceivedEvent) => void): Promise<PluginListenerHandle>;
|
|
130
|
+
/**
|
|
131
|
+
* Remove all listeners for this plugin.
|
|
132
|
+
*
|
|
133
|
+
* @since 0.1.0
|
|
134
|
+
*/
|
|
135
|
+
removeAllListeners(): Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
*/
|
|
140
|
+
export interface OpenInExternalBrowserOptions {
|
|
141
|
+
/**
|
|
142
|
+
* The URL to open in the external browser.
|
|
143
|
+
*
|
|
144
|
+
* @example 'https://capawesome.io'
|
|
145
|
+
* @since 0.1.0
|
|
146
|
+
*/
|
|
147
|
+
url: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @since 0.1.0
|
|
151
|
+
*/
|
|
152
|
+
export interface OpenInSystemBrowserOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Options that are only applied on Android.
|
|
155
|
+
*
|
|
156
|
+
* Only available on Android.
|
|
157
|
+
*
|
|
158
|
+
* @since 0.1.0
|
|
159
|
+
*/
|
|
160
|
+
android?: OpenInSystemBrowserAndroidOptions;
|
|
161
|
+
/**
|
|
162
|
+
* Options that are only applied on iOS.
|
|
163
|
+
*
|
|
164
|
+
* Only available on iOS.
|
|
165
|
+
*
|
|
166
|
+
* @since 0.1.0
|
|
167
|
+
*/
|
|
168
|
+
ios?: OpenInSystemBrowserIosOptions;
|
|
169
|
+
/**
|
|
170
|
+
* The URL to open in the system browser.
|
|
171
|
+
*
|
|
172
|
+
* @example 'https://capawesome.io'
|
|
173
|
+
* @since 0.1.0
|
|
174
|
+
*/
|
|
175
|
+
url: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @since 0.1.0
|
|
179
|
+
*/
|
|
180
|
+
export interface OpenInSystemBrowserAndroidOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Whether or not the toolbar should be hidden when the user scrolls down
|
|
183
|
+
* and shown when the user scrolls up.
|
|
184
|
+
*
|
|
185
|
+
* @default false
|
|
186
|
+
* @since 0.1.0
|
|
187
|
+
*/
|
|
188
|
+
hideToolbarOnScroll?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Whether or not the title of the web page should be shown in the toolbar.
|
|
191
|
+
*
|
|
192
|
+
* @default false
|
|
193
|
+
* @since 0.1.0
|
|
194
|
+
*/
|
|
195
|
+
showTitle?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* The background color of the toolbar as a hex color code.
|
|
198
|
+
*
|
|
199
|
+
* @example '#008080'
|
|
200
|
+
* @since 0.1.0
|
|
201
|
+
*/
|
|
202
|
+
toolbarColor?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @since 0.1.0
|
|
206
|
+
*/
|
|
207
|
+
export interface OpenInSystemBrowserIosOptions {
|
|
208
|
+
/**
|
|
209
|
+
* Whether or not the toolbar should collapse when the user scrolls down.
|
|
210
|
+
*
|
|
211
|
+
* @default true
|
|
212
|
+
* @since 0.1.0
|
|
213
|
+
*/
|
|
214
|
+
barCollapsing?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* The style of the dismiss button in the toolbar.
|
|
217
|
+
*
|
|
218
|
+
* @default 'done'
|
|
219
|
+
* @since 0.1.0
|
|
220
|
+
*/
|
|
221
|
+
dismissButtonStyle?: DismissButtonStyle;
|
|
222
|
+
/**
|
|
223
|
+
* Whether or not the reader mode should be entered if it is available for
|
|
224
|
+
* the web page.
|
|
225
|
+
*
|
|
226
|
+
* @default false
|
|
227
|
+
* @since 0.1.0
|
|
228
|
+
*/
|
|
229
|
+
readerMode?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* The background color of the toolbar as a hex color code.
|
|
232
|
+
*
|
|
233
|
+
* @example '#008080'
|
|
234
|
+
* @since 0.1.0
|
|
235
|
+
*/
|
|
236
|
+
toolbarColor?: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @since 0.1.0
|
|
240
|
+
*/
|
|
241
|
+
export interface OpenInWebViewOptions {
|
|
242
|
+
/**
|
|
243
|
+
* Options that are only applied on Android.
|
|
244
|
+
*
|
|
245
|
+
* Only available on Android.
|
|
246
|
+
*
|
|
247
|
+
* @since 0.1.0
|
|
248
|
+
*/
|
|
249
|
+
android?: OpenInWebViewAndroidOptions;
|
|
250
|
+
/**
|
|
251
|
+
* The data store to use for the web view.
|
|
252
|
+
*
|
|
253
|
+
* On Android, this option is ignored. The web view always uses the
|
|
254
|
+
* app-global (`shared`) data store.
|
|
255
|
+
*
|
|
256
|
+
* Only available on iOS.
|
|
257
|
+
*
|
|
258
|
+
* @default 'shared'
|
|
259
|
+
* @since 0.1.0
|
|
260
|
+
*/
|
|
261
|
+
dataStore?: WebViewDataStore;
|
|
262
|
+
/**
|
|
263
|
+
* Additional HTTP headers to send with the initial request.
|
|
264
|
+
*
|
|
265
|
+
* @since 0.1.0
|
|
266
|
+
*/
|
|
267
|
+
headers?: {
|
|
268
|
+
[key: string]: string;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Options that are only applied on iOS.
|
|
272
|
+
*
|
|
273
|
+
* Only available on iOS.
|
|
274
|
+
*
|
|
275
|
+
* @since 0.1.0
|
|
276
|
+
*/
|
|
277
|
+
ios?: OpenInWebViewIosOptions;
|
|
278
|
+
/**
|
|
279
|
+
* Whether or not media playback requires user action.
|
|
280
|
+
*
|
|
281
|
+
* @default false
|
|
282
|
+
* @since 0.1.0
|
|
283
|
+
*/
|
|
284
|
+
mediaPlaybackRequiresUserAction?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Options for the toolbar of the web view.
|
|
287
|
+
*
|
|
288
|
+
* @since 0.1.0
|
|
289
|
+
*/
|
|
290
|
+
toolbar?: WebViewToolbarOptions;
|
|
291
|
+
/**
|
|
292
|
+
* The URL to open in the web view.
|
|
293
|
+
*
|
|
294
|
+
* @example 'https://capawesome.io'
|
|
295
|
+
* @since 0.1.0
|
|
296
|
+
*/
|
|
297
|
+
url: string;
|
|
298
|
+
/**
|
|
299
|
+
* The custom user agent to use for the web view.
|
|
300
|
+
*
|
|
301
|
+
* @since 0.1.0
|
|
302
|
+
*/
|
|
303
|
+
userAgent?: string;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @since 0.1.0
|
|
307
|
+
*/
|
|
308
|
+
export interface WebViewToolbarOptions {
|
|
309
|
+
/**
|
|
310
|
+
* The background color of the toolbar as a hex color code.
|
|
311
|
+
*
|
|
312
|
+
* @example '#008080'
|
|
313
|
+
* @since 0.1.0
|
|
314
|
+
*/
|
|
315
|
+
backgroundColor?: string;
|
|
316
|
+
/**
|
|
317
|
+
* The text of the close button in the toolbar.
|
|
318
|
+
*
|
|
319
|
+
* @default 'Close'
|
|
320
|
+
* @since 0.1.0
|
|
321
|
+
*/
|
|
322
|
+
closeButtonText?: string;
|
|
323
|
+
/**
|
|
324
|
+
* The text color of the toolbar as a hex color code.
|
|
325
|
+
*
|
|
326
|
+
* @example '#FFFFFF'
|
|
327
|
+
* @since 0.1.0
|
|
328
|
+
*/
|
|
329
|
+
color?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Whether or not the back and forward navigation buttons should be shown
|
|
332
|
+
* in the toolbar.
|
|
333
|
+
*
|
|
334
|
+
* @default false
|
|
335
|
+
* @since 0.1.0
|
|
336
|
+
*/
|
|
337
|
+
showNavigationButtons?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Whether or not the current URL should be displayed in the toolbar
|
|
340
|
+
* instead of the title.
|
|
341
|
+
*
|
|
342
|
+
* @default false
|
|
343
|
+
* @since 0.1.0
|
|
344
|
+
*/
|
|
345
|
+
showUrl?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* The fixed title to display in the toolbar.
|
|
348
|
+
*
|
|
349
|
+
* If not set, the title of the current web page is displayed.
|
|
350
|
+
*
|
|
351
|
+
* @since 0.1.0
|
|
352
|
+
*/
|
|
353
|
+
title?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Whether or not the toolbar should be visible.
|
|
356
|
+
*
|
|
357
|
+
* @default true
|
|
358
|
+
* @since 0.1.0
|
|
359
|
+
*/
|
|
360
|
+
visible?: boolean;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @since 0.1.0
|
|
364
|
+
*/
|
|
365
|
+
export interface OpenInWebViewAndroidOptions {
|
|
366
|
+
/**
|
|
367
|
+
* Whether or not the user can zoom the web page.
|
|
368
|
+
*
|
|
369
|
+
* @default false
|
|
370
|
+
* @since 0.1.0
|
|
371
|
+
*/
|
|
372
|
+
allowZoom?: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Whether or not the hardware back button navigates back in the web view's
|
|
375
|
+
* history before closing the web view.
|
|
376
|
+
*
|
|
377
|
+
* If `false`, the hardware back button closes the web view immediately.
|
|
378
|
+
*
|
|
379
|
+
* @default true
|
|
380
|
+
* @since 0.1.0
|
|
381
|
+
*/
|
|
382
|
+
hardwareBackButton?: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Whether or not media playback is paused when the app is hidden.
|
|
385
|
+
*
|
|
386
|
+
* @default true
|
|
387
|
+
* @since 0.1.0
|
|
388
|
+
*/
|
|
389
|
+
pauseMediaWhenHidden?: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* @since 0.1.0
|
|
393
|
+
*/
|
|
394
|
+
export interface OpenInWebViewIosOptions {
|
|
395
|
+
/**
|
|
396
|
+
* Whether or not horizontal swipe gestures navigate back and forward in
|
|
397
|
+
* the web view's history.
|
|
398
|
+
*
|
|
399
|
+
* @default false
|
|
400
|
+
* @since 0.1.0
|
|
401
|
+
*/
|
|
402
|
+
allowsBackForwardNavigationGestures?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Whether or not the web view bounces when scrolled past the edge of the
|
|
405
|
+
* content.
|
|
406
|
+
*
|
|
407
|
+
* @default true
|
|
408
|
+
* @since 0.1.0
|
|
409
|
+
*/
|
|
410
|
+
overscroll?: boolean;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @since 0.1.0
|
|
414
|
+
*/
|
|
415
|
+
export interface ExecuteScriptOptions {
|
|
416
|
+
/**
|
|
417
|
+
* The JavaScript code to execute in the web view.
|
|
418
|
+
*
|
|
419
|
+
* @example 'document.title'
|
|
420
|
+
* @since 0.1.0
|
|
421
|
+
*/
|
|
422
|
+
script: string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* @since 0.1.0
|
|
426
|
+
*/
|
|
427
|
+
export interface ExecuteScriptResult {
|
|
428
|
+
/**
|
|
429
|
+
* The result of the script execution serialized as a JSON string.
|
|
430
|
+
*
|
|
431
|
+
* If the script does not return a JSON-serializable value, `null` is
|
|
432
|
+
* returned.
|
|
433
|
+
*
|
|
434
|
+
* @example '"Capawesome"'
|
|
435
|
+
* @since 0.1.0
|
|
436
|
+
*/
|
|
437
|
+
result: string | null;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* @since 0.1.0
|
|
441
|
+
*/
|
|
442
|
+
export interface PostMessageOptions {
|
|
443
|
+
/**
|
|
444
|
+
* The message data to post to the web view.
|
|
445
|
+
*
|
|
446
|
+
* Must be a JSON-serializable object.
|
|
447
|
+
*
|
|
448
|
+
* @example { name: 'Capawesome' }
|
|
449
|
+
* @since 0.1.0
|
|
450
|
+
*/
|
|
451
|
+
data: {
|
|
452
|
+
[key: string]: unknown;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @since 0.1.0
|
|
457
|
+
*/
|
|
458
|
+
export interface GetCookiesOptions {
|
|
459
|
+
/**
|
|
460
|
+
* The URL to get the cookies for.
|
|
461
|
+
*
|
|
462
|
+
* @example 'https://capawesome.io'
|
|
463
|
+
* @since 0.1.0
|
|
464
|
+
*/
|
|
465
|
+
url: string;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* @since 0.1.0
|
|
469
|
+
*/
|
|
470
|
+
export interface GetCookiesResult {
|
|
471
|
+
/**
|
|
472
|
+
* The cookies for the URL as a map of cookie names to values.
|
|
473
|
+
*
|
|
474
|
+
* @since 0.1.0
|
|
475
|
+
*/
|
|
476
|
+
cookies: {
|
|
477
|
+
[key: string]: string;
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* @since 0.1.0
|
|
482
|
+
*/
|
|
483
|
+
export interface BrowserPageNavigationCompletedEvent {
|
|
484
|
+
/**
|
|
485
|
+
* The URL of the page that was navigated to.
|
|
486
|
+
*
|
|
487
|
+
* @example 'https://capawesome.io'
|
|
488
|
+
* @since 0.1.0
|
|
489
|
+
*/
|
|
490
|
+
url: string;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* @since 0.1.0
|
|
494
|
+
*/
|
|
495
|
+
export interface MessageReceivedEvent {
|
|
496
|
+
/**
|
|
497
|
+
* The message data posted by the web page.
|
|
498
|
+
*
|
|
499
|
+
* @since 0.1.0
|
|
500
|
+
*/
|
|
501
|
+
data: unknown;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The style of the dismiss button in the toolbar of the system browser.
|
|
505
|
+
*
|
|
506
|
+
* - `cancel`: A button with the text "Cancel".
|
|
507
|
+
* - `close`: A button with the text "Close".
|
|
508
|
+
* - `done`: A button with the text "Done".
|
|
509
|
+
*
|
|
510
|
+
* @since 0.1.0
|
|
511
|
+
*/
|
|
512
|
+
export type DismissButtonStyle = 'cancel' | 'close' | 'done';
|
|
513
|
+
/**
|
|
514
|
+
* The data store to use for the web view.
|
|
515
|
+
*
|
|
516
|
+
* - `isolated`: The web view uses a non-persistent data store. Cookies and
|
|
517
|
+
* web storage are discarded when the web view is closed.
|
|
518
|
+
* - `shared`: The web view uses the app-global data store which is shared
|
|
519
|
+
* with other web views.
|
|
520
|
+
*
|
|
521
|
+
* @since 0.1.0
|
|
522
|
+
*/
|
|
523
|
+
export type WebViewDataStore = 'isolated' | 'shared';
|
|
524
|
+
/**
|
|
525
|
+
* @since 0.1.0
|
|
526
|
+
*/
|
|
527
|
+
export declare enum ErrorCode {
|
|
528
|
+
/**
|
|
529
|
+
* No app was found on the device that can open the URL.
|
|
530
|
+
*
|
|
531
|
+
* @since 0.1.0
|
|
532
|
+
*/
|
|
533
|
+
BrowserNotFound = "BROWSER_NOT_FOUND",
|
|
534
|
+
/**
|
|
535
|
+
* No browser is currently open.
|
|
536
|
+
*
|
|
537
|
+
* @since 0.1.0
|
|
538
|
+
*/
|
|
539
|
+
NoBrowserOpen = "NO_BROWSER_OPEN"
|
|
540
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 0.1.0
|
|
3
|
+
*/
|
|
4
|
+
export var ErrorCode;
|
|
5
|
+
(function (ErrorCode) {
|
|
6
|
+
/**
|
|
7
|
+
* No app was found on the device that can open the URL.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
ErrorCode["BrowserNotFound"] = "BROWSER_NOT_FOUND";
|
|
12
|
+
/**
|
|
13
|
+
* No browser is currently open.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
ErrorCode["NoBrowserOpen"] = "NO_BROWSER_OPEN";
|
|
18
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
19
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAoiBA;;GAEG;AACH,MAAM,CAAN,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB;;;;OAIG;IACH,kDAAqC,CAAA;IACrC;;;;OAIG;IACH,8CAAiC,CAAA;AACnC,CAAC,EAbW,SAAS,KAAT,SAAS,QAapB","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface InAppBrowserPlugin {\n /**\n * Clear the cache of the web view.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n clearCache(): Promise<void>;\n /**\n * Clear the session data (cookies and web storage) of the web view.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n clearSessionData(): Promise<void>;\n /**\n * Close the currently open browser.\n *\n * This closes browsers opened with `openInWebView(...)` or\n * `openInSystemBrowser(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n close(): Promise<void>;\n /**\n * Execute a JavaScript script in the currently open web view.\n *\n * This method is only available for browsers opened with\n * `openInWebView(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n executeScript(options: ExecuteScriptOptions): Promise<ExecuteScriptResult>;\n /**\n * Get the cookies for a specific URL.\n *\n * On iOS, only cookies from the shared data store are returned. Cookies from\n * a web view opened with `dataStore: 'isolated'` are not included.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n getCookies(options: GetCookiesOptions): Promise<GetCookiesResult>;\n /**\n * Open a URL in the default browser app of the device.\n *\n * @since 0.1.0\n */\n openInExternalBrowser(options: OpenInExternalBrowserOptions): Promise<void>;\n /**\n * Open a URL in the system browser (Custom Tabs on Android,\n * `SFSafariViewController` on iOS).\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n openInSystemBrowser(options: OpenInSystemBrowserOptions): Promise<void>;\n /**\n * Open a URL in an embedded web view with a native toolbar.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n openInWebView(options: OpenInWebViewOptions): Promise<void>;\n /**\n * Post a message to the currently open web view.\n *\n * The web page receives the message by listening for the\n * `capacitorInAppBrowserMessage` window event. The message data is\n * available in the `detail` property of the event.\n *\n * This method is only available for browsers opened with\n * `openInWebView(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n postMessage(options: PostMessageOptions): Promise<void>;\n /**\n * Called when the browser is closed.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'browserClosed',\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Called when the initial page of the browser has finished loading.\n *\n * On Android, this event is only emitted for browsers opened with\n * `openInWebView(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Called when a page navigation has been completed in the web view.\n *\n * This event is only emitted for browsers opened with `openInWebView(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'browserPageNavigationCompleted',\n listenerFunc: (event: BrowserPageNavigationCompletedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Called when the web page posts a message to the app using the injected\n * `window.CapacitorInAppBrowser.postMessage(...)` function.\n *\n * This event is only emitted for browsers opened with `openInWebView(...)`.\n *\n * Only available on Android and iOS.\n *\n * @since 0.1.0\n */\n addListener(\n eventName: 'messageReceived',\n listenerFunc: (event: MessageReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 0.1.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInExternalBrowserOptions {\n /**\n * The URL to open in the external browser.\n *\n * @example 'https://capawesome.io'\n * @since 0.1.0\n */\n url: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInSystemBrowserOptions {\n /**\n * Options that are only applied on Android.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n android?: OpenInSystemBrowserAndroidOptions;\n /**\n * Options that are only applied on iOS.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n ios?: OpenInSystemBrowserIosOptions;\n /**\n * The URL to open in the system browser.\n *\n * @example 'https://capawesome.io'\n * @since 0.1.0\n */\n url: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInSystemBrowserAndroidOptions {\n /**\n * Whether or not the toolbar should be hidden when the user scrolls down\n * and shown when the user scrolls up.\n *\n * @default false\n * @since 0.1.0\n */\n hideToolbarOnScroll?: boolean;\n /**\n * Whether or not the title of the web page should be shown in the toolbar.\n *\n * @default false\n * @since 0.1.0\n */\n showTitle?: boolean;\n /**\n * The background color of the toolbar as a hex color code.\n *\n * @example '#008080'\n * @since 0.1.0\n */\n toolbarColor?: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInSystemBrowserIosOptions {\n /**\n * Whether or not the toolbar should collapse when the user scrolls down.\n *\n * @default true\n * @since 0.1.0\n */\n barCollapsing?: boolean;\n /**\n * The style of the dismiss button in the toolbar.\n *\n * @default 'done'\n * @since 0.1.0\n */\n dismissButtonStyle?: DismissButtonStyle;\n /**\n * Whether or not the reader mode should be entered if it is available for\n * the web page.\n *\n * @default false\n * @since 0.1.0\n */\n readerMode?: boolean;\n /**\n * The background color of the toolbar as a hex color code.\n *\n * @example '#008080'\n * @since 0.1.0\n */\n toolbarColor?: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInWebViewOptions {\n /**\n * Options that are only applied on Android.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n android?: OpenInWebViewAndroidOptions;\n /**\n * The data store to use for the web view.\n *\n * On Android, this option is ignored. The web view always uses the\n * app-global (`shared`) data store.\n *\n * Only available on iOS.\n *\n * @default 'shared'\n * @since 0.1.0\n */\n dataStore?: WebViewDataStore;\n /**\n * Additional HTTP headers to send with the initial request.\n *\n * @since 0.1.0\n */\n headers?: { [key: string]: string };\n /**\n * Options that are only applied on iOS.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n ios?: OpenInWebViewIosOptions;\n /**\n * Whether or not media playback requires user action.\n *\n * @default false\n * @since 0.1.0\n */\n mediaPlaybackRequiresUserAction?: boolean;\n /**\n * Options for the toolbar of the web view.\n *\n * @since 0.1.0\n */\n toolbar?: WebViewToolbarOptions;\n /**\n * The URL to open in the web view.\n *\n * @example 'https://capawesome.io'\n * @since 0.1.0\n */\n url: string;\n /**\n * The custom user agent to use for the web view.\n *\n * @since 0.1.0\n */\n userAgent?: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface WebViewToolbarOptions {\n /**\n * The background color of the toolbar as a hex color code.\n *\n * @example '#008080'\n * @since 0.1.0\n */\n backgroundColor?: string;\n /**\n * The text of the close button in the toolbar.\n *\n * @default 'Close'\n * @since 0.1.0\n */\n closeButtonText?: string;\n /**\n * The text color of the toolbar as a hex color code.\n *\n * @example '#FFFFFF'\n * @since 0.1.0\n */\n color?: string;\n /**\n * Whether or not the back and forward navigation buttons should be shown\n * in the toolbar.\n *\n * @default false\n * @since 0.1.0\n */\n showNavigationButtons?: boolean;\n /**\n * Whether or not the current URL should be displayed in the toolbar\n * instead of the title.\n *\n * @default false\n * @since 0.1.0\n */\n showUrl?: boolean;\n /**\n * The fixed title to display in the toolbar.\n *\n * If not set, the title of the current web page is displayed.\n *\n * @since 0.1.0\n */\n title?: string;\n /**\n * Whether or not the toolbar should be visible.\n *\n * @default true\n * @since 0.1.0\n */\n visible?: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInWebViewAndroidOptions {\n /**\n * Whether or not the user can zoom the web page.\n *\n * @default false\n * @since 0.1.0\n */\n allowZoom?: boolean;\n /**\n * Whether or not the hardware back button navigates back in the web view's\n * history before closing the web view.\n *\n * If `false`, the hardware back button closes the web view immediately.\n *\n * @default true\n * @since 0.1.0\n */\n hardwareBackButton?: boolean;\n /**\n * Whether or not media playback is paused when the app is hidden.\n *\n * @default true\n * @since 0.1.0\n */\n pauseMediaWhenHidden?: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface OpenInWebViewIosOptions {\n /**\n * Whether or not horizontal swipe gestures navigate back and forward in\n * the web view's history.\n *\n * @default false\n * @since 0.1.0\n */\n allowsBackForwardNavigationGestures?: boolean;\n /**\n * Whether or not the web view bounces when scrolled past the edge of the\n * content.\n *\n * @default true\n * @since 0.1.0\n */\n overscroll?: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface ExecuteScriptOptions {\n /**\n * The JavaScript code to execute in the web view.\n *\n * @example 'document.title'\n * @since 0.1.0\n */\n script: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface ExecuteScriptResult {\n /**\n * The result of the script execution serialized as a JSON string.\n *\n * If the script does not return a JSON-serializable value, `null` is\n * returned.\n *\n * @example '\"Capawesome\"'\n * @since 0.1.0\n */\n result: string | null;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface PostMessageOptions {\n /**\n * The message data to post to the web view.\n *\n * Must be a JSON-serializable object.\n *\n * @example { name: 'Capawesome' }\n * @since 0.1.0\n */\n data: { [key: string]: unknown };\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetCookiesOptions {\n /**\n * The URL to get the cookies for.\n *\n * @example 'https://capawesome.io'\n * @since 0.1.0\n */\n url: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetCookiesResult {\n /**\n * The cookies for the URL as a map of cookie names to values.\n *\n * @since 0.1.0\n */\n cookies: { [key: string]: string };\n}\n\n/**\n * @since 0.1.0\n */\nexport interface BrowserPageNavigationCompletedEvent {\n /**\n * The URL of the page that was navigated to.\n *\n * @example 'https://capawesome.io'\n * @since 0.1.0\n */\n url: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface MessageReceivedEvent {\n /**\n * The message data posted by the web page.\n *\n * @since 0.1.0\n */\n data: unknown;\n}\n\n/**\n * The style of the dismiss button in the toolbar of the system browser.\n *\n * - `cancel`: A button with the text \"Cancel\".\n * - `close`: A button with the text \"Close\".\n * - `done`: A button with the text \"Done\".\n *\n * @since 0.1.0\n */\nexport type DismissButtonStyle = 'cancel' | 'close' | 'done';\n\n/**\n * The data store to use for the web view.\n *\n * - `isolated`: The web view uses a non-persistent data store. Cookies and\n * web storage are discarded when the web view is closed.\n * - `shared`: The web view uses the app-global data store which is shared\n * with other web views.\n *\n * @since 0.1.0\n */\nexport type WebViewDataStore = 'isolated' | 'shared';\n\n/**\n * @since 0.1.0\n */\nexport enum ErrorCode {\n /**\n * No app was found on the device that can open the URL.\n *\n * @since 0.1.0\n */\n BrowserNotFound = 'BROWSER_NOT_FOUND',\n /**\n * No browser is currently open.\n *\n * @since 0.1.0\n */\n NoBrowserOpen = 'NO_BROWSER_OPEN',\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const InAppBrowser = registerPlugin('InAppBrowser', {
|
|
3
|
+
web: () => import('./web').then(m => new m.InAppBrowserWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { InAppBrowser };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { InAppBrowserPlugin } from './definitions';\n\nconst InAppBrowser = registerPlugin<InAppBrowserPlugin>('InAppBrowser', {\n web: () => import('./web').then(m => new m.InAppBrowserWeb()),\n});\n\nexport * from './definitions';\nexport { InAppBrowser };\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { ExecuteScriptResult, GetCookiesResult, InAppBrowserPlugin, OpenInExternalBrowserOptions } from './definitions';
|
|
3
|
+
export declare class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {
|
|
4
|
+
private static errorUrlMissing;
|
|
5
|
+
clearCache(): Promise<void>;
|
|
6
|
+
clearSessionData(): Promise<void>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
executeScript(): Promise<ExecuteScriptResult>;
|
|
9
|
+
getCookies(): Promise<GetCookiesResult>;
|
|
10
|
+
openInExternalBrowser(options: OpenInExternalBrowserOptions): Promise<void>;
|
|
11
|
+
openInSystemBrowser(): Promise<void>;
|
|
12
|
+
openInWebView(): Promise<void>;
|
|
13
|
+
postMessage(): Promise<void>;
|
|
14
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class InAppBrowserWeb extends WebPlugin {
|
|
3
|
+
async clearCache() {
|
|
4
|
+
throw this.unimplemented('Not implemented on web.');
|
|
5
|
+
}
|
|
6
|
+
async clearSessionData() {
|
|
7
|
+
throw this.unimplemented('Not implemented on web.');
|
|
8
|
+
}
|
|
9
|
+
async close() {
|
|
10
|
+
throw this.unimplemented('Not implemented on web.');
|
|
11
|
+
}
|
|
12
|
+
async executeScript() {
|
|
13
|
+
throw this.unimplemented('Not implemented on web.');
|
|
14
|
+
}
|
|
15
|
+
async getCookies() {
|
|
16
|
+
throw this.unimplemented('Not implemented on web.');
|
|
17
|
+
}
|
|
18
|
+
async openInExternalBrowser(options) {
|
|
19
|
+
if (!options.url) {
|
|
20
|
+
throw new Error(InAppBrowserWeb.errorUrlMissing);
|
|
21
|
+
}
|
|
22
|
+
window.open(options.url, '_blank');
|
|
23
|
+
}
|
|
24
|
+
async openInSystemBrowser() {
|
|
25
|
+
throw this.unimplemented('Not implemented on web.');
|
|
26
|
+
}
|
|
27
|
+
async openInWebView() {
|
|
28
|
+
throw this.unimplemented('Not implemented on web.');
|
|
29
|
+
}
|
|
30
|
+
async postMessage() {
|
|
31
|
+
throw this.unimplemented('Not implemented on web.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
InAppBrowserWeb.errorUrlMissing = 'url must be provided.';
|
|
35
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAG5C,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,OAAqC;QAErC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;;AAzCc,+BAAe,GAAG,uBAAuB,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n ExecuteScriptResult,\n GetCookiesResult,\n InAppBrowserPlugin,\n OpenInExternalBrowserOptions,\n} from './definitions';\n\nexport class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {\n private static errorUrlMissing = 'url must be provided.';\n\n async clearCache(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async clearSessionData(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async close(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async executeScript(): Promise<ExecuteScriptResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getCookies(): Promise<GetCookiesResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async openInExternalBrowser(\n options: OpenInExternalBrowserOptions,\n ): Promise<void> {\n if (!options.url) {\n throw new Error(InAppBrowserWeb.errorUrlMissing);\n }\n window.open(options.url, '_blank');\n }\n\n async openInSystemBrowser(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async openInWebView(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async postMessage(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|