@selfhelp/shared 1.15.0 → 1.15.2
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 +74 -1
- package/dist/index.d.mts +185 -7
- package/dist/index.d.ts +185 -7
- package/dist/index.js +58 -1
- package/dist/index.mjs +53 -1
- package/package.json +1 -1
- package/src/types/__tests__/preview-bridge.test.ts +100 -0
- package/src/types/api/__tests__/system.test.ts +83 -0
- package/src/types/api/system.ts +83 -3
- package/src/types/distribution.ts +17 -4
- package/src/types/index.ts +1 -0
- package/src/types/preview-bridge.ts +139 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,80 @@ 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.
|
|
12
|
+
## v1.15.2
|
|
13
|
+
|
|
14
|
+
**Live Preview bridge contract** — the `postMessage` protocol that keeps the CMS
|
|
15
|
+
**Live Preview** shell and its two embedded frames (web frontend +
|
|
16
|
+
`selfhelp-mobile-preview`) on the same page. Clicking a link in one frame reports
|
|
17
|
+
the navigation up to the shell, which drives the other frame to the same CMS
|
|
18
|
+
keyword (with a per-frame loop guard). Additive only — new module + exports — so
|
|
19
|
+
`^1.15.x` consumers are unaffected; the frontend (`>=0.1.35`) and mobile
|
|
20
|
+
(`>=0.1.14`) Live Preview adopt it.
|
|
21
|
+
|
|
22
|
+
### Added (additive, non-breaking)
|
|
23
|
+
|
|
24
|
+
- **`types/preview-bridge.ts`** (re-exported from the root): the single source of
|
|
25
|
+
truth for the bridge protocol —
|
|
26
|
+
- message-type constants `PREVIEW_BRIDGE_MESSAGE` (`READY` / `NAVIGATED` /
|
|
27
|
+
`NAVIGATE`) + `TPreviewBridgeMessageType`;
|
|
28
|
+
- activation/origin query-param names `PREVIEW_SHELL_PARAM` (`previewShell`) and
|
|
29
|
+
`PREVIEW_PARENT_ORIGIN_PARAM` (`parentOrigin`);
|
|
30
|
+
- payload shapes `IPreviewReadyMessage`, `IPreviewNavigatedMessage`,
|
|
31
|
+
`IPreviewNavigateCommand`, the `TPreviewBridgeMessage` union, and
|
|
32
|
+
`TPreviewFrameSource`;
|
|
33
|
+
- runtime helpers `isPreviewBridgeMessage(value)` (defensive guard for
|
|
34
|
+
`event.data`) and `previewKeywordFromPath(path)` (web/mobile paths → the same
|
|
35
|
+
keyword sync unit). Covered by `types/__tests__/preview-bridge.test.ts`.
|
|
36
|
+
|
|
37
|
+
## v1.15.1
|
|
38
|
+
|
|
39
|
+
Mobile preview RN/Expo provenance parity **plus the CMS-driven mobile-preview
|
|
40
|
+
update contract**. Promotes the React Native / Expo SDK versions to **top-level**
|
|
41
|
+
canonical fields on the mobile-preview release descriptor and adds the matching
|
|
42
|
+
plugin-compatibility axes, so the SelfHelp Manager's dual-axis plugin gate reads
|
|
43
|
+
one canonical location across every repo (mobile CI emitter, registry assembler,
|
|
44
|
+
manager schema). It also adds the System-Maintenance contracts that let the CMS
|
|
45
|
+
show the provisioned preview version and request a compatible mobile-preview
|
|
46
|
+
update/enable (mirroring the frontend-only update flow). All additions are
|
|
47
|
+
additive (optional fields / new types / a widened union arm), so `^1.14.25`
|
|
48
|
+
consumers are unaffected.
|
|
49
|
+
|
|
50
|
+
### Added (additive, non-breaking)
|
|
51
|
+
|
|
52
|
+
- **Mobile-preview update flow contracts** (`types/api/system.ts`):
|
|
53
|
+
`SYSTEM_ENDPOINTS.UPDATE_MOBILE_PREVIEW_{RELEASES,PREFLIGHT,REQUEST}`, the
|
|
54
|
+
`IMobilePreviewUpdateRequest` body, and the `IMobilePreviewUpdate{Releases,
|
|
55
|
+
Preflight,Request}Response` aliases — the CMS analogue of the frontend-only
|
|
56
|
+
update surface. Requesting a preview onto an instance that has none doubles as
|
|
57
|
+
the enable/bootstrap path the SelfHelp Manager provisions.
|
|
58
|
+
- **`ISystemVersion.mobile_preview_version`** — the provisioned
|
|
59
|
+
`selfhelp-mobile-preview` image version surfaced in System Maintenance
|
|
60
|
+
(`unknown` until the manager stamps `SELFHELP_MOBILE_PREVIEW_VERSION`,
|
|
61
|
+
`not_installed` when no preview is provisioned).
|
|
62
|
+
- **`IUpdateStatus.target_mobile_preview_version`** — the targeted preview
|
|
63
|
+
version for a `mobile-preview`-kind operation (`null` otherwise).
|
|
64
|
+
|
|
65
|
+
### Changed (additive, non-breaking)
|
|
66
|
+
|
|
67
|
+
- **`TUpdateKind` widened to include `'mobile-preview'`** (`types/api/system.ts`)
|
|
68
|
+
alongside `'core' | 'frontend'`, and **`ICompatibilityError.component`** gains
|
|
69
|
+
the `'mobile-preview'` arm so the standardized compatibility-error object can
|
|
70
|
+
describe a preview ⇄ core block. Existing `'core' | 'frontend'` consumers keep
|
|
71
|
+
working (the new arm is only emitted for preview operations).
|
|
72
|
+
|
|
73
|
+
- **`MobilePreviewRelease.reactNativeVersion?` + `.expoSdkVersion?`**
|
|
74
|
+
(`types/distribution.ts`) — the canonical top-level React Native / Expo SDK
|
|
75
|
+
versions the image was built with, mirroring the registry
|
|
76
|
+
`mobile-preview-release.schema.json` and the manager's internal schema. The
|
|
77
|
+
existing `builtFrom.{reactNative,expoSdk}` stay as raw build provenance; the
|
|
78
|
+
manager gates a plugin's RN/Expo range against the top-level values.
|
|
79
|
+
- **`PluginRelease.compatibility.reactNative?` + `.expoSdk?`**
|
|
80
|
+
(`types/distribution.ts`) — the RN/Expo runtime axes a plugin's native bundle
|
|
81
|
+
targets, gated against the resolved preview image's `reactNativeVersion` /
|
|
82
|
+
`expoSdkVersion` (parallel to the existing `compatibility.mobile` renderer
|
|
83
|
+
axis; web-only plugins omit all three).
|
|
84
|
+
|
|
85
|
+
## v1.14.25
|
|
13
86
|
|
|
14
87
|
Mobile preview service contracts. Adds the cross-repo types for the new
|
|
15
88
|
`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
|
-
/**
|
|
401
|
-
|
|
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
|
|
@@ -777,6 +846,100 @@ interface IMobilePreviewExchangeData {
|
|
|
777
846
|
}
|
|
778
847
|
type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
|
|
779
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Live Preview bridge contract — the `postMessage` protocol between the CMS
|
|
851
|
+
* **Live Preview** shell (the admin page that embeds the previews) and the two
|
|
852
|
+
* embedded preview frames (the web frontend and the `selfhelp-mobile-preview`
|
|
853
|
+
* web image).
|
|
854
|
+
*
|
|
855
|
+
* The shell owns the canonical preview page. Each frame runs a small bridge that
|
|
856
|
+
* (a) reports its in-app navigations up to the shell and (b) accepts a
|
|
857
|
+
* "navigate to keyword" command down from the shell, so clicking a link in one
|
|
858
|
+
* frame keeps the other frame on the same page. The shell prevents sync loops
|
|
859
|
+
* with a per-frame "expected keyword" guard (it ignores the echo of a command it
|
|
860
|
+
* just sent). See the frontend `LivePreview` shell + `PreviewShellBridge` and the
|
|
861
|
+
* mobile `PreviewSyncBridge`.
|
|
862
|
+
*
|
|
863
|
+
* This module is the SINGLE SOURCE OF TRUTH for the message `type` strings, the
|
|
864
|
+
* activation/origin query-param names, the payload shapes, and the runtime type
|
|
865
|
+
* guard, so the shell and both bridges cannot drift. It is a pure contract: no
|
|
866
|
+
* DOM / window access lives here (each app reads `window`/`postMessage` itself).
|
|
867
|
+
*
|
|
868
|
+
* Security: messages are validated by `event.origin` on both ends (the shell
|
|
869
|
+
* allow-lists its own origin for the web frame and the mobile origin for the
|
|
870
|
+
* mobile frame; each frame trusts only the shell origin it was handed via
|
|
871
|
+
* {@link PREVIEW_PARENT_ORIGIN_PARAM}). Never post these with `'*'`.
|
|
872
|
+
*/
|
|
873
|
+
/** Which embedded preview frame a bridge message refers to. */
|
|
874
|
+
type TPreviewFrameSource = 'web' | 'mobile';
|
|
875
|
+
/**
|
|
876
|
+
* Query param the shell appends to a frame URL to ACTIVATE its bridge
|
|
877
|
+
* (`previewShell=1`). Absent (normal public browsing) → the bridge stays dormant
|
|
878
|
+
* so a real visitor never posts navigation messages.
|
|
879
|
+
*/
|
|
880
|
+
declare const PREVIEW_SHELL_PARAM = "previewShell";
|
|
881
|
+
/**
|
|
882
|
+
* Query param carrying the shell's `window.location.origin` so a (possibly
|
|
883
|
+
* cross-origin) frame can target its `postMessage` precisely instead of `'*'`.
|
|
884
|
+
*/
|
|
885
|
+
declare const PREVIEW_PARENT_ORIGIN_PARAM = "parentOrigin";
|
|
886
|
+
/**
|
|
887
|
+
* Message `type` discriminators. Namespaced (`selfhelp-preview:`) so they never
|
|
888
|
+
* collide with other `postMessage` traffic (HMR, analytics, embeds).
|
|
889
|
+
*/
|
|
890
|
+
declare const PREVIEW_BRIDGE_MESSAGE: {
|
|
891
|
+
/** frame → shell: the bridge mounted and is ready to sync. */
|
|
892
|
+
readonly READY: "selfhelp-preview:ready";
|
|
893
|
+
/** frame → shell: the frame navigated to a new in-app location. */
|
|
894
|
+
readonly NAVIGATED: "selfhelp-preview:navigated";
|
|
895
|
+
/** shell → frame: navigate the frame to a CMS keyword (soft, no reload). */
|
|
896
|
+
readonly NAVIGATE: "selfhelp-preview:navigate";
|
|
897
|
+
};
|
|
898
|
+
type TPreviewBridgeMessageType = (typeof PREVIEW_BRIDGE_MESSAGE)[keyof typeof PREVIEW_BRIDGE_MESSAGE];
|
|
899
|
+
/** frame → shell: emitted once when the bridge mounts. */
|
|
900
|
+
interface IPreviewReadyMessage {
|
|
901
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.READY;
|
|
902
|
+
source: TPreviewFrameSource;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* frame → shell: the frame moved to a new page. `keyword` is the CMS keyword of
|
|
906
|
+
* the current page (the cross-platform sync unit), or `null` for home / a
|
|
907
|
+
* non-CMS location. `locale` is the frame's active locale when known — a
|
|
908
|
+
* read-only toolbar indicator; locales are NOT cross-synced.
|
|
909
|
+
*/
|
|
910
|
+
interface IPreviewNavigatedMessage {
|
|
911
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.NAVIGATED;
|
|
912
|
+
source: TPreviewFrameSource;
|
|
913
|
+
keyword: string | null;
|
|
914
|
+
/** Full in-frame href, for diagnostics / the toolbar URL display. */
|
|
915
|
+
href: string;
|
|
916
|
+
locale?: string | null;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* shell → frame: navigate to `keyword` (the canonical page). `null`/empty =
|
|
920
|
+
* home. The frame performs a SOFT client-side navigation (no reload), so app
|
|
921
|
+
* state and the embedded dev client are preserved.
|
|
922
|
+
*/
|
|
923
|
+
interface IPreviewNavigateCommand {
|
|
924
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.NAVIGATE;
|
|
925
|
+
keyword: string | null;
|
|
926
|
+
}
|
|
927
|
+
/** Every message that can cross the preview bridge, in either direction. */
|
|
928
|
+
type TPreviewBridgeMessage = IPreviewReadyMessage | IPreviewNavigatedMessage | IPreviewNavigateCommand;
|
|
929
|
+
/**
|
|
930
|
+
* Runtime guard: is `value` a well-formed preview-bridge message? Use it on the
|
|
931
|
+
* receiving end of a `message` event (AFTER the `event.origin` allow-list check)
|
|
932
|
+
* to safely narrow `event.data`. Defensive against arbitrary cross-frame noise.
|
|
933
|
+
*/
|
|
934
|
+
declare function isPreviewBridgeMessage(value: unknown): value is TPreviewBridgeMessage;
|
|
935
|
+
/**
|
|
936
|
+
* Normalize an in-app path to its CMS keyword (the sync unit): strip the leading
|
|
937
|
+
* slash and any query/hash, decode segments; an empty path (home) → `null`.
|
|
938
|
+
* Shared so the web and mobile bridges derive identical keywords from their
|
|
939
|
+
* respective routers.
|
|
940
|
+
*/
|
|
941
|
+
declare function previewKeywordFromPath(path: string | null | undefined): string | null;
|
|
942
|
+
|
|
780
943
|
/**
|
|
781
944
|
* Cross-repo SelfHelp distribution contracts: registry index + release metadata
|
|
782
945
|
* (core / frontend / scheduler / worker / plugin), security advisories,
|
|
@@ -1133,6 +1296,17 @@ interface MobilePreviewRelease {
|
|
|
1133
1296
|
backendCompatibility: ServiceBackendCompatibility;
|
|
1134
1297
|
/** Mobile renderer contract version advertised by this image (semver). */
|
|
1135
1298
|
mobileRendererVersion: string;
|
|
1299
|
+
/**
|
|
1300
|
+
* React Native version the preview image was built with. Top-level canonical
|
|
1301
|
+
* value the SelfHelp Manager gates a plugin's `compatibility.reactNative`
|
|
1302
|
+
* range against (the `builtFrom.reactNative` provenance field mirrors it).
|
|
1303
|
+
*/
|
|
1304
|
+
reactNativeVersion?: string;
|
|
1305
|
+
/**
|
|
1306
|
+
* Expo SDK version the preview image was built with. Gated against a plugin's
|
|
1307
|
+
* `compatibility.expoSdk` range (mirrors `builtFrom.expoSdk`).
|
|
1308
|
+
*/
|
|
1309
|
+
expoSdkVersion?: string;
|
|
1136
1310
|
/** Curated plugin mobile packages baked into the image. */
|
|
1137
1311
|
bundledPlugins: BundledPluginRef[];
|
|
1138
1312
|
security: SignatureBlock;
|
|
@@ -1146,14 +1320,18 @@ interface PluginRelease {
|
|
|
1146
1320
|
official: boolean;
|
|
1147
1321
|
/**
|
|
1148
1322
|
* Compatibility ranges the host must satisfy. `mobile` (additive) is the
|
|
1149
|
-
*
|
|
1150
|
-
* plugin's mobile package supports (parallel to `pluginApi`).
|
|
1151
|
-
*
|
|
1323
|
+
* mobile-renderer axis: the range of host `mobileRendererVersion` the
|
|
1324
|
+
* plugin's mobile package supports (parallel to `pluginApi`). `reactNative`
|
|
1325
|
+
* and `expoSdk` (additive) are gated against the resolved
|
|
1326
|
+
* `selfhelp-mobile-preview` image's `reactNativeVersion` / `expoSdkVersion`.
|
|
1327
|
+
* All three are absent for web-only plugins.
|
|
1152
1328
|
*/
|
|
1153
1329
|
compatibility: {
|
|
1154
1330
|
core: string;
|
|
1155
1331
|
pluginApi: string;
|
|
1156
1332
|
mobile?: string;
|
|
1333
|
+
reactNative?: string;
|
|
1334
|
+
expoSdk?: string;
|
|
1157
1335
|
};
|
|
1158
1336
|
dependencies?: {
|
|
1159
1337
|
plugins: {
|
|
@@ -1810,4 +1988,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
1810
1988
|
*/
|
|
1811
1989
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
1812
1990
|
|
|
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 };
|
|
1991
|
+
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 IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewReadyMessage, 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, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, 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, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewFrameSource, 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, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, 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
|
-
/**
|
|
401
|
-
|
|
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
|
|
@@ -777,6 +846,100 @@ interface IMobilePreviewExchangeData {
|
|
|
777
846
|
}
|
|
778
847
|
type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
|
|
779
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Live Preview bridge contract — the `postMessage` protocol between the CMS
|
|
851
|
+
* **Live Preview** shell (the admin page that embeds the previews) and the two
|
|
852
|
+
* embedded preview frames (the web frontend and the `selfhelp-mobile-preview`
|
|
853
|
+
* web image).
|
|
854
|
+
*
|
|
855
|
+
* The shell owns the canonical preview page. Each frame runs a small bridge that
|
|
856
|
+
* (a) reports its in-app navigations up to the shell and (b) accepts a
|
|
857
|
+
* "navigate to keyword" command down from the shell, so clicking a link in one
|
|
858
|
+
* frame keeps the other frame on the same page. The shell prevents sync loops
|
|
859
|
+
* with a per-frame "expected keyword" guard (it ignores the echo of a command it
|
|
860
|
+
* just sent). See the frontend `LivePreview` shell + `PreviewShellBridge` and the
|
|
861
|
+
* mobile `PreviewSyncBridge`.
|
|
862
|
+
*
|
|
863
|
+
* This module is the SINGLE SOURCE OF TRUTH for the message `type` strings, the
|
|
864
|
+
* activation/origin query-param names, the payload shapes, and the runtime type
|
|
865
|
+
* guard, so the shell and both bridges cannot drift. It is a pure contract: no
|
|
866
|
+
* DOM / window access lives here (each app reads `window`/`postMessage` itself).
|
|
867
|
+
*
|
|
868
|
+
* Security: messages are validated by `event.origin` on both ends (the shell
|
|
869
|
+
* allow-lists its own origin for the web frame and the mobile origin for the
|
|
870
|
+
* mobile frame; each frame trusts only the shell origin it was handed via
|
|
871
|
+
* {@link PREVIEW_PARENT_ORIGIN_PARAM}). Never post these with `'*'`.
|
|
872
|
+
*/
|
|
873
|
+
/** Which embedded preview frame a bridge message refers to. */
|
|
874
|
+
type TPreviewFrameSource = 'web' | 'mobile';
|
|
875
|
+
/**
|
|
876
|
+
* Query param the shell appends to a frame URL to ACTIVATE its bridge
|
|
877
|
+
* (`previewShell=1`). Absent (normal public browsing) → the bridge stays dormant
|
|
878
|
+
* so a real visitor never posts navigation messages.
|
|
879
|
+
*/
|
|
880
|
+
declare const PREVIEW_SHELL_PARAM = "previewShell";
|
|
881
|
+
/**
|
|
882
|
+
* Query param carrying the shell's `window.location.origin` so a (possibly
|
|
883
|
+
* cross-origin) frame can target its `postMessage` precisely instead of `'*'`.
|
|
884
|
+
*/
|
|
885
|
+
declare const PREVIEW_PARENT_ORIGIN_PARAM = "parentOrigin";
|
|
886
|
+
/**
|
|
887
|
+
* Message `type` discriminators. Namespaced (`selfhelp-preview:`) so they never
|
|
888
|
+
* collide with other `postMessage` traffic (HMR, analytics, embeds).
|
|
889
|
+
*/
|
|
890
|
+
declare const PREVIEW_BRIDGE_MESSAGE: {
|
|
891
|
+
/** frame → shell: the bridge mounted and is ready to sync. */
|
|
892
|
+
readonly READY: "selfhelp-preview:ready";
|
|
893
|
+
/** frame → shell: the frame navigated to a new in-app location. */
|
|
894
|
+
readonly NAVIGATED: "selfhelp-preview:navigated";
|
|
895
|
+
/** shell → frame: navigate the frame to a CMS keyword (soft, no reload). */
|
|
896
|
+
readonly NAVIGATE: "selfhelp-preview:navigate";
|
|
897
|
+
};
|
|
898
|
+
type TPreviewBridgeMessageType = (typeof PREVIEW_BRIDGE_MESSAGE)[keyof typeof PREVIEW_BRIDGE_MESSAGE];
|
|
899
|
+
/** frame → shell: emitted once when the bridge mounts. */
|
|
900
|
+
interface IPreviewReadyMessage {
|
|
901
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.READY;
|
|
902
|
+
source: TPreviewFrameSource;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* frame → shell: the frame moved to a new page. `keyword` is the CMS keyword of
|
|
906
|
+
* the current page (the cross-platform sync unit), or `null` for home / a
|
|
907
|
+
* non-CMS location. `locale` is the frame's active locale when known — a
|
|
908
|
+
* read-only toolbar indicator; locales are NOT cross-synced.
|
|
909
|
+
*/
|
|
910
|
+
interface IPreviewNavigatedMessage {
|
|
911
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.NAVIGATED;
|
|
912
|
+
source: TPreviewFrameSource;
|
|
913
|
+
keyword: string | null;
|
|
914
|
+
/** Full in-frame href, for diagnostics / the toolbar URL display. */
|
|
915
|
+
href: string;
|
|
916
|
+
locale?: string | null;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* shell → frame: navigate to `keyword` (the canonical page). `null`/empty =
|
|
920
|
+
* home. The frame performs a SOFT client-side navigation (no reload), so app
|
|
921
|
+
* state and the embedded dev client are preserved.
|
|
922
|
+
*/
|
|
923
|
+
interface IPreviewNavigateCommand {
|
|
924
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE.NAVIGATE;
|
|
925
|
+
keyword: string | null;
|
|
926
|
+
}
|
|
927
|
+
/** Every message that can cross the preview bridge, in either direction. */
|
|
928
|
+
type TPreviewBridgeMessage = IPreviewReadyMessage | IPreviewNavigatedMessage | IPreviewNavigateCommand;
|
|
929
|
+
/**
|
|
930
|
+
* Runtime guard: is `value` a well-formed preview-bridge message? Use it on the
|
|
931
|
+
* receiving end of a `message` event (AFTER the `event.origin` allow-list check)
|
|
932
|
+
* to safely narrow `event.data`. Defensive against arbitrary cross-frame noise.
|
|
933
|
+
*/
|
|
934
|
+
declare function isPreviewBridgeMessage(value: unknown): value is TPreviewBridgeMessage;
|
|
935
|
+
/**
|
|
936
|
+
* Normalize an in-app path to its CMS keyword (the sync unit): strip the leading
|
|
937
|
+
* slash and any query/hash, decode segments; an empty path (home) → `null`.
|
|
938
|
+
* Shared so the web and mobile bridges derive identical keywords from their
|
|
939
|
+
* respective routers.
|
|
940
|
+
*/
|
|
941
|
+
declare function previewKeywordFromPath(path: string | null | undefined): string | null;
|
|
942
|
+
|
|
780
943
|
/**
|
|
781
944
|
* Cross-repo SelfHelp distribution contracts: registry index + release metadata
|
|
782
945
|
* (core / frontend / scheduler / worker / plugin), security advisories,
|
|
@@ -1133,6 +1296,17 @@ interface MobilePreviewRelease {
|
|
|
1133
1296
|
backendCompatibility: ServiceBackendCompatibility;
|
|
1134
1297
|
/** Mobile renderer contract version advertised by this image (semver). */
|
|
1135
1298
|
mobileRendererVersion: string;
|
|
1299
|
+
/**
|
|
1300
|
+
* React Native version the preview image was built with. Top-level canonical
|
|
1301
|
+
* value the SelfHelp Manager gates a plugin's `compatibility.reactNative`
|
|
1302
|
+
* range against (the `builtFrom.reactNative` provenance field mirrors it).
|
|
1303
|
+
*/
|
|
1304
|
+
reactNativeVersion?: string;
|
|
1305
|
+
/**
|
|
1306
|
+
* Expo SDK version the preview image was built with. Gated against a plugin's
|
|
1307
|
+
* `compatibility.expoSdk` range (mirrors `builtFrom.expoSdk`).
|
|
1308
|
+
*/
|
|
1309
|
+
expoSdkVersion?: string;
|
|
1136
1310
|
/** Curated plugin mobile packages baked into the image. */
|
|
1137
1311
|
bundledPlugins: BundledPluginRef[];
|
|
1138
1312
|
security: SignatureBlock;
|
|
@@ -1146,14 +1320,18 @@ interface PluginRelease {
|
|
|
1146
1320
|
official: boolean;
|
|
1147
1321
|
/**
|
|
1148
1322
|
* Compatibility ranges the host must satisfy. `mobile` (additive) is the
|
|
1149
|
-
*
|
|
1150
|
-
* plugin's mobile package supports (parallel to `pluginApi`).
|
|
1151
|
-
*
|
|
1323
|
+
* mobile-renderer axis: the range of host `mobileRendererVersion` the
|
|
1324
|
+
* plugin's mobile package supports (parallel to `pluginApi`). `reactNative`
|
|
1325
|
+
* and `expoSdk` (additive) are gated against the resolved
|
|
1326
|
+
* `selfhelp-mobile-preview` image's `reactNativeVersion` / `expoSdkVersion`.
|
|
1327
|
+
* All three are absent for web-only plugins.
|
|
1152
1328
|
*/
|
|
1153
1329
|
compatibility: {
|
|
1154
1330
|
core: string;
|
|
1155
1331
|
pluginApi: string;
|
|
1156
1332
|
mobile?: string;
|
|
1333
|
+
reactNative?: string;
|
|
1334
|
+
expoSdk?: string;
|
|
1157
1335
|
};
|
|
1158
1336
|
dependencies?: {
|
|
1159
1337
|
plugins: {
|
|
@@ -1810,4 +1988,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
1810
1988
|
*/
|
|
1811
1989
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
1812
1990
|
|
|
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 };
|
|
1991
|
+
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 IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewReadyMessage, 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, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, 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, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewFrameSource, 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, isPreviewBridgeMessage, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|