@capgo/inappbrowser 8.1.1 → 8.1.3

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 CHANGED
@@ -205,6 +205,8 @@ window.mobileApp.close();
205
205
  * [`clearCache()`](#clearcache)
206
206
  * [`getCookies(...)`](#getcookies)
207
207
  * [`close(...)`](#close)
208
+ * [`hide()`](#hide)
209
+ * [`show()`](#show)
208
210
  * [`openWebView(...)`](#openwebview)
209
211
  * [`executeScript(...)`](#executescript)
210
212
  * [`postMessage(...)`](#postmessage)
@@ -345,6 +347,33 @@ Close the webview.
345
347
  --------------------
346
348
 
347
349
 
350
+ ### hide()
351
+
352
+ ```typescript
353
+ hide() => Promise<void>
354
+ ```
355
+
356
+ Hide the webview without closing it.
357
+ Use show() to bring it back.
358
+
359
+ **Since:** 8.0.8
360
+
361
+ --------------------
362
+
363
+
364
+ ### show()
365
+
366
+ ```typescript
367
+ show() => Promise<void>
368
+ ```
369
+
370
+ Show a previously hidden webview.
371
+
372
+ **Since:** 8.0.8
373
+
374
+ --------------------
375
+
376
+
348
377
  ### openWebView(...)
349
378
 
350
379
  ```typescript
@@ -648,7 +677,7 @@ Allows changing the size and position of the webview at runtime.
648
677
  | **`headers`** | <code><a href="#headers">Headers</a></code> | <a href="#headers">Headers</a> to send with the request. | | 0.1.0 |
649
678
  | **`credentials`** | <code><a href="#credentials">Credentials</a></code> | <a href="#credentials">Credentials</a> to send with the request and all subsequent requests for the same host. | | 6.1.0 |
650
679
  | **`materialPicker`** | <code>boolean</code> | materialPicker: if true, uses Material Design theme for date and time pickers on Android. This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers. | <code>false</code> | 7.4.1 |
651
- | **`jsInterface`** | | JavaScript Interface: The webview automatically injects a JavaScript interface providing: - `window.mobileApp.close()`: Closes the webview from JavaScript - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via "messageFromWebview" event) | | 6.10.0 |
680
+ | **`jsInterface`** | | JavaScript Interface: The webview automatically injects a JavaScript interface providing: - `window.mobileApp.close()`: Closes the webview from JavaScript - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via "messageFromWebview" event) - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig | | 6.10.0 |
652
681
  | **`shareDisclaimer`** | <code><a href="#disclaimeroptions">DisclaimerOptions</a></code> | Share options for the webview. When provided, shows a disclaimer dialog before sharing content. This is useful for: - Warning users about sharing sensitive information - Getting user consent before sharing - Explaining what will be shared - Complying with privacy regulations Note: shareSubject is required when using shareDisclaimer | | 0.1.0 |
653
682
  | **`toolbarType`** | <code><a href="#toolbartype">ToolBarType</a></code> | Toolbar type determines the appearance and behavior of the browser's toolbar - "activity": Shows a simple toolbar with just a close button and share button - "navigation": Shows a full navigation toolbar with back/forward buttons - "blank": Shows no toolbar - "": Default toolbar with close button | <code>ToolBarType.DEFAULT</code> | 0.1.0 |
654
683
  | **`shareSubject`** | <code>string</code> | Subject text for sharing. Required when using shareDisclaimer. This text will be used as the subject line when sharing content. | | 0.1.0 |
@@ -50,7 +50,7 @@ import org.json.JSONObject;
50
50
  )
51
51
  public class InAppBrowserPlugin extends Plugin implements WebViewDialog.PermissionHandler {
52
52
 
53
- private final String pluginVersion = "8.1.1";
53
+ private final String pluginVersion = "8.1.3";
54
54
 
55
55
  public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome"; // Change when in stable
56
56
  private CustomTabsClient customTabsClient;
@@ -673,6 +673,8 @@ public class InAppBrowserPlugin extends Plugin implements WebViewDialog.Permissi
673
673
  }
674
674
 
675
675
  options.setHidden(Boolean.TRUE.equals(call.getBoolean("hidden", false)));
676
+ boolean allowWebViewJsVisibilityControl = getConfig().getBoolean("allowWebViewJsVisibilityControl", false);
677
+ options.setAllowWebViewJsVisibilityControl(allowWebViewJsVisibilityControl);
676
678
  options.setInvisibilityMode(Options.InvisibilityMode.fromString(call.getString("invisibilityMode", "AWARE")));
677
679
 
678
680
  this.getActivity().runOnUiThread(
@@ -736,6 +738,53 @@ public class InAppBrowserPlugin extends Plugin implements WebViewDialog.Permissi
736
738
  );
737
739
  }
738
740
 
741
+ @PluginMethod
742
+ public void hide(PluginCall call) {
743
+ if (webViewDialog == null) {
744
+ call.reject("WebView is not initialized");
745
+ return;
746
+ }
747
+
748
+ this.getActivity().runOnUiThread(
749
+ new Runnable() {
750
+ @Override
751
+ public void run() {
752
+ if (webViewDialog == null) {
753
+ call.reject("WebView is not initialized");
754
+ return;
755
+ }
756
+ webViewDialog.setHidden(true);
757
+ call.resolve();
758
+ }
759
+ }
760
+ );
761
+ }
762
+
763
+ @PluginMethod
764
+ public void show(PluginCall call) {
765
+ if (webViewDialog == null) {
766
+ call.reject("WebView is not initialized");
767
+ return;
768
+ }
769
+
770
+ this.getActivity().runOnUiThread(
771
+ new Runnable() {
772
+ @Override
773
+ public void run() {
774
+ if (webViewDialog == null) {
775
+ call.reject("WebView is not initialized");
776
+ return;
777
+ }
778
+ if (!webViewDialog.isShowing()) {
779
+ webViewDialog.show();
780
+ }
781
+ webViewDialog.setHidden(false);
782
+ call.resolve();
783
+ }
784
+ }
785
+ );
786
+ }
787
+
739
788
  @PluginMethod
740
789
  public void executeScript(PluginCall call) {
741
790
  String script = call.getString("code");
@@ -184,6 +184,7 @@ public class Options {
184
184
  private Integer x = null;
185
185
  private Integer y = null;
186
186
  private boolean hidden = false;
187
+ private boolean allowWebViewJsVisibilityControl = false;
187
188
  private InvisibilityMode invisibilityMode = InvisibilityMode.AWARE;
188
189
 
189
190
  public Integer getWidth() {
@@ -511,6 +512,14 @@ public class Options {
511
512
  this.hidden = hidden;
512
513
  }
513
514
 
515
+ public boolean getAllowWebViewJsVisibilityControl() {
516
+ return allowWebViewJsVisibilityControl;
517
+ }
518
+
519
+ public void setAllowWebViewJsVisibilityControl(boolean allowWebViewJsVisibilityControl) {
520
+ this.allowWebViewJsVisibilityControl = allowWebViewJsVisibilityControl;
521
+ }
522
+
514
523
  public InvisibilityMode getInvisibilityMode() {
515
524
  return invisibilityMode;
516
525
  }
@@ -16,6 +16,7 @@ import android.graphics.Color;
16
16
  import android.graphics.Paint;
17
17
  import android.graphics.PorterDuff;
18
18
  import android.graphics.PorterDuffColorFilter;
19
+ import android.graphics.drawable.Drawable;
19
20
  import android.net.Uri;
20
21
  import android.net.http.SslError;
21
22
  import android.os.Build;
@@ -116,6 +117,14 @@ public class WebViewDialog extends Dialog {
116
117
  private final Map<String, ProxiedRequest> proxiedRequestsHashmap = new HashMap<>();
117
118
  private final ExecutorService executorService = Executors.newCachedThreadPool();
118
119
  private int iconColor = Color.BLACK; // Default icon color
120
+ private boolean isHiddenModeActive = false;
121
+ private WindowManager.LayoutParams previousWindowAttributes;
122
+ private Drawable previousWindowBackground;
123
+ private ViewGroup.LayoutParams previousWebViewLayoutParams;
124
+ private float previousDecorAlpha = 1f;
125
+ private int previousDecorVisibility = View.VISIBLE;
126
+ private float previousWebViewAlpha = 1f;
127
+ private int previousWebViewVisibility = View.VISIBLE;
119
128
 
120
129
  Semaphore preShowSemaphore = null;
121
130
  String preShowError = null;
@@ -194,6 +203,41 @@ public class WebViewDialog extends Dialog {
194
203
  Log.e("InAppBrowser", "Error in close: " + e.getMessage());
195
204
  }
196
205
  }
206
+
207
+ @JavascriptInterface
208
+ public void hide() {
209
+ if (!isJavaScriptControlAllowed()) {
210
+ Log.w("InAppBrowser", "hide() blocked: allowWebViewJsVisibilityControl is false");
211
+ return;
212
+ }
213
+ if (activity == null) {
214
+ Log.e("InAppBrowser", "Cannot hide - activity is null");
215
+ return;
216
+ }
217
+ activity.runOnUiThread(() -> setHidden(true));
218
+ }
219
+
220
+ @JavascriptInterface
221
+ public void show() {
222
+ if (!isJavaScriptControlAllowed()) {
223
+ Log.w("InAppBrowser", "show() blocked: allowWebViewJsVisibilityControl is false");
224
+ return;
225
+ }
226
+ if (activity == null) {
227
+ Log.e("InAppBrowser", "Cannot show - activity is null");
228
+ return;
229
+ }
230
+ activity.runOnUiThread(() -> {
231
+ if (!isShowing()) {
232
+ WebViewDialog.this.show();
233
+ }
234
+ setHidden(false);
235
+ });
236
+ }
237
+ }
238
+
239
+ private boolean isJavaScriptControlAllowed() {
240
+ return _options != null && _options.getAllowWebViewJsVisibilityControl();
197
241
  }
198
242
 
199
243
  public class PreShowScriptInterface {
@@ -899,22 +943,101 @@ public class WebViewDialog extends Dialog {
899
943
  return;
900
944
  }
901
945
 
946
+ previousWindowAttributes = new WindowManager.LayoutParams();
947
+ previousWindowAttributes.copyFrom(window.getAttributes());
948
+ previousWindowBackground = window.getDecorView().getBackground();
949
+
950
+ View decorView = window.getDecorView();
951
+ if (decorView != null) {
952
+ previousDecorAlpha = decorView.getAlpha();
953
+ previousDecorVisibility = decorView.getVisibility();
954
+ }
955
+
956
+ if (_webView != null) {
957
+ previousWebViewAlpha = _webView.getAlpha();
958
+ previousWebViewVisibility = _webView.getVisibility();
959
+ previousWebViewLayoutParams = _webView.getLayoutParams();
960
+ }
961
+
902
962
  window.setBackgroundDrawableResource(android.R.color.transparent);
903
963
  window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
904
964
  window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
905
965
  window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
906
966
  window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
907
967
 
908
- View decorView = window.getDecorView();
909
968
  if (decorView != null) {
910
969
  decorView.setAlpha(0f);
911
970
  decorView.setVisibility(View.VISIBLE);
912
971
  }
913
972
 
914
973
  if (_webView != null) {
915
- _webView.setAlpha(0f);
916
- _webView.setVisibility(View.VISIBLE);
974
+ if (_options.getInvisibilityMode() == Options.InvisibilityMode.AWARE) {
975
+ _webView.setAlpha(0f);
976
+ _webView.setVisibility(View.INVISIBLE);
977
+ _webView.setLayoutParams(new ViewGroup.LayoutParams(0, 0));
978
+ } else {
979
+ _webView.setAlpha(0f);
980
+ _webView.setVisibility(View.VISIBLE);
981
+ }
917
982
  }
983
+
984
+ isHiddenModeActive = true;
985
+ }
986
+
987
+ private void restoreVisibleMode() {
988
+ Window window = getWindow();
989
+ if (window == null) {
990
+ return;
991
+ }
992
+
993
+ if (previousWindowAttributes != null) {
994
+ window.setAttributes(previousWindowAttributes);
995
+ }
996
+ if (previousWindowBackground != null) {
997
+ window.setBackgroundDrawable(previousWindowBackground);
998
+ }
999
+
1000
+ View decorView = window.getDecorView();
1001
+ if (decorView != null) {
1002
+ decorView.setAlpha(previousDecorAlpha);
1003
+ decorView.setVisibility(previousDecorVisibility);
1004
+ }
1005
+
1006
+ if (_webView != null) {
1007
+ if (previousWebViewLayoutParams != null) {
1008
+ _webView.setLayoutParams(previousWebViewLayoutParams);
1009
+ }
1010
+ _webView.setAlpha(previousWebViewAlpha);
1011
+ _webView.setVisibility(previousWebViewVisibility);
1012
+ }
1013
+
1014
+ previousWindowAttributes = null;
1015
+ previousWindowBackground = null;
1016
+ previousWebViewLayoutParams = null;
1017
+ previousDecorAlpha = 1f;
1018
+ previousDecorVisibility = View.VISIBLE;
1019
+ previousWebViewAlpha = 1f;
1020
+ previousWebViewVisibility = View.VISIBLE;
1021
+ isHiddenModeActive = false;
1022
+ }
1023
+
1024
+ public void setHidden(boolean hidden) {
1025
+ if (hidden) {
1026
+ if (!isHiddenModeActive) {
1027
+ applyHiddenMode();
1028
+ }
1029
+ } else {
1030
+ if (isHiddenModeActive) {
1031
+ restoreVisibleMode();
1032
+ }
1033
+ }
1034
+ if (_options != null) {
1035
+ _options.setHidden(hidden);
1036
+ }
1037
+ }
1038
+
1039
+ public boolean isHiddenModeActive() {
1040
+ return isHiddenModeActive;
918
1041
  }
919
1042
 
920
1043
  /**
@@ -1132,7 +1255,28 @@ public class WebViewDialog extends Dialog {
1132
1255
  }
1133
1256
 
1134
1257
  try {
1135
- String script = """
1258
+ String mobileAppExtras = "";
1259
+ if (isJavaScriptControlAllowed()) {
1260
+ mobileAppExtras = """
1261
+ , hide: function() {
1262
+ try {
1263
+ window.AndroidInterface.hide();
1264
+ } catch(e) {
1265
+ console.error('Error in mobileApp.hide:', e);
1266
+ }
1267
+ },
1268
+ show: function() {
1269
+ try {
1270
+ window.AndroidInterface.show();
1271
+ } catch(e) {
1272
+ console.error('Error in mobileApp.show:', e);
1273
+ }
1274
+ }
1275
+ """;
1276
+ }
1277
+
1278
+ String script = String.format(
1279
+ """
1136
1280
  (function() {
1137
1281
  if (window.AndroidInterface) {
1138
1282
  // Create mobileApp object for backward compatibility
@@ -1152,7 +1296,7 @@ public class WebViewDialog extends Dialog {
1152
1296
  } catch(e) {
1153
1297
  console.error('Error in mobileApp.close:', e);
1154
1298
  }
1155
- }
1299
+ }%s
1156
1300
  };
1157
1301
  }
1158
1302
  }
@@ -1167,7 +1311,9 @@ public class WebViewDialog extends Dialog {
1167
1311
  };
1168
1312
  }
1169
1313
  })();
1170
- """;
1314
+ """,
1315
+ mobileAppExtras
1316
+ );
1171
1317
 
1172
1318
  _webView.post(() -> {
1173
1319
  if (_webView != null) {
package/dist/docs.json CHANGED
@@ -146,6 +146,36 @@
146
146
  ],
147
147
  "slug": "close"
148
148
  },
149
+ {
150
+ "name": "hide",
151
+ "signature": "() => Promise<void>",
152
+ "parameters": [],
153
+ "returns": "Promise<void>",
154
+ "tags": [
155
+ {
156
+ "name": "since",
157
+ "text": "8.0.8"
158
+ }
159
+ ],
160
+ "docs": "Hide the webview without closing it.\nUse show() to bring it back.",
161
+ "complexTypes": [],
162
+ "slug": "hide"
163
+ },
164
+ {
165
+ "name": "show",
166
+ "signature": "() => Promise<void>",
167
+ "parameters": [],
168
+ "returns": "Promise<void>",
169
+ "tags": [
170
+ {
171
+ "name": "since",
172
+ "text": "8.0.8"
173
+ }
174
+ ],
175
+ "docs": "Show a previously hidden webview.",
176
+ "complexTypes": [],
177
+ "slug": "show"
178
+ },
149
179
  {
150
180
  "name": "openWebView",
151
181
  "signature": "(options: OpenWebViewOptions) => Promise<any>",
@@ -687,7 +717,7 @@
687
717
  "name": "since"
688
718
  }
689
719
  ],
690
- "docs": "JavaScript Interface:\nThe 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)",
720
+ "docs": "JavaScript Interface:\nThe 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- `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig",
691
721
  "complexTypes": [],
692
722
  "type": "undefined"
693
723
  },
@@ -158,6 +158,7 @@ export interface OpenWebViewOptions {
158
158
  * The webview automatically injects a JavaScript interface providing:
159
159
  * - `window.mobileApp.close()`: Closes the webview from JavaScript
160
160
  * - `window.mobileApp.postMessage(obj)`: Sends a message to the app (listen via "messageFromWebview" event)
161
+ * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig
161
162
  *
162
163
  * @example
163
164
  * // In your webpage loaded in the webview:
@@ -637,6 +638,19 @@ export interface InAppBrowserPlugin {
637
638
  * Close the webview.
638
639
  */
639
640
  close(options?: CloseWebviewOptions): Promise<any>;
641
+ /**
642
+ * Hide the webview without closing it.
643
+ * Use show() to bring it back.
644
+ *
645
+ * @since 8.0.8
646
+ */
647
+ hide(): Promise<void>;
648
+ /**
649
+ * Show a previously hidden webview.
650
+ *
651
+ * @since 8.0.8
652
+ */
653
+ show(): Promise<void>;
640
654
  /**
641
655
  * Open url in a new webview with toolbars, and enhanced capabilities, like camera access, file access, listen events, inject javascript, bi directional communication, etc.
642
656
  *
@@ -776,6 +790,18 @@ export interface InAppBrowserWebViewAPIs {
776
790
  * @since 6.10.0
777
791
  */
778
792
  postMessage(message: Record<string, any>): void;
793
+ /**
794
+ * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)
795
+ *
796
+ * @since 8.0.8
797
+ */
798
+ hide(): void;
799
+ /**
800
+ * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)
801
+ *
802
+ * @since 8.0.8
803
+ */
804
+ show(): void;
779
805
  };
780
806
  /**
781
807
  * Get the native Capacitor plugin version
@@ -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,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","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 simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = 'compact',\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 enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\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 * 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 CloseWebviewOptions {\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\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 * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\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\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\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 * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\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 * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: boolean;\n\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(): Promise<{ canGoBack: boolean }>;\n\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\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(options?: CloseWebviewOptions): 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({detail: {message: \"myMessage\"}})`: Sends a message from the webview to the app, detail object is the data you want to send to the webview\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.addEventListener(\"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(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): 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(eventName: 'browserPageLoaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(eventName: 'pageLoadError', listenerFunc: () => void): 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 * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions): Promise<void>;\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 /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\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,WAqBX;AArBD,WAAY,WAAW;IACrB;;;OAGG;IACH,oCAAqB,CAAA;IACrB;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,wCAAyB,CAAA;IACzB;;;OAGG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAED,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mCAAe,CAAA;IACf;;OAEG;IACH,iDAA6B,CAAA;AAC/B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B","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 simple toolbar with just a close button\n * @since 7.6.8\n */\n COMPACT = 'compact',\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 enum InvisibilityMode {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n AWARE = 'AWARE',\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n FAKE_VISIBLE = 'FAKE_VISIBLE',\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 * 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 CloseWebviewOptions {\n /**\n * Whether the webview closing is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\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 * materialPicker: if true, uses Material Design theme for date and time pickers on Android.\n * This improves the appearance of HTML date inputs to use modern Material Design UI instead of the old style pickers.\n * @since 7.4.1\n * @default false\n * @example\n * materialPicker: true\n * Test URL: https://show-picker.glitch.me/demo.html\n */\n materialPicker?: boolean;\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 * - `window.mobileApp.hide()` / `window.mobileApp.show()` when allowWebViewJsVisibilityControl is true in CapacitorConfig\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\n * @since 0.1.0\n * @default BackgroundColor.BLACK\n */\n backgroundColor?: BackgroundColor;\n /**\n * If true, enables native navigation gestures within the webview.\n * - Android: Native back button navigates within webview history\n * - iOS: Enables swipe left/right gestures for back/forward navigation\n * @default false (Android), true (iOS - enabled by default)\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 * preShowScriptInjectionTime: controls when the preShowScript is injected.\n * - \"documentStart\": injects before any page JavaScript runs (good for polyfills like Firebase)\n * - \"pageLoad\": injects after page load (default, original behavior)\n * @since 7.26.0\n * @default \"pageLoad\"\n * @example\n * preShowScriptInjectionTime: \"documentStart\"\n */\n preShowScriptInjectionTime?: 'documentStart' | 'pageLoad';\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 * textZoom: sets the text zoom of the page in percent.\n * Allows users to increase or decrease the text size for better readability.\n * @since 7.6.0\n * @default 100\n * @example\n * textZoom: 120\n * Test URL: https://capgo.app\n */\n textZoom?: number;\n /**\n * preventDeeplink: if true, the deeplink will not be opened, if false the deeplink will be opened when clicked on the link. on IOS each schema need to be added to info.plist file under LSApplicationQueriesSchemes when false to make it work.\n * @since 0.1.0\n * @default false\n * @example\n * preventDeeplink: true\n * Test URL: https://aasa-tester.capgo.app/\n */\n preventDeeplink?: boolean;\n\n /**\n * List of base URLs whose hosts are treated as authorized App Links (Android) and Universal Links (iOS).\n *\n * - On both platforms, only HTTPS links whose host matches any entry in this list\n * will attempt to open via the corresponding native application.\n * - If the app is not installed or the system cannot handle the link, the URL\n * will continue loading inside the in-app browser.\n * - Matching is host-based (case-insensitive), ignoring the \"www.\" prefix.\n * - When `preventDeeplink` is enabled, all external handling is blocked regardless of this list.\n *\n * @example\n * ```ts\n * [\"https://example.com\", \"https://subdomain.app.io\"]\n * ```\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n\n /**\n * If true, the webView will not take the full height and will have a 20px margin at the bottom.\n * This creates a safe margin area outside the browser view.\n * @since 7.13.0\n * @default false\n * @example\n * enabledSafeBottomMargin: true\n */\n enabledSafeBottomMargin?: boolean;\n\n /**\n * When true, applies the system status bar inset as the WebView top margin on Android.\n * Keeps the legacy 0px margin by default for apps that handle padding themselves.\n * @default false\n * @example\n * useTopInset: true\n */\n useTopInset?: boolean;\n\n /**\n * enableGooglePaySupport: if true, enables support for Google Pay popups and Payment Request API.\n * This fixes OR_BIBED_15 errors by allowing popup windows and configuring Cross-Origin-Opener-Policy.\n * Only enable this if you need Google Pay functionality as it allows popup windows.\n *\n * When enabled:\n * - Allows popup windows for Google Pay authentication\n * - Sets proper CORS headers for Payment Request API\n * - Enables multiple window support in WebView\n * - Configures secure context for payment processing\n *\n * @since 7.13.0\n * @default false\n * @example\n * enableGooglePaySupport: true\n * Test URL: https://developers.google.com/pay/api/web/guides/tutorial\n */\n enableGooglePaySupport?: boolean;\n\n /**\n * blockedHosts: List of host patterns that should be blocked from loading in the InAppBrowser's internal navigations.\n * Any request inside WebView to a URL with a host matching any of these patterns will be blocked.\n * Supports wildcard patterns like:\n * - \"*.example.com\" to block all subdomains\n * - \"www.example.*\" to block wildcard domain extensions\n *\n * @since 7.17.0\n * @default []\n * @example\n * blockedHosts: [\"*.tracking.com\", \"ads.example.com\"]\n */\n blockedHosts?: string[];\n\n /**\n * Width of the webview in pixels.\n * If not set, webview will be fullscreen width.\n * @default undefined (fullscreen)\n * @example\n * width: 400\n */\n width?: number;\n\n /**\n * Height of the webview in pixels.\n * If not set, webview will be fullscreen height.\n * @default undefined (fullscreen)\n * @example\n * height: 600\n */\n height?: number;\n\n /**\n * X position of the webview in pixels from the left edge.\n * Only effective when width is set.\n * @default 0\n * @example\n * x: 50\n */\n x?: number;\n\n /**\n * Y position of the webview in pixels from the top edge.\n * Only effective when height is set.\n * @default 0\n * @example\n * y: 100\n */\n y?: number;\n\n /**\n * Disables the bounce (overscroll) effect on iOS WebView.\n * When enabled, prevents the rubber band scrolling effect when users scroll beyond content boundaries.\n * This is useful for:\n * - Creating a more native, app-like experience\n * - Preventing accidental overscroll states\n * - Avoiding issues when keyboard opens/closes\n *\n * Note: This option only affects iOS. Android does not have this bounce effect by default.\n *\n * @since 8.0.2\n * @default false\n * @example\n * disableOverscroll: true\n */\n disableOverscroll?: boolean;\n\n /**\n * Opens the webview in hidden mode (not visible to user but fully functional).\n * When hidden, the webview loads and executes JavaScript but is not displayed.\n * All control methods (executeScript, postMessage, setUrl, etc.) work while hidden.\n * Use close() to clean up the hidden webview when done.\n *\n * @since 8.0.7\n * @default false\n * @example\n * hidden: true\n */\n hidden?: boolean;\n\n /**\n * Controls how a hidden webview reports its visibility and size.\n * - AWARE: webview is aware it's hidden (dimensions may be zero).\n * - FAKE_VISIBLE: webview is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n *\n * @default InvisibilityMode.AWARE\n * @example\n * invisibilityMode: InvisibilityMode.FAKE_VISIBLE\n */\n invisibilityMode?: InvisibilityMode;\n}\n\nexport interface DimensionOptions {\n /**\n * Width of the webview in pixels\n */\n width?: number;\n /**\n * Height of the webview in pixels\n */\n height?: number;\n /**\n * X position from the left edge in pixels\n */\n x?: number;\n /**\n * Y position from the top edge in pixels\n */\n y?: number;\n}\n\nexport interface InAppBrowserPlugin {\n /**\n * Navigates back in the WebView's history if possible\n *\n * @since 7.21.0\n * @returns Promise that resolves with true if navigation was possible, false otherwise\n */\n goBack(): Promise<{ canGoBack: boolean }>;\n\n /**\n * Open url in a new window fullscreen, on android it use chrome custom tabs, on ios it use SFSafariViewController\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(options?: CloseWebviewOptions): Promise<any>;\n /**\n * Hide the webview without closing it.\n * Use show() to bring it back.\n *\n * @since 8.0.8\n */\n hide(): Promise<void>;\n /**\n * Show a previously hidden webview.\n *\n * @since 8.0.8\n */\n show(): Promise<void>;\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({detail: {message: \"myMessage\"}})`: Sends a message from the webview to the app, detail object is the data you want to send to the webview\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.addEventListener(\"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(eventName: 'urlChangeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n\n addListener(eventName: 'buttonNearDoneClick', listenerFunc: ButtonNearListener): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(eventName: 'closeEvent', listenerFunc: UrlChangeListener): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required,\n * works with openWebView shareDisclaimer and closeModal\n *\n * @since 0.0.1\n */\n addListener(eventName: 'confirmBtnClicked', listenerFunc: ConfirmBtnListener): 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(eventName: 'browserPageLoaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(eventName: 'pageLoadError', listenerFunc: () => void): 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 * Update the dimensions of the webview.\n * Allows changing the size and position of the webview at runtime.\n *\n * @param options Dimension options (width, height, x, y)\n * @returns Promise that resolves when dimensions are updated\n */\n updateDimensions(options: DimensionOptions): Promise<void>;\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 * Hide the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n hide(): void;\n\n /**\n * Show the WebView from JavaScript (requires allowWebViewJsVisibilityControl: true in CapacitorConfig)\n *\n * @since 8.0.8\n */\n show(): void;\n };\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -11,6 +11,8 @@ export declare class InAppBrowserWeb extends WebPlugin implements InAppBrowserPl
11
11
  code: string;
12
12
  }): Promise<any>;
13
13
  close(): Promise<any>;
14
+ hide(): Promise<void>;
15
+ show(): Promise<void>;
14
16
  setUrl(options: {
15
17
  url: string;
16
18
  }): Promise<any>;
package/dist/esm/web.js CHANGED
@@ -32,6 +32,14 @@ export class InAppBrowserWeb extends WebPlugin {
32
32
  console.log('close');
33
33
  return;
34
34
  }
35
+ async hide() {
36
+ console.log('hide');
37
+ return;
38
+ }
39
+ async show() {
40
+ console.log('show');
41
+ return;
42
+ }
35
43
  async setUrl(options) {
36
44
  console.log('setUrl', options.url);
37
45
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,eAAe;QACb,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,OAAO,CA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,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAyB;QAC9C,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QACzC,iDAAiD;QACjD,OAAO;IACT,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n InAppBrowserPlugin,\n OpenWebViewOptions,\n OpenOptions,\n GetCookieOptions,\n ClearCookieOptions,\n DimensionOptions,\n} from './definitions';\n\nexport class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {\n clearAllCookies(): Promise<any> {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache(): Promise<any> {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options: OpenOptions): Promise<any> {\n console.log('open', options);\n return options;\n }\n\n async clearCookies(options: ClearCookieOptions): Promise<any> {\n console.log('cleanCookies', options);\n return;\n }\n\n async getCookies(options: GetCookieOptions): Promise<any> {\n // Web implementation to get cookies\n return options;\n }\n\n async openWebView(options: OpenWebViewOptions): Promise<any> {\n console.log('openWebView', options);\n return options;\n }\n\n async executeScript({ code }: { code: string }): Promise<any> {\n console.log('code', code);\n return code;\n }\n\n async close(): Promise<any> {\n console.log('close');\n return;\n }\n\n async setUrl(options: { url: string }): Promise<any> {\n console.log('setUrl', options.url);\n return;\n }\n\n async reload(): Promise<any> {\n console.log('reload');\n return;\n }\n async postMessage(options: Record<string, any>): Promise<any> {\n console.log('postMessage', options);\n return options;\n }\n\n async goBack(): Promise<any> {\n console.log('goBack');\n return;\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n\n async updateDimensions(options: DimensionOptions): Promise<void> {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension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AI;QACR,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO;IACT,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAwB;QACnC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAyB;QAC9C,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QACzC,iDAAiD;QACjD,OAAO;IACT,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n InAppBrowserPlugin,\n OpenWebViewOptions,\n OpenOptions,\n GetCookieOptions,\n ClearCookieOptions,\n DimensionOptions,\n} from './definitions';\n\nexport class InAppBrowserWeb extends WebPlugin implements InAppBrowserPlugin {\n clearAllCookies(): Promise<any> {\n console.log('clearAllCookies');\n return Promise.resolve();\n }\n clearCache(): Promise<any> {\n console.log('clearCache');\n return Promise.resolve();\n }\n async open(options: OpenOptions): Promise<any> {\n console.log('open', options);\n return options;\n }\n\n async clearCookies(options: ClearCookieOptions): Promise<any> {\n console.log('cleanCookies', options);\n return;\n }\n\n async getCookies(options: GetCookieOptions): Promise<any> {\n // Web implementation to get cookies\n return options;\n }\n\n async openWebView(options: OpenWebViewOptions): Promise<any> {\n console.log('openWebView', options);\n return options;\n }\n\n async executeScript({ code }: { code: string }): Promise<any> {\n console.log('code', code);\n return code;\n }\n\n async close(): Promise<any> {\n console.log('close');\n return;\n }\n\n async hide(): Promise<void> {\n console.log('hide');\n return;\n }\n\n async show(): Promise<void> {\n console.log('show');\n return;\n }\n\n async setUrl(options: { url: string }): Promise<any> {\n console.log('setUrl', options.url);\n return;\n }\n\n async reload(): Promise<any> {\n console.log('reload');\n return;\n }\n async postMessage(options: Record<string, any>): Promise<any> {\n console.log('postMessage', options);\n return options;\n }\n\n async goBack(): Promise<any> {\n console.log('goBack');\n return;\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n\n async updateDimensions(options: DimensionOptions): Promise<void> {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n}\n"]}
@@ -79,6 +79,14 @@ class InAppBrowserWeb extends core.WebPlugin {
79
79
  console.log('close');
80
80
  return;
81
81
  }
82
+ async hide() {
83
+ console.log('hide');
84
+ return;
85
+ }
86
+ async show() {
87
+ console.log('show');
88
+ return;
89
+ }
82
90
  async setUrl(options) {
83
91
  console.log('setUrl', options.url);
84
92
  return;
@@ -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 /**\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 simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\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 = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\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 async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,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AACR,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;AACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;AAChD;AACA,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
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 simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\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 = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\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 hide() {\n console.log('hide');\n return;\n }\n async show() {\n console.log('show');\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 async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","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,SAAS,CAAC,GAAG,SAAS;AACtC;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;AAC5C;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AACl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AAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -78,6 +78,14 @@ var capacitorInAppBrowser = (function (exports, core) {
78
78
  console.log('close');
79
79
  return;
80
80
  }
81
+ async hide() {
82
+ console.log('hide');
83
+ return;
84
+ }
85
+ async show() {
86
+ console.log('show');
87
+ return;
88
+ }
81
89
  async setUrl(options) {
82
90
  console.log('setUrl', options.url);
83
91
  return;
@@ -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 /**\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 simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\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 = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\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 async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","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,SAAS,CAAC,GAAG,SAAS;IACtC;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,CAA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AAM,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE;IAClC,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IACjC,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IAC5B,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;IAC1C,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7B,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;IAC3C,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7B,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;IACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAChD;IACA,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
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 simple toolbar with just a close button\n * @since 7.6.8\n */\n ToolBarType[\"COMPACT\"] = \"compact\";\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 = {}));\nexport var InvisibilityMode;\n(function (InvisibilityMode) {\n /**\n * WebView is aware it is hidden (dimensions may be zero).\n */\n InvisibilityMode[\"AWARE\"] = \"AWARE\";\n /**\n * WebView is hidden but reports fullscreen dimensions (uses alpha=0 to remain invisible).\n */\n InvisibilityMode[\"FAKE_VISIBLE\"] = \"FAKE_VISIBLE\";\n})(InvisibilityMode || (InvisibilityMode = {}));\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 hide() {\n console.log('hide');\n return;\n }\n async show() {\n console.log('show');\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 async goBack() {\n console.log('goBack');\n return;\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n async updateDimensions(options) {\n console.log('updateDimensions', options);\n // Web platform doesn't support dimension control\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","InvisibilityMode","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,SAAS,CAAC,GAAG,SAAS;IACtC;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;AAC1BC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO;IACvC;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,cAAc;IACrD,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACrC1C,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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,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC;IAC1C,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7B,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;IAC3C,QAAQ,OAAO,OAAO;IACtB,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7B,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,OAAO,EAAE;IACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAChD;IACA,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -28,7 +28,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
28
28
  case aware = "AWARE"
29
29
  case fakeVisible = "FAKE_VISIBLE"
30
30
  }
31
- private let pluginVersion: String = "8.1.1"
31
+ private let pluginVersion: String = "8.1.3"
32
32
  public let identifier = "InAppBrowserPlugin"
33
33
  public let jsName = "InAppBrowser"
34
34
  public let pluginMethods: [CAPPluginMethod] = [
@@ -42,6 +42,7 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
42
42
  CAPPluginMethod(name: "reload", returnType: CAPPluginReturnPromise),
43
43
  CAPPluginMethod(name: "setUrl", returnType: CAPPluginReturnPromise),
44
44
  CAPPluginMethod(name: "show", returnType: CAPPluginReturnPromise),
45
+ CAPPluginMethod(name: "hide", returnType: CAPPluginReturnPromise),
45
46
  CAPPluginMethod(name: "close", returnType: CAPPluginReturnPromise),
46
47
  CAPPluginMethod(name: "executeScript", returnType: CAPPluginReturnPromise),
47
48
  CAPPluginMethod(name: "postMessage", returnType: CAPPluginReturnPromise),
@@ -84,6 +85,64 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
84
85
  })
85
86
  }
86
87
 
88
+ private func activeWindow() -> UIWindow? {
89
+ return UIApplication.shared.connectedScenes
90
+ .compactMap { $0 as? UIWindowScene }
91
+ .first { $0.activationState == .foregroundActive }?
92
+ .windows
93
+ .first { $0.isKeyWindow }
94
+ }
95
+
96
+ private func attachWebViewToWindow(_ webView: WKWebView) -> Bool {
97
+ guard let window = activeWindow() else {
98
+ return false
99
+ }
100
+
101
+ webView.removeFromSuperview()
102
+
103
+ switch self.invisibilityMode {
104
+ case .aware:
105
+ webView.frame = .zero
106
+ webView.alpha = 1
107
+ webView.isOpaque = true
108
+ case .fakeVisible:
109
+ webView.frame = window.bounds
110
+ webView.alpha = 0
111
+ webView.isOpaque = false
112
+ webView.backgroundColor = .clear
113
+ webView.scrollView.backgroundColor = .clear
114
+ }
115
+
116
+ webView.isUserInteractionEnabled = false
117
+ window.addSubview(webView)
118
+ return true
119
+ }
120
+
121
+ private func attachWebViewToController(_ webViewController: WKWebViewController, webView: WKWebView) {
122
+ webView.removeFromSuperview()
123
+ webView.translatesAutoresizingMaskIntoConstraints = false
124
+ webViewController.view.addSubview(webView)
125
+
126
+ let bottomAnchor = webViewController.enabledSafeBottomMargin
127
+ ? webViewController.view.safeAreaLayoutGuide.bottomAnchor
128
+ : webViewController.view.bottomAnchor
129
+
130
+ NSLayoutConstraint.activate([
131
+ webView.topAnchor.constraint(equalTo: webViewController.view.safeAreaLayoutGuide.topAnchor),
132
+ webView.leadingAnchor.constraint(equalTo: webViewController.view.leadingAnchor),
133
+ webView.trailingAnchor.constraint(equalTo: webViewController.view.trailingAnchor),
134
+ webView.bottomAnchor.constraint(equalTo: bottomAnchor)
135
+ ])
136
+
137
+ if let backgroundColor = webViewController.view.backgroundColor {
138
+ webView.backgroundColor = backgroundColor
139
+ webView.scrollView.backgroundColor = backgroundColor
140
+ }
141
+ webView.alpha = 1
142
+ webView.isOpaque = true
143
+ webView.isUserInteractionEnabled = true
144
+ }
145
+
87
146
  @objc func clearAllCookies(_ call: CAPPluginCall) {
88
147
  DispatchQueue.main.async {
89
148
  let dataStore = WKWebsiteDataStore.default()
@@ -302,7 +361,8 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
302
361
  let enabledSafeBottomMargin = call.getBool("enabledSafeBottomMargin", false)
303
362
  let hidden = call.getBool("hidden", false)
304
363
  self.isHidden = hidden
305
- let invisibilityModeRaw = call.getString("invisibilityMode", "AWARE") ?? "AWARE"
364
+ let allowWebViewJsVisibilityControl = self.getConfig().getBoolean("allowWebViewJsVisibilityControl", false)
365
+ let invisibilityModeRaw = call.getString("invisibilityMode", "AWARE")
306
366
  self.invisibilityMode = InvisibilityMode(rawValue: invisibilityModeRaw.uppercased()) ?? .aware
307
367
 
308
368
  // Validate preShowScript requires isPresentAfterPageLoad
@@ -415,6 +475,8 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
415
475
  return
416
476
  }
417
477
 
478
+ webViewController.allowWebViewJsVisibilityControl = allowWebViewJsVisibilityControl
479
+
418
480
  // Set dimensions if provided
419
481
  if let width = width {
420
482
  webViewController.customWidth = CGFloat(width)
@@ -705,39 +767,15 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
705
767
  self.navigationWebViewController?.setToolbarHidden(true, animated: false)
706
768
 
707
769
  if hidden {
708
- // Zero-frame in window hierarchy required for WKWebView JS execution when hidden
709
- // Use scene-based API (UIApplication.shared.windows deprecated in iOS 15)
710
- let window = UIApplication.shared.connectedScenes
711
- .compactMap { $0 as? UIWindowScene }
712
- .first { $0.activationState == .foregroundActive }?
713
- .windows
714
- .first { $0.isKeyWindow }
715
-
716
- guard let window = window else {
717
- call.reject("Failed to get active window for hidden webview")
718
- return
719
- }
720
-
721
770
  guard let webView = webViewController.capableWebView else {
722
771
  call.reject("Failed to get webview for hidden mode")
723
772
  return
724
773
  }
725
-
726
- switch self.invisibilityMode {
727
- case .aware:
728
- webView.frame = .zero
729
- webView.alpha = 1
730
- webView.isOpaque = true
731
- webView.isUserInteractionEnabled = false
732
- case .fakeVisible:
733
- webView.frame = window.bounds
734
- webView.alpha = 0
735
- webView.isOpaque = false
736
- webView.backgroundColor = .clear
737
- webView.scrollView.backgroundColor = .clear
738
- webView.isUserInteractionEnabled = false
774
+ // Zero-frame in window hierarchy required for WKWebView JS execution when hidden
775
+ if !self.attachWebViewToWindow(webView) {
776
+ call.reject("Failed to get active window for hidden webview")
777
+ return
739
778
  }
740
- window.addSubview(webView)
741
779
  } else if !self.isPresentAfterPageLoad {
742
780
  self.presentView(isAnimated: isAnimated)
743
781
  }
@@ -777,6 +815,60 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
777
815
  call.resolve()
778
816
  }
779
817
 
818
+ private func setHiddenState(_ hidden: Bool, call: CAPPluginCall?) {
819
+ DispatchQueue.main.async {
820
+ guard let webViewController = self.webViewController,
821
+ let webView = webViewController.capableWebView else {
822
+ call?.reject("WebView is not initialized")
823
+ return
824
+ }
825
+
826
+ self.isHidden = hidden
827
+
828
+ if hidden {
829
+ if let navController = self.navigationWebViewController, navController.presentingViewController != nil {
830
+ navController.view.isHidden = true
831
+ navController.view.isUserInteractionEnabled = false
832
+ }
833
+
834
+ if !self.attachWebViewToWindow(webView) {
835
+ call?.reject("Failed to get active window for hidden webview")
836
+ return
837
+ }
838
+ } else {
839
+ if webView.superview !== webViewController.view {
840
+ self.attachWebViewToController(webViewController, webView: webView)
841
+ }
842
+
843
+ if let navController = self.navigationWebViewController {
844
+ navController.view.isHidden = false
845
+ navController.view.isUserInteractionEnabled = true
846
+
847
+ if navController.presentingViewController == nil {
848
+ self.bridge?.viewController?.present(navController, animated: true, completion: {
849
+ call?.resolve()
850
+ })
851
+ return
852
+ }
853
+ }
854
+ }
855
+
856
+ call?.resolve()
857
+ }
858
+ }
859
+
860
+ func setHiddenFromJavaScript(_ hidden: Bool) {
861
+ self.setHiddenState(hidden, call: nil)
862
+ }
863
+
864
+ @objc func hide(_ call: CAPPluginCall) {
865
+ self.setHiddenState(true, call: call)
866
+ }
867
+
868
+ @objc func show(_ call: CAPPluginCall) {
869
+ self.setHiddenState(false, call: call)
870
+ }
871
+
780
872
  @objc func executeScript(_ call: CAPPluginCall) {
781
873
  guard let script = call.getString("code") else {
782
874
  call.reject("Cannot get script to execute")
@@ -910,12 +1002,20 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
910
1002
 
911
1003
  DispatchQueue.main.async {
912
1004
  let currentUrl = self.webViewController?.url?.absoluteString ?? ""
1005
+ let isPresented = self.navigationWebViewController?.presentingViewController != nil
913
1006
 
914
1007
  if self.isHidden {
915
1008
  self.webViewController?.capableWebView?.removeFromSuperview()
916
1009
  self.webViewController?.cleanupWebView()
917
- self.webViewController = nil
918
- self.navigationWebViewController = nil
1010
+ if isPresented {
1011
+ self.navigationWebViewController?.dismiss(animated: isAnimated) {
1012
+ self.webViewController = nil
1013
+ self.navigationWebViewController = nil
1014
+ }
1015
+ } else {
1016
+ self.webViewController = nil
1017
+ self.navigationWebViewController = nil
1018
+ }
919
1019
  self.isHidden = false
920
1020
  } else {
921
1021
  self.webViewController?.cleanupWebView()
@@ -118,6 +118,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
118
118
  open internal(set) var url: URL?
119
119
  open var tintColor: UIColor?
120
120
  open var allowsFileURL = true
121
+ open var allowWebViewJsVisibilityControl = false
121
122
  open var delegate: WKWebViewControllerDelegate?
122
123
  open var bypassedSSLHosts: [String]?
123
124
  open var cookies: [HTTPCookie]?
@@ -543,6 +544,16 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
543
544
  semaphore.signal()
544
545
  } else if message.name == "close" {
545
546
  closeView()
547
+ } else if message.name == "hide" {
548
+ guard allowWebViewJsVisibilityControl else {
549
+ return
550
+ }
551
+ capBrowserPlugin?.setHiddenFromJavaScript(true)
552
+ } else if message.name == "show" {
553
+ guard allowWebViewJsVisibilityControl else {
554
+ return
555
+ }
556
+ capBrowserPlugin?.setHiddenFromJavaScript(false)
546
557
  } else if message.name == "magicPrint" {
547
558
  if let webView = self.webView {
548
559
  let printController = UIPrintInteractionController.shared
@@ -560,6 +571,15 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
560
571
  }
561
572
 
562
573
  func injectJavaScriptInterface() {
574
+ let extraControls = allowWebViewJsVisibilityControl ? """
575
+ ,
576
+ hide: function() {
577
+ window.webkit.messageHandlers.hide.postMessage(null);
578
+ },
579
+ show: function() {
580
+ window.webkit.messageHandlers.show.postMessage(null);
581
+ }
582
+ """ : ""
563
583
  let script = """
564
584
  if (!window.mobileApp) {
565
585
  window.mobileApp = {
@@ -570,7 +590,7 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
570
590
  },
571
591
  close: function() {
572
592
  window.webkit.messageHandlers.close.postMessage(null);
573
- }
593
+ }\(extraControls)
574
594
  };
575
595
  }
576
596
  """
@@ -605,6 +625,8 @@ open class WKWebViewController: UIViewController, WKScriptMessageHandler {
605
625
  userContentController.add(weakHandler, name: "preShowScriptError")
606
626
  userContentController.add(weakHandler, name: "preShowScriptSuccess")
607
627
  userContentController.add(weakHandler, name: "close")
628
+ userContentController.add(weakHandler, name: "hide")
629
+ userContentController.add(weakHandler, name: "show")
608
630
  userContentController.add(weakHandler, name: "magicPrint")
609
631
 
610
632
  // Inject JavaScript to override window.print
@@ -1005,6 +1027,8 @@ public extension WKWebViewController {
1005
1027
  webView.configuration.userContentController.removeAllUserScripts()
1006
1028
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "messageHandler")
1007
1029
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "close")
1030
+ webView.configuration.userContentController.removeScriptMessageHandler(forName: "hide")
1031
+ webView.configuration.userContentController.removeScriptMessageHandler(forName: "show")
1008
1032
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "preShowScriptSuccess")
1009
1033
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "preShowScriptError")
1010
1034
  webView.configuration.userContentController.removeScriptMessageHandler(forName: "magicPrint")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "8.1.1",
3
+ "version": "8.1.3",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",