@capgo/capacitor-updater 8.48.0 → 8.49.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.
package/README.md CHANGED
@@ -448,6 +448,12 @@ export default config;
448
448
  * [`next(...)`](#next)
449
449
  * [`set(...)`](#set)
450
450
  * [`startPreviewSession(...)`](#startpreviewsession)
451
+ * [`listPreviews()`](#listpreviews)
452
+ * [`setPreview(...)`](#setpreview)
453
+ * [`resetPreview()`](#resetpreview)
454
+ * [`deletePreview(...)`](#deletepreview)
455
+ * [`checkPreviewUpdate(...)`](#checkpreviewupdate)
456
+ * [`updatePreview(...)`](#updatepreview)
451
457
  * [`delete(...)`](#delete)
452
458
  * [`setBundleError(...)`](#setbundleerror)
453
459
  * [`list(...)`](#list)
@@ -726,6 +732,9 @@ for update checks until the user leaves the preview. Native updater stats are
726
732
  skipped while the preview session is active.
727
733
 
728
734
  Use this before calling {@link set} for Expo Go-style preview flows.
735
+ Use {@link listPreviews}, {@link setPreview}, {@link resetPreview},
736
+ {@link deletePreview}, {@link checkPreviewUpdate}, and
737
+ {@link updatePreview} to manage saved local previews.
729
738
 
730
739
  | Param | Type | Description |
731
740
  | ------------- | --------------------------------------------------------------------------------- | --------------------------------- |
@@ -736,6 +745,131 @@ Use this before calling {@link set} for Expo Go-style preview flows.
736
745
  --------------------
737
746
 
738
747
 
748
+ #### listPreviews()
749
+
750
+ ```typescript
751
+ listPreviews() => Promise<PreviewListResult>
752
+ ```
753
+
754
+ Get every locally available preview bundle that was registered by
755
+ {@link startPreviewSession} and later applied with {@link set}.
756
+
757
+ This only returns previews whose bundles are still available locally. It is
758
+ safe to show this in a preview switcher or native debug menu.
759
+
760
+ **Returns:** <code>Promise&lt;<a href="#previewlistresult">PreviewListResult</a>&gt;</code>
761
+
762
+ **Since:** 8.49.0
763
+
764
+ --------------------
765
+
766
+
767
+ #### setPreview(...)
768
+
769
+ ```typescript
770
+ setPreview(options: BundleId) => Promise<void>
771
+ ```
772
+
773
+ Switch to a locally available preview bundle and reload the WebView.
774
+
775
+ If the app is not already in a preview session, the current live bundle is
776
+ saved as the fallback so {@link resetPreview} or the native shake menu can
777
+ return to it later.
778
+
779
+ | Param | Type | Description |
780
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
781
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
782
+
783
+ **Since:** 8.49.0
784
+
785
+ --------------------
786
+
787
+
788
+ #### resetPreview()
789
+
790
+ ```typescript
791
+ resetPreview() => Promise<void>
792
+ ```
793
+
794
+ Leave the active preview session and reload the saved live bundle.
795
+
796
+ This does not delete any saved previews. Use {@link deletePreview} to remove
797
+ a preview from local storage.
798
+
799
+ **Since:** 8.49.0
800
+
801
+ --------------------
802
+
803
+
804
+ #### deletePreview(...)
805
+
806
+ ```typescript
807
+ deletePreview(options: BundleId) => Promise<DeletePreviewResult>
808
+ ```
809
+
810
+ Delete a locally saved preview and its bundle when possible.
811
+
812
+ Active previews cannot be deleted until you switch away from them or call
813
+ {@link resetPreview}. If only the preview metadata can be removed, the
814
+ method still resolves with `deleted: false`.
815
+
816
+ | Param | Type | Description |
817
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
818
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
819
+
820
+ **Returns:** <code>Promise&lt;<a href="#deletepreviewresult">DeletePreviewResult</a>&gt;</code>
821
+
822
+ **Since:** 8.49.0
823
+
824
+ --------------------
825
+
826
+
827
+ #### checkPreviewUpdate(...)
828
+
829
+ ```typescript
830
+ checkPreviewUpdate(options: BundleId) => Promise<PreviewUpdateResult>
831
+ ```
832
+
833
+ Check whether a saved preview's payload URL points to a newer preview bundle.
834
+
835
+ Only previews started with a `payloadUrl` can be checked natively. Direct URL
836
+ previews can still be switched or deleted locally, but the updater does not
837
+ know where to check for newer versions.
838
+
839
+ | Param | Type | Description |
840
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
841
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
842
+
843
+ **Returns:** <code>Promise&lt;<a href="#previewupdateresult">PreviewUpdateResult</a>&gt;</code>
844
+
845
+ **Since:** 8.49.0
846
+
847
+ --------------------
848
+
849
+
850
+ #### updatePreview(...)
851
+
852
+ ```typescript
853
+ updatePreview(options: BundleId) => Promise<PreviewUpdateResult>
854
+ ```
855
+
856
+ Download the newest bundle for a saved preview payload URL.
857
+
858
+ If the preview being updated is active, the new bundle is applied and the
859
+ WebView reloads. Otherwise, the saved preview entry is moved to the newly
860
+ downloaded bundle and can be selected later with {@link setPreview}.
861
+
862
+ | Param | Type | Description |
863
+ | ------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
864
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the preview bundle ID. |
865
+
866
+ **Returns:** <code>Promise&lt;<a href="#previewupdateresult">PreviewUpdateResult</a>&gt;</code>
867
+
868
+ **Since:** 8.49.0
869
+
870
+ --------------------
871
+
872
+
739
873
  #### delete(...)
740
874
 
741
875
  ```typescript
@@ -1842,8 +1976,7 @@ shown outside preview sessions when {@link PluginsConfig.CapacitorUpdater.allowS
1842
1976
  **Important:** Disable this in production builds or only enable for internal testers.
1843
1977
 
1844
1978
  This can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1845
- The native gesture can be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}
1846
- or `options.gesture`.
1979
+ The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1847
1980
 
1848
1981
  | Param | Type |
1849
1982
  | ------------- | ------------------------------------------------------------------- |
@@ -1890,8 +2023,7 @@ If {@link setShakeMenu} is also enabled while a preview session is active, the s
1890
2023
  both preview actions and channel switching.
1891
2024
 
1892
2025
  This can also be configured via {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}.
1893
- The native gesture can be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}
1894
- or {@link setShakeMenu}.
2026
+ The native gesture is configured via {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}.
1895
2027
 
1896
2028
  | Param | Type |
1897
2029
  | ------------- | ----------------------------------------------------------------------------------------- |
@@ -2212,6 +2344,53 @@ If you don't use backend, you need to provide the URL and version of the bundle.
2212
2344
  | ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ |
2213
2345
  | **`appId`** | <code>string</code> | App id to use while the preview session is active. The previous app id is restored when leaving the preview session. Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`. | <code>undefined</code> | 8.47.0 |
2214
2346
  | **`payloadUrl`** | <code>string</code> | HTTP(S) URL returning a preview download payload. When provided, the native shake reload action fetches this payload again before reloading so channel previews can move to the latest bundle. Requires {@link PluginsConfig.CapacitorUpdater.allowPreview} to be `true`. | <code>undefined</code> | 8.48.0 |
2347
+ | **`name`** | <code>string</code> | Human-readable preview name stored with the next preview bundle applied by {@link set}. Native preview menus and {@link listPreviews} can display it. | <code>undefined</code> | 8.49.0 |
2348
+ | **`source`** | <code>string</code> | Optional source label for the preview, such as `channel`, `bundle`, `url`, or `payload`. This is stored as metadata only. | <code>undefined</code> | 8.49.0 |
2349
+
2350
+
2351
+ ##### PreviewListResult
2352
+
2353
+ | Prop | Type | Description | Since |
2354
+ | ------------------- | --------------------------------------------------- | ------------------------------------------------------- | ------ |
2355
+ | **`previews`** | <code>PreviewInfo[]</code> | Locally available preview bundles. | 8.49.0 |
2356
+ | **`current`** | <code><a href="#previewinfo">PreviewInfo</a></code> | Current preview when a preview session is active. | 8.49.0 |
2357
+ | **`currentBundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Bundle currently loaded by the WebView. | 8.49.0 |
2358
+ | **`liveBundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Bundle that will be restored when leaving preview mode. | 8.49.0 |
2359
+
2360
+
2361
+ ##### PreviewInfo
2362
+
2363
+ | Prop | Type | Description | Since |
2364
+ | ---------------- | ------------------------------------------------- | ------------------------------------------------------------------------- | ------ |
2365
+ | **`id`** | <code>string</code> | Preview bundle id. | 8.49.0 |
2366
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Locally downloaded bundle backing this preview. | 8.49.0 |
2367
+ | **`name`** | <code>string</code> | Human-readable name supplied when the preview was started. | 8.49.0 |
2368
+ | **`source`** | <code>string</code> | Metadata source label supplied when the preview was started. | 8.49.0 |
2369
+ | **`appId`** | <code>string</code> | Preview app id, when the session uses an app id override. | 8.49.0 |
2370
+ | **`payloadUrl`** | <code>string</code> | Payload URL used to refresh this preview. | 8.49.0 |
2371
+ | **`createdAt`** | <code>string</code> | ISO timestamp for when this preview was first saved. | 8.49.0 |
2372
+ | **`updatedAt`** | <code>string</code> | ISO timestamp for the last metadata or bundle update. | 8.49.0 |
2373
+ | **`lastUsedAt`** | <code>string</code> | ISO timestamp for the last time this preview was activated. | 8.49.0 |
2374
+ | **`isActive`** | <code>boolean</code> | Whether this preview is the currently active bundle in a preview session. | 8.49.0 |
2375
+
2376
+
2377
+ ##### DeletePreviewResult
2378
+
2379
+ | Prop | Type | Description | Since |
2380
+ | ------------- | -------------------- | ------------------------------------------------ | ------ |
2381
+ | **`removed`** | <code>boolean</code> | Whether preview metadata was removed. | 8.49.0 |
2382
+ | **`deleted`** | <code>boolean</code> | Whether the underlying local bundle was deleted. | 8.49.0 |
2383
+
2384
+
2385
+ ##### PreviewUpdateResult
2386
+
2387
+ | Prop | Type | Description | Since |
2388
+ | ------------------- | --------------------------------------------------- | --------------------------------------------------------------------- | ------ |
2389
+ | **`preview`** | <code><a href="#previewinfo">PreviewInfo</a></code> | Saved preview metadata after the check or update. | 8.49.0 |
2390
+ | **`latestVersion`** | <code>string</code> | Latest version returned by the preview payload endpoint. | 8.49.0 |
2391
+ | **`upToDate`** | <code>boolean</code> | Whether the saved preview already matches the latest payload version. | 8.49.0 |
2392
+ | **`updated`** | <code>boolean</code> | Whether a newer bundle was downloaded and saved. | 8.49.0 |
2393
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | New bundle when {@link updatePreview} downloaded one. | 8.49.0 |
2215
2394
 
2216
2395
 
2217
2396
  ##### BundleListResult
@@ -2554,10 +2733,9 @@ State information for flexible update progress (Android only).
2554
2733
 
2555
2734
  ##### SetShakeMenuOptions
2556
2735
 
2557
- | Prop | Type | Description | Default |
2558
- | ------------- | ------------------------------------------------------------- | ----------------------------------------------------- | -------------------- |
2559
- | **`enabled`** | <code>boolean</code> | | |
2560
- | **`gesture`** | <code><a href="#shakemenugesture">ShakeMenuGesture</a></code> | Native gesture used to open the preview/channel menu. | <code>'shake'</code> |
2736
+ | Prop | Type |
2737
+ | ------------- | -------------------- |
2738
+ | **`enabled`** | <code>boolean</code> |
2561
2739
 
2562
2740
 
2563
2741
  ##### ShakeMenuEnabled