@capgo/capacitor-updater 7.32.0 → 7.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -863,6 +863,34 @@ After receiving the latest version info, you can:
863
863
  2. Download it using {@link download}
864
864
  3. Apply it using {@link next} or {@link set}
865
865
 
866
+ **Important: Error handling for "no new version available"**
867
+
868
+ When the device's current version matches the latest version on the server (i.e., the device is already
869
+ up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
870
+ `message: "No new version available"`. **This causes `getLatest()` to throw an error**, even though
871
+ this is a normal, expected condition.
872
+
873
+ You should catch this specific error to handle it gracefully:
874
+
875
+ ```typescript
876
+ try {
877
+ const latest = await CapacitorUpdater.getLatest();
878
+ // New version is available, proceed with download
879
+ } catch (error) {
880
+ if (error.message === 'No new version available') {
881
+ // Device is already on the latest version - this is normal
882
+ console.log('Already up to date');
883
+ } else {
884
+ // Actual error occurred
885
+ console.error('Failed to check for updates:', error);
886
+ }
887
+ }
888
+ ```
889
+
890
+ In this scenario, the server:
891
+ - Logs the request with a "No new version available" message
892
+ - Sends a "noNew" stat action to track that the device checked for updates but was already current (done on the backend)
893
+
866
894
  | Param | Type | Description |
867
895
  | ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
868
896
  | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> | Optional {@link <a href="#getlatestoptions">GetLatestOptions</a>} to specify which channel to check. |
@@ -1678,18 +1706,18 @@ If you don't use backend, you need to provide the URL and version of the bundle.
1678
1706
 
1679
1707
  ##### LatestVersion
1680
1708
 
1681
- | Prop | Type | Description | Since |
1682
- | ---------------- | ---------------------------- | -------------------------------------------------------------------- | ------ |
1683
- | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
1684
- | **`checksum`** | <code>string</code> | | 6 |
1685
- | **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
1686
- | **`major`** | <code>boolean</code> | | |
1687
- | **`message`** | <code>string</code> | | |
1688
- | **`sessionKey`** | <code>string</code> | | |
1689
- | **`error`** | <code>string</code> | | |
1690
- | **`old`** | <code>string</code> | | |
1691
- | **`url`** | <code>string</code> | | |
1692
- | **`manifest`** | <code>ManifestEntry[]</code> | | 6.1 |
1709
+ | Prop | Type | Description | Since |
1710
+ | ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
1711
+ | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
1712
+ | **`checksum`** | <code>string</code> | | 6 |
1713
+ | **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
1714
+ | **`major`** | <code>boolean</code> | | |
1715
+ | **`message`** | <code>string</code> | Optional message from the server. When no new version is available, this will be "No new version available". | |
1716
+ | **`sessionKey`** | <code>string</code> | | |
1717
+ | **`error`** | <code>string</code> | Error code from the server, if any. Common values: - `"no_new_version_available"`: Device is already on the latest version (not a failure) - Other error codes indicate actual failures in the update process | |
1718
+ | **`old`** | <code>string</code> | The previous/current version name (provided for reference). | |
1719
+ | **`url`** | <code>string</code> | Download URL for the bundle (when a new version is available). | |
1720
+ | **`manifest`** | <code>ManifestEntry[]</code> | File list for partial updates (when using multi-file downloads). | 6.1 |
1693
1721
 
1694
1722
 
1695
1723
  ##### GetLatestOptions
@@ -71,7 +71,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
71
71
  private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
72
72
  private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
73
73
 
74
- private final String pluginVersion = "7.32.0";
74
+ private final String pluginVersion = "7.33.0";
75
75
  private static final String DELAY_CONDITION_PREFERENCES = "";
76
76
 
77
77
  private SharedPreferences.Editor editor;
package/dist/docs.json CHANGED
@@ -492,14 +492,14 @@
492
492
  },
493
493
  {
494
494
  "name": "throws",
495
- "text": "{Error} If the request fails or the server returns an error."
495
+ "text": "{Error} Always throws when no new version is available (`error: \"no_new_version_available\"`), or when the request fails."
496
496
  },
497
497
  {
498
498
  "name": "since",
499
499
  "text": "4.0.0"
500
500
  }
501
501
  ],
502
- "docs": "Check the update server for the latest available bundle version.\n\nThis queries your configured update URL (or Capgo backend) to see if a newer bundle\nis available for download. It does NOT download the bundle automatically.\n\nThe 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 partial updates (if using multi-file downloads)\n\nAfter receiving the latest version info, you can:\n1. Compare it with your current version\n2. Download it using {@link download}\n3. Apply it using {@link next} or {@link set}",
502
+ "docs": "Check the update server for the latest available bundle version.\n\nThis queries your configured update URL (or Capgo backend) to see if a newer bundle\nis available for download. It does NOT download the bundle automatically.\n\nThe 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 partial updates (if using multi-file downloads)\n\nAfter receiving the latest version info, you can:\n1. Compare it with your current version\n2. Download it using {@link download}\n3. Apply it using {@link next} or {@link set}\n\n**Important: Error handling for \"no new version available\"**\n\nWhen the device's current version matches the latest version on the server (i.e., the device is already\nup-to-date), the server returns a 200 response with `error: \"no_new_version_available\"` and\n`message: \"No new version available\"`. **This causes `getLatest()` to throw an error**, even though\nthis is a normal, expected condition.\n\nYou should catch this specific error to handle it gracefully:\n\n```typescript\ntry {\n const latest = await CapacitorUpdater.getLatest();\n // New version is available, proceed with download\n} catch (error) {\n if (error.message === 'No new version available') {\n // Device is already on the latest version - this is normal\n console.log('Already up to date');\n } else {\n // Actual error occurred\n console.error('Failed to check for updates:', error);\n }\n}\n```\n\nIn 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)",
503
503
  "complexTypes": [
504
504
  "LatestVersion",
505
505
  "GetLatestOptions"
@@ -1690,7 +1690,7 @@
1690
1690
  {
1691
1691
  "name": "message",
1692
1692
  "tags": [],
1693
- "docs": "",
1693
+ "docs": "Optional message from the server.\nWhen no new version is available, this will be \"No new version available\".",
1694
1694
  "complexTypes": [],
1695
1695
  "type": "string | undefined"
1696
1696
  },
@@ -1704,21 +1704,21 @@
1704
1704
  {
1705
1705
  "name": "error",
1706
1706
  "tags": [],
1707
- "docs": "",
1707
+ "docs": "Error code from the server, if any.\nCommon values:\n- `\"no_new_version_available\"`: Device is already on the latest version (not a failure)\n- Other error codes indicate actual failures in the update process",
1708
1708
  "complexTypes": [],
1709
1709
  "type": "string | undefined"
1710
1710
  },
1711
1711
  {
1712
1712
  "name": "old",
1713
1713
  "tags": [],
1714
- "docs": "",
1714
+ "docs": "The previous/current version name (provided for reference).",
1715
1715
  "complexTypes": [],
1716
1716
  "type": "string | undefined"
1717
1717
  },
1718
1718
  {
1719
1719
  "name": "url",
1720
1720
  "tags": [],
1721
- "docs": "",
1721
+ "docs": "Download URL for the bundle (when a new version is available).",
1722
1722
  "complexTypes": [],
1723
1723
  "type": "string | undefined"
1724
1724
  },
@@ -1730,7 +1730,7 @@
1730
1730
  "name": "since"
1731
1731
  }
1732
1732
  ],
1733
- "docs": "",
1733
+ "docs": "File list for partial updates (when using multi-file downloads).",
1734
1734
  "complexTypes": [
1735
1735
  "ManifestEntry"
1736
1736
  ],
@@ -655,9 +655,37 @@ export interface CapacitorUpdaterPlugin {
655
655
  * 2. Download it using {@link download}
656
656
  * 3. Apply it using {@link next} or {@link set}
657
657
  *
658
+ * **Important: Error handling for "no new version available"**
659
+ *
660
+ * When the device's current version matches the latest version on the server (i.e., the device is already
661
+ * up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
662
+ * `message: "No new version available"`. **This causes `getLatest()` to throw an error**, even though
663
+ * this is a normal, expected condition.
664
+ *
665
+ * You should catch this specific error to handle it gracefully:
666
+ *
667
+ * ```typescript
668
+ * try {
669
+ * const latest = await CapacitorUpdater.getLatest();
670
+ * // New version is available, proceed with download
671
+ * } catch (error) {
672
+ * if (error.message === 'No new version available') {
673
+ * // Device is already on the latest version - this is normal
674
+ * console.log('Already up to date');
675
+ * } else {
676
+ * // Actual error occurred
677
+ * console.error('Failed to check for updates:', error);
678
+ * }
679
+ * }
680
+ * ```
681
+ *
682
+ * In this scenario, the server:
683
+ * - Logs the request with a "No new version available" message
684
+ * - Sends a "noNew" stat action to track that the device checked for updates but was already current (done on the backend)
685
+ *
658
686
  * @param options Optional {@link GetLatestOptions} to specify which channel to check.
659
687
  * @returns {Promise<LatestVersion>} Information about the latest available bundle version.
660
- * @throws {Error} If the request fails or the server returns an error.
688
+ * @throws {Error} Always throws when no new version is available (`error: "no_new_version_available"`), or when the request fails.
661
689
  * @since 4.0.0
662
690
  */
663
691
  getLatest(options?: GetLatestOptions): Promise<LatestVersion>;
@@ -1250,12 +1278,29 @@ export interface LatestVersion {
1250
1278
  * @deprecated Use {@link LatestVersion.breaking} instead.
1251
1279
  */
1252
1280
  major?: boolean;
1281
+ /**
1282
+ * Optional message from the server.
1283
+ * When no new version is available, this will be "No new version available".
1284
+ */
1253
1285
  message?: string;
1254
1286
  sessionKey?: string;
1287
+ /**
1288
+ * Error code from the server, if any.
1289
+ * Common values:
1290
+ * - `"no_new_version_available"`: Device is already on the latest version (not a failure)
1291
+ * - Other error codes indicate actual failures in the update process
1292
+ */
1255
1293
  error?: string;
1294
+ /**
1295
+ * The previous/current version name (provided for reference).
1296
+ */
1256
1297
  old?: string;
1298
+ /**
1299
+ * Download URL for the bundle (when a new version is available).
1300
+ */
1257
1301
  url?: string;
1258
1302
  /**
1303
+ * File list for partial updates (when using multi-file downloads).
1259
1304
  * @since 6.1
1260
1305
  */
1261
1306
  manifest?: ManifestEntry[];
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG","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\" />\n\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)\n */\n appReadyTimeout?: number;\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 * 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 whether the plugin should use Auto Update via an update server.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoUpdate?: boolean;\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n *\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 *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\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 * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n * Works well for apps less than 10MB and with uploads done using --partial 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 * 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 directUpdate 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 autoUpdate and directUpdate 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * Enable shake gesture to show update menu for debugging/testing purposes\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: 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 partial 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 * 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. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.\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 * 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 partial 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 * @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} If the request fails or the server returns an error.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\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 * 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 * - `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 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 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, this event is retain till consumed.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): 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 for debugging and testing.\n *\n * When enabled, users can shake their device to open a debug menu that shows:\n * - Current bundle information\n * - Available bundles\n * - Options to switch bundles manually\n * - Update status\n *\n * This is useful during development and testing to:\n * - Quickly test different bundle versions\n * - Debug update flows\n * - Switch between production and test bundles\n * - Verify bundle installations\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 * 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/**\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\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 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: string;\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 AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: 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 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 message?: string;\n sessionKey?: string;\n error?: string;\n old?: string;\n url?: string;\n /**\n * @since 6.1\n */\n manifest?: ManifestEntry[];\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\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 toLastSuccessful: 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\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG","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\" />\n\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)\n */\n appReadyTimeout?: number;\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 * 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 whether the plugin should use Auto Update via an update server.\n *\n * Only available for Android and iOS.\n *\n * @default true\n * @example false\n */\n autoUpdate?: boolean;\n\n /**\n * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n *\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 *\n * @default https://plugin.capgo.app/stats\n * @example https://example.com/api/stats\n */\n statsUrl?: string;\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 * Configure when the plugin should direct install updates. Only for autoUpdate mode.\n * Works well for apps less than 10MB and with uploads done using --partial 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 * 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 directUpdate 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 autoUpdate and directUpdate 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * Enable shake gesture to show update menu for debugging/testing purposes\n *\n * @default false\n * @since 7.5.0\n */\n shakeMenu?: 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 partial 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 * 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. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.\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 * 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 partial 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: Error handling for \"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 causes `getLatest()` to throw an error**, even though\n * this is a normal, expected condition.\n *\n * You should catch this specific error to handle it gracefully:\n *\n * ```typescript\n * try {\n * const latest = await CapacitorUpdater.getLatest();\n * // New version is available, proceed with download\n * } catch (error) {\n * if (error.message === 'No new version available') {\n * // Device is already on the latest version - this is normal\n * console.log('Already up to date');\n * } else {\n * // Actual error occurred\n * console.error('Failed to check for updates:', error);\n * }\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} Always throws when no new version is available (`error: \"no_new_version_available\"`), or when the request fails.\n * @since 4.0.0\n */\n getLatest(options?: GetLatestOptions): Promise<LatestVersion>;\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 * 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 * - `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 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 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, this event is retain till consumed.\n *\n * @since 5.1.0\n */\n addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): 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 for debugging and testing.\n *\n * When enabled, users can shake their device to open a debug menu that shows:\n * - Current bundle information\n * - Available bundles\n * - Options to switch bundles manually\n * - Update status\n *\n * This is useful during development and testing to:\n * - Quickly test different bundle versions\n * - Debug update flows\n * - Switch between production and test bundles\n * - Verify bundle installations\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 * 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/**\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\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 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: string;\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 AppReadyEvent {\n /**\n * Emitted when the app is ready to use.\n *\n * @since 5.2.0\n */\n bundle: BundleInfo;\n status: 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 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.\n * Common values:\n * - `\"no_new_version_available\"`: Device is already on the latest version (not a failure)\n * - Other error codes indicate actual failures in the update process\n */\n error?: string;\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 partial updates (when using multi-file downloads).\n * @since 6.1\n */\n manifest?: ManifestEntry[];\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\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 toLastSuccessful: 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\nexport interface SetShakeMenuOptions {\n enabled: boolean;\n}\n\nexport interface ShakeMenuEnabled {\n enabled: boolean;\n}\n\nexport interface GetAppIdRes {\n appId: string;\n}\n\nexport interface SetAppIdOptions {\n appId: string;\n}\n"]}
@@ -54,7 +54,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
54
54
  CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
55
55
  ]
56
56
  public var implementation = CapgoUpdater()
57
- private let pluginVersion: String = "7.32.0"
57
+ private let pluginVersion: String = "7.33.0"
58
58
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
59
59
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
60
60
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "7.32.0",
3
+ "version": "7.33.0",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",