@capgo/capacitor-updater 8.47.8 → 8.47.9

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
@@ -633,6 +633,11 @@ The bundle must include an `index.html` file at the root level.
633
633
  For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
634
634
  For multi-file delta updates, provide the `manifest` array.
635
635
 
636
+ **Android Background Runner note:** `@capacitor/background-runner` loads its
637
+ configured runner script from native APK assets. Live updates cannot replace
638
+ that runner script. Keep it stable across OTA updates and ship a native app
639
+ update when the runner code changes.
640
+
636
641
  | Param | Type | Description |
637
642
  | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
638
643
  | **`options`** | <code><a href="#downloadoptions">DownloadOptions</a></code> | The {@link <a href="#downloadoptions">DownloadOptions</a>} for downloading a new bundle zip. |
@@ -1188,6 +1193,9 @@ Use this to:
1188
1193
  - Check if a device is on a specific channel before showing features
1189
1194
  - Verify channel assignment after calling {@link setChannel}
1190
1195
 
1196
+ On native platforms, a successful response also refreshes the locally persisted
1197
+ default channel used by update checks.
1198
+
1191
1199
  **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
1192
1200
 
1193
1201
  **Since:** 4.8.0
@@ -129,7 +129,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
129
129
  static final int APPLICATION_EXIT_REASON_USER_REQUESTED = 10;
130
130
  static final int APPLICATION_EXIT_REASON_DEPENDENCY_DIED = 12;
131
131
 
132
- private final String pluginVersion = "8.47.8";
132
+ private final String pluginVersion = "8.47.9";
133
133
  private static final String DELAY_CONDITION_PREFERENCES = "";
134
134
 
135
135
  private SharedPreferences.Editor editor;
@@ -1995,6 +1995,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
1995
1995
  CapacitorUpdaterPlugin.this.editor,
1996
1996
  DEFAULT_CHANNEL_PREF_KEY,
1997
1997
  CapacitorUpdaterPlugin.this.allowSetDefaultChannel,
1998
+ CapacitorUpdaterPlugin.this.getConfig().getString("defaultChannel", ""),
1998
1999
  (res) -> {
1999
2000
  JSObject jsRes = InternalUtils.mapToJSObject(res);
2000
2001
  if (jsRes.has("error")) {
@@ -2043,21 +2044,25 @@ public class CapacitorUpdaterPlugin extends Plugin {
2043
2044
  try {
2044
2045
  logger.info("getChannel");
2045
2046
  startNewThread(() ->
2046
- CapacitorUpdaterPlugin.this.implementation.getChannel((res) -> {
2047
- JSObject jsRes = InternalUtils.mapToJSObject(res);
2048
- if (jsRes.has("error")) {
2049
- String errorMessage = jsRes.has("message") ? jsRes.getString("message") : jsRes.getString("error");
2050
- String errorCode = jsRes.getString("error");
2047
+ CapacitorUpdaterPlugin.this.implementation.getChannel(
2048
+ (res) -> {
2049
+ JSObject jsRes = InternalUtils.mapToJSObject(res);
2050
+ if (jsRes.has("error")) {
2051
+ String errorMessage = jsRes.has("message") ? jsRes.getString("message") : jsRes.getString("error");
2052
+ String errorCode = jsRes.getString("error");
2051
2053
 
2052
- JSObject errorObj = new JSObject();
2053
- errorObj.put("message", errorMessage);
2054
- errorObj.put("error", errorCode);
2054
+ JSObject errorObj = new JSObject();
2055
+ errorObj.put("message", errorMessage);
2056
+ errorObj.put("error", errorCode);
2055
2057
 
2056
- call.reject(errorMessage, "GETCHANNEL_FAILED", null, errorObj);
2057
- } else {
2058
- call.resolve(jsRes);
2059
- }
2060
- })
2058
+ call.reject(errorMessage, "GETCHANNEL_FAILED", null, errorObj);
2059
+ } else {
2060
+ call.resolve(jsRes);
2061
+ }
2062
+ },
2063
+ CapacitorUpdaterPlugin.this.editor,
2064
+ DEFAULT_CHANNEL_PREF_KEY
2065
+ )
2061
2066
  );
2062
2067
  } catch (final Exception e) {
2063
2068
  logger.error("Failed to getChannel " + e.getMessage());
@@ -2523,16 +2528,11 @@ public class CapacitorUpdaterPlugin extends Plugin {
2523
2528
  private boolean leavePreviewSessionForIncomingPreviewLink() {
2524
2529
  this.showPreviewTransitionLoader("incoming-preview-deeplink");
2525
2530
  final BundleInfo previewBundle = this.implementation.getCurrentBundle();
2526
- final BundleInfo previewFallbackBundle = this.implementation.getPreviewFallbackBundle();
2531
+ final BundleInfo previewFallbackBundle = this.resolvePreviewFallbackBundle("incoming preview deeplink");
2527
2532
  boolean didReload = false;
2528
2533
 
2529
2534
  try {
2530
- if (previewFallbackBundle == null || previewFallbackBundle.isErrorStatus()) {
2531
- logger.error("No preview fallback bundle available");
2532
- return false;
2533
- }
2534
- if (!this.implementation.canSet(previewFallbackBundle)) {
2535
- logger.error("Preview fallback bundle is not installable");
2535
+ if (previewFallbackBundle == null) {
2536
2536
  return false;
2537
2537
  }
2538
2538
 
@@ -2542,7 +2542,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
2542
2542
  return false;
2543
2543
  }
2544
2544
 
2545
- if (!this._reload()) {
2545
+ if (!this.reloadWithoutWaitingForAppReady()) {
2546
2546
  this.implementation.restoreResetState(previousState);
2547
2547
  this.restoreLiveBundleStateAfterFailedReload();
2548
2548
  return false;
@@ -2590,13 +2590,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
2590
2590
 
2591
2591
  private boolean leavePreviewSessionWithoutReload(final boolean keepPreviewGuard) {
2592
2592
  final BundleInfo previewBundle = this.implementation.getCurrentBundle();
2593
- final BundleInfo previewFallbackBundle = this.implementation.getPreviewFallbackBundle();
2594
- if (previewFallbackBundle == null || previewFallbackBundle.isErrorStatus()) {
2595
- logger.error("No preview fallback bundle available");
2596
- return false;
2597
- }
2598
- if (!this.implementation.canSet(previewFallbackBundle)) {
2599
- logger.error("Preview fallback bundle is not installable");
2593
+ final BundleInfo previewFallbackBundle = this.resolvePreviewFallbackBundle("preview deeplink launch");
2594
+ if (previewFallbackBundle == null) {
2600
2595
  return false;
2601
2596
  }
2602
2597
  if (!this.implementation.stagePreviewFallbackReload(previewFallbackBundle)) {
@@ -2649,20 +2644,15 @@ public class CapacitorUpdaterPlugin extends Plugin {
2649
2644
  }
2650
2645
 
2651
2646
  private boolean resetToPreviewFallbackBundle() {
2652
- final BundleInfo fallback = this.implementation.getPreviewFallbackBundle();
2653
- if (fallback == null || fallback.isErrorStatus()) {
2654
- logger.error("No preview fallback bundle available");
2655
- return false;
2656
- }
2657
- if (!this.implementation.canSet(fallback)) {
2658
- logger.error("Preview fallback bundle is not installable");
2647
+ final BundleInfo fallback = this.resolvePreviewFallbackBundle("leave preview");
2648
+ if (fallback == null) {
2659
2649
  return false;
2660
2650
  }
2661
2651
 
2662
2652
  final CapgoUpdater.ResetState previousState = this.implementation.captureResetState();
2663
2653
  final String previousBundleName = this.implementation.getCurrentBundle().getVersionName();
2664
2654
  logger.info("Resetting to preview fallback bundle: " + fallback.getVersionName());
2665
- if (this.implementation.stagePreviewFallbackReload(fallback) && this._reload()) {
2655
+ if (this.implementation.stagePreviewFallbackReload(fallback) && this.reloadWithoutWaitingForAppReady()) {
2666
2656
  this.implementation.finalizeResetTransition(previousBundleName, false);
2667
2657
  this.notifyBundleSet(fallback);
2668
2658
  return true;
@@ -2672,6 +2662,29 @@ public class CapacitorUpdaterPlugin extends Plugin {
2672
2662
  return false;
2673
2663
  }
2674
2664
 
2665
+ private BundleInfo resolvePreviewFallbackBundle(final String reason) {
2666
+ final BundleInfo fallback = this.implementation.getPreviewFallbackBundle();
2667
+ if (fallback != null && !fallback.isErrorStatus() && this.implementation.canSet(fallback)) {
2668
+ return fallback;
2669
+ }
2670
+
2671
+ if (fallback == null) {
2672
+ logger.warn("No preview fallback bundle available for " + reason + ". Falling back to builtin bundle.");
2673
+ } else if (fallback.isErrorStatus()) {
2674
+ logger.warn("Preview fallback bundle is in error state for " + reason + ". Falling back to builtin bundle.");
2675
+ } else {
2676
+ logger.warn("Preview fallback bundle is not installable for " + reason + ". Falling back to builtin bundle.");
2677
+ }
2678
+
2679
+ final BundleInfo builtin = this.implementation.getBundleInfo(BundleInfo.ID_BUILTIN);
2680
+ if (builtin != null && !builtin.isErrorStatus() && this.implementation.canSet(builtin)) {
2681
+ return builtin;
2682
+ }
2683
+
2684
+ logger.error("Builtin bundle is not available to leave preview for " + reason);
2685
+ return null;
2686
+ }
2687
+
2675
2688
  private void endPreviewSession() {
2676
2689
  this.endPreviewSession(false);
2677
2690
  }
@@ -2706,11 +2719,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
2706
2719
 
2707
2720
  private void clearPreviewSessionBecauseDisabled() {
2708
2721
  logger.info("Preview session disabled by config; restoring preview fallback");
2709
- final BundleInfo fallback = this.implementation.getPreviewFallbackBundle();
2710
- final BundleInfo bundleToRestore =
2711
- fallback == null || fallback.isErrorStatus() ? this.implementation.getBundleInfo(BundleInfo.ID_BUILTIN) : fallback;
2712
-
2713
- if (this.implementation.canSet(bundleToRestore)) {
2722
+ final BundleInfo bundleToRestore = this.resolvePreviewFallbackBundle("preview disabled");
2723
+ if (bundleToRestore != null) {
2714
2724
  this.implementation.stagePreviewFallbackReload(bundleToRestore);
2715
2725
  } else {
2716
2726
  logger.warn("Could not restore preview fallback while disabling preview");
@@ -18,12 +18,15 @@ import androidx.work.WorkManager;
18
18
  import com.google.common.util.concurrent.Futures;
19
19
  import com.google.common.util.concurrent.ListenableFuture;
20
20
  import java.io.BufferedInputStream;
21
+ import java.io.BufferedReader;
21
22
  import java.io.File;
22
23
  import java.io.FileInputStream;
23
24
  import java.io.FileNotFoundException;
24
25
  import java.io.FileOutputStream;
25
26
  import java.io.FilenameFilter;
26
27
  import java.io.IOException;
28
+ import java.io.InputStreamReader;
29
+ import java.nio.charset.StandardCharsets;
27
30
  import java.security.SecureRandom;
28
31
  import java.util.ArrayList;
29
32
  import java.util.Date;
@@ -63,6 +66,8 @@ public class CapgoUpdater {
63
66
  private static final String PREVIEW_FALLBACK_VERSION = "previewFallbackVersion";
64
67
  private static final String bundleDirectory = "versions";
65
68
  private static final String TEMP_UNZIP_PREFIX = "capgo_unzip_";
69
+ private static final String CAPACITOR_CONFIG_ASSET = "capacitor.config.json";
70
+ private static final String BACKGROUND_RUNNER_CONFIG_KEY = "BackgroundRunner";
66
71
 
67
72
  public static final String TAG = "Capacitor-updater";
68
73
  public SharedPreferences.Editor editor;
@@ -920,6 +925,7 @@ public class CapgoUpdater {
920
925
  }
921
926
 
922
927
  private void setCurrentBundle(final File bundle) {
928
+ this.cancelBackgroundRunnerWorkBeforeBundleSwitch();
923
929
  this.editor.putString(this.CAP_SERVER_PATH, bundle.getPath());
924
930
  logger.info("Current bundle set to: " + bundle);
925
931
  this.editor.commit();
@@ -929,6 +935,73 @@ public class CapgoUpdater {
929
935
  return bundlePath != null && !bundlePath.trim().isEmpty() && !isBuiltin && !hasStoredBundleInfo;
930
936
  }
931
937
 
938
+ static String getBackgroundRunnerLabelFromConfig(final String configJson) {
939
+ if (configJson == null || configJson.trim().isEmpty()) {
940
+ return null;
941
+ }
942
+
943
+ try {
944
+ final JSONObject config = new JSONObject(configJson);
945
+ final JSONObject plugins = config.optJSONObject("plugins");
946
+ if (plugins == null) {
947
+ return null;
948
+ }
949
+
950
+ final JSONObject backgroundRunner = plugins.optJSONObject(BACKGROUND_RUNNER_CONFIG_KEY);
951
+ if (backgroundRunner == null) {
952
+ return null;
953
+ }
954
+
955
+ final String label = backgroundRunner.optString("label", "").trim();
956
+ return label.isEmpty() ? null : label;
957
+ } catch (JSONException ignored) {
958
+ return null;
959
+ }
960
+ }
961
+
962
+ private String readAssetAsString(final String assetPath) throws IOException {
963
+ final StringBuilder buffer = new StringBuilder();
964
+ try (
965
+ final BufferedReader reader = new BufferedReader(
966
+ new InputStreamReader(this.activity.getAssets().open(assetPath), StandardCharsets.UTF_8)
967
+ )
968
+ ) {
969
+ String line;
970
+ while ((line = reader.readLine()) != null) {
971
+ buffer.append(line).append('\n');
972
+ }
973
+ }
974
+ return buffer.toString();
975
+ }
976
+
977
+ private void cancelBackgroundRunnerWorkBeforeBundleSwitch() {
978
+ if (this.activity == null) {
979
+ return;
980
+ }
981
+
982
+ final String label;
983
+ try {
984
+ label = getBackgroundRunnerLabelFromConfig(this.readAssetAsString(CAPACITOR_CONFIG_ASSET));
985
+ } catch (IOException ignored) {
986
+ return;
987
+ }
988
+
989
+ if (label == null) {
990
+ return;
991
+ }
992
+
993
+ try {
994
+ final WorkManager workManager = WorkManager.getInstance(this.activity.getApplicationContext());
995
+ workManager.cancelUniqueWork(label);
996
+ workManager.cancelAllWorkByTag(label);
997
+ logger.info("Cancelled Background Runner work before bundle switch.");
998
+ logger.debug("Background Runner label: " + label);
999
+ } catch (Exception e) {
1000
+ logger.warn("Failed to cancel Background Runner work before bundle switch.");
1001
+ logger.debug("Background Runner cancellation error: " + e.getMessage());
1002
+ }
1003
+ }
1004
+
932
1005
  private boolean hasStoredBundleInfo(final String id) {
933
1006
  return (
934
1007
  id != null &&
@@ -1614,6 +1687,17 @@ public class CapgoUpdater {
1614
1687
  final String defaultChannelKey,
1615
1688
  final boolean allowSetDefaultChannel,
1616
1689
  final Callback callback
1690
+ ) {
1691
+ this.setChannel(channel, editor, defaultChannelKey, allowSetDefaultChannel, "", callback);
1692
+ }
1693
+
1694
+ public void setChannel(
1695
+ final String channel,
1696
+ final SharedPreferences.Editor editor,
1697
+ final String defaultChannelKey,
1698
+ final boolean allowSetDefaultChannel,
1699
+ final String configDefaultChannel,
1700
+ final Callback callback
1617
1701
  ) {
1618
1702
  // Check if setting defaultChannel is allowed
1619
1703
  if (!allowSetDefaultChannel) {
@@ -1666,6 +1750,7 @@ public class CapgoUpdater {
1666
1750
  // Clear persisted defaultChannel and revert to config value
1667
1751
  editor.remove(defaultChannelKey);
1668
1752
  editor.apply();
1753
+ this.defaultChannel = configDefaultChannel;
1669
1754
  logger.info("Public channel requested, channel override removed");
1670
1755
  callback.callback(res);
1671
1756
  } else {
@@ -1680,6 +1765,10 @@ public class CapgoUpdater {
1680
1765
  }
1681
1766
 
1682
1767
  public void getChannel(final Callback callback) {
1768
+ this.getChannel(callback, null, null);
1769
+ }
1770
+
1771
+ public void getChannel(final Callback callback, final SharedPreferences.Editor editor, final String defaultChannelKey) {
1683
1772
  // Check if rate limit was exceeded
1684
1773
  if (rateLimitExceeded) {
1685
1774
  logger.debug("Skipping getChannel due to rate limit (429). Requests will resume after app restart.");
@@ -1798,6 +1887,7 @@ public class CapgoUpdater {
1798
1887
  ret.put(key, jsonResponse.get(key));
1799
1888
  }
1800
1889
  }
1890
+ persistDefaultChannelFromResponse(ret.get("channel"), editor, defaultChannelKey);
1801
1891
  logger.info("Channel get to \"" + ret);
1802
1892
  callback.callback(ret);
1803
1893
  } catch (JSONException e) {
@@ -1811,6 +1901,24 @@ public class CapgoUpdater {
1811
1901
  );
1812
1902
  }
1813
1903
 
1904
+ void persistDefaultChannelFromResponse(final Object channel, final SharedPreferences.Editor editor, final String defaultChannelKey) {
1905
+ if (!(channel instanceof String)) {
1906
+ return;
1907
+ }
1908
+
1909
+ final String channelName = ((String) channel).trim();
1910
+ if (channelName.isEmpty() || BundleInfo.ID_BUILTIN.equals(channelName)) {
1911
+ return;
1912
+ }
1913
+
1914
+ this.defaultChannel = channelName;
1915
+ if (editor != null && defaultChannelKey != null && !defaultChannelKey.isEmpty()) {
1916
+ editor.putString(defaultChannelKey, channelName);
1917
+ editor.apply();
1918
+ }
1919
+ logger.info("defaultChannel synchronized from getChannel(): " + channelName);
1920
+ }
1921
+
1814
1922
  public void listChannels(final Callback callback) {
1815
1923
  // Check if rate limit was exceeded
1816
1924
  if (rateLimitExceeded) {
@@ -542,6 +542,7 @@ public class ShakeMenu implements ShakeDetector.Listener {
542
542
  new Thread(() -> {
543
543
  final CapgoUpdater updater = plugin.implementation;
544
544
  final Bridge bridge = activity.getBridge();
545
+ final String configDefaultChannel = plugin.getConfig().getString("defaultChannel", "");
545
546
 
546
547
  // Set the channel - respect plugin's allowSetDefaultChannel config
547
548
  updater.setChannel(
@@ -549,6 +550,7 @@ public class ShakeMenu implements ShakeDetector.Listener {
549
550
  updater.editor,
550
551
  "CapacitorUpdater.defaultChannel",
551
552
  plugin.allowSetDefaultChannel,
553
+ configDefaultChannel,
552
554
  (setRes) -> {
553
555
  if (setRes == null) {
554
556
  activity.runOnUiThread(() -> {
package/dist/docs.json CHANGED
@@ -156,7 +156,7 @@
156
156
  "text": "{Error} If the download fails or the bundle is invalid."
157
157
  }
158
158
  ],
159
- "docs": "Download a new bundle from the provided URL for later installation.\n\nThe downloaded bundle is stored locally but not activated. To use it:\n- Call {@link next} to set it for installation on next app backgrounding/restart\n- Call {@link set} to activate it immediately (destroys current JavaScript context)\n\nThe URL should point to a zip file containing either:\n- Your app files directly in the zip root, or\n- A single folder containing all your app files\n\nThe bundle must include an `index.html` file at the root level.\n\nFor encrypted bundles, provide the `sessionKey` and `checksum` parameters.\nFor multi-file delta updates, provide the `manifest` array.",
159
+ "docs": "Download a new bundle from the provided URL for later installation.\n\nThe downloaded bundle is stored locally but not activated. To use it:\n- Call {@link next} to set it for installation on next app backgrounding/restart\n- Call {@link set} to activate it immediately (destroys current JavaScript context)\n\nThe URL should point to a zip file containing either:\n- Your app files directly in the zip root, or\n- A single folder containing all your app files\n\nThe bundle must include an `index.html` file at the root level.\n\nFor encrypted bundles, provide the `sessionKey` and `checksum` parameters.\nFor multi-file delta updates, provide the `manifest` array.\n\n**Android Background Runner note:** `@capacitor/background-runner` loads its\nconfigured runner script from native APK assets. Live updates cannot replace\nthat runner script. Keep it stable across OTA updates and ship a native app\nupdate when the runner code changes.",
160
160
  "complexTypes": [
161
161
  "BundleInfo",
162
162
  "DownloadOptions"
@@ -720,7 +720,7 @@
720
720
  "text": "4.8.0"
721
721
  }
722
722
  ],
723
- "docs": "Get the current channel assigned to this device.\n\nReturns information about:\n- `channel`: The currently assigned channel name (if any)\n- `allowSet`: Whether the channel allows self-assignment\n- `status`: Operation status\n- `error`/`message`: Additional information (if applicable)\n\nUse this to:\n- Display current channel to users (e.g., \"You're on the Beta channel\")\n- Check if a device is on a specific channel before showing features\n- Verify channel assignment after calling {@link setChannel}",
723
+ "docs": "Get the current channel assigned to this device.\n\nReturns information about:\n- `channel`: The currently assigned channel name (if any)\n- `allowSet`: Whether the channel allows self-assignment\n- `status`: Operation status\n- `error`/`message`: Additional information (if applicable)\n\nUse this to:\n- Display current channel to users (e.g., \"You're on the Beta channel\")\n- Check if a device is on a specific channel before showing features\n- Verify channel assignment after calling {@link setChannel}\n\nOn native platforms, a successful response also refreshes the locally persisted\ndefault channel used by update checks.",
724
724
  "complexTypes": [
725
725
  "GetChannelRes"
726
726
  ],
@@ -467,6 +467,11 @@ export interface CapacitorUpdaterPlugin {
467
467
  * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
468
468
  * For multi-file delta updates, provide the `manifest` array.
469
469
  *
470
+ * **Android Background Runner note:** `@capacitor/background-runner` loads its
471
+ * configured runner script from native APK assets. Live updates cannot replace
472
+ * that runner script. Keep it stable across OTA updates and ship a native app
473
+ * update when the runner code changes.
474
+ *
470
475
  * @example
471
476
  * const bundle = await CapacitorUpdater.download({
472
477
  * url: `https://example.com/versions/${version}/dist.zip`,
@@ -909,6 +914,9 @@ export interface CapacitorUpdaterPlugin {
909
914
  * - Check if a device is on a specific channel before showing features
910
915
  * - Verify channel assignment after calling {@link setChannel}
911
916
  *
917
+ * On native platforms, a successful response also refreshes the locally persisted
918
+ * default channel used by update checks.
919
+ *
912
920
  * @returns {Promise<GetChannelRes>} The current channel information.
913
921
  * @throws {Error} If the operation fails.
914
922
  * @since 4.8.0
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAu8EH;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAsBX;AAtBD,WAAY,qBAAqB;IAC/B;;;OAGG;IACH,uEAAW,CAAA;IAEX;;;OAGG;IACH,iGAAwB,CAAA;IAExB;;OAEG;IACH,yFAAoB,CAAA;IAEpB;;OAEG;IACH,6FAAsB,CAAA;AACxB,CAAC,EAtBW,qBAAqB,KAArB,qBAAqB,QAsBhC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,2BA2CX;AA3CD,WAAY,2BAA2B;IACrC;;OAEG;IACH,mFAAW,CAAA;IAEX;;OAEG;IACH,mFAAW,CAAA;IAEX;;;OAGG;IACH,2FAAe,CAAA;IAEf;;OAEG;IACH,yFAAc,CAAA;IAEd;;;OAGG;IACH,uFAAa,CAAA;IAEb;;OAEG;IACH,iFAAU,CAAA;IAEV;;OAEG;IACH,qFAAY,CAAA;IAEZ;;;OAGG;IACH,0FAAe,CAAA;AACjB,CAAC,EA3CW,2BAA2B,KAA3B,2BAA2B,QA2CtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBAgCX;AAhCD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,yDAAM,CAAA;IAEN;;OAEG;IACH,qEAAY,CAAA;IAEZ;;OAEG;IACH,iEAAU,CAAA;IAEV;;OAEG;IACH,+EAAiB,CAAA;IAEjB;;;OAGG;IACH,2EAAe,CAAA;IAEf;;;OAGG;IACH,6EAAgB,CAAA;AAClB,CAAC,EAhCW,mBAAmB,KAAnB,mBAAmB,QAgC9B","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/// <reference types=\"@capacitor/cli\" />\nimport type { PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * CapacitorUpdater can be configured with these options:\n */\n CapacitorUpdater?: {\n /**\n * Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @example 1000 // (1 second, minimum 1000)\n */\n appReadyTimeout?: number;\n\n /**\n * Configure the number of seconds the native plugin should wait before considering API timeout.\n *\n * Only available for Android and iOS.\n *\n * @default 20 // (20 second)\n * @example 10 // (10 second)\n */\n responseTimeout?: number;\n\n /**\n * Configure whether the plugin should use automatically delete failed bundles.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeleteFailed?: boolean;\n\n /**\n * Configure whether the plugin should use automatically delete previous bundles after a successful update.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeletePrevious?: boolean;\n\n /**\n * Configure how the plugin should use Auto Update via an update server.\n *\n * Boolean values keep their existing behavior:\n * - `true`: Same as `\"atBackground\"`.\n * - `false`: Same as `\"off\"`.\n *\n * String values merge the previous Auto Update and Direct Update configuration:\n * - `\"off\"`: Disable Auto Update.\n * - `\"atBackground\"`: Check and download updates automatically, then apply them the next time the app moves to background.\n * - `\"atInstall\"`: Direct install only after app install or native app update, otherwise use `\"atBackground\"` behavior.\n * - `\"onLaunch\"`: Direct install on app launch, otherwise use `\"atBackground\"` behavior after the first launch attempt.\n * - `\"always\"`: Direct install whenever Auto Update runs.\n * - `\"onlyDownload\"`: Check and download updates automatically, emit `updateAvailable`, but never direct install or set the next bundle automatically.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example \"onlyDownload\"\n */\n autoUpdate?: boolean | 'off' | 'atBackground' | 'atInstall' | 'onLaunch' | 'always' | 'onlyDownload';\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n * Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native.\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n resetWhenUpdate?: boolean;\n\n /**\n * Configure the URL / endpoint to which update checks are sent.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/updates\n * @example https://example.com/api/auto_update\n */\n updateUrl?: string;\n\n /**\n * Configure the URL / endpoint for channel operations.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/channel_self\n * @example https://example.com/api/channel\n */\n channelUrl?: string;\n\n /**\n * Configure the URL / endpoint to which update statistics are sent.\n *\n * Only available for Android and iOS. Set to \"\" to disable stats reporting.\n * Native stats include update lifecycle events, app health signals such as crashes,\n * Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals\n * such as JavaScript errors, unhandled promise rejections, resource load failures,\n * WebView renderer exits, and unclean WebView restarts when available.\n *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\n\n /**\n * Configure the public key for end to end live update encryption Version 2\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 6.2.0\n */\n publicKey?: string;\n\n /**\n * Configure the current version of the app. This will be used for the first update request.\n * If not set, the plugin will get the version from the native code.\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 4.17.48\n */\n version?: string;\n\n /**\n * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n *\n * @deprecated Use {@link PluginsConfig.CapacitorUpdater.autoUpdate} string modes instead.\n * Works well for apps less than 10MB and with uploads done using --delta flag.\n * Zip or apps more than 10MB will be relatively slow for users to update.\n * - false: Never do direct updates (use default behavior: download at start, set when backgrounded)\n * - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false\n * - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false\n * - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false\n * - true: (deprecated) Same as \"always\" for backward compatibility\n *\n * Activate this flag will automatically make the CLI upload delta in CICD envs and will ask for confirmation in local uploads.\n * Only available for Android and iOS.\n *\n * @default false\n * @since 5.1.0\n */\n directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';\n\n /**\n * Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed.\n * This removes the need to manually listen for appReady events and call SplashScreen.hide().\n * Only works when autoUpdate is set to \"atInstall\", \"always\", or \"onLaunch\", or when the deprecated directUpdate option is set to \"atInstall\", \"always\", \"onLaunch\", or true.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n * Requires Auto Update and Direct Update behavior to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.6.0\n */\n autoSplashscreen?: boolean;\n\n /**\n * Display a native loading indicator on top of the splashscreen while automatic direct updates are running.\n * Only takes effect when {@link autoSplashscreen} is enabled.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.19.0\n */\n autoSplashscreenLoader?: boolean;\n\n /**\n * Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.\n * If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.\n * Set to `0` (zero) to disable the timeout.\n * When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.\n * Requires {@link autoSplashscreen} to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @since 7.19.0\n */\n autoSplashscreenTimeout?: number;\n\n /**\n * Configure the delay period for period update check. the unit is in seconds.\n *\n * Only available for Android and iOS.\n * Cannot be less than 600 seconds (10 minutes).\n *\n * @default 0 (disabled)\n * @example 3600 (1 hour)\n * @example 86400 (24 hours)\n */\n periodCheckDelay?: number;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localS3?: boolean;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localHost?: string;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localWebHost?: string;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupa?: string;\n\n /**\n * Configure the CLI to use a local server for testing.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupaAnon?: string;\n\n /**\n * Configure the CLI to use a local api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApi?: string;\n\n /**\n * Configure the CLI to use a local file api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApiFiles?: string;\n /**\n * Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 5.4.0\n */\n allowModifyUrl?: boolean;\n\n /**\n * Allow the plugin to modify the appId dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 7.14.0\n */\n allowModifyAppId?: boolean;\n\n /**\n * Allow marking bundles as errored from JavaScript while using manual update flows.\n * When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.\n *\n * @default false\n * @since 7.20.0\n */\n allowManualBundleError?: boolean;\n\n /**\n * Allow JavaScript to start a native preview session and temporarily request updates for another app id.\n * This is intended for trusted container apps that implement Expo Go-style preview flows.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 8.47.0\n */\n allowPreview?: boolean;\n\n /**\n * Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false (will be true by default in a future major release v8.x.x)\n * @since 7.17.3\n */\n persistCustomId?: boolean;\n\n /**\n * Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},\n * {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.20.0\n */\n persistModifyUrl?: boolean;\n\n /**\n * Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel.\n * When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.\n *\n * @default true\n * @since 7.34.0\n */\n allowSetDefaultChannel?: boolean;\n\n /**\n * Set the default channel for the app in the config. Case sensitive.\n * This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.\n * This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options\n *\n *\n * @default undefined\n * @since 5.5.0\n */\n defaultChannel?: string;\n /**\n * Configure the app id for the app in the config.\n *\n * @default undefined\n * @since 6.0.0\n */\n appId?: string;\n\n /**\n * Configure the plugin to keep the URL path after a reload.\n * WARNING: When a reload is triggered, 'window.history' will be cleared.\n *\n * @default false\n * @since 6.8.0\n */\n keepUrlPathAfterReload?: boolean;\n\n /**\n * Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done\n *\n * @default false\n * @since 7.3.0\n */\n disableJSLogging?: boolean;\n\n /**\n * Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds.\n *\n * - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments\n * - **Android**: Logs to Logcat (android.util.Log)\n *\n * When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled).\n *\n * This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android).\n *\n * @default true\n * @since 8.42.0\n */\n osLogging?: boolean;\n\n /**\n * Enable the shake gesture while a preview session is active.\n * Outside preview sessions this preview menu is ignored, unless\n * {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: boolean;\n\n /**\n * Enable the shake gesture to show a channel selector menu for switching between update channels.\n * If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active,\n * the shake menu includes both preview actions and channel switching.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 8.43.0\n */\n allowShakeChannelSelector?: boolean;\n };\n }\n}\n\nexport interface CapacitorUpdaterPlugin {\n /**\n * Notify the native layer that JavaScript initialized successfully.\n *\n * **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**\n *\n * This is a simple notification to confirm that your bundle's JavaScript loaded and executed.\n * The native web server successfully served the bundle files and your JS runtime started.\n * That's all it checks - nothing more complex.\n *\n * **What triggers rollback:**\n * - NOT calling this method within the timeout (default: 10 seconds)\n * - Complete JavaScript failure (bundle won't load at all)\n *\n * **What does NOT trigger rollback:**\n * - Runtime errors after initialization (API failures, crashes, etc.)\n * - Network request failures\n * - Application logic errors\n *\n * **IMPORTANT: Call this BEFORE any network requests.**\n * Don't wait for APIs, data loading, or async operations. Call it as soon as your\n * JavaScript bundle starts executing to confirm the bundle itself is valid.\n *\n * Best practices:\n * - Call immediately in your app entry point (main.js, app component mount, etc.)\n * - Don't put it after network calls or heavy initialization\n * - Don't wrap it in try/catch with conditions\n * - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time\n *\n * @returns {Promise<AppReadyResult>} Always resolves successfully with current bundle info. This method never fails.\n */\n notifyAppReady(): Promise<AppReadyResult>;\n\n /**\n * Set the update URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for checking for updates.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setUpdateUrl(options: UpdateUrl): Promise<void>;\n\n /**\n * Set the statistics URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Pass an empty string to disable statistics gathering entirely.\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n *\n * @param options Contains the URL to use for sending statistics, or an empty string to disable.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setStatsUrl(options: StatsUrl): Promise<void>;\n\n /**\n * Set the channel URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for channel operations.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setChannelUrl(options: ChannelUrl): Promise<void>;\n\n /**\n * Download a new bundle from the provided URL for later installation.\n *\n * The downloaded bundle is stored locally but not activated. To use it:\n * - Call {@link next} to set it for installation on next app backgrounding/restart\n * - Call {@link set} to activate it immediately (destroys current JavaScript context)\n *\n * The URL should point to a zip file containing either:\n * - Your app files directly in the zip root, or\n * - A single folder containing all your app files\n *\n * The bundle must include an `index.html` file at the root level.\n *\n * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.\n * For multi-file delta updates, provide the `manifest` array.\n *\n * @example\n * const bundle = await CapacitorUpdater.download({\n * url: `https://example.com/versions/${version}/dist.zip`,\n * version: version\n * });\n * // Bundle is downloaded but not active yet\n * await CapacitorUpdater.next({ id: bundle.id }); // Will activate on next background\n *\n * @param options The {@link DownloadOptions} for downloading a new bundle zip.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the downloaded bundle.\n * @throws {Error} If the download fails or the bundle is invalid.\n */\n download(options: DownloadOptions): Promise<BundleInfo>;\n\n /**\n * Set the next bundle to be activated when the app backgrounds or restarts.\n *\n * This is the recommended way to apply updates as it doesn't interrupt the user's current session.\n * The bundle will be activated when:\n * - The app is backgrounded (user switches away), or\n * - The app is killed and relaunched, or\n * - {@link reload} is called manually\n *\n * Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.\n * Your app continues running normally until one of the above events occurs.\n *\n * Use {@link setMultiDelay} to add additional conditions before the update is applied.\n *\n * @param options Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.\n * @throws {Error} When there is no index.html file inside the bundle folder or the bundle doesn't exist.\n */\n next(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Set the current bundle and immediately reloads the app.\n *\n * **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**\n *\n * When you call this method:\n * - The entire JavaScript context is immediately destroyed\n * - The app reloads from a different folder with different files\n * - NO code after this call will execute\n * - NO promises will resolve\n * - NO callbacks will fire\n * - Event listeners registered after this call are unreliable and may never fire\n *\n * The reload happens automatically - you don't need to do anything else.\n * If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.\n * For other state preservation needs, save your data before calling this method (e.g., to localStorage).\n *\n * **Do not** try to execute additional logic after calling `set()` - it won't work as expected.\n *\n * @param options A {@link BundleId} object containing the new bundle id to set as current.\n * @returns {Promise<void>} A promise that will never resolve because the JavaScript context is destroyed.\n * @throws {Error} When there is no index.html file inside the bundle folder.\n */\n set(options: BundleId): Promise<void>;\n\n /**\n * Start a temporary preview/testing session.\n *\n * This stores the currently active bundle as the pending fallback, enables the\n * native shake menu, and makes the next applied bundle show a native notice\n * explaining that shaking the device can reload or leave the preview.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * When `appId` is provided, the preview session temporarily uses that app id\n * for update checks until the user leaves the preview. Native updater stats are\n * skipped while the preview session is active.\n *\n * Use this before calling {@link set} for Expo Go-style preview flows.\n *\n * @param options Optional preview session options.\n * @returns {Promise<void>} Resolves when preview session state is prepared.\n * @since 8.47.0\n */\n startPreviewSession(options?: StartPreviewSessionOptions): Promise<void>;\n\n /**\n * Delete a bundle from local storage to free up disk space.\n *\n * You cannot delete:\n * - The currently active bundle\n * - The `builtin` bundle (the version shipped with your app)\n * - The bundle set as `next` (call {@link next} with a different bundle first)\n *\n * Use {@link list} to get all available bundle IDs.\n *\n * **Note:** The bundle ID is NOT the same as the version name.\n * Use the `id` field from {@link BundleInfo}, not the `version` field.\n *\n * @param options A {@link BundleId} object containing the bundle ID to delete.\n * @returns {Promise<void>} Resolves when the bundle is successfully deleted.\n * @throws {Error} If the bundle is currently in use or doesn't exist.\n */\n delete(options: BundleId): Promise<void>;\n\n /**\n * Manually mark a bundle as failed/errored in manual update mode.\n *\n * This is useful when you detect that a bundle has critical issues and want to prevent\n * it from being used again. The bundle status will be changed to `error` and the plugin\n * will avoid using this bundle in the future.\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`\n * - Only works in manual update mode (when autoUpdate is disabled)\n *\n * Common use case: After downloading and testing a bundle, you discover it has critical\n * bugs and want to mark it as failed so it won't be retried.\n *\n * @param options A {@link BundleId} object containing the bundle ID to mark as errored.\n * @returns {Promise<BundleInfo>} The updated {@link BundleInfo} with status set to `error`.\n * @throws {Error} When the bundle does not exist or `allowManualBundleError` is false.\n * @since 7.20.0\n */\n setBundleError(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Get all locally downloaded bundles stored in your app.\n *\n * This returns all bundles that have been downloaded and are available locally, including:\n * - The currently active bundle\n * - The `builtin` bundle (shipped with your app)\n * - Any downloaded bundles waiting to be activated\n * - Failed bundles (with `error` status)\n *\n * Use this to:\n * - Check available disk space by counting bundles\n * - Delete old bundles with {@link delete}\n * - Monitor bundle download status\n *\n * @param options The {@link ListOptions} for customizing the bundle list output.\n * @returns {Promise<BundleListResult>} A promise containing the array of {@link BundleInfo} objects.\n * @throws {Error} If the operation fails.\n */\n list(options?: ListOptions): Promise<BundleListResult>;\n\n /**\n * Reset the app to a known good bundle.\n *\n * This method helps recover from problematic updates by reverting to either:\n * - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)\n * - The last successfully loaded bundle (most recent bundle that worked correctly)\n *\n * **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**\n * See {@link set} for details on the implications of this operation.\n *\n * Use cases:\n * - Emergency recovery when an update causes critical issues\n * - Testing rollback functionality\n * - Providing users a \"reset to factory\" option\n *\n * @param options {@link ResetOptions} to control reset behavior.\n * If `toLastSuccessful` is `false` (or omitted), resets to builtin.\n * If `true`, resets to last successful bundle.\n * If `usePendingBundle` is `true`, applies the pending bundle set via {@link next} and clears it.\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reset operation fails.\n */\n reset(options?: ResetOptions): Promise<void>;\n\n /**\n * Get information about the currently active bundle.\n *\n * Returns:\n * - `bundle`: The currently active bundle information\n * - `native`: The version of the builtin bundle (the original app version from App/Play Store)\n *\n * If no updates have been applied, `bundle.id` will be `\"builtin\"`, indicating the app\n * is running the original version shipped with the native app.\n *\n * Use this to:\n * - Display the current version to users\n * - Check if an update is currently active\n * - Compare against available updates\n * - Log the active bundle for debugging\n *\n * @returns {Promise<CurrentBundleResult>} A promise with the current bundle and native version info.\n * @throws {Error} If the operation fails.\n */\n current(): Promise<CurrentBundleResult>;\n\n /**\n * Manually reload the app to apply a pending update.\n *\n * This triggers the same reload behavior that happens automatically when the app backgrounds.\n * If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.\n *\n * **IMPORTANT: This destroys the current JavaScript context immediately.**\n * See {@link set} for details on the implications of this operation.\n *\n * Common use cases:\n * - Applying an update immediately after download instead of waiting for backgrounding\n * - Providing a \"Restart now\" button to users after an update is ready\n * - Testing update flows during development\n *\n * If no update is pending (no call to {@link next}), this simply reloads the current bundle.\n *\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reload operation fails.\n */\n reload(): Promise<void>;\n\n /**\n * Configure conditions that must be met before a pending update is applied.\n *\n * After calling {@link next} to queue an update, use this method to control when it gets applied.\n * The update will only be installed after ALL specified conditions are satisfied.\n *\n * Available condition types:\n * - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.\n * - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)\n * - `date`: Wait until a specific date/time (ISO 8601 format)\n * - `nativeVersion`: Wait until the native app is updated to a specific version\n *\n * Condition value formats:\n * - `background`: Number in milliseconds (e.g., `\"300000\"` for 5 minutes), or omit for immediate\n * - `kill`: No value needed\n * - `date`: ISO 8601 date string (e.g., `\"2025-12-31T23:59:59Z\"`)\n * - `nativeVersion`: Version string (e.g., `\"2.0.0\"`)\n *\n * @example\n * // Update after user kills app OR after 5 minutes in background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [\n * { kind: 'kill' },\n * { kind: 'background', value: '300000' }\n * ]\n * });\n *\n * @example\n * // Update after a specific date\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'date', value: '2025-12-31T23:59:59Z' }]\n * });\n *\n * @example\n * // Default behavior: update on next background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'background' }]\n * });\n *\n * @param options Contains the {@link MultiDelayConditions} array of conditions.\n * @returns {Promise<void>} Resolves when the delay conditions are set.\n * @throws {Error} If the operation fails or conditions are invalid.\n * @since 4.3.0\n */\n setMultiDelay(options: MultiDelayConditions): Promise<void>;\n\n /**\n * Cancel all delay conditions and apply the pending update immediately.\n *\n * If you've set delay conditions with {@link setMultiDelay}, this method clears them\n * and triggers the pending update to be applied on the next app background or restart.\n *\n * This is useful when:\n * - User manually requests to update now (e.g., clicks \"Update now\" button)\n * - Your app detects it's a good time to update (e.g., user finished critical task)\n * - You want to override a time-based delay early\n *\n * @returns {Promise<void>} Resolves when the delay conditions are cleared.\n * @throws {Error} If the operation fails.\n * @since 4.0.0\n */\n cancelDelay(): Promise<void>;\n\n /**\n * Trigger the native auto-update check/download pipeline immediately.\n *\n * This starts the same background update flow used when the app moves to the\n * foreground with auto-update enabled. It is useful for native integrations\n * such as a silent push notification asking the app to check for a Capgo\n * bundle without reimplementing the update protocol in JavaScript.\n *\n * The promise resolves after the native background work has been queued, not\n * after the update has been downloaded or installed. Listen to updater events\n * such as `updateAvailable`, `downloadComplete`, `downloadFailed`, and\n * `noNeedUpdate` for the final result.\n *\n * Native support is available on iOS and Android. On Web, this method returns\n * a result with `status: 'unavailable'`. Native platforms also return\n * `unavailable` when the native auto-update system is disabled.\n *\n * @returns {Promise<TriggerUpdateCheckResult>} Whether a native update check was queued.\n */\n triggerUpdateCheck(): Promise<TriggerUpdateCheckResult>;\n\n /**\n * Check the update server for the latest available bundle version.\n *\n * This queries your configured update URL (or Capgo backend) to see if a newer bundle\n * is available for download. It does NOT download the bundle automatically.\n *\n * The response includes:\n * - `version`: The latest available version identifier\n * - `url`: Download URL for the bundle (if available)\n * - `breaking`: Whether this update is marked as incompatible (requires native app update)\n * - `message`: Optional message from the server\n * - `manifest`: File list for delta updates (if using multi-file downloads)\n *\n * After receiving the latest version info, you can:\n * 1. Compare it with your current version\n * 2. Download it using {@link download}\n * 3. Apply it using {@link next} or {@link set}\n *\n * **Important: Handling \"no new version available\"**\n *\n * When the device's current version matches the latest version on the server (i.e., the device is already\n * up-to-date), the server returns a 200 response with `error: \"no_new_version_available\"` and\n * `message: \"No new version available\"`. This is a normal, expected condition and resolves with\n * `kind: \"up_to_date\"` when the backend provides that classification.\n *\n * You should check `kind` and `error` before attempting to download:\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * if (latest.kind === 'up_to_date') {\n * console.log('Already up to date');\n * } else if (latest.kind === 'blocked') {\n * console.log('Update is blocked:', latest.error);\n * } else if (latest.url) {\n * // New version is available, proceed with download\n * }\n * ```\n *\n * In this scenario, the server:\n * - Logs the request with a \"No new version available\" message\n * - Sends a \"noNew\" stat action to track that the device checked for updates but was already current (done on the backend)\n *\n * @param options Optional {@link GetLatestOptions} to specify which channel to check.\n * @returns {Promise<LatestVersion>} Information about the latest available bundle version.\n * @throws {Error} Throws for failed update checks or transport/request failures.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\n\n /**\n * Return the manifest entries that still need to be downloaded for a partial update.\n *\n * Pass the result from {@link getLatest} directly when it includes a `manifest`.\n * The native plugin compares each manifest entry with the files already available\n * in the builtin bundle and the local delta cache. Entries that can be reused are\n * omitted from the returned `missing` list.\n *\n * For encrypted manifests, pass the `sessionKey` returned by {@link getLatest} so\n * encrypted file hashes can be checked against local files.\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);\n * ```\n *\n * @param options A {@link GetMissingBundleFilesOptions} object, or a {@link LatestVersion} response containing `manifest`.\n * @returns {Promise<GetMissingBundleFilesResult>} The manifest entries that require network download.\n * @throws {Error} If the manifest is missing or invalid.\n * @since 8.47.0\n */\n getMissingBundleFiles(options: GetMissingBundleFilesOptions): Promise<GetMissingBundleFilesResult>;\n\n /**\n * Estimate the download size for manifest entries before downloading them.\n *\n * This method sends the provided manifest entries to the Capgo update endpoint\n * once and reads the stored manifest `file_size` metadata. It does not perform\n * per-file `HEAD` requests from the app.\n *\n * Use this after {@link getMissingBundleFiles} to estimate only the files this\n * device still needs:\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);\n * const size = await CapacitorUpdater.getBundleDownloadSize({\n * version: latest.version,\n * manifest: missing.missing,\n * });\n * ```\n *\n * @param options A {@link GetBundleDownloadSizeOptions} object containing manifest entries.\n * @returns {Promise<GetBundleDownloadSizeResult>} Known byte totals and per-file size results.\n * @throws {Error} If the manifest is missing or invalid.\n * @since 8.47.0\n */\n getBundleDownloadSize(options: GetBundleDownloadSizeOptions): Promise<GetBundleDownloadSizeResult>;\n\n /**\n * Assign this device to a specific update channel at runtime.\n *\n * Channels allow you to distribute different bundle versions to different groups of users\n * (e.g., \"production\", \"beta\", \"staging\"). This method switches the device to a new channel.\n *\n * **Requirements:**\n * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)\n * - The backend may accept or reject the request based on channel settings\n *\n * **When to use:**\n * - After the app is ready and the user has interacted (e.g., opted into beta program)\n * - To implement in-app channel switching (beta toggle, tester access, etc.)\n * - For user-driven channel changes\n *\n * **When NOT to use:**\n * - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead\n * - Before user interaction\n *\n * **Important: Listen for the `channelPrivate` event**\n *\n * When a user attempts to set a channel that doesn't allow device self-assignment, the method will\n * throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event\n * to provide appropriate feedback to users:\n *\n * ```typescript\n * CapacitorUpdater.addListener('channelPrivate', (data) => {\n * console.warn(`Cannot access channel \"${data.channel}\": ${data.message}`);\n * // Show user-friendly message\n * });\n * ```\n *\n * This sends a request to the Capgo backend linking your device ID to the specified channel.\n *\n * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.\n * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.\n * @throws {Error} If the channel doesn't exist or doesn't allow self-assignment.\n * @since 4.7.0\n */\n setChannel(options: SetChannelOptions): Promise<ChannelRes>;\n\n /**\n * Remove the device's channel assignment and return to the default channel.\n *\n * This unlinks the device from any specifically assigned channel, causing it to fall back to:\n * - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or\n * - Your backend's default channel for this app\n *\n * Use this when:\n * - Users opt out of beta/testing programs\n * - You want to reset a device to standard update distribution\n * - Testing channel switching behavior\n *\n * @param options {@link UnsetChannelOptions} containing optional auto-update trigger.\n * @returns {Promise<void>} Resolves when the channel is successfully unset.\n * @throws {Error} If the operation fails.\n * @since 4.7.0\n */\n unsetChannel(options: UnsetChannelOptions): Promise<void>;\n\n /**\n * Get the current channel assigned to this device.\n *\n * Returns information about:\n * - `channel`: The currently assigned channel name (if any)\n * - `allowSet`: Whether the channel allows self-assignment\n * - `status`: Operation status\n * - `error`/`message`: Additional information (if applicable)\n *\n * Use this to:\n * - Display current channel to users (e.g., \"You're on the Beta channel\")\n * - Check if a device is on a specific channel before showing features\n * - Verify channel assignment after calling {@link setChannel}\n *\n * @returns {Promise<GetChannelRes>} The current channel information.\n * @throws {Error} If the operation fails.\n * @since 4.8.0\n */\n getChannel(): Promise<GetChannelRes>;\n\n /**\n * Get a list of all channels available for this device to self-assign to.\n *\n * Only returns channels where `allow_self_set` is `true`. These are channels that\n * users can switch to using {@link setChannel} without backend administrator intervention.\n *\n * Each channel includes:\n * - `id`: Unique channel identifier\n * - `name`: Human-readable channel name\n * - `public`: Whether the channel is publicly visible\n * - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)\n *\n * Use this to:\n * - Build a channel selector UI for users (e.g., \"Join Beta\" button)\n * - Show available testing/preview channels\n * - Implement channel discovery features\n *\n * @returns {Promise<ListChannelsResult>} List of channels the device can self-assign to.\n * @throws {Error} If the operation fails or the request to the backend fails.\n * @since 7.5.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Set a custom identifier for this device.\n *\n * This allows you to identify devices by your own custom ID (user ID, account ID, etc.)\n * instead of or in addition to the device's unique hardware ID. The custom ID is sent\n * to your update server and can be used for:\n * - Targeting specific users for updates\n * - Analytics and user tracking\n * - Debugging and support (correlating devices with users)\n * - A/B testing or feature flagging\n *\n * **Persistence:**\n * - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts\n * - When `false`, the ID is only kept for the current session\n *\n * **Clearing the custom ID:**\n * - Pass an empty string `\"\"` to remove any stored custom ID\n *\n * @param options The {@link SetCustomIdOptions} containing the custom identifier string.\n * @returns {Promise<void>} Resolves immediately (synchronous operation).\n * @throws {Error} If the operation fails.\n * @since 4.9.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n\n /**\n * Get the builtin bundle version (the original version shipped with your native app).\n *\n * This returns the version of the bundle that was included when the app was installed\n * from the App Store or Play Store. This is NOT the currently active bundle version -\n * use {@link current} for that.\n *\n * Returns:\n * - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or\n * - The native app version from platform configs (package.json, Info.plist, build.gradle)\n *\n * Use this to:\n * - Display the \"factory\" version to users\n * - Compare against downloaded bundle versions\n * - Determine if any updates have been applied\n * - Debugging version mismatches\n *\n * @returns {Promise<BuiltinVersion>} The builtin bundle version string.\n * @since 5.2.0\n */\n getBuiltinVersion(): Promise<BuiltinVersion>;\n\n /**\n * Get the unique, privacy-friendly identifier for this device.\n *\n * This ID is used to identify the device when communicating with update servers.\n * It's automatically generated and stored securely by the plugin.\n *\n * **Privacy & Security characteristics:**\n * - Generated as a UUID (not based on hardware identifiers)\n * - Stored securely in platform-specific secure storage\n * - Android: Android Keystore (persists across app reinstalls on API 23+)\n * - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`\n * - Not synced to cloud (iOS)\n * - Follows Apple and Google privacy best practices\n * - Users can clear it via system settings (Android) or keychain access (iOS)\n *\n * **Persistence:**\n * The device ID persists across app reinstalls to maintain consistent device identity\n * for update tracking and analytics.\n *\n * Use this to:\n * - Debug update delivery issues (check what ID the server sees)\n * - Implement device-specific features\n * - Correlate server logs with specific devices\n *\n * @returns {Promise<DeviceId>} The unique device identifier string.\n * @throws {Error} If the operation fails.\n */\n getDeviceId(): Promise<DeviceId>;\n\n /**\n * Get the version of the Capacitor Updater plugin installed in your app.\n *\n * This returns the version of the native plugin code (Android/iOS), which is sent\n * to the update server with each request. This is NOT your app version or bundle version.\n *\n * Use this to:\n * - Debug plugin-specific issues (when reporting bugs)\n * - Verify plugin installation and version\n * - Check compatibility with backend features\n * - Display in debug/about screens\n *\n * @returns {Promise<PluginVersion>} The Capacitor Updater plugin version string.\n * @throws {Error} If the operation fails.\n */\n getPluginVersion(): Promise<PluginVersion>;\n\n /**\n * Check if automatic updates are currently enabled.\n *\n * Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,\n * meaning the plugin will automatically check for, download, and apply updates.\n *\n * Returns `false` if in manual mode, where you control the update flow using\n * {@link getLatest}, {@link download}, {@link next}, and {@link set}.\n *\n * Use this to:\n * - Determine which update flow your app is using\n * - Show/hide manual update UI based on mode\n * - Debug update behavior\n *\n * @returns {Promise<AutoUpdateEnabled>} `true` if auto-update is enabled, `false` if in manual mode.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;\n\n /**\n * Remove all event listeners registered for this plugin.\n *\n * This unregisters all listeners added via {@link addListener} for all event types:\n * - `download`\n * - `noNeedUpdate`\n * - `updateCheckResult`\n * - `updateAvailable`\n * - `downloadComplete`\n * - `downloadFailed`\n * - `breakingAvailable` / `majorAvailable`\n * - `updateFailed`\n * - `appReloaded`\n * - `appReady`\n *\n * Use this during cleanup (e.g., when unmounting components or closing screens)\n * to prevent memory leaks from lingering event listeners.\n *\n * @returns {Promise<void>} Resolves when all listeners are removed.\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.\n * This will return you all download percent during the download\n *\n * @since 2.0.11\n */\n addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for no need to update event, useful when you want force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update check results before the updater decides whether to download.\n * The backend can classify the UpdateCheckResultEvent payload as `up_to_date`, `blocked`, or `failed`.\n *\n * This event is emitted alongside legacy events. For `up_to_date` and `blocked`, it is emitted before\n * `noNeedUpdate` and does not emit `downloadFailed`. For `failed`, it is emitted before the legacy\n * `downloadFailed` event and keeps the existing failure stats behavior.\n *\n * @since 8.45.11\n */\n addListener(\n eventName: 'updateCheckResult',\n listenerFunc: (state: UpdateCheckResultEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for available update event, useful when you want to force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'updateAvailable',\n listenerFunc: (state: UpdateAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for downloadComplete events.\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadComplete',\n listenerFunc: (state: DownloadCompleteEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for breaking update events when the backend flags an update as incompatible with the current app.\n * Emits the same payload as the legacy `majorAvailable` listener.\n *\n * @since 7.22.0\n */\n addListener(\n eventName: 'breakingAvailable',\n listenerFunc: (state: BreakingAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking\n *\n * @deprecated Deprecated alias for {@link addListener} with `breakingAvailable`. Emits the same payload. will be removed in v8\n * @since 2.3.0\n */\n addListener(\n eventName: 'majorAvailable',\n listenerFunc: (state: MajorAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update fail event in the App, let you know when update has fail to install at next app start\n *\n * @since 2.3.0\n */\n addListener(\n eventName: 'updateFailed',\n listenerFunc: (state: UpdateFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for set event in the App, let you know when a bundle has been applied successfully.\n * This event is retained natively until JavaScript consumes it, so if the app reloads before your\n * listener is attached, the last pending `set` event is delivered once the listener subscribes.\n *\n * @since 8.43.12\n */\n addListener(eventName: 'set', listenerFunc: (state: SetEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for set next event in the App, let you know when a bundle is queued as the next bundle to install.\n *\n * @since 6.14.0\n */\n addListener(eventName: 'setNext', listenerFunc: (state: SetNextEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for download fail event in the App, let you know when a bundle download has failed\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (state: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for reload event in the App, let you know when reload has happened\n *\n * @since 4.3.0\n */\n addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for app ready event in the App, let you know when app is ready to use.\n * This event is retained natively until JavaScript consumes it, so it can still be delivered after\n * a reload even if the listener is attached later in app startup.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.\n *\n * This event is useful for:\n * - Informing users they don't have permission to switch to a specific channel\n * - Implementing custom error handling for channel restrictions\n * - Logging unauthorized channel access attempts\n *\n * @since 7.34.0\n */\n addListener(\n eventName: 'channelPrivate',\n listenerFunc: (state: ChannelPrivateEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for flexible update state changes on Android.\n *\n * This event fires during the flexible update download process, providing:\n * - Download progress (bytes downloaded / total bytes)\n * - Installation status changes\n *\n * **Install status values:**\n * - `UNKNOWN` (0): Unknown status\n * - `PENDING` (1): Download pending\n * - `DOWNLOADING` (2): Download in progress\n * - `INSTALLING` (3): Installing the update\n * - `INSTALLED` (4): Update installed (app restart needed)\n * - `FAILED` (5): Update failed\n * - `CANCELED` (6): Update was canceled\n * - `DOWNLOADED` (11): Download complete, ready to install\n *\n * When status is `DOWNLOADED`, you should prompt the user and call\n * {@link completeFlexibleUpdate} to finish the installation.\n *\n * @since 8.0.0\n */\n addListener(\n eventName: 'onFlexibleUpdateStateChange',\n listenerFunc: (state: FlexibleUpdateState) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Check if the auto-update feature is available (not disabled by custom server configuration).\n *\n * Returns `false` when a custom `updateUrl` is configured, as this typically indicates\n * you're using a self-hosted update server that may not support all auto-update features.\n *\n * Returns `true` when using the default Capgo backend or when the feature is available.\n *\n * This is different from {@link isAutoUpdateEnabled}:\n * - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off\n * - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration\n *\n * @returns {Promise<AutoUpdateAvailable>} `false` when custom updateUrl is set, `true` otherwise.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateAvailable(): Promise<AutoUpdateAvailable>;\n\n /**\n * Get information about the bundle queued to be activated on next reload.\n *\n * Returns:\n * - {@link BundleInfo} object if a bundle has been queued via {@link next}\n * - `null` if no update is pending\n *\n * This is useful to:\n * - Check if an update is waiting to be applied\n * - Display \"Update pending\" status to users\n * - Show version info of the queued update\n * - Decide whether to show a \"Restart to update\" prompt\n *\n * The queued bundle will be activated when:\n * - The app is backgrounded (default behavior)\n * - The app is killed and restarted\n * - {@link reload} is called manually\n * - Delay conditions set by {@link setMultiDelay} are met\n *\n * @returns {Promise<BundleInfo | null>} The pending bundle info, or `null` if none is queued.\n * @throws {Error} If the operation fails.\n * @since 6.8.0\n */\n getNextBundle(): Promise<BundleInfo | null>;\n\n /**\n * Retrieve information about the most recent bundle that failed to load.\n *\n * When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),\n * the plugin automatically rolls back and stores information about the failure. This method\n * retrieves that failure information.\n *\n * **IMPORTANT: The stored value is cleared after being retrieved once.**\n * Calling this method multiple times will only return the failure info on the first call,\n * then `null` on subsequent calls until another failure occurs.\n *\n * Returns:\n * - {@link UpdateFailedEvent} with bundle info if a failure was recorded\n * - `null` if no failure has occurred or if it was already retrieved\n *\n * Use this to:\n * - Show users why an update failed\n * - Log failure information for debugging\n * - Implement custom error handling/reporting\n * - Display rollback notifications\n *\n * @returns {Promise<UpdateFailedEvent | null>} The failed update info (cleared after first retrieval), or `null`.\n * @throws {Error} If the operation fails.\n * @since 7.22.0\n */\n getFailedUpdate(): Promise<UpdateFailedEvent | null>;\n\n /**\n * Enable or disable the shake gesture menu.\n *\n * During preview sessions, users can shake their device to:\n * - Reload the current preview\n * - Leave the test app and return to the fallback bundle\n * - Switch update channel, when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is also enabled\n *\n * Outside preview sessions, this preview menu is ignored. The channel selector can still be\n * shown outside preview sessions when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.\n *\n * **Important:** Disable this in production builds or only enable for internal testers.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n setShakeMenu(options: SetShakeMenuOptions): Promise<void>;\n\n /**\n * Check if the shake gesture debug menu is currently enabled.\n *\n * Returns the current state of the shake menu feature that can be toggled via\n * {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * Use this to:\n * - Check if debug features are enabled\n * - Show/hide debug settings UI\n * - Verify configuration during testing\n *\n * @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;\n\n /**\n * Enable or disable the shake channel selector at runtime.\n *\n * When enabled, shaking the device can show a channel selector, including outside preview sessions.\n * If {@link setShakeMenu} is also enabled while a preview session is active, the shake menu includes\n * both preview actions and channel switching.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.\n *\n * @param options {@link SetShakeChannelSelectorOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 8.43.0\n */\n setShakeChannelSelector(options: SetShakeChannelSelectorOptions): Promise<void>;\n\n /**\n * Check if the shake channel selector is currently enabled.\n *\n * Returns the current state of the shake channel selector feature that can be toggled via\n * {@link setShakeChannelSelector} or configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.\n *\n * @returns {Promise<ShakeChannelSelectorEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 8.43.0\n */\n isShakeChannelSelectorEnabled(): Promise<ShakeChannelSelectorEnabled>;\n\n /**\n * Get the currently configured App ID used for update server communication.\n *\n * Returns the App ID that identifies this app to the update server. This can be:\n * - The value set via {@link setAppId}, or\n * - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or\n * - The default app identifier from your native app configuration\n *\n * Use this to:\n * - Verify which App ID is being used for updates\n * - Debug update delivery issues\n * - Display app configuration in debug screens\n * - Confirm App ID after calling {@link setAppId}\n *\n * @returns {Promise<GetAppIdRes>} Object containing the current `appId` string.\n * @throws {Error} If the operation fails.\n * @since 7.14.0\n */\n getAppId(): Promise<GetAppIdRes>;\n\n /**\n * Dynamically change the App ID used for update server communication.\n *\n * This overrides the App ID used to identify your app to the update server, allowing you\n * to switch between different app configurations at runtime (e.g., production vs staging\n * app IDs, or multi-tenant configurations).\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`\n *\n * **Important considerations:**\n * - Changing the App ID will affect which updates this device receives\n * - The new App ID must exist on your update server\n * - This is primarily for advanced use cases (multi-tenancy, environment switching)\n * - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead\n *\n * @param options {@link SetAppIdOptions} containing the new App ID string.\n * @returns {Promise<void>} Resolves when the App ID is successfully changed.\n * @throws {Error} If `allowModifyAppId` is false or the operation fails.\n * @since 7.14.0\n */\n setAppId(options: SetAppIdOptions): Promise<void>;\n\n // ============================================================================\n // App Store / Play Store Update Methods\n // ============================================================================\n\n /**\n * Get information about the app's availability in the App Store or Play Store.\n *\n * This method checks the native app stores to see if a newer version of the app\n * is available for download. This is different from Capgo's OTA updates - this\n * checks for native app updates that require going through the app stores.\n *\n * **Platform differences:**\n * - **Android**: Uses Play Store's In-App Updates API for accurate update information\n * - **iOS**: Queries the App Store lookup API (requires country code for accurate results)\n *\n * **Returns information about:**\n * - Current installed version\n * - Available version in the store (if any)\n * - Whether an update is available\n * - Update priority (Android only)\n * - Whether immediate/flexible updates are allowed (Android only)\n *\n * Use this to:\n * - Check if users need to update from the app store\n * - Show \"Update Available\" prompts for native updates\n * - Implement version gating (require minimum native version)\n * - Combine with Capgo OTA updates for a complete update strategy\n *\n * @param options Optional {@link GetAppUpdateInfoOptions} with country code for iOS.\n * @returns {Promise<AppUpdateInfo>} Information about the current and available app versions.\n * @throws {Error} If the operation fails or store information is unavailable.\n * @since 8.0.0\n */\n getAppUpdateInfo(options?: GetAppUpdateInfoOptions): Promise<AppUpdateInfo>;\n\n /**\n * Open the app's page in the App Store or Play Store.\n *\n * This navigates the user to your app's store listing where they can manually\n * update the app. Use this as a fallback when in-app updates are not available\n * or when the user needs to update on iOS.\n *\n * **Platform behavior:**\n * - **Android**: Opens Play Store to the app's page\n * - **iOS**: Opens App Store to the app's page\n *\n * **Customization options:**\n * - `appId`: Specify a custom App Store ID (iOS) - useful for opening a different app's page\n * - `packageName`: Specify a custom package name (Android) - useful for opening a different app's page\n *\n * @param options Optional {@link OpenAppStoreOptions} to customize which app's store page to open.\n * @returns {Promise<void>} Resolves when the store is opened.\n * @throws {Error} If the store cannot be opened.\n * @since 8.0.0\n */\n openAppStore(options?: OpenAppStoreOptions): Promise<void>;\n\n /**\n * Perform an immediate in-app update on Android.\n *\n * This triggers Google Play's immediate update flow, which:\n * 1. Shows a full-screen update UI\n * 2. Downloads and installs the update\n * 3. Restarts the app automatically\n *\n * The user cannot continue using the app until the update is complete.\n * This is ideal for critical updates that must be installed immediately.\n *\n * **Requirements:**\n * - Android only (throws error on iOS)\n * - An update must be available (check with {@link getAppUpdateInfo} first)\n * - The update must allow immediate updates (`immediateUpdateAllowed: true`)\n *\n * **User experience:**\n * - Full-screen blocking UI\n * - Progress shown during download\n * - App automatically restarts after installation\n *\n * @returns {Promise<AppUpdateResult>} Result indicating success, cancellation, or failure.\n * @throws {Error} If not on Android, no update is available, or immediate updates not allowed.\n * @since 8.0.0\n */\n performImmediateUpdate(): Promise<AppUpdateResult>;\n\n /**\n * Start a flexible in-app update on Android.\n *\n * This triggers Google Play's flexible update flow, which:\n * 1. Downloads the update in the background\n * 2. Allows the user to continue using the app\n * 3. Notifies when download is complete\n * 4. Requires calling {@link completeFlexibleUpdate} to install\n *\n * Monitor the download progress using the `onFlexibleUpdateStateChange` listener.\n *\n * **Requirements:**\n * - Android only (throws error on iOS)\n * - An update must be available (check with {@link getAppUpdateInfo} first)\n * - The update must allow flexible updates (`flexibleUpdateAllowed: true`)\n *\n * **Typical flow:**\n * 1. Call `startFlexibleUpdate()` to begin download\n * 2. Listen to `onFlexibleUpdateStateChange` for progress\n * 3. When status is `DOWNLOADED`, prompt user to restart\n * 4. Call `completeFlexibleUpdate()` to install and restart\n *\n * @returns {Promise<AppUpdateResult>} Result indicating the update was started, cancelled, or failed.\n * @throws {Error} If not on Android, no update is available, or flexible updates not allowed.\n * @since 8.0.0\n */\n startFlexibleUpdate(): Promise<AppUpdateResult>;\n\n /**\n * Complete a flexible in-app update on Android.\n *\n * After a flexible update has been downloaded (status `DOWNLOADED` in\n * `onFlexibleUpdateStateChange`), call this method to install the update\n * and restart the app.\n *\n * **Important:** This will immediately restart the app. Make sure to:\n * - Save any user data before calling\n * - Prompt the user before restarting\n * - Only call when the download status is `DOWNLOADED`\n *\n * @returns {Promise<void>} Resolves when the update installation begins (app will restart).\n * @throws {Error} If not on Android or no downloaded update is pending.\n * @since 8.0.0\n */\n completeFlexibleUpdate(): Promise<void>;\n}\n\n/**\n * pending: The bundle is pending to be **SET** as the next bundle.\n * downloading: The bundle is being downloaded.\n * success: The bundle has been downloaded and is ready to be **SET** as the next bundle.\n * error: The bundle has failed to download.\n */\nexport type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';\n\nexport type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';\n\n/**\n * Classification for update-check responses that do not provide a downloadable bundle.\n * The update backend provides this field directly. Missing or unknown values are treated as\n * failed by native clients.\n *\n * @since 8.45.11\n */\nexport type UpdateResponseKind = 'up_to_date' | 'blocked' | 'failed';\n\nexport interface NoNeedEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateCheckResultEvent {\n /**\n * Classification for the update check result, provided by the backend.\n *\n * @since 8.45.11\n */\n kind: UpdateResponseKind;\n /**\n * Backend error code, when provided.\n *\n * @since 8.45.11\n */\n error?: string;\n /**\n * Backend message, when provided.\n *\n * @since 8.45.11\n */\n message?: string;\n /**\n * HTTP status code returned by the update endpoint.\n *\n * @since 8.45.11\n */\n statusCode?: number;\n /**\n * Version referenced by the update check result.\n *\n * @since 8.45.11\n */\n version?: string;\n /**\n * Current bundle on the device.\n *\n * @since 8.45.11\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateAvailableEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface ChannelRes {\n /**\n * Current status of set channel\n *\n * @since 4.7.0\n */\n status: string;\n error?: string;\n message?: string;\n}\n\nexport interface GetChannelRes {\n /**\n * Current status of get channel\n *\n * @since 4.8.0\n */\n channel?: string;\n error?: string;\n message?: string;\n status?: string;\n allowSet?: boolean;\n}\n\nexport interface ChannelInfo {\n /**\n * The channel ID\n *\n * @since 7.5.0\n */\n id: number;\n /**\n * The channel name\n *\n * @since 7.5.0\n */\n name: string;\n /**\n * Whether this is a public channel\n *\n * @since 7.5.0\n */\n public: boolean;\n /**\n * Whether devices can self-assign to this channel\n *\n * @since 7.5.0\n */\n allow_self_set: boolean;\n}\n\nexport interface ListChannelsResult {\n /**\n * List of available channels\n *\n * @since 7.5.0\n */\n channels: ChannelInfo[];\n}\n\nexport interface DownloadEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n percent: number;\n bundle: BundleInfo;\n}\n\nexport interface MajorAvailableEvent {\n /**\n * Emit when a breaking update is available.\n *\n * @deprecated Deprecated alias for {@link BreakingAvailableEvent}. Receives the same payload.\n * @since 4.0.0\n */\n version: string;\n}\n\n/**\n * Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.\n *\n * @since 7.22.0\n */\nexport type BreakingAvailableEvent = MajorAvailableEvent;\n\nexport interface DownloadFailedEvent {\n /**\n * Emit when a download fail.\n *\n * @since 4.0.0\n */\n version: string;\n}\n\nexport interface DownloadCompleteEvent {\n /**\n * Emit when a new update is available.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateFailedEvent {\n /**\n * Emit when a update failed to install.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface SetEvent {\n /**\n * Emit when a bundle has been applied successfully.\n * This event uses native `retainUntilConsumed` behavior.\n *\n * @since 8.43.12\n */\n bundle: BundleInfo;\n}\n\nexport interface SetNextEvent {\n /**\n * Emit when a bundle is queued as the next bundle to install.\n *\n * @since 6.14.0\n */\n bundle: BundleInfo;\n}\n\nexport interface AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n * This event uses native `retainUntilConsumed` behavior.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: string;\n}\n\nexport interface ChannelPrivateEvent {\n /**\n * Emitted when attempting to set a channel that doesn't allow device self-assignment.\n *\n * @since 7.34.0\n */\n channel: string;\n message: string;\n}\n\nexport interface ManifestEntry {\n file_name: string | null;\n file_hash: string | null;\n download_url: string | null;\n}\n\nexport interface GetMissingBundleFilesOptions {\n /**\n * Manifest returned by {@link getLatest}. Passing the full {@link LatestVersion}\n * response is supported because it contains this field.\n *\n * @since 8.47.0\n */\n manifest?: ManifestEntry[];\n /**\n * Target bundle version. Passing the full {@link LatestVersion} response is\n * supported because it contains this field.\n *\n * @since 8.47.0\n */\n version?: string;\n /**\n * Session key returned by {@link getLatest}, required only when file hashes are encrypted.\n *\n * @since 8.47.0\n */\n sessionKey?: string;\n}\n\nexport interface GetMissingBundleFilesResult {\n /**\n * Entries that are not available locally and need to be downloaded.\n *\n * @since 8.47.0\n */\n missing: ManifestEntry[];\n /**\n * Total entries in the provided manifest.\n *\n * @since 8.47.0\n */\n total: number;\n /**\n * Number of entries that need to be downloaded.\n *\n * @since 8.47.0\n */\n missingCount: number;\n /**\n * Number of entries that can be reused from builtin files or local cache.\n *\n * @since 8.47.0\n */\n reusableCount: number;\n}\n\nexport interface GetBundleDownloadSizeOptions {\n /**\n * Manifest entries to estimate. Pass `missing.missing` from {@link getMissingBundleFiles}\n * to estimate only the bytes this device still needs to download.\n *\n * @since 8.47.0\n */\n manifest?: ManifestEntry[];\n /**\n * Target bundle version. Pass `latest.version` when estimating files returned\n * by {@link getLatest}.\n *\n * @since 8.47.0\n */\n version?: string;\n}\n\nexport interface BundleFileSize {\n /**\n * File name from the manifest entry.\n *\n * @since 8.47.0\n */\n file_name: string | null;\n /**\n * File hash from the manifest entry.\n *\n * @since 8.47.0\n */\n file_hash: string | null;\n /**\n * Download URL from the manifest entry.\n *\n * @since 8.47.0\n */\n download_url: string | null;\n /**\n * Estimated bytes to download when the server exposes a size.\n *\n * @since 8.47.0\n */\n size?: number;\n /**\n * Error for this entry when the size could not be determined.\n *\n * @since 8.47.0\n */\n error?: string;\n}\n\nexport interface GetBundleDownloadSizeResult {\n /**\n * Sum of all known file sizes in bytes.\n *\n * @since 8.47.0\n */\n totalSize: number;\n /**\n * Number of files with a known size.\n *\n * @since 8.47.0\n */\n knownFiles: number;\n /**\n * Number of files whose size could not be determined.\n *\n * @since 8.47.0\n */\n unknownFiles: number;\n /**\n * Per-file size results.\n *\n * @since 8.47.0\n */\n files: BundleFileSize[];\n}\n\nexport interface LatestVersion {\n /**\n * Result of getLatest method\n *\n * @since 4.0.0\n */\n version: string;\n /**\n * @since 6\n */\n checksum?: string;\n /**\n * Indicates whether the update was flagged as breaking by the backend.\n *\n * @since 7.22.0\n */\n breaking?: boolean;\n /**\n * @deprecated Use {@link LatestVersion.breaking} instead.\n */\n major?: boolean;\n /**\n * Optional message from the server.\n * When no new version is available, this will be \"No new version available\".\n */\n message?: string;\n sessionKey?: string;\n /**\n * Error code from the server, if any. Use `kind` for classification instead of parsing this value.\n */\n error?: string;\n /**\n * Classification for this response, provided by the backend.\n *\n * @since 8.45.11\n */\n kind?: UpdateResponseKind;\n /**\n * HTTP status code returned by the update server for classified update-check responses.\n *\n * @since 8.45.11\n */\n statusCode?: number;\n /**\n * The previous/current version name (provided for reference).\n */\n old?: string;\n /**\n * Download URL for the bundle (when a new version is available).\n */\n url?: string;\n /**\n * File list for delta updates (when using multi-file downloads).\n * @since 6.1\n */\n manifest?: ManifestEntry[];\n /**\n * Missing manifest entries for this device when {@link GetLatestOptions.includeBundleSize}\n * is enabled.\n *\n * @since 8.47.0\n */\n missing?: GetMissingBundleFilesResult;\n /**\n * Estimated download size for missing manifest entries when\n * {@link GetLatestOptions.includeBundleSize} is enabled.\n *\n * @since 8.47.0\n */\n downloadSize?: GetBundleDownloadSizeResult;\n /**\n * Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).\n * @since 7.35.0\n */\n link?: string;\n /**\n * Optional comment or description for this bundle version.\n * @since 7.35.0\n */\n comment?: string;\n}\n\nexport interface BundleInfo {\n id: string;\n version: string;\n downloaded: string;\n checksum: string;\n status: BundleStatus;\n}\n\nexport interface SetChannelOptions {\n channel: string;\n triggerAutoUpdate?: boolean;\n}\n\nexport interface UnsetChannelOptions {\n triggerAutoUpdate?: boolean;\n}\n\nexport interface SetCustomIdOptions {\n /**\n * Custom identifier to associate with the device. Use an empty string to clear any saved value.\n */\n customId: string;\n}\n\nexport interface DelayCondition {\n /**\n * Set up delay conditions in setMultiDelay\n * @param value is useless for @param kind \"kill\", optional for \"background\" (default value: \"0\") and required for \"nativeVersion\" and \"date\"\n */\n kind: DelayUntilNext;\n value?: string;\n}\n\nexport interface GetLatestOptions {\n /**\n * The channel to get the latest version for\n * The channel must allow 'self_assign' for this to work\n * @since 6.8.0\n * @default undefined\n */\n channel?: string;\n /**\n * Temporarily use another app id for this update check while using a trusted preview container.\n * This only changes the app id sent by this request; it does not persist a preview session.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.47.0\n * @default undefined\n */\n appId?: string;\n /**\n * When true, the native plugin computes which manifest files are missing on\n * this device and asks the Capgo update endpoint for their stored sizes before\n * resolving {@link getLatest}.\n *\n * This adds one backend request only when the update response contains a\n * manifest. It does not perform per-file network checks.\n *\n * @since 8.47.0\n * @default false\n */\n includeBundleSize?: boolean;\n}\n\nexport interface StartPreviewSessionOptions {\n /**\n * App id to use while the preview session is active.\n * The previous app id is restored when leaving the preview session.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.47.0\n * @default undefined\n */\n appId?: string;\n /**\n * HTTP(S) URL returning a preview download payload.\n * When provided, the native shake reload action fetches this payload again\n * before reloading so channel previews can move to the latest bundle.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.48.0\n * @default undefined\n */\n payloadUrl?: string;\n}\n\nexport interface AppReadyResult {\n bundle: BundleInfo;\n}\n\nexport interface UpdateUrl {\n url: string;\n}\n\nexport interface StatsUrl {\n url: string;\n}\n\nexport interface ChannelUrl {\n url: string;\n}\n\n/**\n * This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.\n * If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.\n */\nexport interface DownloadOptions {\n /**\n * The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)\n */\n url: string;\n /**\n * The version code/name of this bundle/version\n */\n version: string;\n /**\n * The session key for the update, when the bundle is encrypted with a session key\n * @since 4.0.0\n * @default undefined\n */\n sessionKey?: string;\n /**\n * The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted\n * @since 4.0.0\n * @default undefined\n */\n checksum?: string;\n /**\n * The manifest for multi-file downloads\n * @since 6.1.0\n * @default undefined\n */\n manifest?: ManifestEntry[];\n}\n\nexport interface BundleId {\n id: string;\n}\n\nexport interface BundleListResult {\n bundles: BundleInfo[];\n}\n\nexport interface ResetOptions {\n /**\n * Reset to the last successfully loaded bundle instead of the builtin one.\n * @default false\n */\n toLastSuccessful?: boolean;\n /**\n * Apply the pending bundle set via {@link next} while resetting.\n *\n * When `true`, the plugin will switch to the pending bundle immediately and clear the pending flag.\n * If no pending bundle exists, the reset will fail.\n * @default false\n */\n usePendingBundle?: boolean;\n}\n\nexport interface ListOptions {\n /**\n * Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.\n * @since 6.14.0\n * @default false\n */\n raw?: boolean;\n}\n\nexport interface CurrentBundleResult {\n bundle: BundleInfo;\n native: string;\n}\n\nexport interface MultiDelayConditions {\n delayConditions: DelayCondition[];\n}\n\nexport interface BuiltinVersion {\n version: string;\n}\n\nexport interface DeviceId {\n deviceId: string;\n}\n\nexport interface PluginVersion {\n version: string;\n}\n\nexport interface AutoUpdateEnabled {\n enabled: boolean;\n}\n\nexport interface AutoUpdateAvailable {\n available: boolean;\n}\n\n/**\n * Result returned after requesting an immediate native auto-update check.\n *\n * @property status - Native trigger state: `queued` when a check was queued,\n * `already_running` when the native update pipeline is already active, or\n * `unavailable` on Web or when native auto-update is disabled.\n * @property queued - Whether a new native update check was queued. This is\n * `true` only when `status` is `queued`; otherwise it is `false`.\n */\nexport interface TriggerUpdateCheckResult {\n /**\n * Native trigger state: `queued` when a check was queued, `already_running`\n * when the native update pipeline is already active, or `unavailable` on Web\n * or when native auto-update is disabled.\n */\n status: 'queued' | 'already_running' | 'unavailable';\n /**\n * Whether a new native update check was queued. This is `true` only when\n * `status` is `queued`; otherwise it is `false`.\n */\n queued: boolean;\n}\n\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface SetShakeChannelSelectorOptions {\n enabled: boolean;\n}\n\nexport interface ShakeChannelSelectorEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n\n// ============================================================================\n// App Store / Play Store Update Types\n// ============================================================================\n\n/**\n * Options for {@link CapacitorUpdaterPlugin.getAppUpdateInfo}.\n *\n * @since 8.0.0\n */\nexport interface GetAppUpdateInfoOptions {\n /**\n * Two-letter country code (ISO 3166-1 alpha-2) for the App Store lookup.\n *\n * This is required on iOS to get accurate App Store information, as app\n * availability and versions can vary by country.\n *\n * Examples: \"US\", \"GB\", \"DE\", \"JP\", \"FR\"\n *\n * On Android, this option is ignored as the Play Store handles region\n * detection automatically.\n *\n * @since 8.0.0\n */\n country?: string;\n}\n\n/**\n * Information about app updates available in the App Store or Play Store.\n *\n * @since 8.0.0\n */\nexport interface AppUpdateInfo {\n /**\n * The currently installed version name (e.g., \"1.2.3\").\n *\n * @since 8.0.0\n */\n currentVersionName: string;\n\n /**\n * The version name available in the store, if an update is available.\n * May be undefined if no update information is available.\n *\n * @since 8.0.0\n */\n availableVersionName?: string;\n\n /**\n * The currently installed version code (Android) or build number (iOS).\n *\n * @since 8.0.0\n */\n currentVersionCode: string;\n\n /**\n * The version code available in the store (Android only).\n * On iOS, this will be the same as `availableVersionName`.\n *\n * @since 8.0.0\n */\n availableVersionCode?: string;\n\n /**\n * The release date of the available version (iOS only).\n * Format: ISO 8601 date string.\n *\n * @since 8.0.0\n */\n availableVersionReleaseDate?: string;\n\n /**\n * The current update availability status.\n *\n * @since 8.0.0\n */\n updateAvailability: AppUpdateAvailability;\n\n /**\n * The priority of the update as set by the developer in Play Console (Android only).\n * Values range from 0 (default/lowest) to 5 (highest priority).\n *\n * Use this to decide whether to show an update prompt or force an update.\n *\n * @since 8.0.0\n */\n updatePriority?: number;\n\n /**\n * Whether an immediate update is allowed (Android only).\n *\n * If `true`, you can call {@link CapacitorUpdaterPlugin.performImmediateUpdate}.\n *\n * @since 8.0.0\n */\n immediateUpdateAllowed?: boolean;\n\n /**\n * Whether a flexible update is allowed (Android only).\n *\n * If `true`, you can call {@link CapacitorUpdaterPlugin.startFlexibleUpdate}.\n *\n * @since 8.0.0\n */\n flexibleUpdateAllowed?: boolean;\n\n /**\n * Number of days since the update became available (Android only).\n *\n * Use this to implement \"update nagging\" - remind users more frequently\n * as the update ages.\n *\n * @since 8.0.0\n */\n clientVersionStalenessDays?: number;\n\n /**\n * The current install status of a flexible update (Android only).\n *\n * @since 8.0.0\n */\n installStatus?: FlexibleUpdateInstallStatus;\n\n /**\n * The minimum OS version required for the available update (iOS only).\n *\n * @since 8.0.0\n */\n minimumOsVersion?: string;\n}\n\n/**\n * Options for {@link CapacitorUpdaterPlugin.openAppStore}.\n *\n * @since 8.0.0\n */\nexport interface OpenAppStoreOptions {\n /**\n * The Android package name to open in the Play Store.\n *\n * If not specified, uses the current app's package name.\n * Use this to open a different app's store page.\n *\n * Only used on Android.\n *\n * @since 8.0.0\n */\n packageName?: string;\n\n /**\n * The iOS App Store ID to open.\n *\n * If not specified, uses the current app's bundle identifier to look up the app.\n * Use this to open a different app's store page or when automatic lookup fails.\n *\n * Only used on iOS.\n *\n * @since 8.0.0\n */\n appId?: string;\n}\n\n/**\n * State information for flexible update progress (Android only).\n *\n * @since 8.0.0\n */\nexport interface FlexibleUpdateState {\n /**\n * The current installation status.\n *\n * @since 8.0.0\n */\n installStatus: FlexibleUpdateInstallStatus;\n\n /**\n * Number of bytes downloaded so far.\n * Only available during the `DOWNLOADING` status.\n *\n * @since 8.0.0\n */\n bytesDownloaded?: number;\n\n /**\n * Total number of bytes to download.\n * Only available during the `DOWNLOADING` status.\n *\n * @since 8.0.0\n */\n totalBytesToDownload?: number;\n}\n\n/**\n * Result of an app update operation.\n *\n * @since 8.0.0\n */\nexport interface AppUpdateResult {\n /**\n * The result code of the update operation.\n *\n * @since 8.0.0\n */\n code: AppUpdateResultCode;\n}\n\n/**\n * Update availability status.\n *\n * @since 8.0.0\n */\nexport enum AppUpdateAvailability {\n /**\n * Update availability is unknown.\n * This typically means the check hasn't completed or failed.\n */\n UNKNOWN = 0,\n\n /**\n * No update is available.\n * The installed version is the latest.\n */\n UPDATE_NOT_AVAILABLE = 1,\n\n /**\n * An update is available for download.\n */\n UPDATE_AVAILABLE = 2,\n\n /**\n * An update is currently being downloaded or installed.\n */\n UPDATE_IN_PROGRESS = 3,\n}\n\n/**\n * Installation status for flexible updates (Android only).\n *\n * @since 8.0.0\n */\nexport enum FlexibleUpdateInstallStatus {\n /**\n * Unknown install status.\n */\n UNKNOWN = 0,\n\n /**\n * Download is pending and will start soon.\n */\n PENDING = 1,\n\n /**\n * Download is in progress.\n * Check `bytesDownloaded` and `totalBytesToDownload` for progress.\n */\n DOWNLOADING = 2,\n\n /**\n * The update is being installed.\n */\n INSTALLING = 3,\n\n /**\n * The update has been installed.\n * The app needs to be restarted to use the new version.\n */\n INSTALLED = 4,\n\n /**\n * The update failed to download or install.\n */\n FAILED = 5,\n\n /**\n * The update was canceled by the user.\n */\n CANCELED = 6,\n\n /**\n * The update has been downloaded and is ready to install.\n * Call {@link CapacitorUpdaterPlugin.completeFlexibleUpdate} to install.\n */\n DOWNLOADED = 11,\n}\n\n/**\n * Result codes for app update operations.\n *\n * @since 8.0.0\n */\nexport enum AppUpdateResultCode {\n /**\n * The update completed successfully.\n */\n OK = 0,\n\n /**\n * The user canceled the update.\n */\n CANCELED = 1,\n\n /**\n * The update failed.\n */\n FAILED = 2,\n\n /**\n * No update is available.\n */\n NOT_AVAILABLE = 3,\n\n /**\n * The requested update type is not allowed.\n * For example, trying to perform an immediate update when only flexible is allowed.\n */\n NOT_ALLOWED = 4,\n\n /**\n * Required information is missing.\n * This can happen if {@link CapacitorUpdaterPlugin.getAppUpdateInfo} wasn't called first.\n */\n INFO_MISSING = 5,\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+8EH;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAsBX;AAtBD,WAAY,qBAAqB;IAC/B;;;OAGG;IACH,uEAAW,CAAA;IAEX;;;OAGG;IACH,iGAAwB,CAAA;IAExB;;OAEG;IACH,yFAAoB,CAAA;IAEpB;;OAEG;IACH,6FAAsB,CAAA;AACxB,CAAC,EAtBW,qBAAqB,KAArB,qBAAqB,QAsBhC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,2BA2CX;AA3CD,WAAY,2BAA2B;IACrC;;OAEG;IACH,mFAAW,CAAA;IAEX;;OAEG;IACH,mFAAW,CAAA;IAEX;;;OAGG;IACH,2FAAe,CAAA;IAEf;;OAEG;IACH,yFAAc,CAAA;IAEd;;;OAGG;IACH,uFAAa,CAAA;IAEb;;OAEG;IACH,iFAAU,CAAA;IAEV;;OAEG;IACH,qFAAY,CAAA;IAEZ;;;OAGG;IACH,0FAAe,CAAA;AACjB,CAAC,EA3CW,2BAA2B,KAA3B,2BAA2B,QA2CtC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBAgCX;AAhCD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,yDAAM,CAAA;IAEN;;OAEG;IACH,qEAAY,CAAA;IAEZ;;OAEG;IACH,iEAAU,CAAA;IAEV;;OAEG;IACH,+EAAiB,CAAA;IAEjB;;;OAGG;IACH,2EAAe,CAAA;IAEf;;;OAGG;IACH,6EAAgB,CAAA;AAClB,CAAC,EAhCW,mBAAmB,KAAnB,mBAAmB,QAgC9B","sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\n/// <reference types=\"@capacitor/cli\" />\nimport type { PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * CapacitorUpdater can be configured with these options:\n */\n CapacitorUpdater?: {\n /**\n * Configure the number of milliseconds the native plugin should wait before considering an update 'failed'.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @example 1000 // (1 second, minimum 1000)\n */\n appReadyTimeout?: number;\n\n /**\n * Configure the number of seconds the native plugin should wait before considering API timeout.\n *\n * Only available for Android and iOS.\n *\n * @default 20 // (20 second)\n * @example 10 // (10 second)\n */\n responseTimeout?: number;\n\n /**\n * Configure whether the plugin should use automatically delete failed bundles.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeleteFailed?: boolean;\n\n /**\n * Configure whether the plugin should use automatically delete previous bundles after a successful update.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoDeletePrevious?: boolean;\n\n /**\n * Configure how the plugin should use Auto Update via an update server.\n *\n * Boolean values keep their existing behavior:\n * - `true`: Same as `\"atBackground\"`.\n * - `false`: Same as `\"off\"`.\n *\n * String values merge the previous Auto Update and Direct Update configuration:\n * - `\"off\"`: Disable Auto Update.\n * - `\"atBackground\"`: Check and download updates automatically, then apply them the next time the app moves to background.\n * - `\"atInstall\"`: Direct install only after app install or native app update, otherwise use `\"atBackground\"` behavior.\n * - `\"onLaunch\"`: Direct install on app launch, otherwise use `\"atBackground\"` behavior after the first launch attempt.\n * - `\"always\"`: Direct install whenever Auto Update runs.\n * - `\"onlyDownload\"`: Check and download updates automatically, emit `updateAvailable`, but never direct install or set the next bundle automatically.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example \"onlyDownload\"\n */\n autoUpdate?: boolean | 'off' | 'atBackground' | 'atInstall' | 'onLaunch' | 'always' | 'onlyDownload';\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n * Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native.\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n resetWhenUpdate?: boolean;\n\n /**\n * Configure the URL / endpoint to which update checks are sent.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/updates\n * @example https://example.com/api/auto_update\n */\n updateUrl?: string;\n\n /**\n * Configure the URL / endpoint for channel operations.\n *\n * Only available for Android and iOS.\n *\n * @default https://plugin.capgo.app/channel_self\n * @example https://example.com/api/channel\n */\n channelUrl?: string;\n\n /**\n * Configure the URL / endpoint to which update statistics are sent.\n *\n * Only available for Android and iOS. Set to \"\" to disable stats reporting.\n * Native stats include update lifecycle events, app health signals such as crashes,\n * Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals\n * such as JavaScript errors, unhandled promise rejections, resource load failures,\n * WebView renderer exits, and unclean WebView restarts when available.\n *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\n\n /**\n * Configure the public key for end to end live update encryption Version 2\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 6.2.0\n */\n publicKey?: string;\n\n /**\n * Configure the current version of the app. This will be used for the first update request.\n * If not set, the plugin will get the version from the native code.\n *\n * Only available for Android and iOS.\n *\n * @default undefined\n * @since 4.17.48\n */\n version?: string;\n\n /**\n * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n *\n * @deprecated Use {@link PluginsConfig.CapacitorUpdater.autoUpdate} string modes instead.\n * Works well for apps less than 10MB and with uploads done using --delta flag.\n * Zip or apps more than 10MB will be relatively slow for users to update.\n * - false: Never do direct updates (use default behavior: download at start, set when backgrounded)\n * - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false\n * - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false\n * - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false\n * - true: (deprecated) Same as \"always\" for backward compatibility\n *\n * Activate this flag will automatically make the CLI upload delta in CICD envs and will ask for confirmation in local uploads.\n * Only available for Android and iOS.\n *\n * @default false\n * @since 5.1.0\n */\n directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';\n\n /**\n * Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed.\n * This removes the need to manually listen for appReady events and call SplashScreen.hide().\n * Only works when autoUpdate is set to \"atInstall\", \"always\", or \"onLaunch\", or when the deprecated directUpdate option is set to \"atInstall\", \"always\", \"onLaunch\", or true.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n * Requires Auto Update and Direct Update behavior to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.6.0\n */\n autoSplashscreen?: boolean;\n\n /**\n * Display a native loading indicator on top of the splashscreen while automatic direct updates are running.\n * Only takes effect when {@link autoSplashscreen} is enabled.\n * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.19.0\n */\n autoSplashscreenLoader?: boolean;\n\n /**\n * Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.\n * If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.\n * Set to `0` (zero) to disable the timeout.\n * When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.\n * Requires {@link autoSplashscreen} to be enabled.\n *\n * Only available for Android and iOS.\n *\n * @default 10000 // (10 seconds)\n * @since 7.19.0\n */\n autoSplashscreenTimeout?: number;\n\n /**\n * Configure the delay period for period update check. the unit is in seconds.\n *\n * Only available for Android and iOS.\n * Cannot be less than 600 seconds (10 minutes).\n *\n * @default 0 (disabled)\n * @example 3600 (1 hour)\n * @example 86400 (24 hours)\n */\n periodCheckDelay?: number;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localS3?: boolean;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localHost?: string;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localWebHost?: string;\n\n /**\n * Configure the CLI to use a local server for testing or self-hosted update server.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupa?: string;\n\n /**\n * Configure the CLI to use a local server for testing.\n *\n *\n * @default undefined\n * @since 4.17.48\n */\n localSupaAnon?: string;\n\n /**\n * Configure the CLI to use a local api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApi?: string;\n\n /**\n * Configure the CLI to use a local file api for testing.\n *\n *\n * @default undefined\n * @since 6.3.3\n */\n localApiFiles?: string;\n /**\n * Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 5.4.0\n */\n allowModifyUrl?: boolean;\n\n /**\n * Allow the plugin to modify the appId dynamically from the JavaScript side.\n *\n *\n * @default false\n * @since 7.14.0\n */\n allowModifyAppId?: boolean;\n\n /**\n * Allow marking bundles as errored from JavaScript while using manual update flows.\n * When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.\n *\n * @default false\n * @since 7.20.0\n */\n allowManualBundleError?: boolean;\n\n /**\n * Allow JavaScript to start a native preview session and temporarily request updates for another app id.\n * This is intended for trusted container apps that implement Expo Go-style preview flows.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 8.47.0\n */\n allowPreview?: boolean;\n\n /**\n * Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false (will be true by default in a future major release v8.x.x)\n * @since 7.17.3\n */\n persistCustomId?: boolean;\n\n /**\n * Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},\n * {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 7.20.0\n */\n persistModifyUrl?: boolean;\n\n /**\n * Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel.\n * When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.\n *\n * @default true\n * @since 7.34.0\n */\n allowSetDefaultChannel?: boolean;\n\n /**\n * Set the default channel for the app in the config. Case sensitive.\n * This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.\n * This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options\n *\n *\n * @default undefined\n * @since 5.5.0\n */\n defaultChannel?: string;\n /**\n * Configure the app id for the app in the config.\n *\n * @default undefined\n * @since 6.0.0\n */\n appId?: string;\n\n /**\n * Configure the plugin to keep the URL path after a reload.\n * WARNING: When a reload is triggered, 'window.history' will be cleared.\n *\n * @default false\n * @since 6.8.0\n */\n keepUrlPathAfterReload?: boolean;\n\n /**\n * Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done\n *\n * @default false\n * @since 7.3.0\n */\n disableJSLogging?: boolean;\n\n /**\n * Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds.\n *\n * - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments\n * - **Android**: Logs to Logcat (android.util.Log)\n *\n * When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled).\n *\n * This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android).\n *\n * @default true\n * @since 8.42.0\n */\n osLogging?: boolean;\n\n /**\n * Enable the shake gesture while a preview session is active.\n * Outside preview sessions this preview menu is ignored, unless\n * {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: boolean;\n\n /**\n * Enable the shake gesture to show a channel selector menu for switching between update channels.\n * If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active,\n * the shake menu includes both preview actions and channel switching.\n *\n * Only available for Android and iOS.\n *\n * @default false\n * @since 8.43.0\n */\n allowShakeChannelSelector?: boolean;\n };\n }\n}\n\nexport interface CapacitorUpdaterPlugin {\n /**\n * Notify the native layer that JavaScript initialized successfully.\n *\n * **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**\n *\n * This is a simple notification to confirm that your bundle's JavaScript loaded and executed.\n * The native web server successfully served the bundle files and your JS runtime started.\n * That's all it checks - nothing more complex.\n *\n * **What triggers rollback:**\n * - NOT calling this method within the timeout (default: 10 seconds)\n * - Complete JavaScript failure (bundle won't load at all)\n *\n * **What does NOT trigger rollback:**\n * - Runtime errors after initialization (API failures, crashes, etc.)\n * - Network request failures\n * - Application logic errors\n *\n * **IMPORTANT: Call this BEFORE any network requests.**\n * Don't wait for APIs, data loading, or async operations. Call it as soon as your\n * JavaScript bundle starts executing to confirm the bundle itself is valid.\n *\n * Best practices:\n * - Call immediately in your app entry point (main.js, app component mount, etc.)\n * - Don't put it after network calls or heavy initialization\n * - Don't wrap it in try/catch with conditions\n * - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time\n *\n * @returns {Promise<AppReadyResult>} Always resolves successfully with current bundle info. This method never fails.\n */\n notifyAppReady(): Promise<AppReadyResult>;\n\n /**\n * Set the update URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for checking for updates.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setUpdateUrl(options: UpdateUrl): Promise<void>;\n\n /**\n * Set the statistics URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Pass an empty string to disable statistics gathering entirely.\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n *\n * @param options Contains the URL to use for sending statistics, or an empty string to disable.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setStatsUrl(options: StatsUrl): Promise<void>;\n\n /**\n * Set the channel URL for the app dynamically at runtime.\n *\n * This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.\n *\n * Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.\n * Otherwise, the URL will reset to the config value on next app launch.\n *\n * @param options Contains the URL to use for channel operations.\n * @returns {Promise<void>} Resolves when the URL is successfully updated.\n * @throws {Error} If `allowModifyUrl` is false or if the operation fails.\n * @since 5.4.0\n */\n setChannelUrl(options: ChannelUrl): Promise<void>;\n\n /**\n * Download a new bundle from the provided URL for later installation.\n *\n * The downloaded bundle is stored locally but not activated. To use it:\n * - Call {@link next} to set it for installation on next app backgrounding/restart\n * - Call {@link set} to activate it immediately (destroys current JavaScript context)\n *\n * The URL should point to a zip file containing either:\n * - Your app files directly in the zip root, or\n * - A single folder containing all your app files\n *\n * The bundle must include an `index.html` file at the root level.\n *\n * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.\n * For multi-file delta updates, provide the `manifest` array.\n *\n * **Android Background Runner note:** `@capacitor/background-runner` loads its\n * configured runner script from native APK assets. Live updates cannot replace\n * that runner script. Keep it stable across OTA updates and ship a native app\n * update when the runner code changes.\n *\n * @example\n * const bundle = await CapacitorUpdater.download({\n * url: `https://example.com/versions/${version}/dist.zip`,\n * version: version\n * });\n * // Bundle is downloaded but not active yet\n * await CapacitorUpdater.next({ id: bundle.id }); // Will activate on next background\n *\n * @param options The {@link DownloadOptions} for downloading a new bundle zip.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the downloaded bundle.\n * @throws {Error} If the download fails or the bundle is invalid.\n */\n download(options: DownloadOptions): Promise<BundleInfo>;\n\n /**\n * Set the next bundle to be activated when the app backgrounds or restarts.\n *\n * This is the recommended way to apply updates as it doesn't interrupt the user's current session.\n * The bundle will be activated when:\n * - The app is backgrounded (user switches away), or\n * - The app is killed and relaunched, or\n * - {@link reload} is called manually\n *\n * Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.\n * Your app continues running normally until one of the above events occurs.\n *\n * Use {@link setMultiDelay} to add additional conditions before the update is applied.\n *\n * @param options Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.\n * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.\n * @throws {Error} When there is no index.html file inside the bundle folder or the bundle doesn't exist.\n */\n next(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Set the current bundle and immediately reloads the app.\n *\n * **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**\n *\n * When you call this method:\n * - The entire JavaScript context is immediately destroyed\n * - The app reloads from a different folder with different files\n * - NO code after this call will execute\n * - NO promises will resolve\n * - NO callbacks will fire\n * - Event listeners registered after this call are unreliable and may never fire\n *\n * The reload happens automatically - you don't need to do anything else.\n * If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.\n * For other state preservation needs, save your data before calling this method (e.g., to localStorage).\n *\n * **Do not** try to execute additional logic after calling `set()` - it won't work as expected.\n *\n * @param options A {@link BundleId} object containing the new bundle id to set as current.\n * @returns {Promise<void>} A promise that will never resolve because the JavaScript context is destroyed.\n * @throws {Error} When there is no index.html file inside the bundle folder.\n */\n set(options: BundleId): Promise<void>;\n\n /**\n * Start a temporary preview/testing session.\n *\n * This stores the currently active bundle as the pending fallback, enables the\n * native shake menu, and makes the next applied bundle show a native notice\n * explaining that shaking the device can reload or leave the preview.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * When `appId` is provided, the preview session temporarily uses that app id\n * for update checks until the user leaves the preview. Native updater stats are\n * skipped while the preview session is active.\n *\n * Use this before calling {@link set} for Expo Go-style preview flows.\n *\n * @param options Optional preview session options.\n * @returns {Promise<void>} Resolves when preview session state is prepared.\n * @since 8.47.0\n */\n startPreviewSession(options?: StartPreviewSessionOptions): Promise<void>;\n\n /**\n * Delete a bundle from local storage to free up disk space.\n *\n * You cannot delete:\n * - The currently active bundle\n * - The `builtin` bundle (the version shipped with your app)\n * - The bundle set as `next` (call {@link next} with a different bundle first)\n *\n * Use {@link list} to get all available bundle IDs.\n *\n * **Note:** The bundle ID is NOT the same as the version name.\n * Use the `id` field from {@link BundleInfo}, not the `version` field.\n *\n * @param options A {@link BundleId} object containing the bundle ID to delete.\n * @returns {Promise<void>} Resolves when the bundle is successfully deleted.\n * @throws {Error} If the bundle is currently in use or doesn't exist.\n */\n delete(options: BundleId): Promise<void>;\n\n /**\n * Manually mark a bundle as failed/errored in manual update mode.\n *\n * This is useful when you detect that a bundle has critical issues and want to prevent\n * it from being used again. The bundle status will be changed to `error` and the plugin\n * will avoid using this bundle in the future.\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`\n * - Only works in manual update mode (when autoUpdate is disabled)\n *\n * Common use case: After downloading and testing a bundle, you discover it has critical\n * bugs and want to mark it as failed so it won't be retried.\n *\n * @param options A {@link BundleId} object containing the bundle ID to mark as errored.\n * @returns {Promise<BundleInfo>} The updated {@link BundleInfo} with status set to `error`.\n * @throws {Error} When the bundle does not exist or `allowManualBundleError` is false.\n * @since 7.20.0\n */\n setBundleError(options: BundleId): Promise<BundleInfo>;\n\n /**\n * Get all locally downloaded bundles stored in your app.\n *\n * This returns all bundles that have been downloaded and are available locally, including:\n * - The currently active bundle\n * - The `builtin` bundle (shipped with your app)\n * - Any downloaded bundles waiting to be activated\n * - Failed bundles (with `error` status)\n *\n * Use this to:\n * - Check available disk space by counting bundles\n * - Delete old bundles with {@link delete}\n * - Monitor bundle download status\n *\n * @param options The {@link ListOptions} for customizing the bundle list output.\n * @returns {Promise<BundleListResult>} A promise containing the array of {@link BundleInfo} objects.\n * @throws {Error} If the operation fails.\n */\n list(options?: ListOptions): Promise<BundleListResult>;\n\n /**\n * Reset the app to a known good bundle.\n *\n * This method helps recover from problematic updates by reverting to either:\n * - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)\n * - The last successfully loaded bundle (most recent bundle that worked correctly)\n *\n * **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**\n * See {@link set} for details on the implications of this operation.\n *\n * Use cases:\n * - Emergency recovery when an update causes critical issues\n * - Testing rollback functionality\n * - Providing users a \"reset to factory\" option\n *\n * @param options {@link ResetOptions} to control reset behavior.\n * If `toLastSuccessful` is `false` (or omitted), resets to builtin.\n * If `true`, resets to last successful bundle.\n * If `usePendingBundle` is `true`, applies the pending bundle set via {@link next} and clears it.\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reset operation fails.\n */\n reset(options?: ResetOptions): Promise<void>;\n\n /**\n * Get information about the currently active bundle.\n *\n * Returns:\n * - `bundle`: The currently active bundle information\n * - `native`: The version of the builtin bundle (the original app version from App/Play Store)\n *\n * If no updates have been applied, `bundle.id` will be `\"builtin\"`, indicating the app\n * is running the original version shipped with the native app.\n *\n * Use this to:\n * - Display the current version to users\n * - Check if an update is currently active\n * - Compare against available updates\n * - Log the active bundle for debugging\n *\n * @returns {Promise<CurrentBundleResult>} A promise with the current bundle and native version info.\n * @throws {Error} If the operation fails.\n */\n current(): Promise<CurrentBundleResult>;\n\n /**\n * Manually reload the app to apply a pending update.\n *\n * This triggers the same reload behavior that happens automatically when the app backgrounds.\n * If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.\n *\n * **IMPORTANT: This destroys the current JavaScript context immediately.**\n * See {@link set} for details on the implications of this operation.\n *\n * Common use cases:\n * - Applying an update immediately after download instead of waiting for backgrounding\n * - Providing a \"Restart now\" button to users after an update is ready\n * - Testing update flows during development\n *\n * If no update is pending (no call to {@link next}), this simply reloads the current bundle.\n *\n * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.\n * @throws {Error} If the reload operation fails.\n */\n reload(): Promise<void>;\n\n /**\n * Configure conditions that must be met before a pending update is applied.\n *\n * After calling {@link next} to queue an update, use this method to control when it gets applied.\n * The update will only be installed after ALL specified conditions are satisfied.\n *\n * Available condition types:\n * - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.\n * - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)\n * - `date`: Wait until a specific date/time (ISO 8601 format)\n * - `nativeVersion`: Wait until the native app is updated to a specific version\n *\n * Condition value formats:\n * - `background`: Number in milliseconds (e.g., `\"300000\"` for 5 minutes), or omit for immediate\n * - `kill`: No value needed\n * - `date`: ISO 8601 date string (e.g., `\"2025-12-31T23:59:59Z\"`)\n * - `nativeVersion`: Version string (e.g., `\"2.0.0\"`)\n *\n * @example\n * // Update after user kills app OR after 5 minutes in background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [\n * { kind: 'kill' },\n * { kind: 'background', value: '300000' }\n * ]\n * });\n *\n * @example\n * // Update after a specific date\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'date', value: '2025-12-31T23:59:59Z' }]\n * });\n *\n * @example\n * // Default behavior: update on next background\n * await CapacitorUpdater.setMultiDelay({\n * delayConditions: [{ kind: 'background' }]\n * });\n *\n * @param options Contains the {@link MultiDelayConditions} array of conditions.\n * @returns {Promise<void>} Resolves when the delay conditions are set.\n * @throws {Error} If the operation fails or conditions are invalid.\n * @since 4.3.0\n */\n setMultiDelay(options: MultiDelayConditions): Promise<void>;\n\n /**\n * Cancel all delay conditions and apply the pending update immediately.\n *\n * If you've set delay conditions with {@link setMultiDelay}, this method clears them\n * and triggers the pending update to be applied on the next app background or restart.\n *\n * This is useful when:\n * - User manually requests to update now (e.g., clicks \"Update now\" button)\n * - Your app detects it's a good time to update (e.g., user finished critical task)\n * - You want to override a time-based delay early\n *\n * @returns {Promise<void>} Resolves when the delay conditions are cleared.\n * @throws {Error} If the operation fails.\n * @since 4.0.0\n */\n cancelDelay(): Promise<void>;\n\n /**\n * Trigger the native auto-update check/download pipeline immediately.\n *\n * This starts the same background update flow used when the app moves to the\n * foreground with auto-update enabled. It is useful for native integrations\n * such as a silent push notification asking the app to check for a Capgo\n * bundle without reimplementing the update protocol in JavaScript.\n *\n * The promise resolves after the native background work has been queued, not\n * after the update has been downloaded or installed. Listen to updater events\n * such as `updateAvailable`, `downloadComplete`, `downloadFailed`, and\n * `noNeedUpdate` for the final result.\n *\n * Native support is available on iOS and Android. On Web, this method returns\n * a result with `status: 'unavailable'`. Native platforms also return\n * `unavailable` when the native auto-update system is disabled.\n *\n * @returns {Promise<TriggerUpdateCheckResult>} Whether a native update check was queued.\n */\n triggerUpdateCheck(): Promise<TriggerUpdateCheckResult>;\n\n /**\n * Check the update server for the latest available bundle version.\n *\n * This queries your configured update URL (or Capgo backend) to see if a newer bundle\n * is available for download. It does NOT download the bundle automatically.\n *\n * The response includes:\n * - `version`: The latest available version identifier\n * - `url`: Download URL for the bundle (if available)\n * - `breaking`: Whether this update is marked as incompatible (requires native app update)\n * - `message`: Optional message from the server\n * - `manifest`: File list for delta updates (if using multi-file downloads)\n *\n * After receiving the latest version info, you can:\n * 1. Compare it with your current version\n * 2. Download it using {@link download}\n * 3. Apply it using {@link next} or {@link set}\n *\n * **Important: Handling \"no new version available\"**\n *\n * When the device's current version matches the latest version on the server (i.e., the device is already\n * up-to-date), the server returns a 200 response with `error: \"no_new_version_available\"` and\n * `message: \"No new version available\"`. This is a normal, expected condition and resolves with\n * `kind: \"up_to_date\"` when the backend provides that classification.\n *\n * You should check `kind` and `error` before attempting to download:\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * if (latest.kind === 'up_to_date') {\n * console.log('Already up to date');\n * } else if (latest.kind === 'blocked') {\n * console.log('Update is blocked:', latest.error);\n * } else if (latest.url) {\n * // New version is available, proceed with download\n * }\n * ```\n *\n * In this scenario, the server:\n * - Logs the request with a \"No new version available\" message\n * - Sends a \"noNew\" stat action to track that the device checked for updates but was already current (done on the backend)\n *\n * @param options Optional {@link GetLatestOptions} to specify which channel to check.\n * @returns {Promise<LatestVersion>} Information about the latest available bundle version.\n * @throws {Error} Throws for failed update checks or transport/request failures.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\n\n /**\n * Return the manifest entries that still need to be downloaded for a partial update.\n *\n * Pass the result from {@link getLatest} directly when it includes a `manifest`.\n * The native plugin compares each manifest entry with the files already available\n * in the builtin bundle and the local delta cache. Entries that can be reused are\n * omitted from the returned `missing` list.\n *\n * For encrypted manifests, pass the `sessionKey` returned by {@link getLatest} so\n * encrypted file hashes can be checked against local files.\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);\n * ```\n *\n * @param options A {@link GetMissingBundleFilesOptions} object, or a {@link LatestVersion} response containing `manifest`.\n * @returns {Promise<GetMissingBundleFilesResult>} The manifest entries that require network download.\n * @throws {Error} If the manifest is missing or invalid.\n * @since 8.47.0\n */\n getMissingBundleFiles(options: GetMissingBundleFilesOptions): Promise<GetMissingBundleFilesResult>;\n\n /**\n * Estimate the download size for manifest entries before downloading them.\n *\n * This method sends the provided manifest entries to the Capgo update endpoint\n * once and reads the stored manifest `file_size` metadata. It does not perform\n * per-file `HEAD` requests from the app.\n *\n * Use this after {@link getMissingBundleFiles} to estimate only the files this\n * device still needs:\n *\n * ```typescript\n * const latest = await CapacitorUpdater.getLatest();\n * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);\n * const size = await CapacitorUpdater.getBundleDownloadSize({\n * version: latest.version,\n * manifest: missing.missing,\n * });\n * ```\n *\n * @param options A {@link GetBundleDownloadSizeOptions} object containing manifest entries.\n * @returns {Promise<GetBundleDownloadSizeResult>} Known byte totals and per-file size results.\n * @throws {Error} If the manifest is missing or invalid.\n * @since 8.47.0\n */\n getBundleDownloadSize(options: GetBundleDownloadSizeOptions): Promise<GetBundleDownloadSizeResult>;\n\n /**\n * Assign this device to a specific update channel at runtime.\n *\n * Channels allow you to distribute different bundle versions to different groups of users\n * (e.g., \"production\", \"beta\", \"staging\"). This method switches the device to a new channel.\n *\n * **Requirements:**\n * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)\n * - The backend may accept or reject the request based on channel settings\n *\n * **When to use:**\n * - After the app is ready and the user has interacted (e.g., opted into beta program)\n * - To implement in-app channel switching (beta toggle, tester access, etc.)\n * - For user-driven channel changes\n *\n * **When NOT to use:**\n * - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead\n * - Before user interaction\n *\n * **Important: Listen for the `channelPrivate` event**\n *\n * When a user attempts to set a channel that doesn't allow device self-assignment, the method will\n * throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event\n * to provide appropriate feedback to users:\n *\n * ```typescript\n * CapacitorUpdater.addListener('channelPrivate', (data) => {\n * console.warn(`Cannot access channel \"${data.channel}\": ${data.message}`);\n * // Show user-friendly message\n * });\n * ```\n *\n * This sends a request to the Capgo backend linking your device ID to the specified channel.\n *\n * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.\n * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.\n * @throws {Error} If the channel doesn't exist or doesn't allow self-assignment.\n * @since 4.7.0\n */\n setChannel(options: SetChannelOptions): Promise<ChannelRes>;\n\n /**\n * Remove the device's channel assignment and return to the default channel.\n *\n * This unlinks the device from any specifically assigned channel, causing it to fall back to:\n * - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or\n * - Your backend's default channel for this app\n *\n * Use this when:\n * - Users opt out of beta/testing programs\n * - You want to reset a device to standard update distribution\n * - Testing channel switching behavior\n *\n * @param options {@link UnsetChannelOptions} containing optional auto-update trigger.\n * @returns {Promise<void>} Resolves when the channel is successfully unset.\n * @throws {Error} If the operation fails.\n * @since 4.7.0\n */\n unsetChannel(options: UnsetChannelOptions): Promise<void>;\n\n /**\n * Get the current channel assigned to this device.\n *\n * Returns information about:\n * - `channel`: The currently assigned channel name (if any)\n * - `allowSet`: Whether the channel allows self-assignment\n * - `status`: Operation status\n * - `error`/`message`: Additional information (if applicable)\n *\n * Use this to:\n * - Display current channel to users (e.g., \"You're on the Beta channel\")\n * - Check if a device is on a specific channel before showing features\n * - Verify channel assignment after calling {@link setChannel}\n *\n * On native platforms, a successful response also refreshes the locally persisted\n * default channel used by update checks.\n *\n * @returns {Promise<GetChannelRes>} The current channel information.\n * @throws {Error} If the operation fails.\n * @since 4.8.0\n */\n getChannel(): Promise<GetChannelRes>;\n\n /**\n * Get a list of all channels available for this device to self-assign to.\n *\n * Only returns channels where `allow_self_set` is `true`. These are channels that\n * users can switch to using {@link setChannel} without backend administrator intervention.\n *\n * Each channel includes:\n * - `id`: Unique channel identifier\n * - `name`: Human-readable channel name\n * - `public`: Whether the channel is publicly visible\n * - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)\n *\n * Use this to:\n * - Build a channel selector UI for users (e.g., \"Join Beta\" button)\n * - Show available testing/preview channels\n * - Implement channel discovery features\n *\n * @returns {Promise<ListChannelsResult>} List of channels the device can self-assign to.\n * @throws {Error} If the operation fails or the request to the backend fails.\n * @since 7.5.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Set a custom identifier for this device.\n *\n * This allows you to identify devices by your own custom ID (user ID, account ID, etc.)\n * instead of or in addition to the device's unique hardware ID. The custom ID is sent\n * to your update server and can be used for:\n * - Targeting specific users for updates\n * - Analytics and user tracking\n * - Debugging and support (correlating devices with users)\n * - A/B testing or feature flagging\n *\n * **Persistence:**\n * - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts\n * - When `false`, the ID is only kept for the current session\n *\n * **Clearing the custom ID:**\n * - Pass an empty string `\"\"` to remove any stored custom ID\n *\n * @param options The {@link SetCustomIdOptions} containing the custom identifier string.\n * @returns {Promise<void>} Resolves immediately (synchronous operation).\n * @throws {Error} If the operation fails.\n * @since 4.9.0\n */\n setCustomId(options: SetCustomIdOptions): Promise<void>;\n\n /**\n * Get the builtin bundle version (the original version shipped with your native app).\n *\n * This returns the version of the bundle that was included when the app was installed\n * from the App Store or Play Store. This is NOT the currently active bundle version -\n * use {@link current} for that.\n *\n * Returns:\n * - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or\n * - The native app version from platform configs (package.json, Info.plist, build.gradle)\n *\n * Use this to:\n * - Display the \"factory\" version to users\n * - Compare against downloaded bundle versions\n * - Determine if any updates have been applied\n * - Debugging version mismatches\n *\n * @returns {Promise<BuiltinVersion>} The builtin bundle version string.\n * @since 5.2.0\n */\n getBuiltinVersion(): Promise<BuiltinVersion>;\n\n /**\n * Get the unique, privacy-friendly identifier for this device.\n *\n * This ID is used to identify the device when communicating with update servers.\n * It's automatically generated and stored securely by the plugin.\n *\n * **Privacy & Security characteristics:**\n * - Generated as a UUID (not based on hardware identifiers)\n * - Stored securely in platform-specific secure storage\n * - Android: Android Keystore (persists across app reinstalls on API 23+)\n * - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`\n * - Not synced to cloud (iOS)\n * - Follows Apple and Google privacy best practices\n * - Users can clear it via system settings (Android) or keychain access (iOS)\n *\n * **Persistence:**\n * The device ID persists across app reinstalls to maintain consistent device identity\n * for update tracking and analytics.\n *\n * Use this to:\n * - Debug update delivery issues (check what ID the server sees)\n * - Implement device-specific features\n * - Correlate server logs with specific devices\n *\n * @returns {Promise<DeviceId>} The unique device identifier string.\n * @throws {Error} If the operation fails.\n */\n getDeviceId(): Promise<DeviceId>;\n\n /**\n * Get the version of the Capacitor Updater plugin installed in your app.\n *\n * This returns the version of the native plugin code (Android/iOS), which is sent\n * to the update server with each request. This is NOT your app version or bundle version.\n *\n * Use this to:\n * - Debug plugin-specific issues (when reporting bugs)\n * - Verify plugin installation and version\n * - Check compatibility with backend features\n * - Display in debug/about screens\n *\n * @returns {Promise<PluginVersion>} The Capacitor Updater plugin version string.\n * @throws {Error} If the operation fails.\n */\n getPluginVersion(): Promise<PluginVersion>;\n\n /**\n * Check if automatic updates are currently enabled.\n *\n * Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,\n * meaning the plugin will automatically check for, download, and apply updates.\n *\n * Returns `false` if in manual mode, where you control the update flow using\n * {@link getLatest}, {@link download}, {@link next}, and {@link set}.\n *\n * Use this to:\n * - Determine which update flow your app is using\n * - Show/hide manual update UI based on mode\n * - Debug update behavior\n *\n * @returns {Promise<AutoUpdateEnabled>} `true` if auto-update is enabled, `false` if in manual mode.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;\n\n /**\n * Remove all event listeners registered for this plugin.\n *\n * This unregisters all listeners added via {@link addListener} for all event types:\n * - `download`\n * - `noNeedUpdate`\n * - `updateCheckResult`\n * - `updateAvailable`\n * - `downloadComplete`\n * - `downloadFailed`\n * - `breakingAvailable` / `majorAvailable`\n * - `updateFailed`\n * - `appReloaded`\n * - `appReady`\n *\n * Use this during cleanup (e.g., when unmounting components or closing screens)\n * to prevent memory leaks from lingering event listeners.\n *\n * @returns {Promise<void>} Resolves when all listeners are removed.\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.\n * This will return you all download percent during the download\n *\n * @since 2.0.11\n */\n addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for no need to update event, useful when you want force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update check results before the updater decides whether to download.\n * The backend can classify the UpdateCheckResultEvent payload as `up_to_date`, `blocked`, or `failed`.\n *\n * This event is emitted alongside legacy events. For `up_to_date` and `blocked`, it is emitted before\n * `noNeedUpdate` and does not emit `downloadFailed`. For `failed`, it is emitted before the legacy\n * `downloadFailed` event and keeps the existing failure stats behavior.\n *\n * @since 8.45.11\n */\n addListener(\n eventName: 'updateCheckResult',\n listenerFunc: (state: UpdateCheckResultEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for available update event, useful when you want to force check every time the app is launched\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'updateAvailable',\n listenerFunc: (state: UpdateAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for downloadComplete events.\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadComplete',\n listenerFunc: (state: DownloadCompleteEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for breaking update events when the backend flags an update as incompatible with the current app.\n * Emits the same payload as the legacy `majorAvailable` listener.\n *\n * @since 7.22.0\n */\n addListener(\n eventName: 'breakingAvailable',\n listenerFunc: (state: BreakingAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking\n *\n * @deprecated Deprecated alias for {@link addListener} with `breakingAvailable`. Emits the same payload. will be removed in v8\n * @since 2.3.0\n */\n addListener(\n eventName: 'majorAvailable',\n listenerFunc: (state: MajorAvailableEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for update fail event in the App, let you know when update has fail to install at next app start\n *\n * @since 2.3.0\n */\n addListener(\n eventName: 'updateFailed',\n listenerFunc: (state: UpdateFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for set event in the App, let you know when a bundle has been applied successfully.\n * This event is retained natively until JavaScript consumes it, so if the app reloads before your\n * listener is attached, the last pending `set` event is delivered once the listener subscribes.\n *\n * @since 8.43.12\n */\n addListener(eventName: 'set', listenerFunc: (state: SetEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for set next event in the App, let you know when a bundle is queued as the next bundle to install.\n *\n * @since 6.14.0\n */\n addListener(eventName: 'setNext', listenerFunc: (state: SetNextEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for download fail event in the App, let you know when a bundle download has failed\n *\n * @since 4.0.0\n */\n addListener(\n eventName: 'downloadFailed',\n listenerFunc: (state: DownloadFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for reload event in the App, let you know when reload has happened\n *\n * @since 4.3.0\n */\n addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for app ready event in the App, let you know when app is ready to use.\n * This event is retained natively until JavaScript consumes it, so it can still be delivered after\n * a reload even if the listener is attached later in app startup.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;\n\n /**\n * Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.\n *\n * This event is useful for:\n * - Informing users they don't have permission to switch to a specific channel\n * - Implementing custom error handling for channel restrictions\n * - Logging unauthorized channel access attempts\n *\n * @since 7.34.0\n */\n addListener(\n eventName: 'channelPrivate',\n listenerFunc: (state: ChannelPrivateEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for flexible update state changes on Android.\n *\n * This event fires during the flexible update download process, providing:\n * - Download progress (bytes downloaded / total bytes)\n * - Installation status changes\n *\n * **Install status values:**\n * - `UNKNOWN` (0): Unknown status\n * - `PENDING` (1): Download pending\n * - `DOWNLOADING` (2): Download in progress\n * - `INSTALLING` (3): Installing the update\n * - `INSTALLED` (4): Update installed (app restart needed)\n * - `FAILED` (5): Update failed\n * - `CANCELED` (6): Update was canceled\n * - `DOWNLOADED` (11): Download complete, ready to install\n *\n * When status is `DOWNLOADED`, you should prompt the user and call\n * {@link completeFlexibleUpdate} to finish the installation.\n *\n * @since 8.0.0\n */\n addListener(\n eventName: 'onFlexibleUpdateStateChange',\n listenerFunc: (state: FlexibleUpdateState) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Check if the auto-update feature is available (not disabled by custom server configuration).\n *\n * Returns `false` when a custom `updateUrl` is configured, as this typically indicates\n * you're using a self-hosted update server that may not support all auto-update features.\n *\n * Returns `true` when using the default Capgo backend or when the feature is available.\n *\n * This is different from {@link isAutoUpdateEnabled}:\n * - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off\n * - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration\n *\n * @returns {Promise<AutoUpdateAvailable>} `false` when custom updateUrl is set, `true` otherwise.\n * @throws {Error} If the operation fails.\n */\n isAutoUpdateAvailable(): Promise<AutoUpdateAvailable>;\n\n /**\n * Get information about the bundle queued to be activated on next reload.\n *\n * Returns:\n * - {@link BundleInfo} object if a bundle has been queued via {@link next}\n * - `null` if no update is pending\n *\n * This is useful to:\n * - Check if an update is waiting to be applied\n * - Display \"Update pending\" status to users\n * - Show version info of the queued update\n * - Decide whether to show a \"Restart to update\" prompt\n *\n * The queued bundle will be activated when:\n * - The app is backgrounded (default behavior)\n * - The app is killed and restarted\n * - {@link reload} is called manually\n * - Delay conditions set by {@link setMultiDelay} are met\n *\n * @returns {Promise<BundleInfo | null>} The pending bundle info, or `null` if none is queued.\n * @throws {Error} If the operation fails.\n * @since 6.8.0\n */\n getNextBundle(): Promise<BundleInfo | null>;\n\n /**\n * Retrieve information about the most recent bundle that failed to load.\n *\n * When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),\n * the plugin automatically rolls back and stores information about the failure. This method\n * retrieves that failure information.\n *\n * **IMPORTANT: The stored value is cleared after being retrieved once.**\n * Calling this method multiple times will only return the failure info on the first call,\n * then `null` on subsequent calls until another failure occurs.\n *\n * Returns:\n * - {@link UpdateFailedEvent} with bundle info if a failure was recorded\n * - `null` if no failure has occurred or if it was already retrieved\n *\n * Use this to:\n * - Show users why an update failed\n * - Log failure information for debugging\n * - Implement custom error handling/reporting\n * - Display rollback notifications\n *\n * @returns {Promise<UpdateFailedEvent | null>} The failed update info (cleared after first retrieval), or `null`.\n * @throws {Error} If the operation fails.\n * @since 7.22.0\n */\n getFailedUpdate(): Promise<UpdateFailedEvent | null>;\n\n /**\n * Enable or disable the shake gesture menu.\n *\n * During preview sessions, users can shake their device to:\n * - Reload the current preview\n * - Leave the test app and return to the fallback bundle\n * - Switch update channel, when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is also enabled\n *\n * Outside preview sessions, this preview menu is ignored. The channel selector can still be\n * shown outside preview sessions when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.\n *\n * **Important:** Disable this in production builds or only enable for internal testers.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n setShakeMenu(options: SetShakeMenuOptions): Promise<void>;\n\n /**\n * Check if the shake gesture debug menu is currently enabled.\n *\n * Returns the current state of the shake menu feature that can be toggled via\n * {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.\n *\n * Use this to:\n * - Check if debug features are enabled\n * - Show/hide debug settings UI\n * - Verify configuration during testing\n *\n * @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 7.5.0\n */\n isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;\n\n /**\n * Enable or disable the shake channel selector at runtime.\n *\n * When enabled, shaking the device can show a channel selector, including outside preview sessions.\n * If {@link setShakeMenu} is also enabled while a preview session is active, the shake menu includes\n * both preview actions and channel switching.\n *\n * Can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.\n *\n * @param options {@link SetShakeChannelSelectorOptions} with `enabled: true` to enable or `enabled: false` to disable.\n * @returns {Promise<void>} Resolves when the setting is applied.\n * @throws {Error} If the operation fails.\n * @since 8.43.0\n */\n setShakeChannelSelector(options: SetShakeChannelSelectorOptions): Promise<void>;\n\n /**\n * Check if the shake channel selector is currently enabled.\n *\n * Returns the current state of the shake channel selector feature that can be toggled via\n * {@link setShakeChannelSelector} or configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.\n *\n * @returns {Promise<ShakeChannelSelectorEnabled>} Object with `enabled: true` or `enabled: false`.\n * @throws {Error} If the operation fails.\n * @since 8.43.0\n */\n isShakeChannelSelectorEnabled(): Promise<ShakeChannelSelectorEnabled>;\n\n /**\n * Get the currently configured App ID used for update server communication.\n *\n * Returns the App ID that identifies this app to the update server. This can be:\n * - The value set via {@link setAppId}, or\n * - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or\n * - The default app identifier from your native app configuration\n *\n * Use this to:\n * - Verify which App ID is being used for updates\n * - Debug update delivery issues\n * - Display app configuration in debug screens\n * - Confirm App ID after calling {@link setAppId}\n *\n * @returns {Promise<GetAppIdRes>} Object containing the current `appId` string.\n * @throws {Error} If the operation fails.\n * @since 7.14.0\n */\n getAppId(): Promise<GetAppIdRes>;\n\n /**\n * Dynamically change the App ID used for update server communication.\n *\n * This overrides the App ID used to identify your app to the update server, allowing you\n * to switch between different app configurations at runtime (e.g., production vs staging\n * app IDs, or multi-tenant configurations).\n *\n * **Requirements:**\n * - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`\n *\n * **Important considerations:**\n * - Changing the App ID will affect which updates this device receives\n * - The new App ID must exist on your update server\n * - This is primarily for advanced use cases (multi-tenancy, environment switching)\n * - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead\n *\n * @param options {@link SetAppIdOptions} containing the new App ID string.\n * @returns {Promise<void>} Resolves when the App ID is successfully changed.\n * @throws {Error} If `allowModifyAppId` is false or the operation fails.\n * @since 7.14.0\n */\n setAppId(options: SetAppIdOptions): Promise<void>;\n\n // ============================================================================\n // App Store / Play Store Update Methods\n // ============================================================================\n\n /**\n * Get information about the app's availability in the App Store or Play Store.\n *\n * This method checks the native app stores to see if a newer version of the app\n * is available for download. This is different from Capgo's OTA updates - this\n * checks for native app updates that require going through the app stores.\n *\n * **Platform differences:**\n * - **Android**: Uses Play Store's In-App Updates API for accurate update information\n * - **iOS**: Queries the App Store lookup API (requires country code for accurate results)\n *\n * **Returns information about:**\n * - Current installed version\n * - Available version in the store (if any)\n * - Whether an update is available\n * - Update priority (Android only)\n * - Whether immediate/flexible updates are allowed (Android only)\n *\n * Use this to:\n * - Check if users need to update from the app store\n * - Show \"Update Available\" prompts for native updates\n * - Implement version gating (require minimum native version)\n * - Combine with Capgo OTA updates for a complete update strategy\n *\n * @param options Optional {@link GetAppUpdateInfoOptions} with country code for iOS.\n * @returns {Promise<AppUpdateInfo>} Information about the current and available app versions.\n * @throws {Error} If the operation fails or store information is unavailable.\n * @since 8.0.0\n */\n getAppUpdateInfo(options?: GetAppUpdateInfoOptions): Promise<AppUpdateInfo>;\n\n /**\n * Open the app's page in the App Store or Play Store.\n *\n * This navigates the user to your app's store listing where they can manually\n * update the app. Use this as a fallback when in-app updates are not available\n * or when the user needs to update on iOS.\n *\n * **Platform behavior:**\n * - **Android**: Opens Play Store to the app's page\n * - **iOS**: Opens App Store to the app's page\n *\n * **Customization options:**\n * - `appId`: Specify a custom App Store ID (iOS) - useful for opening a different app's page\n * - `packageName`: Specify a custom package name (Android) - useful for opening a different app's page\n *\n * @param options Optional {@link OpenAppStoreOptions} to customize which app's store page to open.\n * @returns {Promise<void>} Resolves when the store is opened.\n * @throws {Error} If the store cannot be opened.\n * @since 8.0.0\n */\n openAppStore(options?: OpenAppStoreOptions): Promise<void>;\n\n /**\n * Perform an immediate in-app update on Android.\n *\n * This triggers Google Play's immediate update flow, which:\n * 1. Shows a full-screen update UI\n * 2. Downloads and installs the update\n * 3. Restarts the app automatically\n *\n * The user cannot continue using the app until the update is complete.\n * This is ideal for critical updates that must be installed immediately.\n *\n * **Requirements:**\n * - Android only (throws error on iOS)\n * - An update must be available (check with {@link getAppUpdateInfo} first)\n * - The update must allow immediate updates (`immediateUpdateAllowed: true`)\n *\n * **User experience:**\n * - Full-screen blocking UI\n * - Progress shown during download\n * - App automatically restarts after installation\n *\n * @returns {Promise<AppUpdateResult>} Result indicating success, cancellation, or failure.\n * @throws {Error} If not on Android, no update is available, or immediate updates not allowed.\n * @since 8.0.0\n */\n performImmediateUpdate(): Promise<AppUpdateResult>;\n\n /**\n * Start a flexible in-app update on Android.\n *\n * This triggers Google Play's flexible update flow, which:\n * 1. Downloads the update in the background\n * 2. Allows the user to continue using the app\n * 3. Notifies when download is complete\n * 4. Requires calling {@link completeFlexibleUpdate} to install\n *\n * Monitor the download progress using the `onFlexibleUpdateStateChange` listener.\n *\n * **Requirements:**\n * - Android only (throws error on iOS)\n * - An update must be available (check with {@link getAppUpdateInfo} first)\n * - The update must allow flexible updates (`flexibleUpdateAllowed: true`)\n *\n * **Typical flow:**\n * 1. Call `startFlexibleUpdate()` to begin download\n * 2. Listen to `onFlexibleUpdateStateChange` for progress\n * 3. When status is `DOWNLOADED`, prompt user to restart\n * 4. Call `completeFlexibleUpdate()` to install and restart\n *\n * @returns {Promise<AppUpdateResult>} Result indicating the update was started, cancelled, or failed.\n * @throws {Error} If not on Android, no update is available, or flexible updates not allowed.\n * @since 8.0.0\n */\n startFlexibleUpdate(): Promise<AppUpdateResult>;\n\n /**\n * Complete a flexible in-app update on Android.\n *\n * After a flexible update has been downloaded (status `DOWNLOADED` in\n * `onFlexibleUpdateStateChange`), call this method to install the update\n * and restart the app.\n *\n * **Important:** This will immediately restart the app. Make sure to:\n * - Save any user data before calling\n * - Prompt the user before restarting\n * - Only call when the download status is `DOWNLOADED`\n *\n * @returns {Promise<void>} Resolves when the update installation begins (app will restart).\n * @throws {Error} If not on Android or no downloaded update is pending.\n * @since 8.0.0\n */\n completeFlexibleUpdate(): Promise<void>;\n}\n\n/**\n * pending: The bundle is pending to be **SET** as the next bundle.\n * downloading: The bundle is being downloaded.\n * success: The bundle has been downloaded and is ready to be **SET** as the next bundle.\n * error: The bundle has failed to download.\n */\nexport type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';\n\nexport type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';\n\n/**\n * Classification for update-check responses that do not provide a downloadable bundle.\n * The update backend provides this field directly. Missing or unknown values are treated as\n * failed by native clients.\n *\n * @since 8.45.11\n */\nexport type UpdateResponseKind = 'up_to_date' | 'blocked' | 'failed';\n\nexport interface NoNeedEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateCheckResultEvent {\n /**\n * Classification for the update check result, provided by the backend.\n *\n * @since 8.45.11\n */\n kind: UpdateResponseKind;\n /**\n * Backend error code, when provided.\n *\n * @since 8.45.11\n */\n error?: string;\n /**\n * Backend message, when provided.\n *\n * @since 8.45.11\n */\n message?: string;\n /**\n * HTTP status code returned by the update endpoint.\n *\n * @since 8.45.11\n */\n statusCode?: number;\n /**\n * Version referenced by the update check result.\n *\n * @since 8.45.11\n */\n version?: string;\n /**\n * Current bundle on the device.\n *\n * @since 8.45.11\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateAvailableEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface ChannelRes {\n /**\n * Current status of set channel\n *\n * @since 4.7.0\n */\n status: string;\n error?: string;\n message?: string;\n}\n\nexport interface GetChannelRes {\n /**\n * Current status of get channel\n *\n * @since 4.8.0\n */\n channel?: string;\n error?: string;\n message?: string;\n status?: string;\n allowSet?: boolean;\n}\n\nexport interface ChannelInfo {\n /**\n * The channel ID\n *\n * @since 7.5.0\n */\n id: number;\n /**\n * The channel name\n *\n * @since 7.5.0\n */\n name: string;\n /**\n * Whether this is a public channel\n *\n * @since 7.5.0\n */\n public: boolean;\n /**\n * Whether devices can self-assign to this channel\n *\n * @since 7.5.0\n */\n allow_self_set: boolean;\n}\n\nexport interface ListChannelsResult {\n /**\n * List of available channels\n *\n * @since 7.5.0\n */\n channels: ChannelInfo[];\n}\n\nexport interface DownloadEvent {\n /**\n * Current status of download, between 0 and 100.\n *\n * @since 4.0.0\n */\n percent: number;\n bundle: BundleInfo;\n}\n\nexport interface MajorAvailableEvent {\n /**\n * Emit when a breaking update is available.\n *\n * @deprecated Deprecated alias for {@link BreakingAvailableEvent}. Receives the same payload.\n * @since 4.0.0\n */\n version: string;\n}\n\n/**\n * Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.\n *\n * @since 7.22.0\n */\nexport type BreakingAvailableEvent = MajorAvailableEvent;\n\nexport interface DownloadFailedEvent {\n /**\n * Emit when a download fail.\n *\n * @since 4.0.0\n */\n version: string;\n}\n\nexport interface DownloadCompleteEvent {\n /**\n * Emit when a new update is available.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface UpdateFailedEvent {\n /**\n * Emit when a update failed to install.\n *\n * @since 4.0.0\n */\n bundle: BundleInfo;\n}\n\nexport interface SetEvent {\n /**\n * Emit when a bundle has been applied successfully.\n * This event uses native `retainUntilConsumed` behavior.\n *\n * @since 8.43.12\n */\n bundle: BundleInfo;\n}\n\nexport interface SetNextEvent {\n /**\n * Emit when a bundle is queued as the next bundle to install.\n *\n * @since 6.14.0\n */\n bundle: BundleInfo;\n}\n\nexport interface AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n * This event uses native `retainUntilConsumed` behavior.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: string;\n}\n\nexport interface ChannelPrivateEvent {\n /**\n * Emitted when attempting to set a channel that doesn't allow device self-assignment.\n *\n * @since 7.34.0\n */\n channel: string;\n message: string;\n}\n\nexport interface ManifestEntry {\n file_name: string | null;\n file_hash: string | null;\n download_url: string | null;\n}\n\nexport interface GetMissingBundleFilesOptions {\n /**\n * Manifest returned by {@link getLatest}. Passing the full {@link LatestVersion}\n * response is supported because it contains this field.\n *\n * @since 8.47.0\n */\n manifest?: ManifestEntry[];\n /**\n * Target bundle version. Passing the full {@link LatestVersion} response is\n * supported because it contains this field.\n *\n * @since 8.47.0\n */\n version?: string;\n /**\n * Session key returned by {@link getLatest}, required only when file hashes are encrypted.\n *\n * @since 8.47.0\n */\n sessionKey?: string;\n}\n\nexport interface GetMissingBundleFilesResult {\n /**\n * Entries that are not available locally and need to be downloaded.\n *\n * @since 8.47.0\n */\n missing: ManifestEntry[];\n /**\n * Total entries in the provided manifest.\n *\n * @since 8.47.0\n */\n total: number;\n /**\n * Number of entries that need to be downloaded.\n *\n * @since 8.47.0\n */\n missingCount: number;\n /**\n * Number of entries that can be reused from builtin files or local cache.\n *\n * @since 8.47.0\n */\n reusableCount: number;\n}\n\nexport interface GetBundleDownloadSizeOptions {\n /**\n * Manifest entries to estimate. Pass `missing.missing` from {@link getMissingBundleFiles}\n * to estimate only the bytes this device still needs to download.\n *\n * @since 8.47.0\n */\n manifest?: ManifestEntry[];\n /**\n * Target bundle version. Pass `latest.version` when estimating files returned\n * by {@link getLatest}.\n *\n * @since 8.47.0\n */\n version?: string;\n}\n\nexport interface BundleFileSize {\n /**\n * File name from the manifest entry.\n *\n * @since 8.47.0\n */\n file_name: string | null;\n /**\n * File hash from the manifest entry.\n *\n * @since 8.47.0\n */\n file_hash: string | null;\n /**\n * Download URL from the manifest entry.\n *\n * @since 8.47.0\n */\n download_url: string | null;\n /**\n * Estimated bytes to download when the server exposes a size.\n *\n * @since 8.47.0\n */\n size?: number;\n /**\n * Error for this entry when the size could not be determined.\n *\n * @since 8.47.0\n */\n error?: string;\n}\n\nexport interface GetBundleDownloadSizeResult {\n /**\n * Sum of all known file sizes in bytes.\n *\n * @since 8.47.0\n */\n totalSize: number;\n /**\n * Number of files with a known size.\n *\n * @since 8.47.0\n */\n knownFiles: number;\n /**\n * Number of files whose size could not be determined.\n *\n * @since 8.47.0\n */\n unknownFiles: number;\n /**\n * Per-file size results.\n *\n * @since 8.47.0\n */\n files: BundleFileSize[];\n}\n\nexport interface LatestVersion {\n /**\n * Result of getLatest method\n *\n * @since 4.0.0\n */\n version: string;\n /**\n * @since 6\n */\n checksum?: string;\n /**\n * Indicates whether the update was flagged as breaking by the backend.\n *\n * @since 7.22.0\n */\n breaking?: boolean;\n /**\n * @deprecated Use {@link LatestVersion.breaking} instead.\n */\n major?: boolean;\n /**\n * Optional message from the server.\n * When no new version is available, this will be \"No new version available\".\n */\n message?: string;\n sessionKey?: string;\n /**\n * Error code from the server, if any. Use `kind` for classification instead of parsing this value.\n */\n error?: string;\n /**\n * Classification for this response, provided by the backend.\n *\n * @since 8.45.11\n */\n kind?: UpdateResponseKind;\n /**\n * HTTP status code returned by the update server for classified update-check responses.\n *\n * @since 8.45.11\n */\n statusCode?: number;\n /**\n * The previous/current version name (provided for reference).\n */\n old?: string;\n /**\n * Download URL for the bundle (when a new version is available).\n */\n url?: string;\n /**\n * File list for delta updates (when using multi-file downloads).\n * @since 6.1\n */\n manifest?: ManifestEntry[];\n /**\n * Missing manifest entries for this device when {@link GetLatestOptions.includeBundleSize}\n * is enabled.\n *\n * @since 8.47.0\n */\n missing?: GetMissingBundleFilesResult;\n /**\n * Estimated download size for missing manifest entries when\n * {@link GetLatestOptions.includeBundleSize} is enabled.\n *\n * @since 8.47.0\n */\n downloadSize?: GetBundleDownloadSizeResult;\n /**\n * Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).\n * @since 7.35.0\n */\n link?: string;\n /**\n * Optional comment or description for this bundle version.\n * @since 7.35.0\n */\n comment?: string;\n}\n\nexport interface BundleInfo {\n id: string;\n version: string;\n downloaded: string;\n checksum: string;\n status: BundleStatus;\n}\n\nexport interface SetChannelOptions {\n channel: string;\n triggerAutoUpdate?: boolean;\n}\n\nexport interface UnsetChannelOptions {\n triggerAutoUpdate?: boolean;\n}\n\nexport interface SetCustomIdOptions {\n /**\n * Custom identifier to associate with the device. Use an empty string to clear any saved value.\n */\n customId: string;\n}\n\nexport interface DelayCondition {\n /**\n * Set up delay conditions in setMultiDelay\n * @param value is useless for @param kind \"kill\", optional for \"background\" (default value: \"0\") and required for \"nativeVersion\" and \"date\"\n */\n kind: DelayUntilNext;\n value?: string;\n}\n\nexport interface GetLatestOptions {\n /**\n * The channel to get the latest version for\n * The channel must allow 'self_assign' for this to work\n * @since 6.8.0\n * @default undefined\n */\n channel?: string;\n /**\n * Temporarily use another app id for this update check while using a trusted preview container.\n * This only changes the app id sent by this request; it does not persist a preview session.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.47.0\n * @default undefined\n */\n appId?: string;\n /**\n * When true, the native plugin computes which manifest files are missing on\n * this device and asks the Capgo update endpoint for their stored sizes before\n * resolving {@link getLatest}.\n *\n * This adds one backend request only when the update response contains a\n * manifest. It does not perform per-file network checks.\n *\n * @since 8.47.0\n * @default false\n */\n includeBundleSize?: boolean;\n}\n\nexport interface StartPreviewSessionOptions {\n /**\n * App id to use while the preview session is active.\n * The previous app id is restored when leaving the preview session.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.47.0\n * @default undefined\n */\n appId?: string;\n /**\n * HTTP(S) URL returning a preview download payload.\n * When provided, the native shake reload action fetches this payload again\n * before reloading so channel previews can move to the latest bundle.\n * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.\n * @since 8.48.0\n * @default undefined\n */\n payloadUrl?: string;\n}\n\nexport interface AppReadyResult {\n bundle: BundleInfo;\n}\n\nexport interface UpdateUrl {\n url: string;\n}\n\nexport interface StatsUrl {\n url: string;\n}\n\nexport interface ChannelUrl {\n url: string;\n}\n\n/**\n * This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.\n * If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.\n */\nexport interface DownloadOptions {\n /**\n * The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)\n */\n url: string;\n /**\n * The version code/name of this bundle/version\n */\n version: string;\n /**\n * The session key for the update, when the bundle is encrypted with a session key\n * @since 4.0.0\n * @default undefined\n */\n sessionKey?: string;\n /**\n * The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted\n * @since 4.0.0\n * @default undefined\n */\n checksum?: string;\n /**\n * The manifest for multi-file downloads\n * @since 6.1.0\n * @default undefined\n */\n manifest?: ManifestEntry[];\n}\n\nexport interface BundleId {\n id: string;\n}\n\nexport interface BundleListResult {\n bundles: BundleInfo[];\n}\n\nexport interface ResetOptions {\n /**\n * Reset to the last successfully loaded bundle instead of the builtin one.\n * @default false\n */\n toLastSuccessful?: boolean;\n /**\n * Apply the pending bundle set via {@link next} while resetting.\n *\n * When `true`, the plugin will switch to the pending bundle immediately and clear the pending flag.\n * If no pending bundle exists, the reset will fail.\n * @default false\n */\n usePendingBundle?: boolean;\n}\n\nexport interface ListOptions {\n /**\n * Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.\n * @since 6.14.0\n * @default false\n */\n raw?: boolean;\n}\n\nexport interface CurrentBundleResult {\n bundle: BundleInfo;\n native: string;\n}\n\nexport interface MultiDelayConditions {\n delayConditions: DelayCondition[];\n}\n\nexport interface BuiltinVersion {\n version: string;\n}\n\nexport interface DeviceId {\n deviceId: string;\n}\n\nexport interface PluginVersion {\n version: string;\n}\n\nexport interface AutoUpdateEnabled {\n enabled: boolean;\n}\n\nexport interface AutoUpdateAvailable {\n available: boolean;\n}\n\n/**\n * Result returned after requesting an immediate native auto-update check.\n *\n * @property status - Native trigger state: `queued` when a check was queued,\n * `already_running` when the native update pipeline is already active, or\n * `unavailable` on Web or when native auto-update is disabled.\n * @property queued - Whether a new native update check was queued. This is\n * `true` only when `status` is `queued`; otherwise it is `false`.\n */\nexport interface TriggerUpdateCheckResult {\n /**\n * Native trigger state: `queued` when a check was queued, `already_running`\n * when the native update pipeline is already active, or `unavailable` on Web\n * or when native auto-update is disabled.\n */\n status: 'queued' | 'already_running' | 'unavailable';\n /**\n * Whether a new native update check was queued. This is `true` only when\n * `status` is `queued`; otherwise it is `false`.\n */\n queued: boolean;\n}\n\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface SetShakeChannelSelectorOptions {\n enabled: boolean;\n}\n\nexport interface ShakeChannelSelectorEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n\n// ============================================================================\n// App Store / Play Store Update Types\n// ============================================================================\n\n/**\n * Options for {@link CapacitorUpdaterPlugin.getAppUpdateInfo}.\n *\n * @since 8.0.0\n */\nexport interface GetAppUpdateInfoOptions {\n /**\n * Two-letter country code (ISO 3166-1 alpha-2) for the App Store lookup.\n *\n * This is required on iOS to get accurate App Store information, as app\n * availability and versions can vary by country.\n *\n * Examples: \"US\", \"GB\", \"DE\", \"JP\", \"FR\"\n *\n * On Android, this option is ignored as the Play Store handles region\n * detection automatically.\n *\n * @since 8.0.0\n */\n country?: string;\n}\n\n/**\n * Information about app updates available in the App Store or Play Store.\n *\n * @since 8.0.0\n */\nexport interface AppUpdateInfo {\n /**\n * The currently installed version name (e.g., \"1.2.3\").\n *\n * @since 8.0.0\n */\n currentVersionName: string;\n\n /**\n * The version name available in the store, if an update is available.\n * May be undefined if no update information is available.\n *\n * @since 8.0.0\n */\n availableVersionName?: string;\n\n /**\n * The currently installed version code (Android) or build number (iOS).\n *\n * @since 8.0.0\n */\n currentVersionCode: string;\n\n /**\n * The version code available in the store (Android only).\n * On iOS, this will be the same as `availableVersionName`.\n *\n * @since 8.0.0\n */\n availableVersionCode?: string;\n\n /**\n * The release date of the available version (iOS only).\n * Format: ISO 8601 date string.\n *\n * @since 8.0.0\n */\n availableVersionReleaseDate?: string;\n\n /**\n * The current update availability status.\n *\n * @since 8.0.0\n */\n updateAvailability: AppUpdateAvailability;\n\n /**\n * The priority of the update as set by the developer in Play Console (Android only).\n * Values range from 0 (default/lowest) to 5 (highest priority).\n *\n * Use this to decide whether to show an update prompt or force an update.\n *\n * @since 8.0.0\n */\n updatePriority?: number;\n\n /**\n * Whether an immediate update is allowed (Android only).\n *\n * If `true`, you can call {@link CapacitorUpdaterPlugin.performImmediateUpdate}.\n *\n * @since 8.0.0\n */\n immediateUpdateAllowed?: boolean;\n\n /**\n * Whether a flexible update is allowed (Android only).\n *\n * If `true`, you can call {@link CapacitorUpdaterPlugin.startFlexibleUpdate}.\n *\n * @since 8.0.0\n */\n flexibleUpdateAllowed?: boolean;\n\n /**\n * Number of days since the update became available (Android only).\n *\n * Use this to implement \"update nagging\" - remind users more frequently\n * as the update ages.\n *\n * @since 8.0.0\n */\n clientVersionStalenessDays?: number;\n\n /**\n * The current install status of a flexible update (Android only).\n *\n * @since 8.0.0\n */\n installStatus?: FlexibleUpdateInstallStatus;\n\n /**\n * The minimum OS version required for the available update (iOS only).\n *\n * @since 8.0.0\n */\n minimumOsVersion?: string;\n}\n\n/**\n * Options for {@link CapacitorUpdaterPlugin.openAppStore}.\n *\n * @since 8.0.0\n */\nexport interface OpenAppStoreOptions {\n /**\n * The Android package name to open in the Play Store.\n *\n * If not specified, uses the current app's package name.\n * Use this to open a different app's store page.\n *\n * Only used on Android.\n *\n * @since 8.0.0\n */\n packageName?: string;\n\n /**\n * The iOS App Store ID to open.\n *\n * If not specified, uses the current app's bundle identifier to look up the app.\n * Use this to open a different app's store page or when automatic lookup fails.\n *\n * Only used on iOS.\n *\n * @since 8.0.0\n */\n appId?: string;\n}\n\n/**\n * State information for flexible update progress (Android only).\n *\n * @since 8.0.0\n */\nexport interface FlexibleUpdateState {\n /**\n * The current installation status.\n *\n * @since 8.0.0\n */\n installStatus: FlexibleUpdateInstallStatus;\n\n /**\n * Number of bytes downloaded so far.\n * Only available during the `DOWNLOADING` status.\n *\n * @since 8.0.0\n */\n bytesDownloaded?: number;\n\n /**\n * Total number of bytes to download.\n * Only available during the `DOWNLOADING` status.\n *\n * @since 8.0.0\n */\n totalBytesToDownload?: number;\n}\n\n/**\n * Result of an app update operation.\n *\n * @since 8.0.0\n */\nexport interface AppUpdateResult {\n /**\n * The result code of the update operation.\n *\n * @since 8.0.0\n */\n code: AppUpdateResultCode;\n}\n\n/**\n * Update availability status.\n *\n * @since 8.0.0\n */\nexport enum AppUpdateAvailability {\n /**\n * Update availability is unknown.\n * This typically means the check hasn't completed or failed.\n */\n UNKNOWN = 0,\n\n /**\n * No update is available.\n * The installed version is the latest.\n */\n UPDATE_NOT_AVAILABLE = 1,\n\n /**\n * An update is available for download.\n */\n UPDATE_AVAILABLE = 2,\n\n /**\n * An update is currently being downloaded or installed.\n */\n UPDATE_IN_PROGRESS = 3,\n}\n\n/**\n * Installation status for flexible updates (Android only).\n *\n * @since 8.0.0\n */\nexport enum FlexibleUpdateInstallStatus {\n /**\n * Unknown install status.\n */\n UNKNOWN = 0,\n\n /**\n * Download is pending and will start soon.\n */\n PENDING = 1,\n\n /**\n * Download is in progress.\n * Check `bytesDownloaded` and `totalBytesToDownload` for progress.\n */\n DOWNLOADING = 2,\n\n /**\n * The update is being installed.\n */\n INSTALLING = 3,\n\n /**\n * The update has been installed.\n * The app needs to be restarted to use the new version.\n */\n INSTALLED = 4,\n\n /**\n * The update failed to download or install.\n */\n FAILED = 5,\n\n /**\n * The update was canceled by the user.\n */\n CANCELED = 6,\n\n /**\n * The update has been downloaded and is ready to install.\n * Call {@link CapacitorUpdaterPlugin.completeFlexibleUpdate} to install.\n */\n DOWNLOADED = 11,\n}\n\n/**\n * Result codes for app update operations.\n *\n * @since 8.0.0\n */\nexport enum AppUpdateResultCode {\n /**\n * The update completed successfully.\n */\n OK = 0,\n\n /**\n * The user canceled the update.\n */\n CANCELED = 1,\n\n /**\n * The update failed.\n */\n FAILED = 2,\n\n /**\n * No update is available.\n */\n NOT_AVAILABLE = 3,\n\n /**\n * The requested update type is not allowed.\n * For example, trying to perform an immediate update when only flexible is allowed.\n */\n NOT_ALLOWED = 4,\n\n /**\n * Required information is missing.\n * This can happen if {@link CapacitorUpdaterPlugin.getAppUpdateInfo} wasn't called first.\n */\n INFO_MISSING = 5,\n}\n"]}
@@ -79,7 +79,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
79
79
  CAPPluginMethod(name: "completeFlexibleUpdate", returnType: CAPPluginReturnPromise)
80
80
  ]
81
81
  public var implementation = CapgoUpdater()
82
- private let pluginVersion: String = "8.47.8"
82
+ private let pluginVersion: String = "8.47.9"
83
83
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
84
84
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
85
85
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
@@ -989,6 +989,29 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
989
989
  }
990
990
  }
991
991
 
992
+ func reloadWithoutWaitingForAppReady() -> Bool {
993
+ guard let bridge = self.bridge else { return false }
994
+
995
+ let performReload: () -> Bool = {
996
+ guard self.applyCurrentBundleToBridge(bridge) else {
997
+ return false
998
+ }
999
+ self.checkAppReady()
1000
+ self.notifyListeners("appReloaded", data: [:])
1001
+ return true
1002
+ }
1003
+
1004
+ if Thread.isMainThread {
1005
+ return performReload()
1006
+ } else {
1007
+ var result = false
1008
+ DispatchQueue.main.sync {
1009
+ result = performReload()
1010
+ }
1011
+ return result
1012
+ }
1013
+ }
1014
+
992
1015
  @objc func reload(_ call: CAPPluginCall) {
993
1016
  let current: BundleInfo = self.implementation.getCurrentBundle()
994
1017
  let next: BundleInfo? = self.implementation.getNextBundle()
@@ -1232,12 +1255,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1232
1255
 
1233
1256
  private func leavePreviewSessionWithoutReload(keepPreviewGuard: Bool = false) -> Bool {
1234
1257
  let previewBundle = self.implementation.getCurrentBundle()
1235
- guard let previewFallbackBundle = self.implementation.getPreviewFallbackBundle(), !previewFallbackBundle.isErrorStatus() else {
1236
- logger.error("No preview fallback bundle available")
1237
- return false
1238
- }
1239
- guard self.implementation.canSet(bundle: previewFallbackBundle) else {
1240
- logger.error("Preview fallback bundle is not installable")
1258
+ guard let previewFallbackBundle = self.resolvePreviewFallbackBundle(reason: "preview deeplink launch") else {
1241
1259
  return false
1242
1260
  }
1243
1261
  guard self.implementation.stagePreviewFallbackReload(bundle: previewFallbackBundle) else {
@@ -1254,14 +1272,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1254
1272
  private func leavePreviewSessionForIncomingPreviewLink() -> Bool {
1255
1273
  self.showPreviewTransitionLoader(reason: "incoming-preview-deeplink")
1256
1274
  let previewBundle = self.implementation.getCurrentBundle()
1257
- guard let previewFallbackBundle = self.implementation.getPreviewFallbackBundle(), !previewFallbackBundle.isErrorStatus() else {
1258
- logger.error("No preview fallback bundle available")
1259
- self.clearIncomingPreviewTransition()
1260
- self.hidePreviewTransitionLoader(reason: "incoming-preview-deeplink-failed")
1261
- return false
1262
- }
1263
- guard self.implementation.canSet(bundle: previewFallbackBundle) else {
1264
- logger.error("Preview fallback bundle is not installable")
1275
+ guard let previewFallbackBundle = self.resolvePreviewFallbackBundle(reason: "incoming preview deeplink") else {
1265
1276
  self.clearIncomingPreviewTransition()
1266
1277
  self.hidePreviewTransitionLoader(reason: "incoming-preview-deeplink-failed")
1267
1278
  return false
@@ -1275,7 +1286,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1275
1286
  return false
1276
1287
  }
1277
1288
 
1278
- let didReload = self._reload()
1289
+ let didReload = self.reloadWithoutWaitingForAppReady()
1279
1290
  if didReload {
1280
1291
  self.endPreviewSession(keepPreviewGuard: true)
1281
1292
  let restoredNextBundle = self.implementation.getNextBundle()
@@ -1312,7 +1323,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1312
1323
  if let payloadUrl = self.storedPreviewPayloadUrl() {
1313
1324
  didReload = self.refreshPreviewSessionFromPayloadUrl(payloadUrl)
1314
1325
  } else {
1315
- didReload = self._reload()
1326
+ didReload = self.reloadWithoutWaitingForAppReady()
1316
1327
  }
1317
1328
 
1318
1329
  if !didReload {
@@ -1325,21 +1336,16 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1325
1336
  self.previewSessionEnabled
1326
1337
  }
1327
1338
 
1328
- private func resetToPreviewFallbackBundle() -> Bool {
1339
+ func resetToPreviewFallbackBundle() -> Bool {
1329
1340
  guard self.canPerformResetTransition() else { return false }
1330
- guard let fallback = self.implementation.getPreviewFallbackBundle(), !fallback.isErrorStatus() else {
1331
- logger.error("No preview fallback bundle available")
1332
- return false
1333
- }
1334
- guard self.implementation.canSet(bundle: fallback) else {
1335
- logger.error("Preview fallback bundle is not installable")
1341
+ guard let fallback = self.resolvePreviewFallbackBundle(reason: "leave preview") else {
1336
1342
  return false
1337
1343
  }
1338
1344
 
1339
1345
  let previousState = self.implementation.captureResetState()
1340
1346
  let previousBundleName = self.implementation.getCurrentBundle().getVersionName()
1341
1347
  logger.info("Resetting to preview fallback bundle: \(fallback.toString())")
1342
- if self.implementation.stagePreviewFallbackReload(bundle: fallback) && self._reload() {
1348
+ if self.implementation.stagePreviewFallbackReload(bundle: fallback) && self.reloadWithoutWaitingForAppReady() {
1343
1349
  self.implementation.finalizeResetTransition(previousBundleName: previousBundleName, isInternal: false)
1344
1350
  self.notifyBundleSet(fallback)
1345
1351
  return true
@@ -1349,6 +1355,31 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1349
1355
  return false
1350
1356
  }
1351
1357
 
1358
+ private func resolvePreviewFallbackBundle(reason: String) -> BundleInfo? {
1359
+ let fallback = self.implementation.getPreviewFallbackBundle()
1360
+ if let fallback, !fallback.isErrorStatus(), self.implementation.canSet(bundle: fallback) {
1361
+ return fallback
1362
+ }
1363
+
1364
+ if let fallback {
1365
+ if fallback.isErrorStatus() {
1366
+ logger.warn("Preview fallback bundle is in error state for \(reason). Falling back to builtin bundle.")
1367
+ } else {
1368
+ logger.warn("Preview fallback bundle is not installable for \(reason). Falling back to builtin bundle.")
1369
+ }
1370
+ } else {
1371
+ logger.warn("No preview fallback bundle available for \(reason). Falling back to builtin bundle.")
1372
+ }
1373
+
1374
+ let builtin = self.implementation.getBundleInfo(id: BundleInfo.ID_BUILTIN)
1375
+ if !builtin.isErrorStatus(), self.implementation.canSet(bundle: builtin) {
1376
+ return builtin
1377
+ }
1378
+
1379
+ logger.error("Builtin bundle is not available to leave preview for \(reason)")
1380
+ return nil
1381
+ }
1382
+
1352
1383
  private func endPreviewSession(keepPreviewGuard: Bool = false) {
1353
1384
  let previousShakeMenuEnabled = UserDefaults.standard.object(forKey: self.previewPreviousShakeMenuDefaultsKey) as? Bool
1354
1385
  ?? getConfig().getBoolean("shakeMenu", false)
@@ -1374,15 +1405,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1374
1405
 
1375
1406
  private func clearPreviewSessionBecauseDisabled() {
1376
1407
  logger.info("Preview session disabled by config; restoring preview fallback")
1377
- let fallback = self.implementation.getPreviewFallbackBundle()
1378
- let bundleToRestore: BundleInfo
1379
- if let fallback, !fallback.isErrorStatus() {
1380
- bundleToRestore = fallback
1381
- } else {
1382
- bundleToRestore = self.implementation.getBundleInfo(id: BundleInfo.ID_BUILTIN)
1383
- }
1384
-
1385
- if self.implementation.canSet(bundle: bundleToRestore) {
1408
+ if let bundleToRestore = self.resolvePreviewFallbackBundle(reason: "preview disabled") {
1386
1409
  _ = self.implementation.stagePreviewFallbackReload(bundle: bundleToRestore)
1387
1410
  } else {
1388
1411
  logger.warn("Could not restore preview fallback while disabling preview")
@@ -1579,7 +1602,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1579
1602
  let current = self.implementation.getCurrentBundle()
1580
1603
  if current.getVersionName() == version {
1581
1604
  self.logger.info("Preview payload unchanged, reloading current bundle")
1582
- return self._reload()
1605
+ return self.reloadWithoutWaitingForAppReady()
1583
1606
  }
1584
1607
 
1585
1608
  let next = try self.downloadBundle(
@@ -1597,7 +1620,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1597
1620
  }
1598
1621
 
1599
1622
  self.notifyBundleSet(next)
1600
- return self._reload()
1623
+ return self.reloadWithoutWaitingForAppReady()
1601
1624
  } catch {
1602
1625
  self.logger.error("Could not refresh preview session: \(error.localizedDescription)")
1603
1626
  return false
@@ -1885,7 +1908,13 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1885
1908
  let triggerAutoUpdate = call.getBool("triggerAutoUpdate") ?? false
1886
1909
  self.saveCallForAsyncHandling(call)
1887
1910
  DispatchQueue.global(qos: .utility).async {
1888
- let res = self.implementation.setChannel(channel: channel, defaultChannelKey: self.defaultChannelDefaultsKey, allowSetDefaultChannel: self.allowSetDefaultChannel)
1911
+ let configDefaultChannel = self.getConfig().getString("defaultChannel", "")!
1912
+ let res = self.implementation.setChannel(
1913
+ channel: channel,
1914
+ defaultChannelKey: self.defaultChannelDefaultsKey,
1915
+ allowSetDefaultChannel: self.allowSetDefaultChannel,
1916
+ configDefaultChannel: configDefaultChannel
1917
+ )
1889
1918
  if res.error != "" {
1890
1919
  // Fire channelPrivate event if channel doesn't allow self-assignment
1891
1920
  if res.error.contains("cannot_update_via_private_channel") || res.error.contains("channel_self_set_not_allowed") {
@@ -1916,7 +1945,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
1916
1945
  @objc func getChannel(_ call: CAPPluginCall) {
1917
1946
  self.saveCallForAsyncHandling(call)
1918
1947
  DispatchQueue.global(qos: .utility).async {
1919
- let res = self.implementation.getChannel()
1948
+ let res = self.implementation.getChannel(defaultChannelKey: self.defaultChannelDefaultsKey)
1920
1949
  if res.error != "" {
1921
1950
  self.rejectCall(call, message: res.error, code: "GETCHANNEL_FAILED", data: [
1922
1951
  "message": res.error,
@@ -2151,7 +2151,12 @@ import UIKit
2151
2151
  return setChannel
2152
2152
  }
2153
2153
 
2154
- func setChannel(channel: String, defaultChannelKey: String, allowSetDefaultChannel: Bool) -> SetChannel {
2154
+ func setChannel(
2155
+ channel: String,
2156
+ defaultChannelKey: String,
2157
+ allowSetDefaultChannel: Bool,
2158
+ configDefaultChannel: String = ""
2159
+ ) -> SetChannel {
2155
2160
  let setChannel: SetChannel = SetChannel()
2156
2161
 
2157
2162
  // Check if setting defaultChannel is allowed
@@ -2231,6 +2236,7 @@ import UIKit
2231
2236
  } else if responseValue.unset == true {
2232
2237
  UserDefaults.standard.removeObject(forKey: defaultChannelKey)
2233
2238
  UserDefaults.standard.synchronize()
2239
+ self.defaultChannel = configDefaultChannel
2234
2240
  self.logger.info("Public channel requested, channel override removed")
2235
2241
 
2236
2242
  setChannel.status = responseValue.status ?? "ok"
@@ -2247,7 +2253,7 @@ import UIKit
2247
2253
  return setChannel
2248
2254
  }
2249
2255
 
2250
- func getChannel() -> GetChannel {
2256
+ func getChannel(defaultChannelKey: String? = nil) -> GetChannel {
2251
2257
  let getChannel: GetChannel = GetChannel()
2252
2258
 
2253
2259
  // Check if rate limit was exceeded
@@ -2334,10 +2340,26 @@ import UIKit
2334
2340
  getChannel.message = responseValue.message ?? ""
2335
2341
  getChannel.channel = responseValue.channel ?? ""
2336
2342
  getChannel.allowSet = responseValue.allowSet ?? true
2343
+ persistDefaultChannelFromResponse(channel: responseValue.channel, defaultChannelKey: defaultChannelKey)
2337
2344
  }
2338
2345
  return getChannel
2339
2346
  }
2340
2347
 
2348
+ func persistDefaultChannelFromResponse(channel: String?, defaultChannelKey: String?) {
2349
+ guard let channelName = channel?.trimmingCharacters(in: .whitespacesAndNewlines),
2350
+ !channelName.isEmpty,
2351
+ channelName != BundleInfo.ID_BUILTIN else {
2352
+ return
2353
+ }
2354
+
2355
+ self.defaultChannel = channelName
2356
+ if let defaultChannelKey, !defaultChannelKey.isEmpty {
2357
+ UserDefaults.standard.set(channelName, forKey: defaultChannelKey)
2358
+ UserDefaults.standard.synchronize()
2359
+ }
2360
+ logger.info("defaultChannel synchronized from getChannel(): \(channelName)")
2361
+ }
2362
+
2341
2363
  func listChannels() -> ListChannels {
2342
2364
  let listChannels: ListChannels = ListChannels()
2343
2365
 
@@ -338,7 +338,8 @@ extension UIWindow {
338
338
  let setResult = updater.setChannel(
339
339
  channel: name,
340
340
  defaultChannelKey: "CapacitorUpdater.defaultChannel",
341
- allowSetDefaultChannel: plugin.allowSetDefaultChannel
341
+ allowSetDefaultChannel: plugin.allowSetDefaultChannel,
342
+ configDefaultChannel: plugin.getConfig().getString("defaultChannel", "") ?? ""
342
343
  )
343
344
 
344
345
  if !setResult.error.isEmpty {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "8.47.8",
3
+ "version": "8.47.9",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",