@capgo/inappbrowser 7.3.0 → 7.4.0
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/README.md +47 -41
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/InAppBrowserPlugin.java +149 -41
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/Options.java +65 -22
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewCallbacks.java +2 -0
- package/android/src/main/java/ee/forgr/capacitor_inappbrowser/WebViewDialog.java +660 -102
- package/android/src/main/res/drawable/ic_share.xml +10 -0
- package/android/src/main/res/layout/activity_browser.xml +8 -0
- package/android/src/main/res/layout/tool_bar.xml +19 -7
- package/android/src/main/res/values/strings.xml +2 -0
- package/dist/docs.json +169 -35
- package/dist/esm/definitions.d.ts +222 -29
- package/dist/esm/definitions.js +12 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js +12 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +12 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/InAppBrowserPlugin.swift +339 -44
- package/ios/Plugin/WKWebViewController.swift +478 -45
- package/package.json +1 -1
- package/ios/Plugin/Assets.xcassets/Back.imageset/Back.png +0 -0
- package/ios/Plugin/Assets.xcassets/Back.imageset/Back@2x.png +0 -0
- package/ios/Plugin/Assets.xcassets/Back.imageset/Back@3x.png +0 -0
- package/ios/Plugin/Assets.xcassets/Back.imageset/Contents.json +0 -26
- package/ios/Plugin/Assets.xcassets/Contents.json +0 -6
- package/ios/Plugin/Assets.xcassets/Forward.imageset/Contents.json +0 -26
- package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward.png +0 -0
- package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@2x.png +0 -0
- package/ios/Plugin/Assets.xcassets/Forward.imageset/Forward@3x.png +0 -0
|
@@ -23,10 +23,21 @@ export declare enum BackgroundColor {
|
|
|
23
23
|
BLACK = "black"
|
|
24
24
|
}
|
|
25
25
|
export declare enum ToolBarType {
|
|
26
|
+
/**
|
|
27
|
+
* Shows a simple toolbar with just a close button and share button
|
|
28
|
+
* @since 0.1.0
|
|
29
|
+
*/
|
|
26
30
|
ACTIVITY = "activity",
|
|
31
|
+
/**
|
|
32
|
+
* Shows a full navigation toolbar with back/forward buttons
|
|
33
|
+
* @since 0.1.0
|
|
34
|
+
*/
|
|
27
35
|
NAVIGATION = "navigation",
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Shows no toolbar
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
*/
|
|
40
|
+
BLANK = "blank"
|
|
30
41
|
}
|
|
31
42
|
export interface Headers {
|
|
32
43
|
[key: string]: string;
|
|
@@ -63,50 +74,127 @@ export interface OpenOptions {
|
|
|
63
74
|
* @since 0.1.0
|
|
64
75
|
*/
|
|
65
76
|
isPresentAfterPageLoad?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link
|
|
79
|
+
* @since 0.1.0
|
|
80
|
+
*/
|
|
66
81
|
preventDeeplink?: boolean;
|
|
67
82
|
}
|
|
68
83
|
export interface DisclaimerOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Title of the disclaimer dialog
|
|
86
|
+
* @default "Title"
|
|
87
|
+
*/
|
|
69
88
|
title: string;
|
|
89
|
+
/**
|
|
90
|
+
* Message shown in the disclaimer dialog
|
|
91
|
+
* @default "Message"
|
|
92
|
+
*/
|
|
70
93
|
message: string;
|
|
94
|
+
/**
|
|
95
|
+
* Text for the confirm button
|
|
96
|
+
* @default "Confirm"
|
|
97
|
+
*/
|
|
71
98
|
confirmBtn: string;
|
|
99
|
+
/**
|
|
100
|
+
* Text for the cancel button
|
|
101
|
+
* @default "Cancel"
|
|
102
|
+
*/
|
|
72
103
|
cancelBtn: string;
|
|
73
104
|
}
|
|
74
105
|
export interface OpenWebViewOptions {
|
|
75
106
|
/**
|
|
76
107
|
* Target URL to load.
|
|
77
108
|
* @since 0.1.0
|
|
109
|
+
* @example "https://capgo.app"
|
|
78
110
|
*/
|
|
79
111
|
url: string;
|
|
80
112
|
/**
|
|
81
113
|
* Headers to send with the request.
|
|
82
114
|
* @since 0.1.0
|
|
115
|
+
* @example
|
|
116
|
+
* headers: {
|
|
117
|
+
* 'Custom-Header': 'test-value',
|
|
118
|
+
* 'Authorization': 'Bearer test-token'
|
|
119
|
+
* }
|
|
120
|
+
* Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/
|
|
83
121
|
*/
|
|
84
122
|
headers?: Headers;
|
|
85
123
|
/**
|
|
86
124
|
* Credentials to send with the request and all subsequent requests for the same host.
|
|
87
125
|
* @since 6.1.0
|
|
126
|
+
* @example
|
|
127
|
+
* credentials: {
|
|
128
|
+
* username: 'test-user',
|
|
129
|
+
* password: 'test-pass'
|
|
130
|
+
* }
|
|
131
|
+
* Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/
|
|
88
132
|
*/
|
|
89
133
|
credentials?: Credentials;
|
|
90
134
|
/**
|
|
91
|
-
*
|
|
135
|
+
* JavaScript Interface:
|
|
136
|
+
* The webview automatically injects a JavaScript interface providing:
|
|
137
|
+
* - `window.mobileApp.close()`: Closes the webview from JavaScript
|
|
138
|
+
* - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via "messageFromWebview" event)
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* // In your webpage loaded in the webview:
|
|
142
|
+
* document.getElementById('closeBtn').addEventListener('click', () => {
|
|
143
|
+
* window.mobileApp.close();
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* // Send data to the app
|
|
147
|
+
* window.mobileApp.postMessage({ action: 'login', data: { user: 'test' }});
|
|
148
|
+
*
|
|
149
|
+
* @since 6.10.0
|
|
150
|
+
*/
|
|
151
|
+
jsInterface?: never;
|
|
152
|
+
/**
|
|
153
|
+
* Share options for the webview. When provided, shows a disclaimer dialog before sharing content.
|
|
154
|
+
* This is useful for:
|
|
155
|
+
* - Warning users about sharing sensitive information
|
|
156
|
+
* - Getting user consent before sharing
|
|
157
|
+
* - Explaining what will be shared
|
|
158
|
+
* - Complying with privacy regulations
|
|
159
|
+
*
|
|
160
|
+
* Note: shareSubject is required when using shareDisclaimer
|
|
92
161
|
* @since 0.1.0
|
|
162
|
+
* @example
|
|
163
|
+
* shareDisclaimer: {
|
|
164
|
+
* title: 'Disclaimer',
|
|
165
|
+
* message: 'This is a test disclaimer',
|
|
166
|
+
* confirmBtn: 'Accept',
|
|
167
|
+
* cancelBtn: 'Decline'
|
|
168
|
+
* }
|
|
169
|
+
* Test URL: https://capgo.app
|
|
93
170
|
*/
|
|
94
171
|
shareDisclaimer?: DisclaimerOptions;
|
|
95
172
|
/**
|
|
96
|
-
* Toolbar type
|
|
173
|
+
* Toolbar type determines the appearance and behavior of the browser's toolbar
|
|
174
|
+
* - "activity": Shows a simple toolbar with just a close button and share button
|
|
175
|
+
* - "navigation": Shows a full navigation toolbar with back/forward buttons
|
|
176
|
+
* - "blank": Shows no toolbar
|
|
177
|
+
* - "": Default toolbar with close button
|
|
97
178
|
* @since 0.1.0
|
|
98
179
|
* @default ToolBarType.DEFAULT
|
|
180
|
+
* @example
|
|
181
|
+
* toolbarType: ToolBarType.ACTIVITY,
|
|
182
|
+
* title: 'Activity Toolbar Test'
|
|
183
|
+
* Test URL: https://capgo.app
|
|
99
184
|
*/
|
|
100
185
|
toolbarType?: ToolBarType;
|
|
101
186
|
/**
|
|
102
|
-
*
|
|
187
|
+
* Subject text for sharing. Required when using shareDisclaimer.
|
|
188
|
+
* This text will be used as the subject line when sharing content.
|
|
103
189
|
* @since 0.1.0
|
|
190
|
+
* @example "Share this page"
|
|
104
191
|
*/
|
|
105
192
|
shareSubject?: string;
|
|
106
193
|
/**
|
|
107
194
|
* Title of the browser
|
|
108
195
|
* @since 0.1.0
|
|
109
196
|
* @default 'New Window'
|
|
197
|
+
* @example "Camera Test"
|
|
110
198
|
*/
|
|
111
199
|
title?: string;
|
|
112
200
|
/**
|
|
@@ -117,34 +205,40 @@ export interface OpenWebViewOptions {
|
|
|
117
205
|
backgroundColor?: BackgroundColor;
|
|
118
206
|
/**
|
|
119
207
|
* If true, active the native navigation within the webview, Android only
|
|
120
|
-
*
|
|
121
208
|
* @default false
|
|
209
|
+
* @example
|
|
210
|
+
* activeNativeNavigationForWebview: true,
|
|
211
|
+
* disableGoBackOnNativeApplication: true
|
|
212
|
+
* Test URL: https://capgo.app
|
|
122
213
|
*/
|
|
123
214
|
activeNativeNavigationForWebview?: boolean;
|
|
124
215
|
/**
|
|
125
216
|
* Disable the possibility to go back on native application,
|
|
126
|
-
*
|
|
127
|
-
*
|
|
217
|
+
* useful to force user to stay on the webview, Android only
|
|
128
218
|
* @default false
|
|
219
|
+
* @example
|
|
220
|
+
* disableGoBackOnNativeApplication: true
|
|
221
|
+
* Test URL: https://capgo.app
|
|
129
222
|
*/
|
|
130
223
|
disableGoBackOnNativeApplication?: boolean;
|
|
131
224
|
/**
|
|
132
225
|
* Open url in a new window fullscreen
|
|
133
|
-
*
|
|
134
226
|
* isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.
|
|
135
227
|
* @since 0.1.0
|
|
136
228
|
* @default false
|
|
229
|
+
* @example
|
|
230
|
+
* isPresentAfterPageLoad: true,
|
|
231
|
+
* preShowScript: "await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });"
|
|
232
|
+
* Test URL: https://capgo.app
|
|
137
233
|
*/
|
|
138
234
|
isPresentAfterPageLoad?: boolean;
|
|
139
235
|
/**
|
|
140
236
|
* Whether the website in the webview is inspectable or not, ios only
|
|
141
|
-
*
|
|
142
237
|
* @default false
|
|
143
238
|
*/
|
|
144
239
|
isInspectable?: boolean;
|
|
145
240
|
/**
|
|
146
241
|
* Whether the webview opening is animated or not, ios only
|
|
147
|
-
*
|
|
148
242
|
* @default true
|
|
149
243
|
*/
|
|
150
244
|
isAnimated?: boolean;
|
|
@@ -152,67 +246,84 @@ export interface OpenWebViewOptions {
|
|
|
152
246
|
* Shows a reload button that reloads the web page
|
|
153
247
|
* @since 1.0.15
|
|
154
248
|
* @default false
|
|
249
|
+
* @example
|
|
250
|
+
* showReloadButton: true
|
|
251
|
+
* Test URL: https://capgo.app
|
|
155
252
|
*/
|
|
156
253
|
showReloadButton?: boolean;
|
|
157
254
|
/**
|
|
158
255
|
* CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.
|
|
159
|
-
*
|
|
160
256
|
* @since 1.1.0
|
|
161
257
|
* @default false
|
|
258
|
+
* @example
|
|
259
|
+
* closeModal: true,
|
|
260
|
+
* closeModalTitle: 'Close Window',
|
|
261
|
+
* closeModalDescription: 'Are you sure you want to close?',
|
|
262
|
+
* closeModalOk: 'Yes, close',
|
|
263
|
+
* closeModalCancel: 'No, stay'
|
|
264
|
+
* Test URL: https://capgo.app
|
|
162
265
|
*/
|
|
163
266
|
closeModal?: boolean;
|
|
164
267
|
/**
|
|
165
|
-
* CloseModalTitle: title of the confirm when user clicks on close button
|
|
166
|
-
*
|
|
268
|
+
* CloseModalTitle: title of the confirm when user clicks on close button
|
|
167
269
|
* @since 1.1.0
|
|
168
270
|
* @default 'Close'
|
|
169
271
|
*/
|
|
170
272
|
closeModalTitle?: string;
|
|
171
273
|
/**
|
|
172
|
-
* CloseModalDescription: description of the confirm when user clicks on close button
|
|
173
|
-
*
|
|
274
|
+
* CloseModalDescription: description of the confirm when user clicks on close button
|
|
174
275
|
* @since 1.1.0
|
|
175
276
|
* @default 'Are you sure you want to close this window?'
|
|
176
277
|
*/
|
|
177
278
|
closeModalDescription?: string;
|
|
178
279
|
/**
|
|
179
|
-
* CloseModalOk: text of the confirm button when user clicks on close button
|
|
180
|
-
*
|
|
280
|
+
* CloseModalOk: text of the confirm button when user clicks on close button
|
|
181
281
|
* @since 1.1.0
|
|
182
282
|
* @default 'Close'
|
|
183
283
|
*/
|
|
184
284
|
closeModalOk?: string;
|
|
185
285
|
/**
|
|
186
|
-
* CloseModalCancel: text of the cancel button when user clicks on close button
|
|
187
|
-
*
|
|
286
|
+
* CloseModalCancel: text of the cancel button when user clicks on close button
|
|
188
287
|
* @since 1.1.0
|
|
189
288
|
* @default 'Cancel'
|
|
190
289
|
*/
|
|
191
290
|
closeModalCancel?: string;
|
|
192
291
|
/**
|
|
193
292
|
* visibleTitle: if true the website title would be shown else shown empty
|
|
194
|
-
*
|
|
195
293
|
* @since 1.2.5
|
|
196
294
|
* @default true
|
|
197
295
|
*/
|
|
198
296
|
visibleTitle?: boolean;
|
|
199
297
|
/**
|
|
200
298
|
* toolbarColor: color of the toolbar in hex format
|
|
201
|
-
*
|
|
202
299
|
* @since 1.2.5
|
|
203
|
-
* @default '#ffffff'
|
|
300
|
+
* @default '#ffffff'
|
|
301
|
+
* @example
|
|
302
|
+
* toolbarColor: '#FF5733'
|
|
303
|
+
* Test URL: https://capgo.app
|
|
204
304
|
*/
|
|
205
305
|
toolbarColor?: string;
|
|
306
|
+
/**
|
|
307
|
+
* toolbarTextColor: color of the buttons and title in the toolbar in hex format
|
|
308
|
+
* When set, it overrides the automatic light/dark mode detection for text color
|
|
309
|
+
* @since 6.10.0
|
|
310
|
+
* @default calculated based on toolbarColor brightness
|
|
311
|
+
* @example
|
|
312
|
+
* toolbarTextColor: '#FFFFFF'
|
|
313
|
+
* Test URL: https://capgo.app
|
|
314
|
+
*/
|
|
315
|
+
toolbarTextColor?: string;
|
|
206
316
|
/**
|
|
207
317
|
* showArrow: if true an arrow would be shown instead of cross for closing the window
|
|
208
|
-
*
|
|
209
318
|
* @since 1.2.5
|
|
210
319
|
* @default false
|
|
320
|
+
* @example
|
|
321
|
+
* showArrow: true
|
|
322
|
+
* Test URL: https://capgo.app
|
|
211
323
|
*/
|
|
212
324
|
showArrow?: boolean;
|
|
213
325
|
/**
|
|
214
326
|
* ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.
|
|
215
|
-
*
|
|
216
327
|
* @since 6.1.0
|
|
217
328
|
* @default false
|
|
218
329
|
*/
|
|
@@ -220,20 +331,46 @@ export interface OpenWebViewOptions {
|
|
|
220
331
|
/**
|
|
221
332
|
* preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.
|
|
222
333
|
* This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)
|
|
223
|
-
*
|
|
224
334
|
* @since 6.6.0
|
|
335
|
+
* @example
|
|
336
|
+
* preShowScript: "await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });"
|
|
337
|
+
* Test URL: https://capgo.app
|
|
225
338
|
*/
|
|
226
339
|
preShowScript?: string;
|
|
227
340
|
/**
|
|
228
341
|
* proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)
|
|
229
|
-
*
|
|
230
342
|
* @since 6.9.0
|
|
231
343
|
*/
|
|
232
344
|
proxyRequests?: string;
|
|
233
345
|
/**
|
|
234
|
-
* buttonNearDone allows for a creation of a custom button
|
|
346
|
+
* buttonNearDone allows for a creation of a custom button near the done/close button.
|
|
347
|
+
* The button is only shown when toolbarType is not "activity", "navigation", or "blank".
|
|
348
|
+
*
|
|
349
|
+
* For Android:
|
|
350
|
+
* - iconType must be "asset"
|
|
351
|
+
* - icon path should be in the public folder (e.g. "monkey.svg")
|
|
352
|
+
* - width and height are optional, defaults to 48dp
|
|
353
|
+
* - button is positioned at the end of toolbar with 8dp margin
|
|
235
354
|
*
|
|
355
|
+
* For iOS:
|
|
356
|
+
* - iconType can be "sf-symbol" or "asset"
|
|
357
|
+
* - for sf-symbol, icon should be the symbol name
|
|
358
|
+
* - for asset, icon should be the asset name
|
|
236
359
|
* @since 6.7.0
|
|
360
|
+
* @example
|
|
361
|
+
* buttonNearDone: {
|
|
362
|
+
* ios: {
|
|
363
|
+
* iconType: 'sf-symbol',
|
|
364
|
+
* icon: 'star.fill'
|
|
365
|
+
* },
|
|
366
|
+
* android: {
|
|
367
|
+
* iconType: 'asset',
|
|
368
|
+
* icon: 'public/monkey.svg',
|
|
369
|
+
* width: 24,
|
|
370
|
+
* height: 24
|
|
371
|
+
* }
|
|
372
|
+
* }
|
|
373
|
+
* Test URL: https://capgo.app
|
|
237
374
|
*/
|
|
238
375
|
buttonNearDone?: {
|
|
239
376
|
ios: {
|
|
@@ -241,7 +378,7 @@ export interface OpenWebViewOptions {
|
|
|
241
378
|
icon: string;
|
|
242
379
|
};
|
|
243
380
|
android: {
|
|
244
|
-
iconType: "asset";
|
|
381
|
+
iconType: "asset" | "vector";
|
|
245
382
|
icon: string;
|
|
246
383
|
width?: number;
|
|
247
384
|
height?: number;
|
|
@@ -286,6 +423,11 @@ export interface InAppBrowserPlugin {
|
|
|
286
423
|
/**
|
|
287
424
|
* Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.
|
|
288
425
|
*
|
|
426
|
+
* JavaScript Interface:
|
|
427
|
+
* When you open a webview with this method, a JavaScript interface is automatically injected that provides:
|
|
428
|
+
* - `window.mobileApp.close()`: Closes the webview from JavaScript
|
|
429
|
+
* - `window.mobileApp.postMessage(obj)`: Sends a message from the webview to the app
|
|
430
|
+
*
|
|
289
431
|
* @since 0.1.0
|
|
290
432
|
*/
|
|
291
433
|
openWebView(options: OpenWebViewOptions): Promise<any>;
|
|
@@ -359,3 +501,54 @@ export interface InAppBrowserPlugin {
|
|
|
359
501
|
*/
|
|
360
502
|
reload(): Promise<any>;
|
|
361
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* JavaScript APIs available in the InAppBrowser WebView.
|
|
506
|
+
*
|
|
507
|
+
* These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* // Closing the webview from JavaScript
|
|
511
|
+
* window.mobileApp.close();
|
|
512
|
+
*
|
|
513
|
+
* // Sending a message from webview to the native app
|
|
514
|
+
* window.mobileApp.postMessage({ key: 'value' });
|
|
515
|
+
*
|
|
516
|
+
* @since 6.10.0
|
|
517
|
+
*/
|
|
518
|
+
export interface InAppBrowserWebViewAPIs {
|
|
519
|
+
/**
|
|
520
|
+
* mobileApp - Global object injected into the WebView providing communication with the native app
|
|
521
|
+
*/
|
|
522
|
+
mobileApp: {
|
|
523
|
+
/**
|
|
524
|
+
* Close the WebView from JavaScript
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* // Add a button to close the webview
|
|
528
|
+
* const closeButton = document.createElement('button');
|
|
529
|
+
* closeButton.textContent = 'Close WebView';
|
|
530
|
+
* closeButton.addEventListener('click', () => {
|
|
531
|
+
* window.mobileApp.close();
|
|
532
|
+
* });
|
|
533
|
+
* document.body.appendChild(closeButton);
|
|
534
|
+
*
|
|
535
|
+
* @since 6.10.0
|
|
536
|
+
*/
|
|
537
|
+
close(): void;
|
|
538
|
+
/**
|
|
539
|
+
* Send a message from the WebView to the native app
|
|
540
|
+
* The native app can listen for these messages with the "messageFromWebview" event
|
|
541
|
+
*
|
|
542
|
+
* @param message Object to send to the native app
|
|
543
|
+
* @example
|
|
544
|
+
* // Send data to native app
|
|
545
|
+
* window.mobileApp.postMessage({
|
|
546
|
+
* action: 'dataSubmitted',
|
|
547
|
+
* data: { username: 'test', email: 'test@example.com' }
|
|
548
|
+
* });
|
|
549
|
+
*
|
|
550
|
+
* @since 6.10.0
|
|
551
|
+
*/
|
|
552
|
+
postMessage(message: Record<string, any>): void;
|
|
553
|
+
};
|
|
554
|
+
}
|
package/dist/esm/definitions.js
CHANGED
|
@@ -5,9 +5,20 @@ export var BackgroundColor;
|
|
|
5
5
|
})(BackgroundColor || (BackgroundColor = {}));
|
|
6
6
|
export var ToolBarType;
|
|
7
7
|
(function (ToolBarType) {
|
|
8
|
+
/**
|
|
9
|
+
* Shows a simple toolbar with just a close button and share button
|
|
10
|
+
* @since 0.1.0
|
|
11
|
+
*/
|
|
8
12
|
ToolBarType["ACTIVITY"] = "activity";
|
|
13
|
+
/**
|
|
14
|
+
* Shows a full navigation toolbar with back/forward buttons
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
9
17
|
ToolBarType["NAVIGATION"] = "navigation";
|
|
18
|
+
/**
|
|
19
|
+
* Shows no toolbar
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
*/
|
|
10
22
|
ToolBarType["BLANK"] = "blank";
|
|
11
|
-
ToolBarType["DEFAULT"] = "";
|
|
12
23
|
})(ToolBarType || (ToolBarType = {}));
|
|
13
24
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,2BAAY,CAAA;AACd,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n ACTIVITY = \"activity\",\n NAVIGATION = \"navigation\",\n BLANK = \"blank\",\n DEFAULT = \"\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n */\n credentials?: Credentials;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n title: string;\n message: string;\n confirmBtn: string;\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n */\n credentials?: Credentials;\n /**\n * share options\n * @since 0.1.0\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n */\n toolbarType?: ToolBarType;\n /**\n * Share subject\n * @since 0.1.0\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n */\n title?: string;\n /**\n * Background color of the browser, only on IOS\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, active the native navigation within the webview, Android only\n *\n * @default false\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * usefull to force user to stay on the webview, Android only\n *\n * @default false\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n *\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n *\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n *\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n *\n * @since 1.1.0\n * @default false\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button, only on IOS\n *\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n *\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n *\n * @since 1.2.5\n * @default '#ffffff''\n */\n toolbarColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n *\n * @since 1.2.5\n * @default false\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n *\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n *\n * @since 6.6.0\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n *\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button. Please see [buttonNearDone.md](/buttonNearDone.md) for more info.\n *\n * @since 6.7.0\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Open url in a new window fullscreen\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n *\n * @since 6.5.0\n */\n clearAllCookies(): Promise<any>;\n\n /**\n * Clear cache\n *\n * @since 6.5.0\n */\n clearCache(): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n */\n close(): Promise<any>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<any>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n */\n executeScript({ code }: { code: string }): Promise<void>;\n /**\n * Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addListener(\"messageFromNative\", listenerFunc: (event: Record<string, any>) => void)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n */\n postMessage(options: { detail: Record<string, any> }): Promise<void>;\n /**\n * Sets the URL of the webview.\n */\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>; // Add this line\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AACD,MAAM,CAAN,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EAhBW,WAAW,KAAX,WAAW,QAgBtB","sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface UrlEvent {\n /**\n * Emit when the url changes\n *\n * @since 0.0.1\n */\n url: string;\n}\nexport interface BtnEvent {\n /**\n * Emit when a button is clicked.\n *\n * @since 0.0.1\n */\n url: string;\n}\n\nexport type UrlChangeListener = (state: UrlEvent) => void;\nexport type ConfirmBtnListener = (state: BtnEvent) => void;\nexport type ButtonNearListener = (state: object) => void;\n\nexport enum BackgroundColor {\n WHITE = \"white\",\n BLACK = \"black\",\n}\nexport enum ToolBarType {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ACTIVITY = \"activity\",\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n NAVIGATION = \"navigation\",\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n BLANK = \"blank\",\n}\n\nexport interface Headers {\n [key: string]: string;\n}\n\nexport interface GetCookieOptions {\n url: string;\n includeHttpOnly?: boolean;\n}\n\nexport interface ClearCookieOptions {\n url: string;\n}\n\nexport interface Credentials {\n username: string;\n password: string;\n}\n\nexport interface OpenOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n */\n credentials?: Credentials;\n /**\n * if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * if true the deeplink will not be opened, if false the deeplink will be opened when clicked on the link\n * @since 0.1.0\n */\n preventDeeplink?: boolean;\n}\n\nexport interface DisclaimerOptions {\n /**\n * Title of the disclaimer dialog\n * @default \"Title\"\n */\n title: string;\n /**\n * Message shown in the disclaimer dialog\n * @default \"Message\"\n */\n message: string;\n /**\n * Text for the confirm button\n * @default \"Confirm\"\n */\n confirmBtn: string;\n /**\n * Text for the cancel button\n * @default \"Cancel\"\n */\n cancelBtn: string;\n}\n\nexport interface OpenWebViewOptions {\n /**\n * Target URL to load.\n * @since 0.1.0\n * @example \"https://capgo.app\"\n */\n url: string;\n /**\n * Headers to send with the request.\n * @since 0.1.0\n * @example\n * headers: {\n * 'Custom-Header': 'test-value',\n * 'Authorization': 'Bearer test-token'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n headers?: Headers;\n /**\n * Credentials to send with the request and all subsequent requests for the same host.\n * @since 6.1.0\n * @example\n * credentials: {\n * username: 'test-user',\n * password: 'test-pass'\n * }\n * Test URL: https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/\n */\n credentials?: Credentials;\n /**\n * JavaScript Interface:\n * The webview automatically injects a JavaScript interface providing:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via \"messageFromWebview\" event)\n *\n * @example\n * // In your webpage loaded in the webview:\n * document.getElementById('closeBtn').addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n *\n * // Send data to the app\n * window.mobileApp.postMessage({ action: 'login', data: { user: 'test' }});\n *\n * @since 6.10.0\n */\n jsInterface?: never; // This property doesn't exist, it's just for documentation\n /**\n * Share options for the webview. When provided, shows a disclaimer dialog before sharing content.\n * This is useful for:\n * - Warning users about sharing sensitive information\n * - Getting user consent before sharing\n * - Explaining what will be shared\n * - Complying with privacy regulations\n *\n * Note: shareSubject is required when using shareDisclaimer\n * @since 0.1.0\n * @example\n * shareDisclaimer: {\n * title: 'Disclaimer',\n * message: 'This is a test disclaimer',\n * confirmBtn: 'Accept',\n * cancelBtn: 'Decline'\n * }\n * Test URL: https://capgo.app\n */\n shareDisclaimer?: DisclaimerOptions;\n /**\n * Toolbar type determines the appearance and behavior of the browser's toolbar\n * - \"activity\": Shows a simple toolbar with just a close button and share button\n * - \"navigation\": Shows a full navigation toolbar with back/forward buttons\n * - \"blank\": Shows no toolbar\n * - \"\": Default toolbar with close button\n * @since 0.1.0\n * @default ToolBarType.DEFAULT\n * @example\n * toolbarType: ToolBarType.ACTIVITY,\n * title: 'Activity Toolbar Test'\n * Test URL: https://capgo.app\n */\n toolbarType?: ToolBarType;\n /**\n * Subject text for sharing. Required when using shareDisclaimer.\n * This text will be used as the subject line when sharing content.\n * @since 0.1.0\n * @example \"Share this page\"\n */\n shareSubject?: string;\n /**\n * Title of the browser\n * @since 0.1.0\n * @default 'New Window'\n * @example \"Camera Test\"\n */\n title?: string;\n /**\n * Background color of the browser, only on IOS\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, active the native navigation within the webview, Android only\n * @default false\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: 'Close Window',\n * closeModalDescription: 'Are you sure you want to close?',\n * closeModalOk: 'Yes, close',\n * closeModalCancel: 'No, stay'\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default '#ffffff'\n * @example\n * toolbarColor: '#FF5733'\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: '#FFFFFF'\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: 'sf-symbol',\n * icon: 'star.fill'\n * },\n * android: {\n * iconType: 'asset',\n * icon: 'public/monkey.svg',\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\" | \"vector\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Open url in a new window fullscreen\n *\n * @since 0.1.0\n */\n open(options: OpenOptions): Promise<any>;\n\n /**\n * Clear cookies of url\n *\n * @since 0.5.0\n */\n clearCookies(options: ClearCookieOptions): Promise<any>;\n /**\n * Clear all cookies\n *\n * @since 6.5.0\n */\n clearAllCookies(): Promise<any>;\n\n /**\n * Clear cache\n *\n * @since 6.5.0\n */\n clearCache(): Promise<any>;\n\n /**\n * Get cookies for a specific URL.\n * @param options The options, including the URL to get cookies for.\n * @returns A promise that resolves with the cookies.\n */\n getCookies(options: GetCookieOptions): Promise<Record<string, string>>;\n /**\n * Close the webview.\n */\n close(): Promise<any>;\n /**\n * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.\n *\n * JavaScript Interface:\n * When you open a webview with this method, a JavaScript interface is automatically injected that provides:\n * - `window.mobileApp.close()`: Closes the webview from JavaScript\n * - `window.mobileApp.postMessage(obj)`: Sends a message from the webview to the app\n *\n * @since 0.1.0\n */\n openWebView(options: OpenWebViewOptions): Promise<any>;\n /**\n * Injects JavaScript code into the InAppBrowser window.\n */\n executeScript({ code }: { code: string }): Promise<void>;\n /**\n * Sends an event to the webview(inappbrowser). you can listen to this event in the inappbrowser JS with window.addListener(\"messageFromNative\", listenerFunc: (event: Record<string, any>) => void)\n * detail is the data you want to send to the webview, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, so no functions or other non-JSON-serializable types are allowed.\n */\n postMessage(options: { detail: Record<string, any> }): Promise<void>;\n /**\n * Sets the URL of the webview.\n */\n setUrl(options: { url: string }): Promise<any>;\n /**\n * Listen for url change, only for openWebView\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: 'value' });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement('button');\n * closeButton.textContent = 'Close WebView';\n * closeButton.addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: 'dataSubmitted',\n * data: { username: 'test', email: 'test@example.com' }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n };\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -9,10 +9,21 @@ exports.BackgroundColor = void 0;
|
|
|
9
9
|
})(exports.BackgroundColor || (exports.BackgroundColor = {}));
|
|
10
10
|
exports.ToolBarType = void 0;
|
|
11
11
|
(function (ToolBarType) {
|
|
12
|
+
/**
|
|
13
|
+
* Shows a simple toolbar with just a close button and share button
|
|
14
|
+
* @since 0.1.0
|
|
15
|
+
*/
|
|
12
16
|
ToolBarType["ACTIVITY"] = "activity";
|
|
17
|
+
/**
|
|
18
|
+
* Shows a full navigation toolbar with back/forward buttons
|
|
19
|
+
* @since 0.1.0
|
|
20
|
+
*/
|
|
13
21
|
ToolBarType["NAVIGATION"] = "navigation";
|
|
22
|
+
/**
|
|
23
|
+
* Shows no toolbar
|
|
24
|
+
* @since 0.1.0
|
|
25
|
+
*/
|
|
14
26
|
ToolBarType["BLANK"] = "blank";
|
|
15
|
-
ToolBarType["DEFAULT"] = "";
|
|
16
27
|
})(exports.ToolBarType || (exports.ToolBarType = {}));
|
|
17
28
|
|
|
18
29
|
const InAppBrowser = core.registerPlugin("InAppBrowser", {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log(\"clearAllCookies\");\n return Promise.resolve();\n }\n clearCache() {\n console.log(\"clearCache\");\n return Promise.resolve();\n }\n async open(options) {\n console.log(\"open\", options);\n return options;\n }\n async clearCookies(options) {\n console.log(\"cleanCookies\", options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log(\"openWebView\", options);\n return options;\n }\n async executeScript({ code }) {\n console.log(\"code\", code);\n return code;\n }\n async close() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n async reload() {\n console.log(\"reload\");\n return;\n }\n async postMessage(options) {\n console.log(\"postMessage\", options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;AACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU;AACxC;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;AAC5C;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACrBhC,MAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,eAAe,GAAG;AACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACtC,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC;AACA,IAAI,UAAU,GAAG;AACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AACjC,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;AAChC;AACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC;AAC5C,QAAQ;AACR;AACA,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B;AACA,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAC3C,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;AAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;AACjC,QAAQ,OAAO,IAAI;AACnB;AACA,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;AAC5B,QAAQ;AACR;AACA,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;AAC1C,QAAQ;AACR;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC7B,QAAQ;AACR;AACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAC3C,QAAQ,OAAO,OAAO;AACtB;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -8,10 +8,21 @@ var capacitorInAppBrowser = (function (exports, core) {
|
|
|
8
8
|
})(exports.BackgroundColor || (exports.BackgroundColor = {}));
|
|
9
9
|
exports.ToolBarType = void 0;
|
|
10
10
|
(function (ToolBarType) {
|
|
11
|
+
/**
|
|
12
|
+
* Shows a simple toolbar with just a close button and share button
|
|
13
|
+
* @since 0.1.0
|
|
14
|
+
*/
|
|
11
15
|
ToolBarType["ACTIVITY"] = "activity";
|
|
16
|
+
/**
|
|
17
|
+
* Shows a full navigation toolbar with back/forward buttons
|
|
18
|
+
* @since 0.1.0
|
|
19
|
+
*/
|
|
12
20
|
ToolBarType["NAVIGATION"] = "navigation";
|
|
21
|
+
/**
|
|
22
|
+
* Shows no toolbar
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
*/
|
|
13
25
|
ToolBarType["BLANK"] = "blank";
|
|
14
|
-
ToolBarType["DEFAULT"] = "";
|
|
15
26
|
})(exports.ToolBarType || (exports.ToolBarType = {}));
|
|
16
27
|
|
|
17
28
|
const InAppBrowser = core.registerPlugin("InAppBrowser", {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n /**\n * Shows a simple toolbar with just a close button and share button\n * @since 0.1.0\n */\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n /**\n * Shows a full navigation toolbar with back/forward buttons\n * @since 0.1.0\n */\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n /**\n * Shows no toolbar\n * @since 0.1.0\n */\n ToolBarType[\"BLANK\"] = \"blank\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst InAppBrowser = registerPlugin(\"InAppBrowser\", {\n web: () => import(\"./web\").then((m) => new m.InAppBrowserWeb()),\n});\nexport * from \"./definitions\";\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class InAppBrowserWeb extends WebPlugin {\n clearAllCookies() {\n console.log(\"clearAllCookies\");\n return Promise.resolve();\n }\n clearCache() {\n console.log(\"clearCache\");\n return Promise.resolve();\n }\n async open(options) {\n console.log(\"open\", options);\n return options;\n }\n async clearCookies(options) {\n console.log(\"cleanCookies\", options);\n return;\n }\n async getCookies(options) {\n // Web implementation to get cookies\n return options;\n }\n async openWebView(options) {\n console.log(\"openWebView\", options);\n return options;\n }\n async executeScript({ code }) {\n console.log(\"code\", code);\n return code;\n }\n async close() {\n console.log(\"close\");\n return;\n }\n async setUrl(options) {\n console.log(\"setUrl\", options.url);\n return;\n }\n async reload() {\n console.log(\"reload\");\n return;\n }\n async postMessage(options) {\n console.log(\"postMessage\", options);\n return options;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO;IACtC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC;AAClCC;IACX,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU;IACxC;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;IAC5C;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACrBhC,UAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,eAAe,GAAG;IACtB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACtC,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;IAChC;IACA,IAAI,UAAU,GAAG;IACjB,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACjC,QAAQ,OAAO,OAAO,CAAC,OAAO,EAAE;IAChC;IACA,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC;IAC5C,QAAQ;IACR;IACA,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B;IACA,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;IAC3C,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;IAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IACjC,QAAQ,OAAO,IAAI;IACnB;IACA,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IAC5B,QAAQ;IACR;IACA,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;IAC1C,QAAQ;IACR;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7B,QAAQ;IACR;IACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;IAC3C,QAAQ,OAAO,OAAO;IACtB;IACA;;;;;;;;;;;;;;;"}
|