@selfhelp/shared 1.15.0 → 1.15.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/CHANGELOG.md CHANGED
@@ -9,7 +9,55 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
9
9
 
10
10
  This project follows semantic versioning.
11
11
 
12
- ## v1.15.0
12
+ ## v1.15.1
13
+
14
+ Mobile preview RN/Expo provenance parity **plus the CMS-driven mobile-preview
15
+ update contract**. Promotes the React Native / Expo SDK versions to **top-level**
16
+ canonical fields on the mobile-preview release descriptor and adds the matching
17
+ plugin-compatibility axes, so the SelfHelp Manager's dual-axis plugin gate reads
18
+ one canonical location across every repo (mobile CI emitter, registry assembler,
19
+ manager schema). It also adds the System-Maintenance contracts that let the CMS
20
+ show the provisioned preview version and request a compatible mobile-preview
21
+ update/enable (mirroring the frontend-only update flow). All additions are
22
+ additive (optional fields / new types / a widened union arm), so `^1.14.25`
23
+ consumers are unaffected.
24
+
25
+ ### Added (additive, non-breaking)
26
+
27
+ - **Mobile-preview update flow contracts** (`types/api/system.ts`):
28
+ `SYSTEM_ENDPOINTS.UPDATE_MOBILE_PREVIEW_{RELEASES,PREFLIGHT,REQUEST}`, the
29
+ `IMobilePreviewUpdateRequest` body, and the `IMobilePreviewUpdate{Releases,
30
+ Preflight,Request}Response` aliases — the CMS analogue of the frontend-only
31
+ update surface. Requesting a preview onto an instance that has none doubles as
32
+ the enable/bootstrap path the SelfHelp Manager provisions.
33
+ - **`ISystemVersion.mobile_preview_version`** — the provisioned
34
+ `selfhelp-mobile-preview` image version surfaced in System Maintenance
35
+ (`unknown` until the manager stamps `SELFHELP_MOBILE_PREVIEW_VERSION`,
36
+ `not_installed` when no preview is provisioned).
37
+ - **`IUpdateStatus.target_mobile_preview_version`** — the targeted preview
38
+ version for a `mobile-preview`-kind operation (`null` otherwise).
39
+
40
+ ### Changed (additive, non-breaking)
41
+
42
+ - **`TUpdateKind` widened to include `'mobile-preview'`** (`types/api/system.ts`)
43
+ alongside `'core' | 'frontend'`, and **`ICompatibilityError.component`** gains
44
+ the `'mobile-preview'` arm so the standardized compatibility-error object can
45
+ describe a preview ⇄ core block. Existing `'core' | 'frontend'` consumers keep
46
+ working (the new arm is only emitted for preview operations).
47
+
48
+ - **`MobilePreviewRelease.reactNativeVersion?` + `.expoSdkVersion?`**
49
+ (`types/distribution.ts`) — the canonical top-level React Native / Expo SDK
50
+ versions the image was built with, mirroring the registry
51
+ `mobile-preview-release.schema.json` and the manager's internal schema. The
52
+ existing `builtFrom.{reactNative,expoSdk}` stay as raw build provenance; the
53
+ manager gates a plugin's RN/Expo range against the top-level values.
54
+ - **`PluginRelease.compatibility.reactNative?` + `.expoSdk?`**
55
+ (`types/distribution.ts`) — the RN/Expo runtime axes a plugin's native bundle
56
+ targets, gated against the resolved preview image's `reactNativeVersion` /
57
+ `expoSdkVersion` (parallel to the existing `compatibility.mobile` renderer
58
+ axis; web-only plugins omit all three).
59
+
60
+ ## v1.14.25
13
61
 
14
62
  Mobile preview service contracts. Adds the cross-repo types for the new
15
63
  `selfhelp-mobile-preview` image + the CMS mobile preview session auth surface,
package/dist/index.d.mts CHANGED
@@ -396,9 +396,17 @@ declare const SYSTEM_ENDPOINTS: {
396
396
  readonly UPDATE_FRONTEND_RELEASES: "/cms-api/v1/admin/system/update/frontend/releases";
397
397
  readonly UPDATE_FRONTEND_PREFLIGHT: "/cms-api/v1/admin/system/update/frontend/preflight";
398
398
  readonly UPDATE_FRONTEND_REQUEST: "/cms-api/v1/admin/system/update/frontend/request";
399
+ readonly UPDATE_MOBILE_PREVIEW_RELEASES: "/cms-api/v1/admin/system/update/mobile-preview/releases";
400
+ readonly UPDATE_MOBILE_PREVIEW_PREFLIGHT: "/cms-api/v1/admin/system/update/mobile-preview/preflight";
401
+ readonly UPDATE_MOBILE_PREVIEW_REQUEST: "/cms-api/v1/admin/system/update/mobile-preview/request";
399
402
  };
400
- /** Discriminates a core (full-stack) update from a frontend-only update. */
401
- type TUpdateKind = 'core' | 'frontend';
403
+ /**
404
+ * Discriminates a core (full-stack) update from the stateless component-only
405
+ * swaps. `frontend` swaps the Next.js image; `mobile-preview` swaps the
406
+ * `selfhelp-mobile-preview` web image. Both are lightweight (no DB migration,
407
+ * no backup) and performed by the SelfHelp Manager.
408
+ */
409
+ type TUpdateKind = 'core' | 'frontend' | 'mobile-preview';
402
410
  interface ISystemInstalledPlugin {
403
411
  id: string;
404
412
  version: string;
@@ -416,6 +424,16 @@ interface ISystemVersion {
416
424
  selfhelp_version: string;
417
425
  backend_version: string;
418
426
  frontend_version: string;
427
+ /**
428
+ * The provisioned `selfhelp-mobile-preview` web image version reported by the
429
+ * backend (set by the SelfHelp Manager via `SELFHELP_MOBILE_PREVIEW_VERSION`
430
+ * when it provisions/updates the service). `unknown` until the manager stamps
431
+ * it; `not_installed` when no preview service is provisioned for this
432
+ * instance (e.g. an instance that predates default provisioning, or a dev
433
+ * source checkout). The page-editor preview panel additionally probes the
434
+ * running image's `version.json` for the live value.
435
+ */
436
+ mobile_preview_version: string;
419
437
  plugin_api_version: string;
420
438
  database_migration_version: string;
421
439
  deployment: TSystemDeployment;
@@ -552,7 +570,7 @@ interface IUpdatePreflightCheck {
552
570
  * and the plugin-specific `pinned` affordance). Snake_case is the wire contract.
553
571
  */
554
572
  interface ICompatibilityError {
555
- component: 'core' | 'frontend' | 'plugin';
573
+ component: 'core' | 'frontend' | 'mobile-preview' | 'plugin';
556
574
  component_id: string;
557
575
  current_version: string | null;
558
576
  target_version: string | null;
@@ -659,6 +677,11 @@ interface IUpdateStatus {
659
677
  * for the synthetic `idle` status.
660
678
  */
661
679
  target_frontend_version: string | null;
680
+ /**
681
+ * The mobile-preview image version a `mobile-preview`-kind operation targets;
682
+ * `null` for core/frontend operations and the synthetic `idle` status.
683
+ */
684
+ target_mobile_preview_version: string | null;
662
685
  progress_percent: number;
663
686
  steps: IUpdateStep[];
664
687
  requested_at: string;
@@ -716,6 +739,52 @@ type IFrontendUpdateRequestResponse = IBaseApiResponse<{
716
739
  kind: 'frontend';
717
740
  target_frontend_version: string;
718
741
  }>;
742
+ /**
743
+ * POST /admin/system/update/mobile-preview/request — request a MOBILE-PREVIEW
744
+ * update for THIS instance. Like {@link IFrontendUpdateRequest} it carries no
745
+ * `instance_id` (the backend derives + verifies it) and no
746
+ * `accepted_migration_risk` (a preview swap is stateless). Requesting it onto an
747
+ * instance that has no preview yet is also the enable/bootstrap path: the
748
+ * SelfHelp Manager provisions the `selfhelp-mobile-preview` service. The manager
749
+ * re-resolves the signed release and is the final authority on compatibility +
750
+ * signatures + image digests before it swaps the container.
751
+ */
752
+ interface IMobilePreviewUpdateRequest {
753
+ target_version: string;
754
+ preflight_id: string;
755
+ }
756
+ /**
757
+ * GET /admin/system/update/mobile-preview/releases — mobile-preview image
758
+ * versions published in the official registry (newest first). Reuses
759
+ * {@link IUpdateReleases}: `current_version` is the instance's provisioned
760
+ * preview version (or `not_installed`) and `available: false` means the registry
761
+ * was unreachable (fall back to manual entry). Aliased for call-site clarity.
762
+ */
763
+ type IMobilePreviewUpdateReleases = IUpdateReleases;
764
+ type IMobilePreviewUpdateReleasesResponse = IUpdateReleasesResponse;
765
+ /**
766
+ * GET /admin/system/update/mobile-preview/preflight — compatibility verdict for
767
+ * a mobile-preview target. Reuses {@link IUpdatePreflight}; the preview is
768
+ * stateless so `database.destructive`/`requires_backup` are always false. The
769
+ * preview ⇄ core compatibility rule IS evaluated here (as a
770
+ * `mobile_preview_compatibility` check) against the same signed registry
771
+ * metadata the SelfHelp Manager resolves — the running core must satisfy the
772
+ * target preview's `backendCompatibility.requiredCoreRange` — so the CMS verdict
773
+ * matches the manager's instead of always reporting "OK". The manager still
774
+ * re-verifies signatures + image digests and re-runs the per-plugin RN/Expo
775
+ * twin-axis gate at execution and remains the final authority. Aliased for
776
+ * call-site clarity.
777
+ */
778
+ type IMobilePreviewUpdatePreflight = IUpdatePreflight;
779
+ type IMobilePreviewUpdatePreflightResponse = IUpdatePreflightResponse;
780
+ /** POST /admin/system/update/mobile-preview/request — accepted record. */
781
+ type IMobilePreviewUpdateRequestResponse = IBaseApiResponse<{
782
+ operation_id: string;
783
+ instance_id: string;
784
+ status: TUpdateOperationStatus;
785
+ kind: 'mobile-preview';
786
+ target_mobile_preview_version: string;
787
+ }>;
719
788
 
720
789
  /**
721
790
  * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
@@ -1133,6 +1202,17 @@ interface MobilePreviewRelease {
1133
1202
  backendCompatibility: ServiceBackendCompatibility;
1134
1203
  /** Mobile renderer contract version advertised by this image (semver). */
1135
1204
  mobileRendererVersion: string;
1205
+ /**
1206
+ * React Native version the preview image was built with. Top-level canonical
1207
+ * value the SelfHelp Manager gates a plugin's `compatibility.reactNative`
1208
+ * range against (the `builtFrom.reactNative` provenance field mirrors it).
1209
+ */
1210
+ reactNativeVersion?: string;
1211
+ /**
1212
+ * Expo SDK version the preview image was built with. Gated against a plugin's
1213
+ * `compatibility.expoSdk` range (mirrors `builtFrom.expoSdk`).
1214
+ */
1215
+ expoSdkVersion?: string;
1136
1216
  /** Curated plugin mobile packages baked into the image. */
1137
1217
  bundledPlugins: BundledPluginRef[];
1138
1218
  security: SignatureBlock;
@@ -1146,14 +1226,18 @@ interface PluginRelease {
1146
1226
  official: boolean;
1147
1227
  /**
1148
1228
  * Compatibility ranges the host must satisfy. `mobile` (additive) is the
1149
- * NEW mobile-renderer axis: the range of host `mobileRendererVersion` the
1150
- * plugin's mobile package supports (parallel to `pluginApi`). Absent for
1151
- * web-only plugins.
1229
+ * mobile-renderer axis: the range of host `mobileRendererVersion` the
1230
+ * plugin's mobile package supports (parallel to `pluginApi`). `reactNative`
1231
+ * and `expoSdk` (additive) are gated against the resolved
1232
+ * `selfhelp-mobile-preview` image's `reactNativeVersion` / `expoSdkVersion`.
1233
+ * All three are absent for web-only plugins.
1152
1234
  */
1153
1235
  compatibility: {
1154
1236
  core: string;
1155
1237
  pluginApi: string;
1156
1238
  mobile?: string;
1239
+ reactNative?: string;
1240
+ expoSdk?: string;
1157
1241
  };
1158
1242
  dependencies?: {
1159
1243
  plugins: {
@@ -1810,4 +1894,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1810
1894
  */
1811
1895
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1812
1896
 
1813
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, parseInlineRich, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
1897
+ export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, parseInlineRich, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
package/dist/index.d.ts CHANGED
@@ -396,9 +396,17 @@ declare const SYSTEM_ENDPOINTS: {
396
396
  readonly UPDATE_FRONTEND_RELEASES: "/cms-api/v1/admin/system/update/frontend/releases";
397
397
  readonly UPDATE_FRONTEND_PREFLIGHT: "/cms-api/v1/admin/system/update/frontend/preflight";
398
398
  readonly UPDATE_FRONTEND_REQUEST: "/cms-api/v1/admin/system/update/frontend/request";
399
+ readonly UPDATE_MOBILE_PREVIEW_RELEASES: "/cms-api/v1/admin/system/update/mobile-preview/releases";
400
+ readonly UPDATE_MOBILE_PREVIEW_PREFLIGHT: "/cms-api/v1/admin/system/update/mobile-preview/preflight";
401
+ readonly UPDATE_MOBILE_PREVIEW_REQUEST: "/cms-api/v1/admin/system/update/mobile-preview/request";
399
402
  };
400
- /** Discriminates a core (full-stack) update from a frontend-only update. */
401
- type TUpdateKind = 'core' | 'frontend';
403
+ /**
404
+ * Discriminates a core (full-stack) update from the stateless component-only
405
+ * swaps. `frontend` swaps the Next.js image; `mobile-preview` swaps the
406
+ * `selfhelp-mobile-preview` web image. Both are lightweight (no DB migration,
407
+ * no backup) and performed by the SelfHelp Manager.
408
+ */
409
+ type TUpdateKind = 'core' | 'frontend' | 'mobile-preview';
402
410
  interface ISystemInstalledPlugin {
403
411
  id: string;
404
412
  version: string;
@@ -416,6 +424,16 @@ interface ISystemVersion {
416
424
  selfhelp_version: string;
417
425
  backend_version: string;
418
426
  frontend_version: string;
427
+ /**
428
+ * The provisioned `selfhelp-mobile-preview` web image version reported by the
429
+ * backend (set by the SelfHelp Manager via `SELFHELP_MOBILE_PREVIEW_VERSION`
430
+ * when it provisions/updates the service). `unknown` until the manager stamps
431
+ * it; `not_installed` when no preview service is provisioned for this
432
+ * instance (e.g. an instance that predates default provisioning, or a dev
433
+ * source checkout). The page-editor preview panel additionally probes the
434
+ * running image's `version.json` for the live value.
435
+ */
436
+ mobile_preview_version: string;
419
437
  plugin_api_version: string;
420
438
  database_migration_version: string;
421
439
  deployment: TSystemDeployment;
@@ -552,7 +570,7 @@ interface IUpdatePreflightCheck {
552
570
  * and the plugin-specific `pinned` affordance). Snake_case is the wire contract.
553
571
  */
554
572
  interface ICompatibilityError {
555
- component: 'core' | 'frontend' | 'plugin';
573
+ component: 'core' | 'frontend' | 'mobile-preview' | 'plugin';
556
574
  component_id: string;
557
575
  current_version: string | null;
558
576
  target_version: string | null;
@@ -659,6 +677,11 @@ interface IUpdateStatus {
659
677
  * for the synthetic `idle` status.
660
678
  */
661
679
  target_frontend_version: string | null;
680
+ /**
681
+ * The mobile-preview image version a `mobile-preview`-kind operation targets;
682
+ * `null` for core/frontend operations and the synthetic `idle` status.
683
+ */
684
+ target_mobile_preview_version: string | null;
662
685
  progress_percent: number;
663
686
  steps: IUpdateStep[];
664
687
  requested_at: string;
@@ -716,6 +739,52 @@ type IFrontendUpdateRequestResponse = IBaseApiResponse<{
716
739
  kind: 'frontend';
717
740
  target_frontend_version: string;
718
741
  }>;
742
+ /**
743
+ * POST /admin/system/update/mobile-preview/request — request a MOBILE-PREVIEW
744
+ * update for THIS instance. Like {@link IFrontendUpdateRequest} it carries no
745
+ * `instance_id` (the backend derives + verifies it) and no
746
+ * `accepted_migration_risk` (a preview swap is stateless). Requesting it onto an
747
+ * instance that has no preview yet is also the enable/bootstrap path: the
748
+ * SelfHelp Manager provisions the `selfhelp-mobile-preview` service. The manager
749
+ * re-resolves the signed release and is the final authority on compatibility +
750
+ * signatures + image digests before it swaps the container.
751
+ */
752
+ interface IMobilePreviewUpdateRequest {
753
+ target_version: string;
754
+ preflight_id: string;
755
+ }
756
+ /**
757
+ * GET /admin/system/update/mobile-preview/releases — mobile-preview image
758
+ * versions published in the official registry (newest first). Reuses
759
+ * {@link IUpdateReleases}: `current_version` is the instance's provisioned
760
+ * preview version (or `not_installed`) and `available: false` means the registry
761
+ * was unreachable (fall back to manual entry). Aliased for call-site clarity.
762
+ */
763
+ type IMobilePreviewUpdateReleases = IUpdateReleases;
764
+ type IMobilePreviewUpdateReleasesResponse = IUpdateReleasesResponse;
765
+ /**
766
+ * GET /admin/system/update/mobile-preview/preflight — compatibility verdict for
767
+ * a mobile-preview target. Reuses {@link IUpdatePreflight}; the preview is
768
+ * stateless so `database.destructive`/`requires_backup` are always false. The
769
+ * preview ⇄ core compatibility rule IS evaluated here (as a
770
+ * `mobile_preview_compatibility` check) against the same signed registry
771
+ * metadata the SelfHelp Manager resolves — the running core must satisfy the
772
+ * target preview's `backendCompatibility.requiredCoreRange` — so the CMS verdict
773
+ * matches the manager's instead of always reporting "OK". The manager still
774
+ * re-verifies signatures + image digests and re-runs the per-plugin RN/Expo
775
+ * twin-axis gate at execution and remains the final authority. Aliased for
776
+ * call-site clarity.
777
+ */
778
+ type IMobilePreviewUpdatePreflight = IUpdatePreflight;
779
+ type IMobilePreviewUpdatePreflightResponse = IUpdatePreflightResponse;
780
+ /** POST /admin/system/update/mobile-preview/request — accepted record. */
781
+ type IMobilePreviewUpdateRequestResponse = IBaseApiResponse<{
782
+ operation_id: string;
783
+ instance_id: string;
784
+ status: TUpdateOperationStatus;
785
+ kind: 'mobile-preview';
786
+ target_mobile_preview_version: string;
787
+ }>;
719
788
 
720
789
  /**
721
790
  * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
@@ -1133,6 +1202,17 @@ interface MobilePreviewRelease {
1133
1202
  backendCompatibility: ServiceBackendCompatibility;
1134
1203
  /** Mobile renderer contract version advertised by this image (semver). */
1135
1204
  mobileRendererVersion: string;
1205
+ /**
1206
+ * React Native version the preview image was built with. Top-level canonical
1207
+ * value the SelfHelp Manager gates a plugin's `compatibility.reactNative`
1208
+ * range against (the `builtFrom.reactNative` provenance field mirrors it).
1209
+ */
1210
+ reactNativeVersion?: string;
1211
+ /**
1212
+ * Expo SDK version the preview image was built with. Gated against a plugin's
1213
+ * `compatibility.expoSdk` range (mirrors `builtFrom.expoSdk`).
1214
+ */
1215
+ expoSdkVersion?: string;
1136
1216
  /** Curated plugin mobile packages baked into the image. */
1137
1217
  bundledPlugins: BundledPluginRef[];
1138
1218
  security: SignatureBlock;
@@ -1146,14 +1226,18 @@ interface PluginRelease {
1146
1226
  official: boolean;
1147
1227
  /**
1148
1228
  * Compatibility ranges the host must satisfy. `mobile` (additive) is the
1149
- * NEW mobile-renderer axis: the range of host `mobileRendererVersion` the
1150
- * plugin's mobile package supports (parallel to `pluginApi`). Absent for
1151
- * web-only plugins.
1229
+ * mobile-renderer axis: the range of host `mobileRendererVersion` the
1230
+ * plugin's mobile package supports (parallel to `pluginApi`). `reactNative`
1231
+ * and `expoSdk` (additive) are gated against the resolved
1232
+ * `selfhelp-mobile-preview` image's `reactNativeVersion` / `expoSdkVersion`.
1233
+ * All three are absent for web-only plugins.
1152
1234
  */
1153
1235
  compatibility: {
1154
1236
  core: string;
1155
1237
  pluginApi: string;
1156
1238
  mobile?: string;
1239
+ reactNative?: string;
1240
+ expoSdk?: string;
1157
1241
  };
1158
1242
  dependencies?: {
1159
1243
  plugins: {
@@ -1810,4 +1894,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1810
1894
  */
1811
1895
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1812
1896
 
1813
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, parseInlineRich, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
1897
+ export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, TMobileSelectPresentation, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, hasInlineFormatting, parseInlineRich, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
package/dist/index.js CHANGED
@@ -189,7 +189,17 @@ var SYSTEM_ENDPOINTS = {
189
189
  // is stateless — no destructive migration, no backup).
190
190
  UPDATE_FRONTEND_RELEASES: `${SYSTEM_PREFIX}/update/frontend/releases`,
191
191
  UPDATE_FRONTEND_PREFLIGHT: `${SYSTEM_PREFIX}/update/frontend/preflight`,
192
- UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`
192
+ UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`,
193
+ // Mobile-preview update flow. The `selfhelp-mobile-preview` web image is
194
+ // provisioned with every install and ships independently of the core (like
195
+ // the frontend), so an instance can move it to a newer compatible version on
196
+ // its own. These reuse the core preflight/releases response shapes; the
197
+ // request body omits `accepted_migration_risk` (a preview swap is stateless).
198
+ // Requesting one onto an instance that never had it doubles as the
199
+ // enable/bootstrap path (the SelfHelp Manager provisions it).
200
+ UPDATE_MOBILE_PREVIEW_RELEASES: `${SYSTEM_PREFIX}/update/mobile-preview/releases`,
201
+ UPDATE_MOBILE_PREVIEW_PREFLIGHT: `${SYSTEM_PREFIX}/update/mobile-preview/preflight`,
202
+ UPDATE_MOBILE_PREVIEW_REQUEST: `${SYSTEM_PREFIX}/update/mobile-preview/request`
193
203
  };
194
204
 
195
205
  // src/types/api/mobile-preview.ts
package/dist/index.mjs CHANGED
@@ -68,7 +68,17 @@ var SYSTEM_ENDPOINTS = {
68
68
  // is stateless — no destructive migration, no backup).
69
69
  UPDATE_FRONTEND_RELEASES: `${SYSTEM_PREFIX}/update/frontend/releases`,
70
70
  UPDATE_FRONTEND_PREFLIGHT: `${SYSTEM_PREFIX}/update/frontend/preflight`,
71
- UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`
71
+ UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`,
72
+ // Mobile-preview update flow. The `selfhelp-mobile-preview` web image is
73
+ // provisioned with every install and ships independently of the core (like
74
+ // the frontend), so an instance can move it to a newer compatible version on
75
+ // its own. These reuse the core preflight/releases response shapes; the
76
+ // request body omits `accepted_migration_risk` (a preview swap is stateless).
77
+ // Requesting one onto an instance that never had it doubles as the
78
+ // enable/bootstrap path (the SelfHelp Manager provisions it).
79
+ UPDATE_MOBILE_PREVIEW_RELEASES: `${SYSTEM_PREFIX}/update/mobile-preview/releases`,
80
+ UPDATE_MOBILE_PREVIEW_PREFLIGHT: `${SYSTEM_PREFIX}/update/mobile-preview/preflight`,
81
+ UPDATE_MOBILE_PREVIEW_REQUEST: `${SYSTEM_PREFIX}/update/mobile-preview/request`
72
82
  };
73
83
 
74
84
  // src/types/api/mobile-preview.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,6 +11,10 @@ import {
11
11
  type IFrontendUpdateRequest,
12
12
  type IFrontendUpdateRequestResponse,
13
13
  type IMaintenanceSetRequest,
14
+ type IMobilePreviewUpdatePreflight,
15
+ type IMobilePreviewUpdateReleases,
16
+ type IMobilePreviewUpdateRequest,
17
+ type IMobilePreviewUpdateRequestResponse,
14
18
  type ISystemAdvisories,
15
19
  type ISystemAdvisoriesResponse,
16
20
  type ISystemAdvisory,
@@ -159,6 +163,7 @@ describe('system maintenance contracts', () => {
159
163
  selfhelp_version: '1.4.0',
160
164
  backend_version: '1.4.0',
161
165
  frontend_version: '1.4.0',
166
+ mobile_preview_version: '0.2.0',
162
167
  plugin_api_version: '2.1',
163
168
  database_migration_version: 'Version20260605081254',
164
169
  safe_mode: false,
@@ -183,6 +188,7 @@ describe('system maintenance contracts', () => {
183
188
  kind: 'core',
184
189
  target_version: '1.5.0',
185
190
  target_frontend_version: null,
191
+ target_mobile_preview_version: null,
186
192
  progress_percent: 42,
187
193
  steps: [{ name: 'backup', status: 'succeeded' }],
188
194
  requested_at: '2026-06-08T00:00:00Z',
@@ -248,6 +254,7 @@ describe('system maintenance contracts', () => {
248
254
  kind: 'core',
249
255
  target_version: '8.0.1',
250
256
  target_frontend_version: null,
257
+ target_mobile_preview_version: null,
251
258
  progress_percent: 100,
252
259
  steps: [],
253
260
  requested_at: '2026-06-08T00:00:00Z',
@@ -290,6 +297,7 @@ describe('system maintenance contracts', () => {
290
297
  kind: 'core',
291
298
  target_version: '8.0.1',
292
299
  target_frontend_version: null,
300
+ target_mobile_preview_version: null,
293
301
  progress_percent: 100,
294
302
  steps: [{ name: 'migrate', status: 'succeeded' }],
295
303
  requested_at: '2026-06-08T00:00:00Z',
@@ -380,4 +388,79 @@ describe('system maintenance contracts', () => {
380
388
  expect(accepted.data.kind).toBe('frontend');
381
389
  expect(accepted.data.target_frontend_version).toBe('0.1.7');
382
390
  });
391
+
392
+ it('exposes the mobile-preview update endpoints under the system prefix', () => {
393
+ expect(SYSTEM_ENDPOINTS.UPDATE_MOBILE_PREVIEW_RELEASES).toBe(
394
+ '/cms-api/v1/admin/system/update/mobile-preview/releases',
395
+ );
396
+ expect(SYSTEM_ENDPOINTS.UPDATE_MOBILE_PREVIEW_PREFLIGHT).toBe(
397
+ '/cms-api/v1/admin/system/update/mobile-preview/preflight',
398
+ );
399
+ expect(SYSTEM_ENDPOINTS.UPDATE_MOBILE_PREVIEW_REQUEST).toBe(
400
+ '/cms-api/v1/admin/system/update/mobile-preview/request',
401
+ );
402
+ });
403
+
404
+ it('models the mobile-preview update flow (stateless swap + core-compat verdict)', () => {
405
+ // mobile-preview is a first-class update kind alongside core/frontend.
406
+ const kinds: TUpdateKind[] = ['core', 'frontend', 'mobile-preview'];
407
+ expect(kinds).toContain('mobile-preview');
408
+
409
+ const releases: IMobilePreviewUpdateReleases = {
410
+ available: true,
411
+ current_version: 'not_installed',
412
+ releases: [
413
+ { version: '0.2.1', channel: 'stable', blocked: false },
414
+ { version: '0.2.0', channel: 'stable', blocked: false },
415
+ ],
416
+ };
417
+
418
+ const preflight: IMobilePreviewUpdatePreflight = {
419
+ preflight_id: 'mp-pf-001',
420
+ status: 'ok',
421
+ instance_id: 'inst-a',
422
+ current_version: 'not_installed',
423
+ target_version: '0.2.1',
424
+ // The preview ⇄ core rule is evaluated server-side against signed
425
+ // registry metadata, so the CMS verdict matches the manager's.
426
+ checks: [
427
+ {
428
+ code: 'mobile_preview_compatibility',
429
+ severity: 'info',
430
+ message: 'Core 0.1.19 satisfies the target preview required core range.',
431
+ component: 'mobile-preview',
432
+ },
433
+ ],
434
+ options: [{ type: 'mobile-preview', version: '0.2.1', label: 'SelfHelp mobile preview 0.2.1' }],
435
+ // The preview image is stateless: a swap is never destructive.
436
+ database: { destructive: false, requires_backup: false, manual_confirmation_required: false },
437
+ rollback: { automatic_before_migrations: true, automatic_after_destructive_migrations: true },
438
+ };
439
+
440
+ // No accepted_migration_risk: a preview swap is stateless. Requesting it
441
+ // onto a not_installed instance doubles as the enable/bootstrap path.
442
+ const request: IMobilePreviewUpdateRequest = { target_version: '0.2.1', preflight_id: 'mp-pf-001' };
443
+
444
+ const accepted: IMobilePreviewUpdateRequestResponse = {
445
+ status: 202,
446
+ message: 'Accepted',
447
+ error: null,
448
+ logged_in: true,
449
+ meta: { version: 'v1', timestamp: '2026-06-23T00:00:00Z' },
450
+ data: {
451
+ operation_id: 'op-mp-1',
452
+ instance_id: 'inst-a',
453
+ status: 'requested',
454
+ kind: 'mobile-preview',
455
+ target_mobile_preview_version: '0.2.1',
456
+ },
457
+ };
458
+
459
+ expect(releases.current_version).toBe('not_installed');
460
+ expect(preflight.checks[0]?.component).toBe('mobile-preview');
461
+ expect(preflight.database.requires_backup).toBe(false);
462
+ expect(request.target_version).toBe('0.2.1');
463
+ expect(accepted.data.kind).toBe('mobile-preview');
464
+ expect(accepted.data.target_mobile_preview_version).toBe('0.2.1');
465
+ });
383
466
  });
@@ -35,10 +35,25 @@ export const SYSTEM_ENDPOINTS = {
35
35
  UPDATE_FRONTEND_RELEASES: `${SYSTEM_PREFIX}/update/frontend/releases`,
36
36
  UPDATE_FRONTEND_PREFLIGHT: `${SYSTEM_PREFIX}/update/frontend/preflight`,
37
37
  UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`,
38
+ // Mobile-preview update flow. The `selfhelp-mobile-preview` web image is
39
+ // provisioned with every install and ships independently of the core (like
40
+ // the frontend), so an instance can move it to a newer compatible version on
41
+ // its own. These reuse the core preflight/releases response shapes; the
42
+ // request body omits `accepted_migration_risk` (a preview swap is stateless).
43
+ // Requesting one onto an instance that never had it doubles as the
44
+ // enable/bootstrap path (the SelfHelp Manager provisions it).
45
+ UPDATE_MOBILE_PREVIEW_RELEASES: `${SYSTEM_PREFIX}/update/mobile-preview/releases`,
46
+ UPDATE_MOBILE_PREVIEW_PREFLIGHT: `${SYSTEM_PREFIX}/update/mobile-preview/preflight`,
47
+ UPDATE_MOBILE_PREVIEW_REQUEST: `${SYSTEM_PREFIX}/update/mobile-preview/request`,
38
48
  } as const;
39
49
 
40
- /** Discriminates a core (full-stack) update from a frontend-only update. */
41
- export type TUpdateKind = 'core' | 'frontend';
50
+ /**
51
+ * Discriminates a core (full-stack) update from the stateless component-only
52
+ * swaps. `frontend` swaps the Next.js image; `mobile-preview` swaps the
53
+ * `selfhelp-mobile-preview` web image. Both are lightweight (no DB migration,
54
+ * no backup) and performed by the SelfHelp Manager.
55
+ */
56
+ export type TUpdateKind = 'core' | 'frontend' | 'mobile-preview';
42
57
 
43
58
  export interface ISystemInstalledPlugin {
44
59
  id: string;
@@ -59,6 +74,16 @@ export interface ISystemVersion {
59
74
  selfhelp_version: string;
60
75
  backend_version: string;
61
76
  frontend_version: string;
77
+ /**
78
+ * The provisioned `selfhelp-mobile-preview` web image version reported by the
79
+ * backend (set by the SelfHelp Manager via `SELFHELP_MOBILE_PREVIEW_VERSION`
80
+ * when it provisions/updates the service). `unknown` until the manager stamps
81
+ * it; `not_installed` when no preview service is provisioned for this
82
+ * instance (e.g. an instance that predates default provisioning, or a dev
83
+ * source checkout). The page-editor preview panel additionally probes the
84
+ * running image's `version.json` for the live value.
85
+ */
86
+ mobile_preview_version: string;
62
87
  plugin_api_version: string;
63
88
  database_migration_version: string;
64
89
  deployment: TSystemDeployment;
@@ -214,7 +239,7 @@ export interface IUpdatePreflightCheck {
214
239
  * and the plugin-specific `pinned` affordance). Snake_case is the wire contract.
215
240
  */
216
241
  export interface ICompatibilityError {
217
- component: 'core' | 'frontend' | 'plugin';
242
+ component: 'core' | 'frontend' | 'mobile-preview' | 'plugin';
218
243
  component_id: string;
219
244
  current_version: string | null;
220
245
  target_version: string | null;
@@ -347,6 +372,11 @@ export interface IUpdateStatus {
347
372
  * for the synthetic `idle` status.
348
373
  */
349
374
  target_frontend_version: string | null;
375
+ /**
376
+ * The mobile-preview image version a `mobile-preview`-kind operation targets;
377
+ * `null` for core/frontend operations and the synthetic `idle` status.
378
+ */
379
+ target_mobile_preview_version: string | null;
350
380
  progress_percent: number;
351
381
  steps: IUpdateStep[];
352
382
  requested_at: string;
@@ -409,3 +439,53 @@ export type IFrontendUpdateRequestResponse = IBaseApiResponse<{
409
439
  kind: 'frontend';
410
440
  target_frontend_version: string;
411
441
  }>;
442
+
443
+ /**
444
+ * POST /admin/system/update/mobile-preview/request — request a MOBILE-PREVIEW
445
+ * update for THIS instance. Like {@link IFrontendUpdateRequest} it carries no
446
+ * `instance_id` (the backend derives + verifies it) and no
447
+ * `accepted_migration_risk` (a preview swap is stateless). Requesting it onto an
448
+ * instance that has no preview yet is also the enable/bootstrap path: the
449
+ * SelfHelp Manager provisions the `selfhelp-mobile-preview` service. The manager
450
+ * re-resolves the signed release and is the final authority on compatibility +
451
+ * signatures + image digests before it swaps the container.
452
+ */
453
+ export interface IMobilePreviewUpdateRequest {
454
+ target_version: string;
455
+ preflight_id: string;
456
+ }
457
+
458
+ /**
459
+ * GET /admin/system/update/mobile-preview/releases — mobile-preview image
460
+ * versions published in the official registry (newest first). Reuses
461
+ * {@link IUpdateReleases}: `current_version` is the instance's provisioned
462
+ * preview version (or `not_installed`) and `available: false` means the registry
463
+ * was unreachable (fall back to manual entry). Aliased for call-site clarity.
464
+ */
465
+ export type IMobilePreviewUpdateReleases = IUpdateReleases;
466
+ export type IMobilePreviewUpdateReleasesResponse = IUpdateReleasesResponse;
467
+
468
+ /**
469
+ * GET /admin/system/update/mobile-preview/preflight — compatibility verdict for
470
+ * a mobile-preview target. Reuses {@link IUpdatePreflight}; the preview is
471
+ * stateless so `database.destructive`/`requires_backup` are always false. The
472
+ * preview ⇄ core compatibility rule IS evaluated here (as a
473
+ * `mobile_preview_compatibility` check) against the same signed registry
474
+ * metadata the SelfHelp Manager resolves — the running core must satisfy the
475
+ * target preview's `backendCompatibility.requiredCoreRange` — so the CMS verdict
476
+ * matches the manager's instead of always reporting "OK". The manager still
477
+ * re-verifies signatures + image digests and re-runs the per-plugin RN/Expo
478
+ * twin-axis gate at execution and remains the final authority. Aliased for
479
+ * call-site clarity.
480
+ */
481
+ export type IMobilePreviewUpdatePreflight = IUpdatePreflight;
482
+ export type IMobilePreviewUpdatePreflightResponse = IUpdatePreflightResponse;
483
+
484
+ /** POST /admin/system/update/mobile-preview/request — accepted record. */
485
+ export type IMobilePreviewUpdateRequestResponse = IBaseApiResponse<{
486
+ operation_id: string;
487
+ instance_id: string;
488
+ status: TUpdateOperationStatus;
489
+ kind: 'mobile-preview';
490
+ target_mobile_preview_version: string;
491
+ }>;
@@ -390,6 +390,17 @@ export interface MobilePreviewRelease {
390
390
  backendCompatibility: ServiceBackendCompatibility;
391
391
  /** Mobile renderer contract version advertised by this image (semver). */
392
392
  mobileRendererVersion: string;
393
+ /**
394
+ * React Native version the preview image was built with. Top-level canonical
395
+ * value the SelfHelp Manager gates a plugin's `compatibility.reactNative`
396
+ * range against (the `builtFrom.reactNative` provenance field mirrors it).
397
+ */
398
+ reactNativeVersion?: string;
399
+ /**
400
+ * Expo SDK version the preview image was built with. Gated against a plugin's
401
+ * `compatibility.expoSdk` range (mirrors `builtFrom.expoSdk`).
402
+ */
403
+ expoSdkVersion?: string;
393
404
  /** Curated plugin mobile packages baked into the image. */
394
405
  bundledPlugins: BundledPluginRef[];
395
406
  security: SignatureBlock;
@@ -404,11 +415,13 @@ export interface PluginRelease {
404
415
  official: boolean;
405
416
  /**
406
417
  * Compatibility ranges the host must satisfy. `mobile` (additive) is the
407
- * NEW mobile-renderer axis: the range of host `mobileRendererVersion` the
408
- * plugin's mobile package supports (parallel to `pluginApi`). Absent for
409
- * web-only plugins.
418
+ * mobile-renderer axis: the range of host `mobileRendererVersion` the
419
+ * plugin's mobile package supports (parallel to `pluginApi`). `reactNative`
420
+ * and `expoSdk` (additive) are gated against the resolved
421
+ * `selfhelp-mobile-preview` image's `reactNativeVersion` / `expoSdkVersion`.
422
+ * All three are absent for web-only plugins.
410
423
  */
411
- compatibility: { core: string; pluginApi: string; mobile?: string };
424
+ compatibility: { core: string; pluginApi: string; mobile?: string; reactNative?: string; expoSdk?: string };
412
425
  dependencies?: { plugins: { id: string; range: string }[] };
413
426
  artifacts: { manifestUrl: string; archiveUrl: string; sha256: string };
414
427
  security: SignatureBlock;