@selfhelp/shared 1.14.24 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,36 @@ 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
13
+
14
+ Mobile preview service contracts. Adds the cross-repo types for the new
15
+ `selfhelp-mobile-preview` image + the CMS mobile preview session auth surface,
16
+ and introduces the mobile-renderer compatibility axis consumed by the SelfHelp
17
+ Manager preflight. All additions are additive (optional fields / new types), so
18
+ existing consumers are unaffected.
19
+
20
+ ### Added
21
+
22
+ - **`MobilePreviewRelease`** (`types/distribution.ts`) — the
23
+ `selfhelp-mobile-preview-release` descriptor (peer of `FrontendRelease`),
24
+ including `mobileRendererVersion` and the curated `bundledPlugins[]`
25
+ (`BundledPluginRef`).
26
+ - **Preview session DTOs** (`types/api/mobile-preview.ts`) —
27
+ `IMobilePreviewSessionRequest/Response`, `IMobilePreviewExchangeRequest/Response`,
28
+ and `MOBILE_PREVIEW_ENDPOINTS` (admin mint + public exchange).
29
+ - **`MOBILE_RENDERER_VERSION`** constant + **`isMobileRendererCompatible()`**
30
+ helper (`plugin-sdk`) — the mobile renderer contract version a plugin's
31
+ `compatibility.mobile` range targets.
32
+
33
+ ### Changed (additive, non-breaking)
34
+
35
+ - `RegistryIndex.mobilePreview?` + `IPluginRegistry.mobilePreview?` — additive
36
+ release-ref array (registry `schemaVersion` 1.1; older managers ignore it).
37
+ - `InstanceVersions.mobilePreview?`, `InstanceImages.mobilePreview?`,
38
+ `InstanceLock.core.mobilePreviewImageDigest?` — per-instance pin fields.
39
+ - `PluginRelease.compatibility.mobile?`, `IPluginRelease.compatibility.mobile?`,
40
+ and `IPluginManifestCompatibility.mobile?` — the new mobile-renderer axis.
41
+
12
42
  ## v1.14.24
13
43
 
14
44
  Semantic mapper cleanup — remove the legacy `shared_intent` field and related
package/dist/index.d.mts CHANGED
@@ -717,6 +717,66 @@ type IFrontendUpdateRequestResponse = IBaseApiResponse<{
717
717
  target_frontend_version: string;
718
718
  }>;
719
719
 
720
+ /**
721
+ * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
722
+ * web image).
723
+ *
724
+ * Flow: the CMS admin mints a SHORT-LIVED, SINGLE-USE preview code (bound to the
725
+ * admin user + an optional scope). The `selfhelp-mobile-preview` web image
726
+ * exchanges that one-time code for an in-memory, scoped JWT
727
+ * (`purpose: 'mobile_preview'`) used for read-only `/cms-api` calls. The admin
728
+ * JWT is never exposed to the preview iframe.
729
+ *
730
+ * Snake_case is the wire contract (these mirror the backend JSON schemas under
731
+ * `config/schemas/api/v1/{requests,responses}/`).
732
+ */
733
+
734
+ /** Mobile preview session endpoints. */
735
+ declare const MOBILE_PREVIEW_ENDPOINTS: {
736
+ /** Admin-only: mint a one-time preview session code. */
737
+ readonly SESSION: "/cms-api/v1/admin/mobile-preview/session";
738
+ /** Public: exchange a one-time code for a scoped preview JWT. */
739
+ readonly EXCHANGE: "/cms-api/v1/mobile-preview/session/exchange";
740
+ };
741
+ /**
742
+ * POST /admin/mobile-preview/session — mint a one-time preview code. No
743
+ * `instance_id`: the backend derives + verifies the admin server-side. The
744
+ * optional scope is bound into the code and enforced on exchange.
745
+ */
746
+ interface IMobilePreviewSessionRequest {
747
+ /** Page keyword to preview. */
748
+ keyword?: string;
749
+ /** Page id to preview (alternative to `keyword`). */
750
+ page_id?: number;
751
+ /** Language id to render in. */
752
+ language_id?: number;
753
+ /** Whether to preview the unpublished draft version. */
754
+ draft?: boolean;
755
+ }
756
+ interface IMobilePreviewSessionData {
757
+ /** Opaque one-time code (safe in the iframe URL; invalid after exchange). */
758
+ code: string;
759
+ /** ISO-8601 expiry of the one-time code. */
760
+ expires_at: string;
761
+ }
762
+ type IMobilePreviewSessionResponse = IBaseApiResponse<IMobilePreviewSessionData>;
763
+ /**
764
+ * POST /mobile-preview/session/exchange — public route; the one-time code IS the
765
+ * credential. Consumes (deletes) the code and mints a scoped preview JWT.
766
+ */
767
+ interface IMobilePreviewExchangeRequest {
768
+ code: string;
769
+ }
770
+ interface IMobilePreviewExchangeData {
771
+ /** Short-lived scoped JWT (`purpose: 'mobile_preview'`); held in memory only. */
772
+ access_token: string;
773
+ /** Seconds until the scoped token expires. */
774
+ expires_in: number;
775
+ /** The previewed user (the minting admin), for the preview UI. */
776
+ user: IUserData;
777
+ }
778
+ type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
779
+
720
780
  /**
721
781
  * Cross-repo SelfHelp distribution contracts: registry index + release metadata
722
782
  * (core / frontend / scheduler / worker / plugin), security advisories,
@@ -783,6 +843,8 @@ interface InstanceVersions {
783
843
  frontend: string;
784
844
  scheduler: string;
785
845
  worker: string;
846
+ /** Mobile-preview web image version pinned for this instance (additive). */
847
+ mobilePreview?: string;
786
848
  pluginApi: string;
787
849
  }
788
850
  interface InstanceImages {
@@ -793,6 +855,8 @@ interface InstanceImages {
793
855
  mysql: string;
794
856
  redis: string;
795
857
  mercure: string;
858
+ /** Mobile-preview web image reference (additive). */
859
+ mobilePreview?: string;
796
860
  }
797
861
  interface InstanceRouting {
798
862
  publicFrontendUrl: string;
@@ -886,6 +950,8 @@ interface InstanceLock {
886
950
  version: string;
887
951
  backendImageDigest: string;
888
952
  frontendImageDigest: string;
953
+ /** Mobile-preview web image digest pinned for this instance (additive). */
954
+ mobilePreviewImageDigest?: string;
889
955
  schedulerImageDigest: string;
890
956
  workerImageDigest: string;
891
957
  migrationVersion: string;
@@ -920,6 +986,8 @@ interface RegistryIndex {
920
986
  scheduler: RegistryReleaseRef[];
921
987
  worker: RegistryReleaseRef[];
922
988
  plugins: RegistryReleaseRef[];
989
+ /** Mobile-preview web image release refs (additive; older managers ignore). */
990
+ mobilePreview?: RegistryReleaseRef[];
923
991
  advisoriesUrl?: string;
924
992
  compatibilityUrl?: string;
925
993
  trustedKeysUrl?: string;
@@ -1029,15 +1097,63 @@ interface WorkerRelease {
1029
1097
  security: SignatureBlock;
1030
1098
  blocked?: boolean;
1031
1099
  }
1100
+ /**
1101
+ * One plugin mobile package baked into a mobile-preview image at build time.
1102
+ * The preview CI runs `plugins-sync.mjs` against a curated official-plugin set
1103
+ * and records the result here so the manager can compute coverage (which
1104
+ * enabled plugins render natively vs. fall back to open-on-web in the preview)
1105
+ * without inspecting the image.
1106
+ */
1107
+ interface BundledPluginRef {
1108
+ id: string;
1109
+ version: string;
1110
+ mobilePackage: string;
1111
+ mobilePackageVersion: string;
1112
+ }
1113
+ /**
1114
+ * Mobile-preview web image release, resolved/pinned as a first-class artifact
1115
+ * (peer of the frontend release). The image serves the Expo web export at
1116
+ * `/mobile-preview` and proxies a narrow `/mobile-preview/api` allowlist to the
1117
+ * private backend. `mobileRendererVersion` is the mobile renderer contract the
1118
+ * image was built against (what plugin `compatibility.mobile` ranges target);
1119
+ * `bundledPlugins` is the curated official-plugin set baked into the image.
1120
+ */
1121
+ interface MobilePreviewRelease {
1122
+ kind: 'selfhelp-mobile-preview-release';
1123
+ id: string;
1124
+ version: string;
1125
+ channel: ReleaseChannel;
1126
+ image: string;
1127
+ digest: string;
1128
+ builtFrom?: {
1129
+ sharedPackageVersion?: string;
1130
+ expoSdk?: string;
1131
+ reactNative?: string;
1132
+ };
1133
+ backendCompatibility: ServiceBackendCompatibility;
1134
+ /** Mobile renderer contract version advertised by this image (semver). */
1135
+ mobileRendererVersion: string;
1136
+ /** Curated plugin mobile packages baked into the image. */
1137
+ bundledPlugins: BundledPluginRef[];
1138
+ security: SignatureBlock;
1139
+ blocked?: boolean;
1140
+ }
1032
1141
  interface PluginRelease {
1033
1142
  kind: 'selfhelp-plugin-release';
1034
1143
  id: string;
1035
1144
  version: string;
1036
1145
  channel: ReleaseChannel;
1037
1146
  official: boolean;
1147
+ /**
1148
+ * 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.
1152
+ */
1038
1153
  compatibility: {
1039
1154
  core: string;
1040
1155
  pluginApi: string;
1156
+ mobile?: string;
1041
1157
  };
1042
1158
  dependencies?: {
1043
1159
  plugins: {
@@ -1694,4 +1810,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1694
1810
  */
1695
1811
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1696
1812
 
1697
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, 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 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -717,6 +717,66 @@ type IFrontendUpdateRequestResponse = IBaseApiResponse<{
717
717
  target_frontend_version: string;
718
718
  }>;
719
719
 
720
+ /**
721
+ * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
722
+ * web image).
723
+ *
724
+ * Flow: the CMS admin mints a SHORT-LIVED, SINGLE-USE preview code (bound to the
725
+ * admin user + an optional scope). The `selfhelp-mobile-preview` web image
726
+ * exchanges that one-time code for an in-memory, scoped JWT
727
+ * (`purpose: 'mobile_preview'`) used for read-only `/cms-api` calls. The admin
728
+ * JWT is never exposed to the preview iframe.
729
+ *
730
+ * Snake_case is the wire contract (these mirror the backend JSON schemas under
731
+ * `config/schemas/api/v1/{requests,responses}/`).
732
+ */
733
+
734
+ /** Mobile preview session endpoints. */
735
+ declare const MOBILE_PREVIEW_ENDPOINTS: {
736
+ /** Admin-only: mint a one-time preview session code. */
737
+ readonly SESSION: "/cms-api/v1/admin/mobile-preview/session";
738
+ /** Public: exchange a one-time code for a scoped preview JWT. */
739
+ readonly EXCHANGE: "/cms-api/v1/mobile-preview/session/exchange";
740
+ };
741
+ /**
742
+ * POST /admin/mobile-preview/session — mint a one-time preview code. No
743
+ * `instance_id`: the backend derives + verifies the admin server-side. The
744
+ * optional scope is bound into the code and enforced on exchange.
745
+ */
746
+ interface IMobilePreviewSessionRequest {
747
+ /** Page keyword to preview. */
748
+ keyword?: string;
749
+ /** Page id to preview (alternative to `keyword`). */
750
+ page_id?: number;
751
+ /** Language id to render in. */
752
+ language_id?: number;
753
+ /** Whether to preview the unpublished draft version. */
754
+ draft?: boolean;
755
+ }
756
+ interface IMobilePreviewSessionData {
757
+ /** Opaque one-time code (safe in the iframe URL; invalid after exchange). */
758
+ code: string;
759
+ /** ISO-8601 expiry of the one-time code. */
760
+ expires_at: string;
761
+ }
762
+ type IMobilePreviewSessionResponse = IBaseApiResponse<IMobilePreviewSessionData>;
763
+ /**
764
+ * POST /mobile-preview/session/exchange — public route; the one-time code IS the
765
+ * credential. Consumes (deletes) the code and mints a scoped preview JWT.
766
+ */
767
+ interface IMobilePreviewExchangeRequest {
768
+ code: string;
769
+ }
770
+ interface IMobilePreviewExchangeData {
771
+ /** Short-lived scoped JWT (`purpose: 'mobile_preview'`); held in memory only. */
772
+ access_token: string;
773
+ /** Seconds until the scoped token expires. */
774
+ expires_in: number;
775
+ /** The previewed user (the minting admin), for the preview UI. */
776
+ user: IUserData;
777
+ }
778
+ type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
779
+
720
780
  /**
721
781
  * Cross-repo SelfHelp distribution contracts: registry index + release metadata
722
782
  * (core / frontend / scheduler / worker / plugin), security advisories,
@@ -783,6 +843,8 @@ interface InstanceVersions {
783
843
  frontend: string;
784
844
  scheduler: string;
785
845
  worker: string;
846
+ /** Mobile-preview web image version pinned for this instance (additive). */
847
+ mobilePreview?: string;
786
848
  pluginApi: string;
787
849
  }
788
850
  interface InstanceImages {
@@ -793,6 +855,8 @@ interface InstanceImages {
793
855
  mysql: string;
794
856
  redis: string;
795
857
  mercure: string;
858
+ /** Mobile-preview web image reference (additive). */
859
+ mobilePreview?: string;
796
860
  }
797
861
  interface InstanceRouting {
798
862
  publicFrontendUrl: string;
@@ -886,6 +950,8 @@ interface InstanceLock {
886
950
  version: string;
887
951
  backendImageDigest: string;
888
952
  frontendImageDigest: string;
953
+ /** Mobile-preview web image digest pinned for this instance (additive). */
954
+ mobilePreviewImageDigest?: string;
889
955
  schedulerImageDigest: string;
890
956
  workerImageDigest: string;
891
957
  migrationVersion: string;
@@ -920,6 +986,8 @@ interface RegistryIndex {
920
986
  scheduler: RegistryReleaseRef[];
921
987
  worker: RegistryReleaseRef[];
922
988
  plugins: RegistryReleaseRef[];
989
+ /** Mobile-preview web image release refs (additive; older managers ignore). */
990
+ mobilePreview?: RegistryReleaseRef[];
923
991
  advisoriesUrl?: string;
924
992
  compatibilityUrl?: string;
925
993
  trustedKeysUrl?: string;
@@ -1029,15 +1097,63 @@ interface WorkerRelease {
1029
1097
  security: SignatureBlock;
1030
1098
  blocked?: boolean;
1031
1099
  }
1100
+ /**
1101
+ * One plugin mobile package baked into a mobile-preview image at build time.
1102
+ * The preview CI runs `plugins-sync.mjs` against a curated official-plugin set
1103
+ * and records the result here so the manager can compute coverage (which
1104
+ * enabled plugins render natively vs. fall back to open-on-web in the preview)
1105
+ * without inspecting the image.
1106
+ */
1107
+ interface BundledPluginRef {
1108
+ id: string;
1109
+ version: string;
1110
+ mobilePackage: string;
1111
+ mobilePackageVersion: string;
1112
+ }
1113
+ /**
1114
+ * Mobile-preview web image release, resolved/pinned as a first-class artifact
1115
+ * (peer of the frontend release). The image serves the Expo web export at
1116
+ * `/mobile-preview` and proxies a narrow `/mobile-preview/api` allowlist to the
1117
+ * private backend. `mobileRendererVersion` is the mobile renderer contract the
1118
+ * image was built against (what plugin `compatibility.mobile` ranges target);
1119
+ * `bundledPlugins` is the curated official-plugin set baked into the image.
1120
+ */
1121
+ interface MobilePreviewRelease {
1122
+ kind: 'selfhelp-mobile-preview-release';
1123
+ id: string;
1124
+ version: string;
1125
+ channel: ReleaseChannel;
1126
+ image: string;
1127
+ digest: string;
1128
+ builtFrom?: {
1129
+ sharedPackageVersion?: string;
1130
+ expoSdk?: string;
1131
+ reactNative?: string;
1132
+ };
1133
+ backendCompatibility: ServiceBackendCompatibility;
1134
+ /** Mobile renderer contract version advertised by this image (semver). */
1135
+ mobileRendererVersion: string;
1136
+ /** Curated plugin mobile packages baked into the image. */
1137
+ bundledPlugins: BundledPluginRef[];
1138
+ security: SignatureBlock;
1139
+ blocked?: boolean;
1140
+ }
1032
1141
  interface PluginRelease {
1033
1142
  kind: 'selfhelp-plugin-release';
1034
1143
  id: string;
1035
1144
  version: string;
1036
1145
  channel: ReleaseChannel;
1037
1146
  official: boolean;
1147
+ /**
1148
+ * 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.
1152
+ */
1038
1153
  compatibility: {
1039
1154
  core: string;
1040
1155
  pluginApi: string;
1156
+ mobile?: string;
1041
1157
  };
1042
1158
  dependencies?: {
1043
1159
  plugins: {
@@ -1694,4 +1810,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1694
1810
  */
1695
1811
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1696
1812
 
1697
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, 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 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, 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 };
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 };
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ __export(index_exports, {
47
47
  HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
48
48
  LINE_HEIGHT: () => LINE_HEIGHT,
49
49
  LITERAL_CLASSES: () => LITERAL_CLASSES,
50
+ MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
50
51
  PERMISSIONS: () => PERMISSIONS,
51
52
  RADIUS_PX: () => RADIUS_PX,
52
53
  RELEASE_CHANNELS: () => RELEASE_CHANNELS,
@@ -191,6 +192,15 @@ var SYSTEM_ENDPOINTS = {
191
192
  UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`
192
193
  };
193
194
 
195
+ // src/types/api/mobile-preview.ts
196
+ var MOBILE_PREVIEW_PREFIX = "/cms-api/v1";
197
+ var MOBILE_PREVIEW_ENDPOINTS = {
198
+ /** Admin-only: mint a one-time preview session code. */
199
+ SESSION: `${MOBILE_PREVIEW_PREFIX}/admin/mobile-preview/session`,
200
+ /** Public: exchange a one-time code for a scoped preview JWT. */
201
+ EXCHANGE: `${MOBILE_PREVIEW_PREFIX}/mobile-preview/session/exchange`
202
+ };
203
+
194
204
  // src/types/distribution.ts
195
205
  var RELEASE_CHANNELS = ["stable", "beta", "nightly", "test"];
196
206
 
@@ -1521,6 +1531,7 @@ function transformPagesData(pages) {
1521
1531
  HEADER_CLIENT_TYPE,
1522
1532
  LINE_HEIGHT,
1523
1533
  LITERAL_CLASSES,
1534
+ MOBILE_PREVIEW_ENDPOINTS,
1524
1535
  PERMISSIONS,
1525
1536
  RADIUS_PX,
1526
1537
  RELEASE_CHANNELS,
package/dist/index.mjs CHANGED
@@ -71,6 +71,15 @@ var SYSTEM_ENDPOINTS = {
71
71
  UPDATE_FRONTEND_REQUEST: `${SYSTEM_PREFIX}/update/frontend/request`
72
72
  };
73
73
 
74
+ // src/types/api/mobile-preview.ts
75
+ var MOBILE_PREVIEW_PREFIX = "/cms-api/v1";
76
+ var MOBILE_PREVIEW_ENDPOINTS = {
77
+ /** Admin-only: mint a one-time preview session code. */
78
+ SESSION: `${MOBILE_PREVIEW_PREFIX}/admin/mobile-preview/session`,
79
+ /** Public: exchange a one-time code for a scoped preview JWT. */
80
+ EXCHANGE: `${MOBILE_PREVIEW_PREFIX}/mobile-preview/session/exchange`
81
+ };
82
+
74
83
  // src/types/distribution.ts
75
84
  var RELEASE_CHANNELS = ["stable", "beta", "nightly", "test"];
76
85
 
@@ -1400,6 +1409,7 @@ export {
1400
1409
  HEADER_CLIENT_TYPE,
1401
1410
  LINE_HEIGHT,
1402
1411
  LITERAL_CLASSES,
1412
+ MOBILE_PREVIEW_ENDPOINTS,
1403
1413
  PERMISSIONS,
1404
1414
  RADIUS_PX,
1405
1415
  RELEASE_CHANNELS,
@@ -20,6 +20,14 @@ interface IPluginManifestCompatibility {
20
20
  reactNative?: string;
21
21
  /** SemVer range for Expo SDK. */
22
22
  expoSdk?: string;
23
+ /**
24
+ * SemVer range for the host mobile renderer contract
25
+ * (`MOBILE_RENDERER_VERSION`) the plugin's mobile package supports. The
26
+ * SelfHelp Manager gates a plugin's mobile package against the selected
27
+ * `selfhelp-mobile-preview` image's advertised `mobileRendererVersion`.
28
+ * Absent for web-only plugins.
29
+ */
30
+ mobile?: string;
23
31
  }
24
32
  interface IPluginManifestDependency {
25
33
  /** Plugin id this plugin requires. */
@@ -20,6 +20,14 @@ interface IPluginManifestCompatibility {
20
20
  reactNative?: string;
21
21
  /** SemVer range for Expo SDK. */
22
22
  expoSdk?: string;
23
+ /**
24
+ * SemVer range for the host mobile renderer contract
25
+ * (`MOBILE_RENDERER_VERSION`) the plugin's mobile package supports. The
26
+ * SelfHelp Manager gates a plugin's mobile package against the selected
27
+ * `selfhelp-mobile-preview` image's advertised `mobileRendererVersion`.
28
+ * Absent for web-only plugins.
29
+ */
30
+ mobile?: string;
23
31
  }
24
32
  interface IPluginManifestDependency {
25
33
  /** Plugin id this plugin requires. */
@@ -1,4 +1,4 @@
1
- export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-C8sBTLJb.mjs';
1
+ export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.mjs';
2
2
  import { I as IStyleRegistryEntry } from '../styles.registry-4W0LzmZB.mjs';
3
3
  import '../common-qaDIAYS3.mjs';
4
4
 
@@ -15,6 +15,23 @@ import '../common-qaDIAYS3.mjs';
15
15
  * Independent from the npm `version` of `@selfhelp/shared`.
16
16
  */
17
17
  declare const PLUGIN_API_VERSION: "0.1.0";
18
+ /**
19
+ * Mobile renderer contract version. This is the SECOND, mobile-only
20
+ * compatibility axis (independent of `PLUGIN_API_VERSION`): it versions the
21
+ * mobile plugin rendering surface — the `registerMobile()` shape, `IStyleProps`
22
+ * / `TPluginStyleImplMap`, and the mobile host SDK primitives — that a plugin's
23
+ * mobile npm package compiles against.
24
+ *
25
+ * The mobile app and the `selfhelp-mobile-preview` image advertise this value
26
+ * (in `version.json` + the signed `mobile-preview-release.json`). A plugin
27
+ * declares the range it supports in `plugin.json` under `compatibility.mobile`;
28
+ * the SelfHelp Manager gates the plugin against the selected preview image's
29
+ * advertised `mobileRendererVersion` using {@see isMobileRendererCompatible}.
30
+ *
31
+ * Bump rules mirror the SDK contract: patch = additive fix, minor = additive
32
+ * renderer feature, major = breaking mobile renderer change.
33
+ */
34
+ declare const MOBILE_RENDERER_VERSION: "0.1.0";
18
35
  interface ISemver {
19
36
  major: number;
20
37
  minor: number;
@@ -44,6 +61,15 @@ declare function isPluginApiCompatible(required: string, host?: string): boolean
44
61
  * - host minor >= plugin's required minor.
45
62
  */
46
63
  declare function assertPluginApiVersion(required: string): void;
64
+ /**
65
+ * Non-throwing satisfaction check for the mobile-renderer axis: returns true
66
+ * when the host's `mobileRendererVersion` falls inside the plugin's declared
67
+ * `compatibility.mobile` range. Used by the SelfHelp Manager preflight to gate
68
+ * an enabled plugin's mobile package against the selected preview image, and by
69
+ * the mobile/preview runtime to skip an incompatible plugin instead of crashing.
70
+ * An empty/undefined range is treated as "no mobile support declared" → false.
71
+ */
72
+ declare function isMobileRendererCompatible(requiredRange: string | undefined, host?: string): boolean;
47
73
  /**
48
74
  * Throw if the running CMS version is not in the plugin's declared
49
75
  * compatibility range.
@@ -141,6 +167,12 @@ interface IPluginRelease {
141
167
  core: string;
142
168
  /** Semver range of host plugin-API versions this plugin runs on. */
143
169
  pluginApi: string;
170
+ /**
171
+ * Semver range of the host mobile renderer contract
172
+ * (`mobileRendererVersion`) this plugin's mobile package supports.
173
+ * Additive; absent for web-only plugins.
174
+ */
175
+ mobile?: string;
144
176
  };
145
177
  /** Optional other-plugin requirements consumed by the resolver. */
146
178
  dependencies?: {
@@ -194,6 +226,11 @@ interface IPluginRegistry {
194
226
  worker: IRegistryReleaseRef[];
195
227
  /** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
196
228
  plugins: IRegistryReleaseRef[];
229
+ /**
230
+ * Mobile-preview web image release refs (Manager-installed). Additive in
231
+ * registry `schemaVersion` 1.1 — older managers ignore the unknown array.
232
+ */
233
+ mobilePreview?: IRegistryReleaseRef[];
197
234
  /** Optional path to the security advisory feed. */
198
235
  advisoriesUrl?: string;
199
236
  /** Optional path to the cross-component compatibility feed. */
@@ -837,4 +874,4 @@ declare function isPluginRuntimeShimSpecifier(value: unknown): value is TPluginR
837
874
  */
838
875
  declare const PLUGIN_RUNTIME_IMPORT_MAP: Readonly<Record<TPluginRuntimeShimSpecifier, string>>;
839
876
 
840
- export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
877
+ export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, MOBILE_RENDERER_VERSION, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isMobileRendererCompatible, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
@@ -1,4 +1,4 @@
1
- export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-C8sBTLJb.js';
1
+ export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.js';
2
2
  import { I as IStyleRegistryEntry } from '../styles.registry-D6xMm5VR.js';
3
3
  import '../common-qaDIAYS3.js';
4
4
 
@@ -15,6 +15,23 @@ import '../common-qaDIAYS3.js';
15
15
  * Independent from the npm `version` of `@selfhelp/shared`.
16
16
  */
17
17
  declare const PLUGIN_API_VERSION: "0.1.0";
18
+ /**
19
+ * Mobile renderer contract version. This is the SECOND, mobile-only
20
+ * compatibility axis (independent of `PLUGIN_API_VERSION`): it versions the
21
+ * mobile plugin rendering surface — the `registerMobile()` shape, `IStyleProps`
22
+ * / `TPluginStyleImplMap`, and the mobile host SDK primitives — that a plugin's
23
+ * mobile npm package compiles against.
24
+ *
25
+ * The mobile app and the `selfhelp-mobile-preview` image advertise this value
26
+ * (in `version.json` + the signed `mobile-preview-release.json`). A plugin
27
+ * declares the range it supports in `plugin.json` under `compatibility.mobile`;
28
+ * the SelfHelp Manager gates the plugin against the selected preview image's
29
+ * advertised `mobileRendererVersion` using {@see isMobileRendererCompatible}.
30
+ *
31
+ * Bump rules mirror the SDK contract: patch = additive fix, minor = additive
32
+ * renderer feature, major = breaking mobile renderer change.
33
+ */
34
+ declare const MOBILE_RENDERER_VERSION: "0.1.0";
18
35
  interface ISemver {
19
36
  major: number;
20
37
  minor: number;
@@ -44,6 +61,15 @@ declare function isPluginApiCompatible(required: string, host?: string): boolean
44
61
  * - host minor >= plugin's required minor.
45
62
  */
46
63
  declare function assertPluginApiVersion(required: string): void;
64
+ /**
65
+ * Non-throwing satisfaction check for the mobile-renderer axis: returns true
66
+ * when the host's `mobileRendererVersion` falls inside the plugin's declared
67
+ * `compatibility.mobile` range. Used by the SelfHelp Manager preflight to gate
68
+ * an enabled plugin's mobile package against the selected preview image, and by
69
+ * the mobile/preview runtime to skip an incompatible plugin instead of crashing.
70
+ * An empty/undefined range is treated as "no mobile support declared" → false.
71
+ */
72
+ declare function isMobileRendererCompatible(requiredRange: string | undefined, host?: string): boolean;
47
73
  /**
48
74
  * Throw if the running CMS version is not in the plugin's declared
49
75
  * compatibility range.
@@ -141,6 +167,12 @@ interface IPluginRelease {
141
167
  core: string;
142
168
  /** Semver range of host plugin-API versions this plugin runs on. */
143
169
  pluginApi: string;
170
+ /**
171
+ * Semver range of the host mobile renderer contract
172
+ * (`mobileRendererVersion`) this plugin's mobile package supports.
173
+ * Additive; absent for web-only plugins.
174
+ */
175
+ mobile?: string;
144
176
  };
145
177
  /** Optional other-plugin requirements consumed by the resolver. */
146
178
  dependencies?: {
@@ -194,6 +226,11 @@ interface IPluginRegistry {
194
226
  worker: IRegistryReleaseRef[];
195
227
  /** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
196
228
  plugins: IRegistryReleaseRef[];
229
+ /**
230
+ * Mobile-preview web image release refs (Manager-installed). Additive in
231
+ * registry `schemaVersion` 1.1 — older managers ignore the unknown array.
232
+ */
233
+ mobilePreview?: IRegistryReleaseRef[];
197
234
  /** Optional path to the security advisory feed. */
198
235
  advisoriesUrl?: string;
199
236
  /** Optional path to the cross-component compatibility feed. */
@@ -837,4 +874,4 @@ declare function isPluginRuntimeShimSpecifier(value: unknown): value is TPluginR
837
874
  */
838
875
  declare const PLUGIN_RUNTIME_IMPORT_MAP: Readonly<Record<TPluginRuntimeShimSpecifier, string>>;
839
876
 
840
- export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
877
+ export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, MOBILE_RENDERER_VERSION, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isMobileRendererCompatible, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/plugin-sdk/index.ts
21
21
  var plugin_sdk_exports = {};
22
22
  __export(plugin_sdk_exports, {
23
+ MOBILE_RENDERER_VERSION: () => MOBILE_RENDERER_VERSION,
23
24
  PLUGIN_API_VERSION: () => PLUGIN_API_VERSION,
24
25
  PLUGIN_REGISTRY_CHANNELS: () => PLUGIN_REGISTRY_CHANNELS,
25
26
  PLUGIN_RUNTIME_GLOBAL_KEY: () => PLUGIN_RUNTIME_GLOBAL_KEY,
@@ -34,6 +35,7 @@ __export(plugin_sdk_exports, {
34
35
  defineMobilePlugin: () => defineMobilePlugin,
35
36
  definePlugin: () => definePlugin,
36
37
  definePluginRealtimeTopic: () => definePluginRealtimeTopic,
38
+ isMobileRendererCompatible: () => isMobileRendererCompatible,
37
39
  isPluginApiCompatible: () => isPluginApiCompatible,
38
40
  isPluginRuntimeShimSpecifier: () => isPluginRuntimeShimSpecifier,
39
41
  parseSemver: () => parseSemver,
@@ -44,6 +46,7 @@ module.exports = __toCommonJS(plugin_sdk_exports);
44
46
 
45
47
  // src/plugin-sdk/version.ts
46
48
  var PLUGIN_API_VERSION = "0.1.0";
49
+ var MOBILE_RENDERER_VERSION = "0.1.0";
47
50
  var SEMVER_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
48
51
  function parseSemver(version) {
49
52
  const match = SEMVER_REGEX.exec(version);
@@ -129,6 +132,14 @@ function assertPluginApiVersion(required) {
129
132
  );
130
133
  }
131
134
  }
135
+ function isMobileRendererCompatible(requiredRange, host = MOBILE_RENDERER_VERSION) {
136
+ if (!requiredRange) return false;
137
+ try {
138
+ return satisfiesSemverRange(host, requiredRange);
139
+ } catch {
140
+ return false;
141
+ }
142
+ }
132
143
  function assertCmsCompatibility(cmsVersion, range) {
133
144
  if (!satisfiesSemverRange(cmsVersion, range)) {
134
145
  throw new Error(
@@ -522,6 +533,7 @@ var PLUGIN_RUNTIME_IMPORT_MAP = Object.freeze(
522
533
  );
523
534
  // Annotate the CommonJS export names for ESM import in node:
524
535
  0 && (module.exports = {
536
+ MOBILE_RENDERER_VERSION,
525
537
  PLUGIN_API_VERSION,
526
538
  PLUGIN_REGISTRY_CHANNELS,
527
539
  PLUGIN_RUNTIME_GLOBAL_KEY,
@@ -536,6 +548,7 @@ var PLUGIN_RUNTIME_IMPORT_MAP = Object.freeze(
536
548
  defineMobilePlugin,
537
549
  definePlugin,
538
550
  definePluginRealtimeTopic,
551
+ isMobileRendererCompatible,
539
552
  isPluginApiCompatible,
540
553
  isPluginRuntimeShimSpecifier,
541
554
  parseSemver,
@@ -1,5 +1,6 @@
1
1
  // src/plugin-sdk/version.ts
2
2
  var PLUGIN_API_VERSION = "0.1.0";
3
+ var MOBILE_RENDERER_VERSION = "0.1.0";
3
4
  var SEMVER_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
4
5
  function parseSemver(version) {
5
6
  const match = SEMVER_REGEX.exec(version);
@@ -85,6 +86,14 @@ function assertPluginApiVersion(required) {
85
86
  );
86
87
  }
87
88
  }
89
+ function isMobileRendererCompatible(requiredRange, host = MOBILE_RENDERER_VERSION) {
90
+ if (!requiredRange) return false;
91
+ try {
92
+ return satisfiesSemverRange(host, requiredRange);
93
+ } catch {
94
+ return false;
95
+ }
96
+ }
88
97
  function assertCmsCompatibility(cmsVersion, range) {
89
98
  if (!satisfiesSemverRange(cmsVersion, range)) {
90
99
  throw new Error(
@@ -477,6 +486,7 @@ var PLUGIN_RUNTIME_IMPORT_MAP = Object.freeze(
477
486
  )
478
487
  );
479
488
  export {
489
+ MOBILE_RENDERER_VERSION,
480
490
  PLUGIN_API_VERSION,
481
491
  PLUGIN_REGISTRY_CHANNELS,
482
492
  PLUGIN_RUNTIME_GLOBAL_KEY,
@@ -491,6 +501,7 @@ export {
491
501
  defineMobilePlugin,
492
502
  definePlugin,
493
503
  definePluginRealtimeTopic,
504
+ isMobileRendererCompatible,
494
505
  isPluginApiCompatible,
495
506
  isPluginRuntimeShimSpecifier,
496
507
  parseSemver,
@@ -1,4 +1,4 @@
1
- import { I as IPluginManifest } from '../manifest-C8sBTLJb.mjs';
1
+ import { I as IPluginManifest } from '../manifest-8YXAk-4o.mjs';
2
2
 
3
3
  /**
4
4
  * `@selfhelp/shared/testing` — the plugin certification kit.
@@ -1,4 +1,4 @@
1
- import { I as IPluginManifest } from '../manifest-C8sBTLJb.js';
1
+ import { I as IPluginManifest } from '../manifest-8YXAk-4o.js';
2
2
 
3
3
  /**
4
4
  * `@selfhelp/shared/testing` — the plugin certification kit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.14.24",
3
+ "version": "1.15.0",
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",
@@ -0,0 +1,40 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ import { describe, expect, it } from 'vitest';
6
+ import {
7
+ MOBILE_RENDERER_VERSION,
8
+ isMobileRendererCompatible,
9
+ parseSemver,
10
+ } from '../version';
11
+
12
+ describe('mobile renderer compatibility (compatibility.mobile axis)', () => {
13
+ it('exposes a valid semver MOBILE_RENDERER_VERSION constant', () => {
14
+ const v = parseSemver(MOBILE_RENDERER_VERSION);
15
+ expect(v.major).toBeGreaterThanOrEqual(0);
16
+ expect(typeof v.minor).toBe('number');
17
+ expect(typeof v.patch).toBe('number');
18
+ });
19
+
20
+ it('accepts a range that covers the host renderer version', () => {
21
+ expect(isMobileRendererCompatible('>=0.1.0 <0.2.0', '0.1.0')).toBe(true);
22
+ expect(isMobileRendererCompatible('^0.2.0', '0.2.3')).toBe(true);
23
+ // Default host arg = MOBILE_RENDERER_VERSION.
24
+ expect(isMobileRendererCompatible(`>=${MOBILE_RENDERER_VERSION}`)).toBe(true);
25
+ });
26
+
27
+ it('rejects a range outside the host renderer version', () => {
28
+ expect(isMobileRendererCompatible('>=0.2.0', '0.1.0')).toBe(false);
29
+ expect(isMobileRendererCompatible('<0.1.0', '0.1.0')).toBe(false);
30
+ });
31
+
32
+ it('treats a missing range as "no mobile support declared" (web-only plugin)', () => {
33
+ expect(isMobileRendererCompatible(undefined)).toBe(false);
34
+ expect(isMobileRendererCompatible('')).toBe(false);
35
+ });
36
+
37
+ it('never throws on a malformed range', () => {
38
+ expect(isMobileRendererCompatible('not-a-range', '0.1.0')).toBe(false);
39
+ });
40
+ });
@@ -17,8 +17,10 @@ SPDX-License-Identifier: MPL-2.0
17
17
 
18
18
  export {
19
19
  PLUGIN_API_VERSION,
20
+ MOBILE_RENDERER_VERSION,
20
21
  assertPluginApiVersion,
21
22
  isPluginApiCompatible,
23
+ isMobileRendererCompatible,
22
24
  assertCmsCompatibility,
23
25
  assertPluginVersionSemantics,
24
26
  parseSemver,
@@ -46,6 +46,14 @@ export interface IPluginManifestCompatibility {
46
46
  reactNative?: string;
47
47
  /** SemVer range for Expo SDK. */
48
48
  expoSdk?: string;
49
+ /**
50
+ * SemVer range for the host mobile renderer contract
51
+ * (`MOBILE_RENDERER_VERSION`) the plugin's mobile package supports. The
52
+ * SelfHelp Manager gates a plugin's mobile package against the selected
53
+ * `selfhelp-mobile-preview` image's advertised `mobileRendererVersion`.
54
+ * Absent for web-only plugins.
55
+ */
56
+ mobile?: string;
49
57
  }
50
58
 
51
59
  export interface IPluginManifestDependency {
@@ -84,6 +84,12 @@ export interface IPluginRelease {
84
84
  core: string;
85
85
  /** Semver range of host plugin-API versions this plugin runs on. */
86
86
  pluginApi: string;
87
+ /**
88
+ * Semver range of the host mobile renderer contract
89
+ * (`mobileRendererVersion`) this plugin's mobile package supports.
90
+ * Additive; absent for web-only plugins.
91
+ */
92
+ mobile?: string;
87
93
  };
88
94
  /** Optional other-plugin requirements consumed by the resolver. */
89
95
  dependencies?: {
@@ -132,6 +138,11 @@ export interface IPluginRegistry {
132
138
  worker: IRegistryReleaseRef[];
133
139
  /** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
134
140
  plugins: IRegistryReleaseRef[];
141
+ /**
142
+ * Mobile-preview web image release refs (Manager-installed). Additive in
143
+ * registry `schemaVersion` 1.1 — older managers ignore the unknown array.
144
+ */
145
+ mobilePreview?: IRegistryReleaseRef[];
135
146
  /** Optional path to the security advisory feed. */
136
147
  advisoriesUrl?: string;
137
148
  /** Optional path to the cross-component compatibility feed. */
@@ -16,6 +16,24 @@ SPDX-License-Identifier: MPL-2.0
16
16
  */
17
17
  export const PLUGIN_API_VERSION = '0.1.0' as const;
18
18
 
19
+ /**
20
+ * Mobile renderer contract version. This is the SECOND, mobile-only
21
+ * compatibility axis (independent of `PLUGIN_API_VERSION`): it versions the
22
+ * mobile plugin rendering surface — the `registerMobile()` shape, `IStyleProps`
23
+ * / `TPluginStyleImplMap`, and the mobile host SDK primitives — that a plugin's
24
+ * mobile npm package compiles against.
25
+ *
26
+ * The mobile app and the `selfhelp-mobile-preview` image advertise this value
27
+ * (in `version.json` + the signed `mobile-preview-release.json`). A plugin
28
+ * declares the range it supports in `plugin.json` under `compatibility.mobile`;
29
+ * the SelfHelp Manager gates the plugin against the selected preview image's
30
+ * advertised `mobileRendererVersion` using {@see isMobileRendererCompatible}.
31
+ *
32
+ * Bump rules mirror the SDK contract: patch = additive fix, minor = additive
33
+ * renderer feature, major = breaking mobile renderer change.
34
+ */
35
+ export const MOBILE_RENDERER_VERSION = '0.1.0' as const;
36
+
19
37
  export interface ISemver {
20
38
  major: number;
21
39
  minor: number;
@@ -139,6 +157,26 @@ export function assertPluginApiVersion(required: string): void {
139
157
  }
140
158
  }
141
159
 
160
+ /**
161
+ * Non-throwing satisfaction check for the mobile-renderer axis: returns true
162
+ * when the host's `mobileRendererVersion` falls inside the plugin's declared
163
+ * `compatibility.mobile` range. Used by the SelfHelp Manager preflight to gate
164
+ * an enabled plugin's mobile package against the selected preview image, and by
165
+ * the mobile/preview runtime to skip an incompatible plugin instead of crashing.
166
+ * An empty/undefined range is treated as "no mobile support declared" → false.
167
+ */
168
+ export function isMobileRendererCompatible(
169
+ requiredRange: string | undefined,
170
+ host: string = MOBILE_RENDERER_VERSION,
171
+ ): boolean {
172
+ if (!requiredRange) return false;
173
+ try {
174
+ return satisfiesSemverRange(host, requiredRange);
175
+ } catch {
176
+ return false;
177
+ }
178
+ }
179
+
142
180
  /**
143
181
  * Throw if the running CMS version is not in the plugin's declared
144
182
  * compatibility range.
@@ -10,6 +10,7 @@ import type {
10
10
  AdvisoryFeed,
11
11
  CompatibilityRules,
12
12
  CoreRelease,
13
+ MobilePreviewRelease,
13
14
  PluginRelease,
14
15
  RegistryIndex,
15
16
  } from '../distribution';
@@ -29,7 +30,7 @@ function readExample(name: string): Record<string, unknown> {
29
30
  const SPEC: Record<string, { required: string[]; optional?: string[]; kind?: string }> = {
30
31
  'registry-index.json': {
31
32
  required: ['schemaVersion', 'requiresManager', 'publishedAt', 'baseUrl', 'publisher', 'core', 'frontend', 'scheduler', 'worker', 'plugins'],
32
- optional: ['advisoriesUrl', 'compatibilityUrl', 'trustedKeysUrl'],
33
+ optional: ['mobilePreview', 'advisoriesUrl', 'compatibilityUrl', 'trustedKeysUrl'],
33
34
  },
34
35
  'core-release.json': {
35
36
  kind: 'selfhelp-core-release',
@@ -165,4 +166,57 @@ describe('distribution contracts compile and are usable', () => {
165
166
  expect(advisories.advisories[0]?.blocked).toBe(true);
166
167
  expect(compatibility.rules[0]?.runtime.mysql.recommendedImage).toBe('mysql:8.4');
167
168
  });
169
+
170
+ it('types a mobile-preview release with bundled plugins + renderer version', () => {
171
+ const preview: MobilePreviewRelease = {
172
+ kind: 'selfhelp-mobile-preview-release',
173
+ id: 'selfhelp-mobile-preview-0.2.0',
174
+ version: '0.2.0',
175
+ channel: 'stable',
176
+ image: 'ghcr.io/humdek-unibe-ch/selfhelp-mobile-preview:0.2.0',
177
+ digest: 'sha256:abc',
178
+ backendCompatibility: { requiredCoreRange: '>=0.1.0 <0.2.0', requiredApiVersion: '0.1.0' },
179
+ mobileRendererVersion: '0.1.0',
180
+ bundledPlugins: [
181
+ {
182
+ id: 'sh2-shp-survey-js',
183
+ version: '0.2.23',
184
+ mobilePackage: '@humdek/sh2-shp-survey-js-mobile',
185
+ mobilePackageVersion: '0.2.23',
186
+ },
187
+ ],
188
+ security: { signature: 'sig', keyId: 'selfhelp-dev-fixture' },
189
+ };
190
+ // Index can carry the additive mobilePreview ref array; a plugin can
191
+ // declare the additive compatibility.mobile axis.
192
+ const index: RegistryIndex = {
193
+ schemaVersion: '1.1',
194
+ requiresManager: '>=0.1.0',
195
+ publishedAt: '2026-06-23T12:00:00Z',
196
+ baseUrl: 'https://example/',
197
+ publisher: { name: 'SelfHelp', url: 'https://example/' },
198
+ core: [],
199
+ frontend: [],
200
+ scheduler: [],
201
+ worker: [],
202
+ plugins: [],
203
+ mobilePreview: [
204
+ { id: preview.id, version: preview.version, channel: 'stable', releaseUrl: 'releases/mobile-preview/x.json' },
205
+ ],
206
+ };
207
+ const plugin: PluginRelease = {
208
+ kind: 'selfhelp-plugin-release',
209
+ id: 'sh2-shp-survey-js',
210
+ version: '0.2.23',
211
+ channel: 'stable',
212
+ official: true,
213
+ compatibility: { core: '>=0.1.0 <0.2.0', pluginApi: '0.1.0', mobile: '>=0.1.0 <0.2.0' },
214
+ artifacts: { manifestUrl: 'm', archiveUrl: 'a', sha256: 'sha256:0' },
215
+ security: { signature: 'sig', keyId: 'selfhelp-dev-fixture' },
216
+ };
217
+ expect(preview.bundledPlugins[0]?.mobilePackage).toBe('@humdek/sh2-shp-survey-js-mobile');
218
+ expect(preview.mobileRendererVersion).toBe('0.1.0');
219
+ expect(index.mobilePreview?.[0]?.version).toBe('0.2.0');
220
+ expect(plugin.compatibility.mobile).toBe('>=0.1.0 <0.2.0');
221
+ });
168
222
  });
@@ -8,3 +8,4 @@ export * from './forms';
8
8
  export * from './language';
9
9
  export * from './page';
10
10
  export * from './system';
11
+ export * from './mobile-preview';
@@ -0,0 +1,71 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
7
+ * web image).
8
+ *
9
+ * Flow: the CMS admin mints a SHORT-LIVED, SINGLE-USE preview code (bound to the
10
+ * admin user + an optional scope). The `selfhelp-mobile-preview` web image
11
+ * exchanges that one-time code for an in-memory, scoped JWT
12
+ * (`purpose: 'mobile_preview'`) used for read-only `/cms-api` calls. The admin
13
+ * JWT is never exposed to the preview iframe.
14
+ *
15
+ * Snake_case is the wire contract (these mirror the backend JSON schemas under
16
+ * `config/schemas/api/v1/{requests,responses}/`).
17
+ */
18
+ import type { IBaseApiResponse } from './envelope';
19
+ import type { IUserData } from '../auth';
20
+
21
+ const MOBILE_PREVIEW_PREFIX = '/cms-api/v1';
22
+
23
+ /** Mobile preview session endpoints. */
24
+ export const MOBILE_PREVIEW_ENDPOINTS = {
25
+ /** Admin-only: mint a one-time preview session code. */
26
+ SESSION: `${MOBILE_PREVIEW_PREFIX}/admin/mobile-preview/session`,
27
+ /** Public: exchange a one-time code for a scoped preview JWT. */
28
+ EXCHANGE: `${MOBILE_PREVIEW_PREFIX}/mobile-preview/session/exchange`,
29
+ } as const;
30
+
31
+ /**
32
+ * POST /admin/mobile-preview/session — mint a one-time preview code. No
33
+ * `instance_id`: the backend derives + verifies the admin server-side. The
34
+ * optional scope is bound into the code and enforced on exchange.
35
+ */
36
+ export interface IMobilePreviewSessionRequest {
37
+ /** Page keyword to preview. */
38
+ keyword?: string;
39
+ /** Page id to preview (alternative to `keyword`). */
40
+ page_id?: number;
41
+ /** Language id to render in. */
42
+ language_id?: number;
43
+ /** Whether to preview the unpublished draft version. */
44
+ draft?: boolean;
45
+ }
46
+
47
+ export interface IMobilePreviewSessionData {
48
+ /** Opaque one-time code (safe in the iframe URL; invalid after exchange). */
49
+ code: string;
50
+ /** ISO-8601 expiry of the one-time code. */
51
+ expires_at: string;
52
+ }
53
+ export type IMobilePreviewSessionResponse = IBaseApiResponse<IMobilePreviewSessionData>;
54
+
55
+ /**
56
+ * POST /mobile-preview/session/exchange — public route; the one-time code IS the
57
+ * credential. Consumes (deletes) the code and mints a scoped preview JWT.
58
+ */
59
+ export interface IMobilePreviewExchangeRequest {
60
+ code: string;
61
+ }
62
+
63
+ export interface IMobilePreviewExchangeData {
64
+ /** Short-lived scoped JWT (`purpose: 'mobile_preview'`); held in memory only. */
65
+ access_token: string;
66
+ /** Seconds until the scoped token expires. */
67
+ expires_in: number;
68
+ /** The previewed user (the minting admin), for the preview UI. */
69
+ user: IUserData;
70
+ }
71
+ export type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
@@ -88,6 +88,8 @@ export interface InstanceVersions {
88
88
  frontend: string;
89
89
  scheduler: string;
90
90
  worker: string;
91
+ /** Mobile-preview web image version pinned for this instance (additive). */
92
+ mobilePreview?: string;
91
93
  pluginApi: string;
92
94
  }
93
95
 
@@ -99,6 +101,8 @@ export interface InstanceImages {
99
101
  mysql: string;
100
102
  redis: string;
101
103
  mercure: string;
104
+ /** Mobile-preview web image reference (additive). */
105
+ mobilePreview?: string;
102
106
  }
103
107
 
104
108
  export interface InstanceRouting {
@@ -205,6 +209,8 @@ export interface InstanceLock {
205
209
  version: string;
206
210
  backendImageDigest: string;
207
211
  frontendImageDigest: string;
212
+ /** Mobile-preview web image digest pinned for this instance (additive). */
213
+ mobilePreviewImageDigest?: string;
208
214
  schedulerImageDigest: string;
209
215
  workerImageDigest: string;
210
216
  migrationVersion: string;
@@ -245,6 +251,8 @@ export interface RegistryIndex {
245
251
  scheduler: RegistryReleaseRef[];
246
252
  worker: RegistryReleaseRef[];
247
253
  plugins: RegistryReleaseRef[];
254
+ /** Mobile-preview web image release refs (additive; older managers ignore). */
255
+ mobilePreview?: RegistryReleaseRef[];
248
256
  advisoriesUrl?: string;
249
257
  compatibilityUrl?: string;
250
258
  trustedKeysUrl?: string;
@@ -349,13 +357,58 @@ export interface WorkerRelease {
349
357
  blocked?: boolean;
350
358
  }
351
359
 
360
+ /**
361
+ * One plugin mobile package baked into a mobile-preview image at build time.
362
+ * The preview CI runs `plugins-sync.mjs` against a curated official-plugin set
363
+ * and records the result here so the manager can compute coverage (which
364
+ * enabled plugins render natively vs. fall back to open-on-web in the preview)
365
+ * without inspecting the image.
366
+ */
367
+ export interface BundledPluginRef {
368
+ id: string;
369
+ version: string;
370
+ mobilePackage: string;
371
+ mobilePackageVersion: string;
372
+ }
373
+
374
+ /**
375
+ * Mobile-preview web image release, resolved/pinned as a first-class artifact
376
+ * (peer of the frontend release). The image serves the Expo web export at
377
+ * `/mobile-preview` and proxies a narrow `/mobile-preview/api` allowlist to the
378
+ * private backend. `mobileRendererVersion` is the mobile renderer contract the
379
+ * image was built against (what plugin `compatibility.mobile` ranges target);
380
+ * `bundledPlugins` is the curated official-plugin set baked into the image.
381
+ */
382
+ export interface MobilePreviewRelease {
383
+ kind: 'selfhelp-mobile-preview-release';
384
+ id: string;
385
+ version: string;
386
+ channel: ReleaseChannel;
387
+ image: string;
388
+ digest: string;
389
+ builtFrom?: { sharedPackageVersion?: string; expoSdk?: string; reactNative?: string };
390
+ backendCompatibility: ServiceBackendCompatibility;
391
+ /** Mobile renderer contract version advertised by this image (semver). */
392
+ mobileRendererVersion: string;
393
+ /** Curated plugin mobile packages baked into the image. */
394
+ bundledPlugins: BundledPluginRef[];
395
+ security: SignatureBlock;
396
+ blocked?: boolean;
397
+ }
398
+
352
399
  export interface PluginRelease {
353
400
  kind: 'selfhelp-plugin-release';
354
401
  id: string;
355
402
  version: string;
356
403
  channel: ReleaseChannel;
357
404
  official: boolean;
358
- compatibility: { core: string; pluginApi: string };
405
+ /**
406
+ * 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.
410
+ */
411
+ compatibility: { core: string; pluginApi: string; mobile?: string };
359
412
  dependencies?: { plugins: { id: string; range: string }[] };
360
413
  artifacts: { manifestUrl: string; archiveUrl: string; sha256: string };
361
414
  security: SignatureBlock;