@capgo/inappbrowser 7.10.11 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -550,6 +550,7 @@ Reload the current web page.
550
550
  | **`buttonNearDone`** | <code>{ ios: { iconType: 'sf-symbol' \| 'asset'; icon: string; }; android: { iconType: 'asset' \| 'vector'; icon: string; width?: number; height?: number; }; }</code> | buttonNearDone allows for a creation of a custom button near the done/close button. The button is only shown when toolbarType is not "activity", "navigation", or "blank". For Android: - iconType must be "asset" - icon path should be in the public folder (e.g. "monkey.svg") - width and height are optional, defaults to 48dp - button is positioned at the end of toolbar with 8dp margin For iOS: - iconType can be "sf-symbol" or "asset" - for sf-symbol, icon should be the symbol name - for asset, icon should be the asset name | | 6.7.0 |
551
551
  | **`textZoom`** | <code>number</code> | textZoom: sets the text zoom of the page in percent. Allows users to increase or decrease the text size for better readability. | <code>100</code> | 7.6.0 |
552
552
  | **`preventDeeplink`** | <code>boolean</code> | 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. | <code>false</code> | 0.1.0 |
553
+ | **`authorizedAppLinks`** | <code>string[]</code> | List of URL base patterns that should be treated as authorized App Links, Android only. Only links starting with any of these base URLs will be opened in the InAppBrowser. | <code>[]</code> | 7.12.0 |
553
554
 
554
555
 
555
556
  #### Headers
@@ -21,6 +21,7 @@ import androidx.browser.customtabs.CustomTabsClient;
21
21
  import androidx.browser.customtabs.CustomTabsIntent;
22
22
  import androidx.browser.customtabs.CustomTabsServiceConnection;
23
23
  import androidx.browser.customtabs.CustomTabsSession;
24
+ import com.getcapacitor.JSArray;
24
25
  import com.getcapacitor.JSObject;
25
26
  import com.getcapacitor.PermissionState;
26
27
  import com.getcapacitor.Plugin;
@@ -32,6 +33,7 @@ import com.getcapacitor.annotation.PermissionCallback;
32
33
  import java.lang.reflect.Field;
33
34
  import java.util.ArrayList;
34
35
  import java.util.Iterator;
36
+ import java.util.List;
35
37
  import java.util.regex.Pattern;
36
38
  import java.util.regex.PatternSyntaxException;
37
39
  import org.json.JSONException;
@@ -723,6 +725,33 @@ public class InAppBrowserPlugin
723
725
  }
724
726
  }
725
727
  );
728
+
729
+ JSArray jsAuthorizedLinks = call.getArray("authorizedAppLinks");
730
+ if (jsAuthorizedLinks != null && jsAuthorizedLinks.length() > 0) {
731
+ List<String> authorizedLinks = new ArrayList<>();
732
+ for (int i = 0; i < jsAuthorizedLinks.length(); i++) {
733
+ try {
734
+ String link = jsAuthorizedLinks.getString(i);
735
+ if (link != null && !link.trim().isEmpty()) {
736
+ authorizedLinks.add(link);
737
+ }
738
+ } catch (Exception e) {
739
+ Log.w(
740
+ "InAppBrowserPlugin",
741
+ "Error reading authorized app link at index " + i,
742
+ e
743
+ );
744
+ }
745
+ }
746
+ Log.d(
747
+ "InAppBrowserPlugin",
748
+ "Parsed authorized app links: " + authorizedLinks
749
+ );
750
+ options.setAuthorizedAppLinks(authorizedLinks);
751
+ } else {
752
+ Log.d("InAppBrowserPlugin", "No authorized app links provided.");
753
+ }
754
+
726
755
  this.getActivity()
727
756
  .runOnUiThread(
728
757
  new Runnable() {
@@ -6,6 +6,9 @@ import com.getcapacitor.JSObject;
6
6
  import com.getcapacitor.PluginCall;
7
7
  import java.io.IOException;
8
8
  import java.io.InputStream;
9
+ import java.util.ArrayList;
10
+ import java.util.List;
11
+ import java.util.Objects;
9
12
  import java.util.Objects;
10
13
  import java.util.regex.Pattern;
11
14
 
@@ -176,6 +179,7 @@ public class Options {
176
179
  private boolean materialPicker = false;
177
180
  private int textZoom = 100; // Default text zoom is 100%
178
181
  private boolean preventDeeplink = false;
182
+ private List<String> authorizedAppLinks = new ArrayList<>();
179
183
 
180
184
  public int getTextZoom() {
181
185
  return textZoom;
@@ -422,4 +426,12 @@ public class Options {
422
426
  public void setPreventDeeplink(boolean preventDeeplink) {
423
427
  this.preventDeeplink = preventDeeplink;
424
428
  }
429
+
430
+ public List<String> getAuthorizedAppLinks() {
431
+ return authorizedAppLinks;
432
+ }
433
+
434
+ public void setAuthorizedAppLinks(List<String> authorizedAppLinks) {
435
+ this.authorizedAppLinks = authorizedAppLinks;
436
+ }
425
437
  }
@@ -24,6 +24,8 @@ import android.print.PrintAttributes;
24
24
  import android.print.PrintDocumentAdapter;
25
25
  import android.print.PrintManager;
26
26
  import android.provider.MediaStore;
27
+ import android.security.KeyChain;
28
+ import android.security.KeyChainAliasCallback;
27
29
  import android.text.TextUtils;
28
30
  import android.util.Base64;
29
31
  import android.util.Log;
@@ -65,9 +67,12 @@ import java.io.InputStream;
65
67
  import java.net.URI;
66
68
  import java.net.URISyntaxException;
67
69
  import java.nio.charset.StandardCharsets;
70
+ import java.security.PrivateKey;
71
+ import java.security.cert.X509Certificate;
68
72
  import java.util.Arrays;
69
73
  import java.util.HashMap;
70
74
  import java.util.Iterator;
75
+ import java.util.List;
71
76
  import java.util.Map;
72
77
  import java.util.Objects;
73
78
  import java.util.UUID;
@@ -186,19 +191,7 @@ public class WebViewDialog extends Dialog {
186
191
 
187
192
  activity.runOnUiThread(() -> {
188
193
  try {
189
- String currentUrl = "";
190
- if (_webView != null) {
191
- try {
192
- currentUrl = _webView.getUrl();
193
- if (currentUrl == null) {
194
- currentUrl = "";
195
- }
196
- } catch (Exception e) {
197
- Log.e("InAppBrowser", "Error getting URL: " + e.getMessage());
198
- currentUrl = "";
199
- }
200
- }
201
-
194
+ String currentUrl = getUrl();
202
195
  dismiss();
203
196
 
204
197
  if (_options != null && _options.getCallbacks() != null) {
@@ -444,11 +437,7 @@ public class WebViewDialog extends Dialog {
444
437
  // DEBUG: Log details about the file chooser request
445
438
  Log.d("InAppBrowser", "onShowFileChooser called");
446
439
  Log.d("InAppBrowser", "Accept type: " + acceptType);
447
- Log.d(
448
- "InAppBrowser",
449
- "Current URL: " +
450
- (webView.getUrl() != null ? webView.getUrl() : "null")
451
- );
440
+ Log.d("InAppBrowser", "Current URL: " + getUrl());
452
441
  Log.d(
453
442
  "InAppBrowser",
454
443
  "Original URL: " +
@@ -477,7 +466,7 @@ public class WebViewDialog extends Dialog {
477
466
  // Direct check for capture attribute in URL (fallback method)
478
467
  boolean isCaptureInUrl;
479
468
  String captureMode;
480
- String currentUrl = webView.getUrl();
469
+ String currentUrl = getUrl();
481
470
 
482
471
  // Look for capture in URL parameters - sometimes the attribute shows up in URL
483
472
  if (currentUrl != null && currentUrl.contains("capture=")) {
@@ -1467,7 +1456,7 @@ public class WebViewDialog extends Dialog {
1467
1456
  _webView.stopLoading();
1468
1457
 
1469
1458
  // Check if there's a URL to reload
1470
- String currentUrl = _webView.getUrl();
1459
+ String currentUrl = getUrl();
1471
1460
  if (currentUrl != null && !currentUrl.equals("about:blank")) {
1472
1461
  // Reload the current page
1473
1462
  _webView.reload();
@@ -1491,7 +1480,16 @@ public class WebViewDialog extends Dialog {
1491
1480
  }
1492
1481
 
1493
1482
  public String getUrl() {
1494
- return _webView != null ? _webView.getUrl() : "";
1483
+ try {
1484
+ WebView webView = _webView;
1485
+ if (webView != null) {
1486
+ String url = webView.getUrl();
1487
+ return url != null ? url : "";
1488
+ }
1489
+ } catch (Exception e) {
1490
+ Log.w("InAppBrowser", "Error getting URL: " + e.getMessage());
1491
+ }
1492
+ return "";
1495
1493
  }
1496
1494
 
1497
1495
  public void executeScript(String script) {
@@ -1633,9 +1631,7 @@ public class WebViewDialog extends Dialog {
1633
1631
  new OnClickListener() {
1634
1632
  public void onClick(DialogInterface dialog, int which) {
1635
1633
  // Close button clicked, do something
1636
- String currentUrl = _webView != null
1637
- ? _webView.getUrl()
1638
- : "";
1634
+ String currentUrl = getUrl();
1639
1635
  dismiss();
1640
1636
  if (_options != null && _options.getCallbacks() != null) {
1641
1637
  _options.getCallbacks().closeEvent(currentUrl);
@@ -1646,7 +1642,7 @@ public class WebViewDialog extends Dialog {
1646
1642
  .setNegativeButton(_options.getCloseModalCancel(), null)
1647
1643
  .show();
1648
1644
  } else {
1649
- String currentUrl = _webView != null ? _webView.getUrl() : "";
1645
+ String currentUrl = getUrl();
1650
1646
  dismiss();
1651
1647
  if (_options != null && _options.getCallbacks() != null) {
1652
1648
  _options.getCallbacks().closeEvent(currentUrl);
@@ -1676,7 +1672,7 @@ public class WebViewDialog extends Dialog {
1676
1672
  _webView.stopLoading();
1677
1673
 
1678
1674
  // Check if there's a URL to reload
1679
- String currentUrl = _webView.getUrl();
1675
+ String currentUrl = getUrl();
1680
1676
  if (currentUrl != null) {
1681
1677
  // Reload the current page
1682
1678
  _webView.reload();
@@ -2120,6 +2116,48 @@ public class WebViewDialog extends Dialog {
2120
2116
  private void setWebViewClient() {
2121
2117
  _webView.setWebViewClient(
2122
2118
  new WebViewClient() {
2119
+ /**
2120
+ * Checks whether the given URL is authorized based on the provided list of authorized links.
2121
+ * <p>
2122
+ * For http(s) URLs, compares only the host (ignoring "www." prefix and case).
2123
+ * Each entry in authorizedLinks should be a base URL (e.g., "https://example.com").
2124
+ * If the host of the input URL matches (case-insensitive) the host of any authorized link, returns true.
2125
+ * <p>
2126
+ * This method is intended to limit which external links can be handled as authorized app links.
2127
+ *
2128
+ * @param url The URL to check. Can be any valid absolute URL.
2129
+ * @param authorizedLinks List of authorized base URLs (e.g., "https://mydomain.com", "myapp://").
2130
+ * @return true if the URL is authorized (host matches one of the authorizedLinks); false otherwise.
2131
+ */
2132
+ private boolean isUrlAuthorized(
2133
+ String url,
2134
+ List<String> authorizedLinks
2135
+ ) {
2136
+ if (
2137
+ authorizedLinks == null || authorizedLinks.isEmpty() || url == null
2138
+ ) {
2139
+ return false;
2140
+ }
2141
+ try {
2142
+ URI uri = new URI(url);
2143
+ String urlHost = uri.getHost();
2144
+ if (urlHost == null) return false;
2145
+ if (urlHost.startsWith("www.")) urlHost = urlHost.substring(4);
2146
+ for (String authorized : authorizedLinks) {
2147
+ URI authUri = new URI(authorized);
2148
+ String authHost = authUri.getHost();
2149
+ if (authHost == null) continue;
2150
+ if (authHost.startsWith("www.")) authHost = authHost.substring(4);
2151
+ if (urlHost.equalsIgnoreCase(authHost)) {
2152
+ return true;
2153
+ }
2154
+ }
2155
+ } catch (URISyntaxException e) {
2156
+ Log.e("InAppBrowser", "Invalid URI in isUrlAuthorized: " + url, e);
2157
+ }
2158
+ return false;
2159
+ }
2160
+
2123
2161
  @Override
2124
2162
  public boolean shouldOverrideUrlLoading(
2125
2163
  WebView view,
@@ -2131,15 +2169,50 @@ public class WebViewDialog extends Dialog {
2131
2169
  Context context = view.getContext();
2132
2170
  String url = request.getUrl().toString();
2133
2171
  Log.d("InAppBrowser", "shouldOverrideUrlLoading: " + url);
2172
+
2173
+ boolean isNotHttpOrHttps =
2174
+ !url.startsWith("https://") && !url.startsWith("http://");
2175
+
2134
2176
  // If preventDeeplink is true, don't handle any non-http(s) URLs
2135
2177
  if (_options.getPreventDeeplink()) {
2136
2178
  Log.d("InAppBrowser", "preventDeeplink is true");
2137
- if (!url.startsWith("https://") && !url.startsWith("http://")) {
2179
+ if (isNotHttpOrHttps) {
2138
2180
  return true;
2139
2181
  }
2140
2182
  }
2141
2183
 
2142
- if (!url.startsWith("https://") && !url.startsWith("http://")) {
2184
+ // Handle authorized app links
2185
+ List<String> authorizedLinks = _options.getAuthorizedAppLinks();
2186
+ boolean urlAuthorized = isUrlAuthorized(url, authorizedLinks);
2187
+
2188
+ Log.d("InAppBrowser", "authorizedLinks: " + authorizedLinks);
2189
+ Log.d("InAppBrowser", "urlAuthorized: " + urlAuthorized);
2190
+
2191
+ if (urlAuthorized) {
2192
+ try {
2193
+ Log.d(
2194
+ "InAppBrowser",
2195
+ "Launching intent for authorized link: " + url
2196
+ );
2197
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
2198
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2199
+ context.startActivity(intent);
2200
+ Log.i(
2201
+ "InAppBrowser",
2202
+ "Intent started for authorized link: " + url
2203
+ );
2204
+ return true;
2205
+ } catch (ActivityNotFoundException e) {
2206
+ Log.e(
2207
+ "InAppBrowser",
2208
+ "No app found to handle this authorized link",
2209
+ e
2210
+ );
2211
+ return false;
2212
+ }
2213
+ }
2214
+
2215
+ if (isNotHttpOrHttps) {
2143
2216
  try {
2144
2217
  Intent intent;
2145
2218
  if (url.startsWith("intent://")) {
@@ -2147,7 +2220,6 @@ public class WebViewDialog extends Dialog {
2147
2220
  } else {
2148
2221
  intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
2149
2222
  }
2150
-
2151
2223
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
2152
2224
  context.startActivity(intent);
2153
2225
  return true;
@@ -2158,6 +2230,109 @@ public class WebViewDialog extends Dialog {
2158
2230
  return false;
2159
2231
  }
2160
2232
 
2233
+ @Override
2234
+ public void onReceivedClientCertRequest(
2235
+ WebView view,
2236
+ android.webkit.ClientCertRequest request
2237
+ ) {
2238
+ Log.i("InAppBrowser", "onReceivedClientCertRequest CALLED");
2239
+
2240
+ if (request == null) {
2241
+ Log.e("InAppBrowser", "ClientCertRequest is null");
2242
+ return;
2243
+ }
2244
+
2245
+ if (activity == null) {
2246
+ Log.e("InAppBrowser", "Activity is null, canceling request");
2247
+ try {
2248
+ request.cancel();
2249
+ } catch (Exception e) {
2250
+ Log.e(
2251
+ "InAppBrowser",
2252
+ "Error canceling request: " + e.getMessage()
2253
+ );
2254
+ }
2255
+ return;
2256
+ }
2257
+
2258
+ try {
2259
+ Log.i("InAppBrowser", "Host: " + request.getHost());
2260
+ Log.i("InAppBrowser", "Port: " + request.getPort());
2261
+ Log.i(
2262
+ "InAppBrowser",
2263
+ "Principals: " +
2264
+ java.util.Arrays.toString(request.getPrincipals())
2265
+ );
2266
+ Log.i(
2267
+ "InAppBrowser",
2268
+ "KeyTypes: " + java.util.Arrays.toString(request.getKeyTypes())
2269
+ );
2270
+
2271
+ KeyChain.choosePrivateKeyAlias(
2272
+ activity,
2273
+ new KeyChainAliasCallback() {
2274
+ @Override
2275
+ public void alias(String alias) {
2276
+ if (alias != null) {
2277
+ try {
2278
+ PrivateKey privateKey = KeyChain.getPrivateKey(
2279
+ activity,
2280
+ alias
2281
+ );
2282
+ X509Certificate[] certChain =
2283
+ KeyChain.getCertificateChain(activity, alias);
2284
+ request.proceed(privateKey, certChain);
2285
+ Log.i("InAppBrowser", "Selected certificate: " + alias);
2286
+ } catch (Exception e) {
2287
+ try {
2288
+ request.cancel();
2289
+ } catch (Exception cancelEx) {
2290
+ Log.e(
2291
+ "InAppBrowser",
2292
+ "Error canceling request: " + cancelEx.getMessage()
2293
+ );
2294
+ }
2295
+ Log.e(
2296
+ "InAppBrowser",
2297
+ "Error selecting certificate: " + e.getMessage()
2298
+ );
2299
+ }
2300
+ } else {
2301
+ try {
2302
+ request.cancel();
2303
+ } catch (Exception e) {
2304
+ Log.e(
2305
+ "InAppBrowser",
2306
+ "Error canceling request: " + e.getMessage()
2307
+ );
2308
+ }
2309
+ Log.i("InAppBrowser", "No certificate found");
2310
+ }
2311
+ }
2312
+ },
2313
+ null, // keyTypes
2314
+ null, // issuers
2315
+ request.getHost(),
2316
+ request.getPort(),
2317
+ null // alias (null = system asks user to choose)
2318
+ );
2319
+ } catch (Exception e) {
2320
+ Log.e(
2321
+ "InAppBrowser",
2322
+ "Error in onReceivedClientCertRequest: " + e.getMessage()
2323
+ );
2324
+ try {
2325
+ request.cancel();
2326
+ } catch (Exception cancelEx) {
2327
+ Log.e(
2328
+ "InAppBrowser",
2329
+ "Error canceling request after exception: " +
2330
+ cancelEx.getMessage()
2331
+ );
2332
+ }
2333
+ }
2334
+ }
2335
+
2161
2336
  private String randomRequestId() {
2162
2337
  return UUID.randomUUID().toString();
2163
2338
  }
@@ -2572,7 +2747,7 @@ public class WebViewDialog extends Dialog {
2572
2747
  ) {
2573
2748
  _webView.goBack();
2574
2749
  } else if (!_options.getDisableGoBackOnNativeApplication()) {
2575
- String currentUrl = _webView != null ? _webView.getUrl() : "";
2750
+ String currentUrl = getUrl();
2576
2751
  _options.getCallbacks().closeEvent(currentUrl);
2577
2752
  if (_webView != null) {
2578
2753
  _webView.destroy();
package/dist/docs.json CHANGED
@@ -1065,6 +1065,22 @@
1065
1065
  "docs": "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.",
1066
1066
  "complexTypes": [],
1067
1067
  "type": "boolean | undefined"
1068
+ },
1069
+ {
1070
+ "name": "authorizedAppLinks",
1071
+ "tags": [
1072
+ {
1073
+ "text": "7.12.0",
1074
+ "name": "since"
1075
+ },
1076
+ {
1077
+ "text": "[]",
1078
+ "name": "default"
1079
+ }
1080
+ ],
1081
+ "docs": "List of URL base patterns that should be treated as authorized App Links, Android only.\nOnly links starting with any of these base URLs will be opened in the InAppBrowser.",
1082
+ "complexTypes": [],
1083
+ "type": "string[] | undefined"
1068
1084
  }
1069
1085
  ]
1070
1086
  },
@@ -408,6 +408,14 @@ export interface OpenWebViewOptions {
408
408
  * Test URL: https://aasa-tester.capgo.app/
409
409
  */
410
410
  preventDeeplink?: boolean;
411
+ /**
412
+ * List of URL base patterns that should be treated as authorized App Links, Android only.
413
+ * Only links starting with any of these base URLs will be opened in the InAppBrowser.
414
+ *
415
+ * @since 7.12.0
416
+ * @default []
417
+ */
418
+ authorizedAppLinks?: string[];
411
419
  }
412
420
  export interface InAppBrowserPlugin {
413
421
  /**
@@ -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","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 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 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, active the native navigation within the webview, Android only\n * @default false\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: 'Close Window',\n * closeModalDescription: 'Are you sure you want to close?',\n * closeModalOk: 'Yes, close',\n * closeModalCancel: 'No, stay'\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default '#ffffff'\n * @example\n * toolbarColor: '#FF5733'\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: '#FFFFFF'\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: 'sf-symbol',\n * icon: 'star.fill'\n * },\n * android: {\n * iconType: 'asset',\n * icon: 'public/monkey.svg',\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\" | \"vector\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * 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\nexport interface InAppBrowserPlugin {\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(): 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(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: 'value' });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement('button');\n * closeButton.textContent = 'Close WebView';\n * closeButton.addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: 'dataSubmitted',\n * data: { username: 'test', email: 'test@example.com' }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n };\n}\n"]}
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","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 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 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, active the native navigation within the webview, Android only\n * @default false\n * @example\n * activeNativeNavigationForWebview: true,\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n activeNativeNavigationForWebview?: boolean;\n /**\n * Disable the possibility to go back on native application,\n * useful to force user to stay on the webview, Android only\n * @default false\n * @example\n * disableGoBackOnNativeApplication: true\n * Test URL: https://capgo.app\n */\n disableGoBackOnNativeApplication?: boolean;\n /**\n * Open url in a new window fullscreen\n * isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.\n * @since 0.1.0\n * @default false\n * @example\n * isPresentAfterPageLoad: true,\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n isPresentAfterPageLoad?: boolean;\n /**\n * Whether the website in the webview is inspectable or not, ios only\n * @default false\n */\n isInspectable?: boolean;\n /**\n * Whether the webview opening is animated or not, ios only\n * @default true\n */\n isAnimated?: boolean;\n /**\n * Shows a reload button that reloads the web page\n * @since 1.0.15\n * @default false\n * @example\n * showReloadButton: true\n * Test URL: https://capgo.app\n */\n showReloadButton?: boolean;\n /**\n * CloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.\n * @since 1.1.0\n * @default false\n * @example\n * closeModal: true,\n * closeModalTitle: 'Close Window',\n * closeModalDescription: 'Are you sure you want to close?',\n * closeModalOk: 'Yes, close',\n * closeModalCancel: 'No, stay'\n * Test URL: https://capgo.app\n */\n closeModal?: boolean;\n /**\n * CloseModalTitle: title of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalTitle?: string;\n /**\n * CloseModalDescription: description of the confirm when user clicks on close button\n * @since 1.1.0\n * @default 'Are you sure you want to close this window?'\n */\n closeModalDescription?: string;\n /**\n * CloseModalOk: text of the confirm button when user clicks on close button\n * @since 1.1.0\n * @default 'Close'\n */\n closeModalOk?: string;\n /**\n * CloseModalCancel: text of the cancel button when user clicks on close button\n * @since 1.1.0\n * @default 'Cancel'\n */\n closeModalCancel?: string;\n /**\n * visibleTitle: if true the website title would be shown else shown empty\n * @since 1.2.5\n * @default true\n */\n visibleTitle?: boolean;\n /**\n * toolbarColor: color of the toolbar in hex format\n * @since 1.2.5\n * @default '#ffffff'\n * @example\n * toolbarColor: '#FF5733'\n * Test URL: https://capgo.app\n */\n toolbarColor?: string;\n /**\n * toolbarTextColor: color of the buttons and title in the toolbar in hex format\n * When set, it overrides the automatic light/dark mode detection for text color\n * @since 6.10.0\n * @default calculated based on toolbarColor brightness\n * @example\n * toolbarTextColor: '#FFFFFF'\n * Test URL: https://capgo.app\n */\n toolbarTextColor?: string;\n /**\n * showArrow: if true an arrow would be shown instead of cross for closing the window\n * @since 1.2.5\n * @default false\n * @example\n * showArrow: true\n * Test URL: https://capgo.app\n */\n showArrow?: boolean;\n /**\n * ignoreUntrustedSSLError: if true, the webview will ignore untrusted SSL errors allowing the user to view the website.\n * @since 6.1.0\n * @default false\n */\n ignoreUntrustedSSLError?: boolean;\n /**\n * preShowScript: if isPresentAfterPageLoad is true and this variable is set the plugin will inject a script before showing the browser.\n * This script will be run in an async context. The plugin will wait for the script to finish (max 10 seconds)\n * @since 6.6.0\n * @example\n * preShowScript: \"await import('https://unpkg.com/darkreader@4.9.89/darkreader.js');\\nDarkReader.enable({ brightness: 100, contrast: 90, sepia: 10 });\"\n * Test URL: https://capgo.app\n */\n preShowScript?: string;\n /**\n * proxyRequests is a regex expression. Please see [this pr](https://github.com/Cap-go/capacitor-inappbrowser/pull/222) for more info. (Android only)\n * @since 6.9.0\n */\n proxyRequests?: string;\n /**\n * buttonNearDone allows for a creation of a custom button near the done/close button.\n * The button is only shown when toolbarType is not \"activity\", \"navigation\", or \"blank\".\n *\n * For Android:\n * - iconType must be \"asset\"\n * - icon path should be in the public folder (e.g. \"monkey.svg\")\n * - width and height are optional, defaults to 48dp\n * - button is positioned at the end of toolbar with 8dp margin\n *\n * For iOS:\n * - iconType can be \"sf-symbol\" or \"asset\"\n * - for sf-symbol, icon should be the symbol name\n * - for asset, icon should be the asset name\n * @since 6.7.0\n * @example\n * buttonNearDone: {\n * ios: {\n * iconType: 'sf-symbol',\n * icon: 'star.fill'\n * },\n * android: {\n * iconType: 'asset',\n * icon: 'public/monkey.svg',\n * width: 24,\n * height: 24\n * }\n * }\n * Test URL: https://capgo.app\n */\n buttonNearDone?: {\n ios: {\n iconType: \"sf-symbol\" | \"asset\";\n icon: string;\n };\n android: {\n iconType: \"asset\" | \"vector\";\n icon: string;\n width?: number;\n height?: number;\n };\n };\n /**\n * 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 URL base patterns that should be treated as authorized App Links, Android only.\n * Only links starting with any of these base URLs will be opened in the InAppBrowser.\n *\n * @since 7.12.0\n * @default []\n */\n authorizedAppLinks?: string[];\n}\n\nexport interface InAppBrowserPlugin {\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(): 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(\n eventName: \"urlChangeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: \"buttonNearDoneClick\",\n listenerFunc: ButtonNearListener,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for close click only for openWebView\n *\n * @since 0.4.0\n */\n addListener(\n eventName: \"closeEvent\",\n listenerFunc: UrlChangeListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when user clicks on confirm button when disclaimer is required\n *\n * @since 0.0.1\n */\n addListener(\n eventName: \"confirmBtnClicked\",\n listenerFunc: ConfirmBtnListener,\n ): Promise<PluginListenerHandle>;\n /**\n * Will be triggered when event is sent from webview(inappbrowser), to send an event to the main app use window.mobileApp.postMessage({ \"detail\": { \"message\": \"myMessage\" } })\n * detail is the data you want to send to the main app, it's a requirement of Capacitor we cannot send direct objects\n * Your object has to be serializable to JSON, no functions or other non-JSON-serializable types are allowed.\n *\n * This method is inject at runtime in the webview\n */\n addListener(\n eventName: \"messageFromWebview\",\n listenerFunc: (event: { detail: Record<string, any> }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page is loaded\n */\n addListener(\n eventName: \"browserPageLoaded\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Will be triggered when page load error\n */\n addListener(\n eventName: \"pageLoadError\",\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Reload the current web page.\n *\n * @since 1.0.0\n */\n reload(): Promise<any>;\n}\n\n/**\n * JavaScript APIs available in the InAppBrowser WebView.\n *\n * These APIs are automatically injected into all webpages loaded in the InAppBrowser WebView.\n *\n * @example\n * // Closing the webview from JavaScript\n * window.mobileApp.close();\n *\n * // Sending a message from webview to the native app\n * window.mobileApp.postMessage({ key: 'value' });\n *\n * @since 6.10.0\n */\nexport interface InAppBrowserWebViewAPIs {\n /**\n * mobileApp - Global object injected into the WebView providing communication with the native app\n */\n mobileApp: {\n /**\n * Close the WebView from JavaScript\n *\n * @example\n * // Add a button to close the webview\n * const closeButton = document.createElement('button');\n * closeButton.textContent = 'Close WebView';\n * closeButton.addEventListener('click', () => {\n * window.mobileApp.close();\n * });\n * document.body.appendChild(closeButton);\n *\n * @since 6.10.0\n */\n close(): void;\n\n /**\n * Send a message from the WebView to the native app\n * The native app can listen for these messages with the \"messageFromWebview\" event\n *\n * @param message Object to send to the native app\n * @example\n * // Send data to native app\n * window.mobileApp.postMessage({\n * action: 'dataSubmitted',\n * data: { username: 'test', email: 'test@example.com' }\n * });\n *\n * @since 6.10.0\n */\n postMessage(message: Record<string, any>): void;\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/inappbrowser",
3
- "version": "7.10.11",
3
+ "version": "7.12.0",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",