@capgo/capacitor-updater 7.43.3 → 7.50.1

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.
Files changed (36) hide show
  1. package/Package.swift +5 -2
  2. package/README.md +643 -115
  3. package/android/build.gradle +3 -3
  4. package/android/src/main/java/ee/forgr/capacitor_updater/AndroidAppExitReporter.java +92 -0
  5. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +3121 -353
  6. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +924 -290
  7. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +49 -13
  8. package/android/src/main/java/ee/forgr/capacitor_updater/DeviceIdHelper.java +45 -30
  9. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +75 -32
  10. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +2 -0
  11. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeDetector.java +3 -3
  12. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +401 -27
  13. package/android/src/main/java/ee/forgr/capacitor_updater/ThreeFingerPinchDetector.java +323 -0
  14. package/dist/docs.json +1590 -196
  15. package/dist/esm/definitions.d.ts +755 -66
  16. package/dist/esm/definitions.js.map +1 -1
  17. package/dist/esm/web.d.ts +11 -2
  18. package/dist/esm/web.js +59 -5
  19. package/dist/esm/web.js.map +1 -1
  20. package/dist/plugin.cjs.js +59 -5
  21. package/dist/plugin.cjs.js.map +1 -1
  22. package/dist/plugin.js +59 -5
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +0 -1
  25. package/ios/Sources/CapacitorUpdaterPlugin/AppHealthTracker.swift +82 -0
  26. package/ios/Sources/CapacitorUpdaterPlugin/BigInt.swift +0 -16
  27. package/ios/Sources/CapacitorUpdaterPlugin/BundleInfo.swift +2 -2
  28. package/ios/Sources/CapacitorUpdaterPlugin/BundleStatus.swift +78 -2
  29. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +2732 -417
  30. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +1191 -363
  31. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +0 -1
  32. package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +37 -16
  33. package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +80 -1
  34. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +438 -39
  35. package/ios/Sources/CapacitorUpdaterPlugin/WebViewStatsReporter.swift +276 -0
  36. package/package.json +24 -9
@@ -42,14 +42,29 @@ declare module '@capacitor/cli' {
42
42
  */
43
43
  autoDeletePrevious?: boolean;
44
44
  /**
45
- * Configure whether the plugin should use Auto Update via an update server.
45
+ * Configure how the plugin checks for, downloads, and applies live updates.
46
+ *
47
+ * The plugin checks for updates when the app moves to the foreground and, if
48
+ * {@link periodCheckDelay} is set, on a repeating timer while the app stays open.
49
+ *
50
+ * Boolean values keep their existing behavior:
51
+ * - `true`: Same as `"atBackground"`.
52
+ * - `false`: Same as `"off"`.
53
+ *
54
+ * String values merge the previous Auto Update and Direct Update configuration:
55
+ * - `"off"`: Disable automatic update checks.
56
+ * - `"atBackground"`: Check and download automatically on each foreground check, then apply the update the next time the app moves to background.
57
+ * - `"atInstall"`: Apply immediately only after a fresh install or native app store update; otherwise use `"atBackground"` behavior.
58
+ * - `"onLaunch"`: Apply immediately only when the app is brought to the foreground from a killed state (cold start). After that first check, fall back to `"atBackground"` behavior.
59
+ * - `"always"`: Check on every foreground transition and apply immediately whenever an update is available.
60
+ * - `"onlyDownload"`: Check and download automatically, emit `updateAvailable`, and never set the next bundle or apply an update automatically.
46
61
  *
47
62
  * Only available for Android and iOS.
48
63
  *
49
64
  * @default true
50
- * @example false
65
+ * @example "onlyDownload"
51
66
  */
52
- autoUpdate?: boolean;
67
+ autoUpdate?: boolean | 'off' | 'atBackground' | 'atInstall' | 'onLaunch' | 'always' | 'onlyDownload';
53
68
  /**
54
69
  * Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.
55
70
  * Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native.
@@ -81,6 +96,10 @@ declare module '@capacitor/cli' {
81
96
  * Configure the URL / endpoint to which update statistics are sent.
82
97
  *
83
98
  * Only available for Android and iOS. Set to "" to disable stats reporting.
99
+ * Native stats include update lifecycle events, app health signals such as crashes,
100
+ * Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals
101
+ * such as JavaScript errors, unhandled promise rejections, resource load failures,
102
+ * WebView renderer exits, and unclean WebView restarts when available.
84
103
  *
85
104
  * @default https://plugin.capgo.app/stats
86
105
  * @example https://example.com/api/stats
@@ -107,12 +126,14 @@ declare module '@capacitor/cli' {
107
126
  version?: string;
108
127
  /**
109
128
  * Configure when the plugin should direct install updates. Only for autoUpdate mode.
129
+ *
130
+ * @deprecated Use {@link PluginsConfig.CapacitorUpdater.autoUpdate} string modes instead.
110
131
  * Works well for apps less than 10MB and with uploads done using --delta flag.
111
132
  * Zip or apps more than 10MB will be relatively slow for users to update.
112
- * - false: Never do direct updates (use default behavior: download at start, set when backgrounded)
113
- * - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false
114
- * - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false
115
- * - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false
133
+ * - false: Never do direct updates (use default behavior: download on foreground check, apply when backgrounded)
134
+ * - atInstall: Direct update only after app install or native app store update, otherwise act as directUpdate = false
135
+ * - onLaunch: Direct update only when the app is brought to the foreground from a killed state, otherwise act as directUpdate = false
136
+ * - always: Direct update on every foreground check whenever an update is available, never act as directUpdate = false
116
137
  * - true: (deprecated) Same as "always" for backward compatibility
117
138
  *
118
139
  * Activate this flag will automatically make the CLI upload delta in CICD envs and will ask for confirmation in local uploads.
@@ -125,9 +146,9 @@ declare module '@capacitor/cli' {
125
146
  /**
126
147
  * 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.
127
148
  * This removes the need to manually listen for appReady events and call SplashScreen.hide().
128
- * Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true.
149
+ * Only works when autoUpdate is set to "atInstall", "always", or "onLaunch", or when the deprecated directUpdate option is set to "atInstall", "always", "onLaunch", or true.
129
150
  * Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.
130
- * Requires autoUpdate and directUpdate to be enabled.
151
+ * Requires Auto Update and Direct Update behavior to be enabled.
131
152
  *
132
153
  * Only available for Android and iOS.
133
154
  *
@@ -250,6 +271,16 @@ declare module '@capacitor/cli' {
250
271
  * @since 7.20.0
251
272
  */
252
273
  allowManualBundleError?: boolean;
274
+ /**
275
+ * Allow JavaScript to start a native preview session and temporarily request updates for another app id.
276
+ * This is intended for trusted container apps that implement Expo Go-style preview flows.
277
+ *
278
+ * Only available for Android and iOS.
279
+ *
280
+ * @default false
281
+ * @since 8.47.0
282
+ */
283
+ allowPreview?: boolean;
253
284
  /**
254
285
  * Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.
255
286
  *
@@ -324,19 +355,30 @@ declare module '@capacitor/cli' {
324
355
  */
325
356
  osLogging?: boolean;
326
357
  /**
327
- * Enable shake gesture to show update menu for debugging/testing purposes
358
+ * Enable the native preview menu gesture while a preview session is active.
359
+ * Outside preview sessions this preview menu is ignored, unless
360
+ * {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.
328
361
  *
329
362
  * @default false
330
363
  * @since 7.5.0
331
364
  */
332
365
  shakeMenu?: boolean;
333
366
  /**
334
- * Enable the shake gesture to show a channel selector menu for switching between update channels.
335
- * When enabled AND `shakeMenu` is true, the shake gesture shows a channel selector
336
- * instead of the default debug menu (Go Home/Reload/Close).
367
+ * Choose which native gesture opens the preview/channel menu.
368
+ * This applies to both {@link PluginsConfig.CapacitorUpdater.shakeMenu}
369
+ * and {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
370
+ *
371
+ * Only available for Android and iOS.
337
372
  *
338
- * After selecting a channel, the app automatically checks for updates and downloads if available.
339
- * Only works if channels have `allow_self_set` enabled on the backend.
373
+ * @default 'shake'
374
+ * @since 8.48.0
375
+ */
376
+ shakeMenuGesture?: ShakeMenuGesture;
377
+ /**
378
+ * Enable the native menu gesture to show a channel selector menu for switching between update channels.
379
+ * If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active,
380
+ * the shake menu includes both preview actions and channel switching.
381
+ * The native gesture can be changed with {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
340
382
  *
341
383
  * Only available for Android and iOS.
342
384
  *
@@ -440,6 +482,11 @@ export interface CapacitorUpdaterPlugin {
440
482
  * For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
441
483
  * For multi-file delta updates, provide the `manifest` array.
442
484
  *
485
+ * **Android Background Runner note:** `@capacitor/background-runner` loads its
486
+ * configured runner script from native APK assets. Live updates cannot replace
487
+ * that runner script. Keep it stable across OTA updates and ship a native app
488
+ * update when the runner code changes.
489
+ *
443
490
  * @example
444
491
  * const bundle = await CapacitorUpdater.download({
445
492
  * url: `https://example.com/versions/${version}/dist.zip`,
@@ -496,6 +543,102 @@ export interface CapacitorUpdaterPlugin {
496
543
  * @throws {Error} When there is no index.html file inside the bundle folder.
497
544
  */
498
545
  set(options: BundleId): Promise<void>;
546
+ /**
547
+ * Start a temporary preview/testing session.
548
+ *
549
+ * This stores the currently active bundle as the pending fallback, enables the
550
+ * native shake menu, and makes the next applied bundle show a native notice
551
+ * explaining that shaking the device can reload or leave the preview.
552
+ * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.
553
+ * When `appId` is provided, the preview session temporarily uses that app id
554
+ * for update checks until the user leaves the preview. Native updater stats are
555
+ * skipped while the preview session is active.
556
+ *
557
+ * Use this before calling {@link set} for Expo Go-style preview flows.
558
+ * Use {@link listPreviews}, {@link setPreview}, {@link resetPreview},
559
+ * {@link deletePreview}, {@link checkPreviewUpdate}, and
560
+ * {@link updatePreview} to manage saved local previews.
561
+ *
562
+ * @param options Optional preview session options.
563
+ * @returns {Promise<void>} Resolves when preview session state is prepared.
564
+ * @since 8.47.0
565
+ */
566
+ startPreviewSession(options?: StartPreviewSessionOptions): Promise<void>;
567
+ /**
568
+ * Get every locally available preview bundle that was registered by
569
+ * {@link startPreviewSession} and later applied with {@link set}.
570
+ *
571
+ * This only returns previews whose bundles are still available locally. It is
572
+ * safe to show this in a preview switcher or native debug menu.
573
+ *
574
+ * @returns {Promise<PreviewListResult>} Locally available previews and current preview state.
575
+ * @throws {Error} If preview sessions are not enabled by config.
576
+ * @since 8.49.0
577
+ */
578
+ listPreviews(): Promise<PreviewListResult>;
579
+ /**
580
+ * Switch to a locally available preview bundle and reload the WebView.
581
+ *
582
+ * If the app is not already in a preview session, the current live bundle is
583
+ * saved as the fallback so {@link resetPreview} or the native shake menu can
584
+ * return to it later.
585
+ *
586
+ * @param options A {@link BundleId} object containing the preview bundle ID.
587
+ * @returns {Promise<void>} Resolves once the preview switch is staged.
588
+ * @throws {Error} If preview sessions are disabled or the preview is not available locally.
589
+ * @since 8.49.0
590
+ */
591
+ setPreview(options: BundleId): Promise<void>;
592
+ /**
593
+ * Leave the active preview session and reload the saved live bundle.
594
+ *
595
+ * This does not delete any saved previews. Use {@link deletePreview} to remove
596
+ * a preview from local storage.
597
+ *
598
+ * @returns {Promise<void>} Resolves once the live bundle reload is staged.
599
+ * @throws {Error} If there is no preview fallback bundle available.
600
+ * @since 8.49.0
601
+ */
602
+ resetPreview(): Promise<void>;
603
+ /**
604
+ * Delete a locally saved preview and its bundle when possible.
605
+ *
606
+ * Active previews cannot be deleted until you switch away from them or call
607
+ * {@link resetPreview}. If only the preview metadata can be removed, the
608
+ * method still resolves with `deleted: false`.
609
+ *
610
+ * @param options A {@link BundleId} object containing the preview bundle ID.
611
+ * @returns {Promise<DeletePreviewResult>} Whether the underlying bundle was deleted.
612
+ * @throws {Error} If preview sessions are disabled.
613
+ * @since 8.49.0
614
+ */
615
+ deletePreview(options: BundleId): Promise<DeletePreviewResult>;
616
+ /**
617
+ * Check whether a saved preview's payload URL points to a newer preview bundle.
618
+ *
619
+ * Only previews started with a `payloadUrl` can be checked natively. Direct URL
620
+ * previews can still be switched or deleted locally, but the updater does not
621
+ * know where to check for newer versions.
622
+ *
623
+ * @param options A {@link BundleId} object containing the preview bundle ID.
624
+ * @returns {Promise<PreviewUpdateResult>} Update status for the preview.
625
+ * @throws {Error} If preview sessions are disabled or the preview has no payload URL.
626
+ * @since 8.49.0
627
+ */
628
+ checkPreviewUpdate(options: BundleId): Promise<PreviewUpdateResult>;
629
+ /**
630
+ * Download the newest bundle for a saved preview payload URL.
631
+ *
632
+ * If the preview being updated is active, the new bundle is applied and the
633
+ * WebView reloads. Otherwise, the saved preview entry is moved to the newly
634
+ * downloaded bundle and can be selected later with {@link setPreview}.
635
+ *
636
+ * @param options A {@link BundleId} object containing the preview bundle ID.
637
+ * @returns {Promise<PreviewUpdateResult>} The update result and saved preview metadata.
638
+ * @throws {Error} If preview sessions are disabled or the preview cannot be updated.
639
+ * @since 8.49.0
640
+ */
641
+ updatePreview(options: BundleId): Promise<PreviewUpdateResult>;
499
642
  /**
500
643
  * Delete a bundle from local storage to free up disk space.
501
644
  *
@@ -568,7 +711,10 @@ export interface CapacitorUpdaterPlugin {
568
711
  * - Testing rollback functionality
569
712
  * - Providing users a "reset to factory" option
570
713
  *
571
- * @param options {@link ResetOptions} to control reset behavior. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.
714
+ * @param options {@link ResetOptions} to control reset behavior.
715
+ * If `toLastSuccessful` is `false` (or omitted), resets to builtin.
716
+ * If `true`, resets to last successful bundle.
717
+ * If `usePendingBundle` is `true`, applies the pending bundle set via {@link next} and clears it.
572
718
  * @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.
573
719
  * @throws {Error} If the reset operation fails.
574
720
  */
@@ -674,6 +820,26 @@ export interface CapacitorUpdaterPlugin {
674
820
  * @since 4.0.0
675
821
  */
676
822
  cancelDelay(): Promise<void>;
823
+ /**
824
+ * Trigger the native auto-update check/download pipeline immediately.
825
+ *
826
+ * This starts the same background update flow used when the app moves to the
827
+ * foreground with auto-update enabled. It is useful for native integrations
828
+ * such as a silent push notification asking the app to check for a Capgo
829
+ * bundle without reimplementing the update protocol in JavaScript.
830
+ *
831
+ * The promise resolves after the native background work has been queued, not
832
+ * after the update has been downloaded or installed. Listen to updater events
833
+ * such as `updateAvailable`, `downloadComplete`, `downloadFailed`, and
834
+ * `noNeedUpdate` for the final result.
835
+ *
836
+ * Native support is available on iOS and Android. On Web, this method returns
837
+ * a result with `status: 'unavailable'`. Native platforms also return
838
+ * `unavailable` when the native auto-update system is disabled.
839
+ *
840
+ * @returns {Promise<TriggerUpdateCheckResult>} Whether a native update check was queued.
841
+ */
842
+ triggerUpdateCheck(): Promise<TriggerUpdateCheckResult>;
677
843
  /**
678
844
  * Check the update server for the latest available bundle version.
679
845
  *
@@ -692,27 +858,23 @@ export interface CapacitorUpdaterPlugin {
692
858
  * 2. Download it using {@link download}
693
859
  * 3. Apply it using {@link next} or {@link set}
694
860
  *
695
- * **Important: Error handling for "no new version available"**
861
+ * **Important: Handling "no new version available"**
696
862
  *
697
863
  * When the device's current version matches the latest version on the server (i.e., the device is already
698
864
  * up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
699
- * `message: "No new version available"`. **This causes `getLatest()` to throw an error**, even though
700
- * this is a normal, expected condition.
865
+ * `message: "No new version available"`. This is a normal, expected condition and resolves with
866
+ * `kind: "up_to_date"` when the backend provides that classification.
701
867
  *
702
- * You should catch this specific error to handle it gracefully:
868
+ * You should check `kind` and `error` before attempting to download:
703
869
  *
704
870
  * ```typescript
705
- * try {
706
- * const latest = await CapacitorUpdater.getLatest();
871
+ * const latest = await CapacitorUpdater.getLatest();
872
+ * if (latest.kind === 'up_to_date') {
873
+ * console.log('Already up to date');
874
+ * } else if (latest.kind === 'blocked') {
875
+ * console.log('Update is blocked:', latest.error);
876
+ * } else if (latest.url) {
707
877
  * // New version is available, proceed with download
708
- * } catch (error) {
709
- * if (error.message === 'No new version available') {
710
- * // Device is already on the latest version - this is normal
711
- * console.log('Already up to date');
712
- * } else {
713
- * // Actual error occurred
714
- * console.error('Failed to check for updates:', error);
715
- * }
716
878
  * }
717
879
  * ```
718
880
  *
@@ -722,16 +884,68 @@ export interface CapacitorUpdaterPlugin {
722
884
  *
723
885
  * @param options Optional {@link GetLatestOptions} to specify which channel to check.
724
886
  * @returns {Promise<LatestVersion>} Information about the latest available bundle version.
725
- * @throws {Error} Always throws when no new version is available (`error: "no_new_version_available"`), or when the request fails.
887
+ * @throws {Error} Throws for failed update checks or transport/request failures.
726
888
  * @since 4.0.0
727
889
  */
728
890
  getLatest(options?: GetLatestOptions): Promise<LatestVersion>;
891
+ /**
892
+ * Return the manifest entries that still need to be downloaded for a partial update.
893
+ *
894
+ * Pass the result from {@link getLatest} directly when it includes a `manifest`.
895
+ * The native plugin compares each manifest entry with the files already available
896
+ * in the builtin bundle and the local delta cache. Entries that can be reused are
897
+ * omitted from the returned `missing` list.
898
+ *
899
+ * For encrypted manifests, pass the `sessionKey` returned by {@link getLatest} so
900
+ * encrypted file hashes can be checked against local files.
901
+ *
902
+ * ```typescript
903
+ * const latest = await CapacitorUpdater.getLatest();
904
+ * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);
905
+ * ```
906
+ *
907
+ * @param options A {@link GetMissingBundleFilesOptions} object, or a {@link LatestVersion} response containing `manifest`.
908
+ * @returns {Promise<GetMissingBundleFilesResult>} The manifest entries that require network download.
909
+ * @throws {Error} If the manifest is missing or invalid.
910
+ * @since 8.47.0
911
+ */
912
+ getMissingBundleFiles(options: GetMissingBundleFilesOptions): Promise<GetMissingBundleFilesResult>;
913
+ /**
914
+ * Estimate the download size for manifest entries before downloading them.
915
+ *
916
+ * This method sends the provided manifest entries to the Capgo update endpoint
917
+ * once and reads the stored manifest `file_size` metadata. It does not perform
918
+ * per-file `HEAD` requests from the app.
919
+ *
920
+ * Use this after {@link getMissingBundleFiles} to estimate only the files this
921
+ * device still needs:
922
+ *
923
+ * ```typescript
924
+ * const latest = await CapacitorUpdater.getLatest();
925
+ * const missing = await CapacitorUpdater.getMissingBundleFiles(latest);
926
+ * const size = await CapacitorUpdater.getBundleDownloadSize({
927
+ * version: latest.version,
928
+ * manifest: missing.missing,
929
+ * });
930
+ * ```
931
+ *
932
+ * @param options A {@link GetBundleDownloadSizeOptions} object containing manifest entries.
933
+ * @returns {Promise<GetBundleDownloadSizeResult>} Known byte totals and per-file size results.
934
+ * @throws {Error} If the manifest is missing or invalid.
935
+ * @since 8.47.0
936
+ */
937
+ getBundleDownloadSize(options: GetBundleDownloadSizeOptions): Promise<GetBundleDownloadSizeResult>;
729
938
  /**
730
939
  * Assign this device to a specific update channel at runtime.
731
940
  *
732
941
  * Channels allow you to distribute different bundle versions to different groups of users
733
942
  * (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
734
943
  *
944
+ * **Device Override UI:** `setChannel()` validates the channel with the backend, then stores the
945
+ * selected channel locally on the device. It does not create or update a backend Device Override,
946
+ * so the device will not appear as overridden in the Capgo dashboard. Only assignments created
947
+ * from the dashboard or the Public API are shown in the Device Override UI.
948
+ *
735
949
  * **Requirements:**
736
950
  * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
737
951
  * - The backend may accept or reject the request based on channel settings
@@ -758,7 +972,8 @@ export interface CapacitorUpdaterPlugin {
758
972
  * });
759
973
  * ```
760
974
  *
761
- * This sends a request to the Capgo backend linking your device ID to the specified channel.
975
+ * This sends a request to the Capgo backend to validate the specified channel, then stores the
976
+ * channel locally on the device.
762
977
  *
763
978
  * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.
764
979
  * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.
@@ -767,11 +982,12 @@ export interface CapacitorUpdaterPlugin {
767
982
  */
768
983
  setChannel(options: SetChannelOptions): Promise<ChannelRes>;
769
984
  /**
770
- * Remove the device's channel assignment and return to the default channel.
985
+ * Remove the plugin-managed local channel assignment and return to the default channel.
771
986
  *
772
- * This unlinks the device from any specifically assigned channel, causing it to fall back to:
987
+ * This clears only the channel stored locally by {@link setChannel}; it does not delete Dashboard or Public API Device Override records. After the local assignment is cleared, normal channel precedence applies:
988
+ * - An existing Dashboard or Public API Device Override, if one exists
773
989
  * - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
774
- * - Your backend's default channel for this app
990
+ * - Your backend default channel for this app
775
991
  *
776
992
  * Use this when:
777
993
  * - Users opt out of beta/testing programs
@@ -798,6 +1014,9 @@ export interface CapacitorUpdaterPlugin {
798
1014
  * - Check if a device is on a specific channel before showing features
799
1015
  * - Verify channel assignment after calling {@link setChannel}
800
1016
  *
1017
+ * On native platforms, a successful response also refreshes the locally persisted
1018
+ * default channel used by update checks.
1019
+ *
801
1020
  * @returns {Promise<GetChannelRes>} The current channel information.
802
1021
  * @throws {Error} If the operation fails.
803
1022
  * @since 4.8.0
@@ -879,7 +1098,7 @@ export interface CapacitorUpdaterPlugin {
879
1098
  * **Privacy & Security characteristics:**
880
1099
  * - Generated as a UUID (not based on hardware identifiers)
881
1100
  * - Stored securely in platform-specific secure storage
882
- * - Android: Android Keystore (persists across app reinstalls on API 23+)
1101
+ * - Android: mirrored into backup-restorable app preferences for reinstall restore
883
1102
  * - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`
884
1103
  * - Not synced to cloud (iOS)
885
1104
  * - Follows Apple and Google privacy best practices
@@ -887,7 +1106,9 @@ export interface CapacitorUpdaterPlugin {
887
1106
  *
888
1107
  * **Persistence:**
889
1108
  * The device ID persists across app reinstalls to maintain consistent device identity
890
- * for update tracking and analytics.
1109
+ * for update tracking and analytics when platform storage is preserved. On Android,
1110
+ * apps with custom backup rules must keep the plugin app preferences eligible for
1111
+ * backup/restore; disabling Android backup or clearing app data creates a new ID.
891
1112
  *
892
1113
  * Use this to:
893
1114
  * - Debug update delivery issues (check what ID the server sees)
@@ -938,6 +1159,7 @@ export interface CapacitorUpdaterPlugin {
938
1159
  * This unregisters all listeners added via {@link addListener} for all event types:
939
1160
  * - `download`
940
1161
  * - `noNeedUpdate`
1162
+ * - `updateCheckResult`
941
1163
  * - `updateAvailable`
942
1164
  * - `downloadComplete`
943
1165
  * - `downloadFailed`
@@ -966,6 +1188,17 @@ export interface CapacitorUpdaterPlugin {
966
1188
  * @since 4.0.0
967
1189
  */
968
1190
  addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;
1191
+ /**
1192
+ * Listen for update check results before the updater decides whether to download.
1193
+ * The backend can classify the UpdateCheckResultEvent payload as `up_to_date`, `blocked`, or `failed`.
1194
+ *
1195
+ * This event is emitted alongside legacy events. For `up_to_date` and `blocked`, it is emitted before
1196
+ * `noNeedUpdate` and does not emit `downloadFailed`. For `failed`, it is emitted before the legacy
1197
+ * `downloadFailed` event and keeps the existing failure stats behavior.
1198
+ *
1199
+ * @since 8.45.11
1200
+ */
1201
+ addListener(eventName: 'updateCheckResult', listenerFunc: (state: UpdateCheckResultEvent) => void): Promise<PluginListenerHandle>;
969
1202
  /**
970
1203
  * Listen for available update event, useful when you want to force check every time the app is launched
971
1204
  *
@@ -998,6 +1231,20 @@ export interface CapacitorUpdaterPlugin {
998
1231
  * @since 2.3.0
999
1232
  */
1000
1233
  addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void): Promise<PluginListenerHandle>;
1234
+ /**
1235
+ * Listen for set event in the App, let you know when a bundle has been applied successfully.
1236
+ * This event is retained natively until JavaScript consumes it, so if the app reloads before your
1237
+ * listener is attached, the last pending `set` event is delivered once the listener subscribes.
1238
+ *
1239
+ * @since 8.43.12
1240
+ */
1241
+ addListener(eventName: 'set', listenerFunc: (state: SetEvent) => void): Promise<PluginListenerHandle>;
1242
+ /**
1243
+ * Listen for set next event in the App, let you know when a bundle is queued as the next bundle to install.
1244
+ *
1245
+ * @since 6.14.0
1246
+ */
1247
+ addListener(eventName: 'setNext', listenerFunc: (state: SetNextEvent) => void): Promise<PluginListenerHandle>;
1001
1248
  /**
1002
1249
  * Listen for download fail event in the App, let you know when a bundle download has failed
1003
1250
  *
@@ -1011,7 +1258,9 @@ export interface CapacitorUpdaterPlugin {
1011
1258
  */
1012
1259
  addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;
1013
1260
  /**
1014
- * Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.
1261
+ * Listen for app ready event in the App, let you know when app is ready to use.
1262
+ * This event is retained natively until JavaScript consumes it, so it can still be delivered after
1263
+ * a reload even if the listener is attached later in app startup.
1015
1264
  *
1016
1265
  * @since 5.1.0
1017
1266
  */
@@ -1117,23 +1366,20 @@ export interface CapacitorUpdaterPlugin {
1117
1366
  */
1118
1367
  getFailedUpdate(): Promise<UpdateFailedEvent | null>;
1119
1368
  /**
1120
- * Enable or disable the shake gesture menu for debugging and testing.
1369
+ * Enable or disable the native preview menu gesture.
1121
1370
  *
1122
- * When enabled, users can shake their device to open a debug menu that shows:
1123
- * - Current bundle information
1124
- * - Available bundles
1125
- * - Options to switch bundles manually
1126
- * - Update status
1371
+ * During preview sessions, users can use the configured native gesture to:
1372
+ * - Reload the current preview
1373
+ * - Leave the test app and return to the fallback bundle
1374
+ * - Switch update channel, when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is also enabled
1127
1375
  *
1128
- * This is useful during development and testing to:
1129
- * - Quickly test different bundle versions
1130
- * - Debug update flows
1131
- * - Switch between production and test bundles
1132
- * - Verify bundle installations
1376
+ * Outside preview sessions, this preview menu is ignored. The channel selector can still be
1377
+ * shown outside preview sessions when {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.
1133
1378
  *
1134
1379
  * **Important:** Disable this in production builds or only enable for internal testers.
1135
1380
  *
1136
- * Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1381
+ * This can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1382
+ * The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1137
1383
  *
1138
1384
  * @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.
1139
1385
  * @returns {Promise<void>} Resolves when the setting is applied.
@@ -1142,7 +1388,7 @@ export interface CapacitorUpdaterPlugin {
1142
1388
  */
1143
1389
  setShakeMenu(options: SetShakeMenuOptions): Promise<void>;
1144
1390
  /**
1145
- * Check if the shake gesture debug menu is currently enabled.
1391
+ * Check if the native preview menu gesture is currently enabled.
1146
1392
  *
1147
1393
  * Returns the current state of the shake menu feature that can be toggled via
1148
1394
  * {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
@@ -1152,22 +1398,20 @@ export interface CapacitorUpdaterPlugin {
1152
1398
  * - Show/hide debug settings UI
1153
1399
  * - Verify configuration during testing
1154
1400
  *
1155
- * @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.
1401
+ * @returns {Promise<ShakeMenuEnabled>} Object with the current enabled state and gesture.
1156
1402
  * @throws {Error} If the operation fails.
1157
1403
  * @since 7.5.0
1158
1404
  */
1159
1405
  isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;
1160
1406
  /**
1161
- * Enable or disable the shake channel selector at runtime.
1407
+ * Enable or disable the channel selector menu gesture at runtime.
1162
1408
  *
1163
- * When enabled AND shakeMenu is true, shaking the device shows a channel
1164
- * selector instead of the debug menu. This allows users to switch between
1165
- * update channels by shaking their device.
1409
+ * When enabled, the configured native gesture can show a channel selector, including outside preview sessions.
1410
+ * If {@link setShakeMenu} is also enabled while a preview session is active, the shake menu includes
1411
+ * both preview actions and channel switching.
1166
1412
  *
1167
- * After selecting a channel, the app automatically checks for updates
1168
- * and downloads if available.
1169
- *
1170
- * Can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
1413
+ * This can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
1414
+ * The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1171
1415
  *
1172
1416
  * @param options {@link SetShakeChannelSelectorOptions} with `enabled: true` to enable or `enabled: false` to disable.
1173
1417
  * @returns {Promise<void>} Resolves when the setting is applied.
@@ -1357,6 +1601,14 @@ export interface CapacitorUpdaterPlugin {
1357
1601
  */
1358
1602
  export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
1359
1603
  export type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
1604
+ /**
1605
+ * Classification for update-check responses that do not provide a downloadable bundle.
1606
+ * The update backend provides this field directly. Missing or unknown values are treated as
1607
+ * failed by native clients.
1608
+ *
1609
+ * @since 8.45.11
1610
+ */
1611
+ export type UpdateResponseKind = 'up_to_date' | 'blocked' | 'failed';
1360
1612
  export interface NoNeedEvent {
1361
1613
  /**
1362
1614
  * Current status of download, between 0 and 100.
@@ -1365,6 +1617,44 @@ export interface NoNeedEvent {
1365
1617
  */
1366
1618
  bundle: BundleInfo;
1367
1619
  }
1620
+ export interface UpdateCheckResultEvent {
1621
+ /**
1622
+ * Classification for the update check result, provided by the backend.
1623
+ *
1624
+ * @since 8.45.11
1625
+ */
1626
+ kind: UpdateResponseKind;
1627
+ /**
1628
+ * Backend error code, when provided.
1629
+ *
1630
+ * @since 8.45.11
1631
+ */
1632
+ error?: string;
1633
+ /**
1634
+ * Backend message, when provided.
1635
+ *
1636
+ * @since 8.45.11
1637
+ */
1638
+ message?: string;
1639
+ /**
1640
+ * HTTP status code returned by the update endpoint.
1641
+ *
1642
+ * @since 8.45.11
1643
+ */
1644
+ statusCode?: number;
1645
+ /**
1646
+ * Version referenced by the update check result.
1647
+ *
1648
+ * @since 8.45.11
1649
+ */
1650
+ version?: string;
1651
+ /**
1652
+ * Current bundle on the device.
1653
+ *
1654
+ * @since 8.45.11
1655
+ */
1656
+ bundle: BundleInfo;
1657
+ }
1368
1658
  export interface UpdateAvailableEvent {
1369
1659
  /**
1370
1660
  * Current status of download, between 0 and 100.
@@ -1401,7 +1691,7 @@ export interface ChannelInfo {
1401
1691
  *
1402
1692
  * @since 7.5.0
1403
1693
  */
1404
- id: string;
1694
+ id: number;
1405
1695
  /**
1406
1696
  * The channel name
1407
1697
  *
@@ -1477,9 +1767,27 @@ export interface UpdateFailedEvent {
1477
1767
  */
1478
1768
  bundle: BundleInfo;
1479
1769
  }
1770
+ export interface SetEvent {
1771
+ /**
1772
+ * Emit when a bundle has been applied successfully.
1773
+ * This event uses native `retainUntilConsumed` behavior.
1774
+ *
1775
+ * @since 8.43.12
1776
+ */
1777
+ bundle: BundleInfo;
1778
+ }
1779
+ export interface SetNextEvent {
1780
+ /**
1781
+ * Emit when a bundle is queued as the next bundle to install.
1782
+ *
1783
+ * @since 6.14.0
1784
+ */
1785
+ bundle: BundleInfo;
1786
+ }
1480
1787
  export interface AppReadyEvent {
1481
1788
  /**
1482
1789
  * Emitted when the app is ready to use.
1790
+ * This event uses native `retainUntilConsumed` behavior.
1483
1791
  *
1484
1792
  * @since 5.2.0
1485
1793
  */
@@ -1500,6 +1808,128 @@ export interface ManifestEntry {
1500
1808
  file_hash: string | null;
1501
1809
  download_url: string | null;
1502
1810
  }
1811
+ export interface GetMissingBundleFilesOptions {
1812
+ /**
1813
+ * Manifest returned by {@link getLatest}. Passing the full {@link LatestVersion}
1814
+ * response is supported because it contains this field.
1815
+ *
1816
+ * @since 8.47.0
1817
+ */
1818
+ manifest?: ManifestEntry[];
1819
+ /**
1820
+ * Target bundle version. Passing the full {@link LatestVersion} response is
1821
+ * supported because it contains this field.
1822
+ *
1823
+ * @since 8.47.0
1824
+ */
1825
+ version?: string;
1826
+ /**
1827
+ * Session key returned by {@link getLatest}, required only when file hashes are encrypted.
1828
+ *
1829
+ * @since 8.47.0
1830
+ */
1831
+ sessionKey?: string;
1832
+ }
1833
+ export interface GetMissingBundleFilesResult {
1834
+ /**
1835
+ * Entries that are not available locally and need to be downloaded.
1836
+ *
1837
+ * @since 8.47.0
1838
+ */
1839
+ missing: ManifestEntry[];
1840
+ /**
1841
+ * Total entries in the provided manifest.
1842
+ *
1843
+ * @since 8.47.0
1844
+ */
1845
+ total: number;
1846
+ /**
1847
+ * Number of entries that need to be downloaded.
1848
+ *
1849
+ * @since 8.47.0
1850
+ */
1851
+ missingCount: number;
1852
+ /**
1853
+ * Number of entries that can be reused from builtin files or local cache.
1854
+ *
1855
+ * @since 8.47.0
1856
+ */
1857
+ reusableCount: number;
1858
+ }
1859
+ export interface GetBundleDownloadSizeOptions {
1860
+ /**
1861
+ * Manifest entries to estimate. Pass `missing.missing` from {@link getMissingBundleFiles}
1862
+ * to estimate only the bytes this device still needs to download.
1863
+ *
1864
+ * @since 8.47.0
1865
+ */
1866
+ manifest?: ManifestEntry[];
1867
+ /**
1868
+ * Target bundle version. Pass `latest.version` when estimating files returned
1869
+ * by {@link getLatest}.
1870
+ *
1871
+ * @since 8.47.0
1872
+ */
1873
+ version?: string;
1874
+ }
1875
+ export interface BundleFileSize {
1876
+ /**
1877
+ * File name from the manifest entry.
1878
+ *
1879
+ * @since 8.47.0
1880
+ */
1881
+ file_name: string | null;
1882
+ /**
1883
+ * File hash from the manifest entry.
1884
+ *
1885
+ * @since 8.47.0
1886
+ */
1887
+ file_hash: string | null;
1888
+ /**
1889
+ * Download URL from the manifest entry.
1890
+ *
1891
+ * @since 8.47.0
1892
+ */
1893
+ download_url: string | null;
1894
+ /**
1895
+ * Estimated bytes to download when the server exposes a size.
1896
+ *
1897
+ * @since 8.47.0
1898
+ */
1899
+ size?: number;
1900
+ /**
1901
+ * Error for this entry when the size could not be determined.
1902
+ *
1903
+ * @since 8.47.0
1904
+ */
1905
+ error?: string;
1906
+ }
1907
+ export interface GetBundleDownloadSizeResult {
1908
+ /**
1909
+ * Sum of all known file sizes in bytes.
1910
+ *
1911
+ * @since 8.47.0
1912
+ */
1913
+ totalSize: number;
1914
+ /**
1915
+ * Number of files with a known size.
1916
+ *
1917
+ * @since 8.47.0
1918
+ */
1919
+ knownFiles: number;
1920
+ /**
1921
+ * Number of files whose size could not be determined.
1922
+ *
1923
+ * @since 8.47.0
1924
+ */
1925
+ unknownFiles: number;
1926
+ /**
1927
+ * Per-file size results.
1928
+ *
1929
+ * @since 8.47.0
1930
+ */
1931
+ files: BundleFileSize[];
1932
+ }
1503
1933
  export interface LatestVersion {
1504
1934
  /**
1505
1935
  * Result of getLatest method
@@ -1528,12 +1958,21 @@ export interface LatestVersion {
1528
1958
  message?: string;
1529
1959
  sessionKey?: string;
1530
1960
  /**
1531
- * Error code from the server, if any.
1532
- * Common values:
1533
- * - `"no_new_version_available"`: Device is already on the latest version (not a failure)
1534
- * - Other error codes indicate actual failures in the update process
1961
+ * Error code from the server, if any. Use `kind` for classification instead of parsing this value.
1535
1962
  */
1536
1963
  error?: string;
1964
+ /**
1965
+ * Classification for this response, provided by the backend.
1966
+ *
1967
+ * @since 8.45.11
1968
+ */
1969
+ kind?: UpdateResponseKind;
1970
+ /**
1971
+ * HTTP status code returned by the update server for classified update-check responses.
1972
+ *
1973
+ * @since 8.45.11
1974
+ */
1975
+ statusCode?: number;
1537
1976
  /**
1538
1977
  * The previous/current version name (provided for reference).
1539
1978
  */
@@ -1547,6 +1986,20 @@ export interface LatestVersion {
1547
1986
  * @since 6.1
1548
1987
  */
1549
1988
  manifest?: ManifestEntry[];
1989
+ /**
1990
+ * Missing manifest entries for this device when {@link GetLatestOptions.includeBundleSize}
1991
+ * is enabled.
1992
+ *
1993
+ * @since 8.47.0
1994
+ */
1995
+ missing?: GetMissingBundleFilesResult;
1996
+ /**
1997
+ * Estimated download size for missing manifest entries when
1998
+ * {@link GetLatestOptions.includeBundleSize} is enabled.
1999
+ *
2000
+ * @since 8.47.0
2001
+ */
2002
+ downloadSize?: GetBundleDownloadSizeResult;
1550
2003
  /**
1551
2004
  * Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release).
1552
2005
  * @since 7.35.0
@@ -1594,6 +2047,193 @@ export interface GetLatestOptions {
1594
2047
  * @default undefined
1595
2048
  */
1596
2049
  channel?: string;
2050
+ /**
2051
+ * Temporarily use another app id for this update check while using a trusted preview container.
2052
+ * This only changes the app id sent by this request; it does not persist a preview session.
2053
+ * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.
2054
+ * @since 8.47.0
2055
+ * @default undefined
2056
+ */
2057
+ appId?: string;
2058
+ /**
2059
+ * When true, the native plugin computes which manifest files are missing on
2060
+ * this device and asks the Capgo update endpoint for their stored sizes before
2061
+ * resolving {@link getLatest}.
2062
+ *
2063
+ * This adds one backend request only when the update response contains a
2064
+ * manifest. It does not perform per-file network checks.
2065
+ *
2066
+ * @since 8.47.0
2067
+ * @default false
2068
+ */
2069
+ includeBundleSize?: boolean;
2070
+ }
2071
+ export interface StartPreviewSessionOptions {
2072
+ /**
2073
+ * App id to use while the preview session is active.
2074
+ * The previous app id is restored when leaving the preview session.
2075
+ * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.
2076
+ * @since 8.47.0
2077
+ * @default undefined
2078
+ */
2079
+ appId?: string;
2080
+ /**
2081
+ * HTTP(S) URL returning a preview download payload.
2082
+ * When provided, the native shake reload action fetches this payload again
2083
+ * before reloading so channel previews can move to the latest bundle.
2084
+ * Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`.
2085
+ * @since 8.48.0
2086
+ * @default undefined
2087
+ */
2088
+ payloadUrl?: string;
2089
+ /**
2090
+ * Human-readable preview name stored with the next preview bundle applied by
2091
+ * {@link set}. Native preview menus and {@link listPreviews} can display it.
2092
+ * @since 8.49.0
2093
+ * @default undefined
2094
+ */
2095
+ name?: string;
2096
+ /**
2097
+ * Optional source label for the preview, such as `channel`, `bundle`, `url`,
2098
+ * or `payload`. This is stored as metadata only.
2099
+ * @since 8.49.0
2100
+ * @default undefined
2101
+ */
2102
+ source?: string;
2103
+ }
2104
+ export interface PreviewInfo {
2105
+ /**
2106
+ * Preview bundle id.
2107
+ *
2108
+ * @since 8.49.0
2109
+ */
2110
+ id: string;
2111
+ /**
2112
+ * Locally downloaded bundle backing this preview.
2113
+ *
2114
+ * @since 8.49.0
2115
+ */
2116
+ bundle: BundleInfo;
2117
+ /**
2118
+ * Human-readable name supplied when the preview was started.
2119
+ *
2120
+ * @since 8.49.0
2121
+ */
2122
+ name?: string;
2123
+ /**
2124
+ * Metadata source label supplied when the preview was started.
2125
+ *
2126
+ * @since 8.49.0
2127
+ */
2128
+ source?: string;
2129
+ /**
2130
+ * Preview app id, when the session uses an app id override.
2131
+ *
2132
+ * @since 8.49.0
2133
+ */
2134
+ appId?: string;
2135
+ /**
2136
+ * Payload URL used to refresh this preview.
2137
+ *
2138
+ * @since 8.49.0
2139
+ */
2140
+ payloadUrl?: string;
2141
+ /**
2142
+ * ISO timestamp for when this preview was first saved.
2143
+ *
2144
+ * @since 8.49.0
2145
+ */
2146
+ createdAt: string;
2147
+ /**
2148
+ * ISO timestamp for the last metadata or bundle update.
2149
+ *
2150
+ * @since 8.49.0
2151
+ */
2152
+ updatedAt: string;
2153
+ /**
2154
+ * ISO timestamp for the last time this preview was activated.
2155
+ *
2156
+ * @since 8.49.0
2157
+ */
2158
+ lastUsedAt: string;
2159
+ /**
2160
+ * Whether this preview is the currently active bundle in a preview session.
2161
+ *
2162
+ * @since 8.49.0
2163
+ */
2164
+ isActive: boolean;
2165
+ }
2166
+ export interface PreviewListResult {
2167
+ /**
2168
+ * Locally available preview bundles.
2169
+ *
2170
+ * @since 8.49.0
2171
+ */
2172
+ previews: PreviewInfo[];
2173
+ /**
2174
+ * Current preview when a preview session is active.
2175
+ *
2176
+ * @since 8.49.0
2177
+ */
2178
+ current?: PreviewInfo;
2179
+ /**
2180
+ * Bundle currently loaded by the WebView.
2181
+ *
2182
+ * @since 8.49.0
2183
+ */
2184
+ currentBundle: BundleInfo;
2185
+ /**
2186
+ * Bundle that will be restored when leaving preview mode.
2187
+ *
2188
+ * @since 8.49.0
2189
+ */
2190
+ liveBundle?: BundleInfo;
2191
+ }
2192
+ export interface DeletePreviewResult {
2193
+ /**
2194
+ * Whether preview metadata was removed.
2195
+ *
2196
+ * @since 8.49.0
2197
+ */
2198
+ removed: boolean;
2199
+ /**
2200
+ * Whether the underlying local bundle was deleted.
2201
+ *
2202
+ * @since 8.49.0
2203
+ */
2204
+ deleted: boolean;
2205
+ }
2206
+ export interface PreviewUpdateResult {
2207
+ /**
2208
+ * Saved preview metadata after the check or update.
2209
+ *
2210
+ * @since 8.49.0
2211
+ */
2212
+ preview: PreviewInfo;
2213
+ /**
2214
+ * Latest version returned by the preview payload endpoint.
2215
+ *
2216
+ * @since 8.49.0
2217
+ */
2218
+ latestVersion?: string;
2219
+ /**
2220
+ * Whether the saved preview already matches the latest payload version.
2221
+ *
2222
+ * @since 8.49.0
2223
+ */
2224
+ upToDate: boolean;
2225
+ /**
2226
+ * Whether a newer bundle was downloaded and saved.
2227
+ *
2228
+ * @since 8.49.0
2229
+ */
2230
+ updated: boolean;
2231
+ /**
2232
+ * New bundle when {@link updatePreview} downloaded one.
2233
+ *
2234
+ * @since 8.49.0
2235
+ */
2236
+ bundle?: BundleInfo;
1597
2237
  }
1598
2238
  export interface AppReadyResult {
1599
2239
  bundle: BundleInfo;
@@ -1646,7 +2286,19 @@ export interface BundleListResult {
1646
2286
  bundles: BundleInfo[];
1647
2287
  }
1648
2288
  export interface ResetOptions {
1649
- toLastSuccessful: boolean;
2289
+ /**
2290
+ * Reset to the last successfully loaded bundle instead of the builtin one.
2291
+ * @default false
2292
+ */
2293
+ toLastSuccessful?: boolean;
2294
+ /**
2295
+ * Apply the pending bundle set via {@link next} while resetting.
2296
+ *
2297
+ * When `true`, the plugin will switch to the pending bundle immediately and clear the pending flag.
2298
+ * If no pending bundle exists, the reset will fail.
2299
+ * @default false
2300
+ */
2301
+ usePendingBundle?: boolean;
1650
2302
  }
1651
2303
  export interface ListOptions {
1652
2304
  /**
@@ -1678,11 +2330,48 @@ export interface AutoUpdateEnabled {
1678
2330
  export interface AutoUpdateAvailable {
1679
2331
  available: boolean;
1680
2332
  }
2333
+ /**
2334
+ * Result returned after requesting an immediate native auto-update check.
2335
+ *
2336
+ * @property status - Native trigger state: `queued` when a check was queued,
2337
+ * `already_running` when the native update pipeline is already active, or
2338
+ * `unavailable` on Web or when native auto-update is disabled.
2339
+ * @property queued - Whether a new native update check was queued. This is
2340
+ * `true` only when `status` is `queued`; otherwise it is `false`.
2341
+ */
2342
+ export interface TriggerUpdateCheckResult {
2343
+ /**
2344
+ * Native trigger state: `queued` when a check was queued, `already_running`
2345
+ * when the native update pipeline is already active, or `unavailable` on Web
2346
+ * or when native auto-update is disabled.
2347
+ */
2348
+ status: 'queued' | 'already_running' | 'unavailable';
2349
+ /**
2350
+ * Whether a new native update check was queued. This is `true` only when
2351
+ * `status` is `queued`; otherwise it is `false`.
2352
+ */
2353
+ queued: boolean;
2354
+ }
2355
+ /**
2356
+ * Native gesture options that open the shake menu.
2357
+ *
2358
+ * Supported values are `shake` and `threeFingerPinch`.
2359
+ *
2360
+ * @public
2361
+ */
2362
+ export type ShakeMenuGesture = 'shake' | 'threeFingerPinch';
1681
2363
  export interface SetShakeMenuOptions {
1682
2364
  enabled: boolean;
1683
2365
  }
1684
2366
  export interface ShakeMenuEnabled {
1685
2367
  enabled: boolean;
2368
+ /**
2369
+ * The currently configured native gesture used to open the preview/channel menu.
2370
+ * Undefined means consumers should treat the gesture as the default `shake` behavior.
2371
+ *
2372
+ * @since 8.48.0
2373
+ */
2374
+ gesture?: ShakeMenuGesture;
1686
2375
  }
1687
2376
  export interface SetShakeChannelSelectorOptions {
1688
2377
  enabled: boolean;