@makershq/react 0.0.0-stage → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/THIRD_PARTY_NOTICES.md +77 -0
- package/dist/api.d.ts +82 -0
- package/dist/api.js +183 -0
- package/dist/cache.d.ts +22 -0
- package/dist/cache.js +86 -0
- package/dist/components/icons/external-link/index.d.ts +52 -0
- package/dist/components/icons/external-link/index.js +60 -0
- package/dist/components/icons/index.d.ts +31 -0
- package/dist/components/icons/index.js +56 -0
- package/dist/components/icons/reduced-motion.d.ts +4 -0
- package/dist/components/icons/reduced-motion.js +24 -0
- package/dist/components/icons/x/index.d.ts +98 -0
- package/dist/components/icons/x/index.js +87 -0
- package/dist/components/release-markdown/index.d.ts +22 -0
- package/dist/components/release-markdown/index.js +101 -0
- package/dist/components/release-notes/index.d.ts +51 -0
- package/dist/components/release-notes/index.js +89 -0
- package/dist/connectors/use-release-note-list-connector.d.ts +24 -0
- package/dist/connectors/use-release-note-list-connector.js +219 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +13 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +8 -0
- package/dist/tauri/components/native-child/index.d.ts +19 -0
- package/dist/tauri/components/native-child/index.js +146 -0
- package/dist/tauri/components/native-child/theme.d.ts +12 -0
- package/dist/tauri/components/native-child/theme.js +45 -0
- package/dist/tauri/components/release-notes-host/index.d.ts +36 -0
- package/dist/tauri/components/release-notes-host/index.js +81 -0
- package/dist/tauri/components/release-notes-settings/index.d.ts +10 -0
- package/dist/tauri/components/release-notes-settings/index.js +23 -0
- package/dist/tauri/components/update-window/index.d.ts +20 -0
- package/dist/tauri/components/update-window/index.js +68 -0
- package/dist/tauri/context.d.ts +20 -0
- package/dist/tauri/context.js +22 -0
- package/dist/tauri/contracts.d.ts +84 -0
- package/dist/tauri/contracts.js +7 -0
- package/dist/tauri/hooks/use-release-notes.d.ts +92 -0
- package/dist/tauri/hooks/use-release-notes.js +101 -0
- package/dist/tauri/host-controller.d.ts +134 -0
- package/dist/tauri/host-controller.js +951 -0
- package/dist/tauri/index.d.ts +10 -0
- package/dist/tauri/index.js +9 -0
- package/dist/tauri/peer-protocol.d.ts +36 -0
- package/dist/tauri/peer-protocol.js +43 -0
- package/dist/tauri/preferences.d.ts +18 -0
- package/dist/tauri/preferences.js +39 -0
- package/dist/tauri/protocol.d.ts +71 -0
- package/dist/tauri/protocol.js +106 -0
- package/dist/tauri/remote-settings-client.d.ts +72 -0
- package/dist/tauri/remote-settings-client.js +265 -0
- package/dist/website/components/update-toast/index.d.ts +14 -0
- package/dist/website/components/update-toast/index.js +22 -0
- package/dist/website/components/website-updates/index.d.ts +24 -0
- package/dist/website/components/website-updates/index.js +35 -0
- package/dist/website/components/whats-new-panel/index.d.ts +23 -0
- package/dist/website/components/whats-new-panel/index.js +38 -0
- package/dist/website/preferences.d.ts +32 -0
- package/dist/website/preferences.js +85 -0
- package/dist/website/use-website-updates-connector.d.ts +34 -0
- package/dist/website/use-website-updates-connector.js +318 -0
- package/dist/website/version.d.ts +27 -0
- package/dist/website/version.js +73 -0
- package/package.json +71 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Presents release notes and consumer-owned updates in native Tauri windows.
|
|
2
|
+
*
|
|
3
|
+
* Mounts SDK child views before app children and keeps all updater callbacks in the host.
|
|
4
|
+
*
|
|
5
|
+
* Import this optional entry point only in Tauri apps with the documented capabilities.
|
|
6
|
+
*/
|
|
7
|
+
export { ReleaseNotesHost, type ReleaseNotesHostProps, } from './components/release-notes-host/index.js';
|
|
8
|
+
export { ReleaseNotesSettings } from './components/release-notes-settings/index.js';
|
|
9
|
+
export { useReleaseNotes, type ReleaseNotesActions, type ReleaseNotesResult, type ReaderPresentation, type UpdatePresentation, } from './hooks/use-release-notes.js';
|
|
10
|
+
export type { AppUpdater, AvailableUpdate, InstallProgress, ReleaseNotesState, ReleaseNotesPreferences, } from './contracts.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Presents release notes and consumer-owned updates in native Tauri windows.
|
|
2
|
+
*
|
|
3
|
+
* Mounts SDK child views before app children and keeps all updater callbacks in the host.
|
|
4
|
+
*
|
|
5
|
+
* Import this optional entry point only in Tauri apps with the documented capabilities.
|
|
6
|
+
*/
|
|
7
|
+
export { ReleaseNotesHost, } from './components/release-notes-host/index.js';
|
|
8
|
+
export { ReleaseNotesSettings } from './components/release-notes-settings/index.js';
|
|
9
|
+
export { useReleaseNotes, } from './hooks/use-release-notes.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Validates the bounded connection between existing local settings windows and main.
|
|
2
|
+
*
|
|
3
|
+
* Keeps secondary windows limited to bounded settings and headless presentation commands.
|
|
4
|
+
*
|
|
5
|
+
* Allow only authenticated presentation commands in headless mode; never remote updater notifications.
|
|
6
|
+
*/
|
|
7
|
+
import { type ChildKind, type PresentationAction } from './protocol.js';
|
|
8
|
+
/** Existing-window connection request event. */
|
|
9
|
+
export declare const PEER_CONNECT_EVENT = "makers-hq-release-notes-connect";
|
|
10
|
+
/** Existing-window command event, authenticated after the connection handshake. */
|
|
11
|
+
export declare const PEER_ACTION_EVENT = "makers-hq-release-notes-peer-action";
|
|
12
|
+
/** Targeted completion event for bounded settings and presentation commands. */
|
|
13
|
+
export declare const PEER_RESULT_EVENT = "makers-hq-release-notes-peer-result";
|
|
14
|
+
/** Supported settings and presentation actions; updater resources remain main-owned. */
|
|
15
|
+
export type PeerAction = {
|
|
16
|
+
type: 'open' | 'check' | 'disconnect';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'preference';
|
|
19
|
+
value: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'presentation';
|
|
22
|
+
kind: ChildKind;
|
|
23
|
+
generation: number;
|
|
24
|
+
action: PresentationAction;
|
|
25
|
+
};
|
|
26
|
+
/** Tests the labels allowed to request a settings connection.
|
|
27
|
+
* @param label - Claimed existing native window label.
|
|
28
|
+
* @param host - Sole callback-owning main label.
|
|
29
|
+
* @returns Whether the label can belong to a non-SDK settings peer.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isPeerLabel(label: unknown, host: string): label is string;
|
|
32
|
+
/** Validates a bounded settings or presentation action and its exact payload.
|
|
33
|
+
* @param value - Untrusted action payload.
|
|
34
|
+
* @returns Whether the payload is a supported bounded command.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPeerAction(value: unknown): value is PeerAction;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Validates the bounded connection between existing local settings windows and main.
|
|
2
|
+
*
|
|
3
|
+
* Keeps secondary windows limited to bounded settings and headless presentation commands.
|
|
4
|
+
*
|
|
5
|
+
* Allow only authenticated presentation commands in headless mode; never remote updater notifications.
|
|
6
|
+
*/
|
|
7
|
+
import { CHILD_PREFIX, isPresentationAction, } from './protocol.js';
|
|
8
|
+
/** Existing-window connection request event. */
|
|
9
|
+
export const PEER_CONNECT_EVENT = 'makers-hq-release-notes-connect';
|
|
10
|
+
/** Existing-window command event, authenticated after the connection handshake. */
|
|
11
|
+
export const PEER_ACTION_EVENT = 'makers-hq-release-notes-peer-action';
|
|
12
|
+
/** Targeted completion event for bounded settings and presentation commands. */
|
|
13
|
+
export const PEER_RESULT_EVENT = 'makers-hq-release-notes-peer-result';
|
|
14
|
+
/** Tests the labels allowed to request a settings connection.
|
|
15
|
+
* @param label - Claimed existing native window label.
|
|
16
|
+
* @param host - Sole callback-owning main label.
|
|
17
|
+
* @returns Whether the label can belong to a non-SDK settings peer.
|
|
18
|
+
*/
|
|
19
|
+
export function isPeerLabel(label, host) {
|
|
20
|
+
return (typeof label === 'string' &&
|
|
21
|
+
/^[a-zA-Z0-9_:/-]{1,128}$/.test(label) &&
|
|
22
|
+
label !== host &&
|
|
23
|
+
!label.startsWith(CHILD_PREFIX));
|
|
24
|
+
}
|
|
25
|
+
/** Validates a bounded settings or presentation action and its exact payload.
|
|
26
|
+
* @param value - Untrusted action payload.
|
|
27
|
+
* @returns Whether the payload is a supported bounded command.
|
|
28
|
+
*/
|
|
29
|
+
export function isPeerAction(value) {
|
|
30
|
+
if (!value || typeof value !== 'object')
|
|
31
|
+
return false;
|
|
32
|
+
const action = value;
|
|
33
|
+
if (action.type === 'presentation')
|
|
34
|
+
return ((action.kind === 'reader' || action.kind === 'update') &&
|
|
35
|
+
Number.isSafeInteger(action.generation) &&
|
|
36
|
+
Number(action.generation) > 0 &&
|
|
37
|
+
isPresentationAction(action.action) &&
|
|
38
|
+
Object.keys(action).length === 4);
|
|
39
|
+
if (action.type === 'preference')
|
|
40
|
+
return typeof action.value === 'boolean' && Object.keys(action).length === 2;
|
|
41
|
+
return (['open', 'check', 'disconnect'].includes(String(action.type)) &&
|
|
42
|
+
Object.keys(action).length === 1);
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Owns the native after-update preference and version-transition rules.
|
|
2
|
+
*
|
|
3
|
+
* Keeps first launch, downgrades and unavailable-note retries deterministic.
|
|
4
|
+
*
|
|
5
|
+
* Preserve exact version strings when adding presentation rules.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReleaseNotesPreferences } from './contracts.js';
|
|
8
|
+
/** Validates stored preferences without retaining extra persisted fields.
|
|
9
|
+
* @param value - Value read from the app-local store.
|
|
10
|
+
* @returns The supported preferences, applying safe defaults to invalid data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readPreferences(value: unknown): ReleaseNotesPreferences;
|
|
13
|
+
/** Determines whether an installed version is an unacknowledged upgrade.
|
|
14
|
+
* @param current - Installed native app version.
|
|
15
|
+
* @param acknowledged - Last acknowledged version, or null for first launch.
|
|
16
|
+
* @returns True only for a valid newer installed release, including changed build metadata.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isInstalledUpgrade(current: string, acknowledged: string | null): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Owns the native after-update preference and version-transition rules.
|
|
2
|
+
*
|
|
3
|
+
* Keeps first launch, downgrades and unavailable-note retries deterministic.
|
|
4
|
+
*
|
|
5
|
+
* Preserve exact version strings when adding presentation rules.
|
|
6
|
+
*/
|
|
7
|
+
import { gt, eq, valid } from 'semver';
|
|
8
|
+
import { normalizeReleaseVersion } from '../api.js';
|
|
9
|
+
/** Validates stored preferences without retaining extra persisted fields.
|
|
10
|
+
* @param value - Value read from the app-local store.
|
|
11
|
+
* @returns The supported preferences, applying safe defaults to invalid data.
|
|
12
|
+
*/
|
|
13
|
+
export function readPreferences(value) {
|
|
14
|
+
const data = value && typeof value === 'object' ? value : {};
|
|
15
|
+
return {
|
|
16
|
+
showAfterUpdate: typeof data.showAfterUpdate === 'boolean' ? data.showAfterUpdate : true,
|
|
17
|
+
acknowledgedVersion: typeof data.acknowledgedVersion === 'string' &&
|
|
18
|
+
valid(data.acknowledgedVersion)
|
|
19
|
+
? data.acknowledgedVersion
|
|
20
|
+
: null,
|
|
21
|
+
skippedVersion: typeof data.skippedVersion === 'string' && valid(data.skippedVersion)
|
|
22
|
+
? data.skippedVersion
|
|
23
|
+
: null,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Determines whether an installed version is an unacknowledged upgrade.
|
|
27
|
+
* @param current - Installed native app version.
|
|
28
|
+
* @param acknowledged - Last acknowledged version, or null for first launch.
|
|
29
|
+
* @returns True only for a valid newer installed release, including changed build metadata.
|
|
30
|
+
*/
|
|
31
|
+
export function isInstalledUpgrade(current, acknowledged) {
|
|
32
|
+
return Boolean(acknowledged &&
|
|
33
|
+
valid(current) &&
|
|
34
|
+
valid(acknowledged) &&
|
|
35
|
+
(gt(current, acknowledged) ||
|
|
36
|
+
(eq(current, acknowledged) &&
|
|
37
|
+
normalizeReleaseVersion(current) !==
|
|
38
|
+
normalizeReleaseVersion(acknowledged))));
|
|
39
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Validates the narrow messages exchanged by the native host and its child windows.
|
|
2
|
+
*
|
|
3
|
+
* Authenticates each child with a random per-window token and fixed same-origin route.
|
|
4
|
+
*
|
|
5
|
+
* Add explicit actions here instead of creating a general-purpose remote call protocol.
|
|
6
|
+
*/
|
|
7
|
+
/** Targeted child-to-host presentation event. */
|
|
8
|
+
export declare const ACTION_EVENT = "makers-hq-release-notes-action";
|
|
9
|
+
/** Targeted host-to-child snapshot event. */
|
|
10
|
+
export declare const STATE_EVENT = "makers-hq-release-notes-state";
|
|
11
|
+
/** SDK-owned route discriminator on the existing app entry point. */
|
|
12
|
+
export declare const CHILD_QUERY = "__makers_hq_window";
|
|
13
|
+
/** Fixed namespace for the two SDK child labels. */
|
|
14
|
+
export declare const CHILD_PREFIX = "makers-hq-release-notes-";
|
|
15
|
+
/** Fixed SDK child-window roles. */
|
|
16
|
+
export type ChildKind = 'reader' | 'update';
|
|
17
|
+
/** Serializable child actions; installation always carries the displayed version. */
|
|
18
|
+
export type ChildAction = {
|
|
19
|
+
type: 'ready' | 'check' | 'open-reader' | 'cancel';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'preference';
|
|
22
|
+
value: boolean;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'install' | 'skip' | 'rendered';
|
|
25
|
+
version: string;
|
|
26
|
+
};
|
|
27
|
+
/** Authenticated envelope scoped to one child lifecycle. */
|
|
28
|
+
export interface ActionEnvelope {
|
|
29
|
+
sender: string;
|
|
30
|
+
token: string;
|
|
31
|
+
action: ChildAction;
|
|
32
|
+
generation?: number;
|
|
33
|
+
}
|
|
34
|
+
/** Checks a child action and rejects arbitrary payloads before dispatch.
|
|
35
|
+
* @param value - Untrusted event payload.
|
|
36
|
+
* @param sender - Expected fixed child label.
|
|
37
|
+
* @param token - Random capability token assigned when creating the child.
|
|
38
|
+
* @returns Whether the complete envelope is valid.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isActionEnvelope(value: unknown, sender: string, token: string): value is ActionEnvelope;
|
|
41
|
+
/** Reads a child route only when its role, label and host are valid.
|
|
42
|
+
* @param url - Current same-origin application URL.
|
|
43
|
+
* @param label - Native current webview label.
|
|
44
|
+
* @returns Validated child route or null for the ordinary host app.
|
|
45
|
+
*/
|
|
46
|
+
export declare function childRoute(url: string, label: string): {
|
|
47
|
+
kind: ChildKind;
|
|
48
|
+
host: string;
|
|
49
|
+
token: string;
|
|
50
|
+
} | null;
|
|
51
|
+
/** Bounded presentation commands shared by the host and authenticated headless peers. */
|
|
52
|
+
export type PresentationAction = {
|
|
53
|
+
type: 'dismiss' | 'cancel';
|
|
54
|
+
} | {
|
|
55
|
+
type: 'install' | 'skip';
|
|
56
|
+
version: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'rendered';
|
|
59
|
+
version: string;
|
|
60
|
+
cached: boolean;
|
|
61
|
+
};
|
|
62
|
+
/** Validates the complete scalar presentation command.
|
|
63
|
+
* @param value - Untrusted peer command.
|
|
64
|
+
* @returns Whether the command is supported with an exact payload.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isPresentationAction(value: unknown): value is PresentationAction;
|
|
67
|
+
/** Checks the serializable presentation fields before authenticated snapshots reach hooks.
|
|
68
|
+
* @param state - Authenticated state object from the host.
|
|
69
|
+
* @returns Whether readiness, mode and private presentation identities are valid.
|
|
70
|
+
*/
|
|
71
|
+
export declare function hasPresentationState(state: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Validates the narrow messages exchanged by the native host and its child windows.
|
|
2
|
+
*
|
|
3
|
+
* Authenticates each child with a random per-window token and fixed same-origin route.
|
|
4
|
+
*
|
|
5
|
+
* Add explicit actions here instead of creating a general-purpose remote call protocol.
|
|
6
|
+
*/
|
|
7
|
+
/** Targeted child-to-host presentation event. */
|
|
8
|
+
export const ACTION_EVENT = 'makers-hq-release-notes-action';
|
|
9
|
+
/** Targeted host-to-child snapshot event. */
|
|
10
|
+
export const STATE_EVENT = 'makers-hq-release-notes-state';
|
|
11
|
+
/** SDK-owned route discriminator on the existing app entry point. */
|
|
12
|
+
export const CHILD_QUERY = '__makers_hq_window';
|
|
13
|
+
/** Fixed namespace for the two SDK child labels. */
|
|
14
|
+
export const CHILD_PREFIX = 'makers-hq-release-notes-';
|
|
15
|
+
/** Checks a child action and rejects arbitrary payloads before dispatch.
|
|
16
|
+
* @param value - Untrusted event payload.
|
|
17
|
+
* @param sender - Expected fixed child label.
|
|
18
|
+
* @param token - Random capability token assigned when creating the child.
|
|
19
|
+
* @returns Whether the complete envelope is valid.
|
|
20
|
+
*/
|
|
21
|
+
export function isActionEnvelope(value, sender, token) {
|
|
22
|
+
if (!value || typeof value !== 'object')
|
|
23
|
+
return false;
|
|
24
|
+
const envelope = value;
|
|
25
|
+
if (envelope.sender !== sender ||
|
|
26
|
+
envelope.token !== token ||
|
|
27
|
+
!envelope.action ||
|
|
28
|
+
typeof envelope.action !== 'object')
|
|
29
|
+
return false;
|
|
30
|
+
if (envelope.generation !== undefined &&
|
|
31
|
+
(!Number.isSafeInteger(envelope.generation) ||
|
|
32
|
+
Number(envelope.generation) < 1))
|
|
33
|
+
return false;
|
|
34
|
+
const action = envelope.action;
|
|
35
|
+
if (['ready', 'check', 'open-reader', 'cancel'].includes(String(action.type)))
|
|
36
|
+
return Object.keys(action).length === 1;
|
|
37
|
+
if (action.type === 'preference')
|
|
38
|
+
return typeof action.value === 'boolean' && Object.keys(action).length === 2;
|
|
39
|
+
return (['install', 'skip', 'rendered'].includes(String(action.type)) &&
|
|
40
|
+
typeof action.version === 'string' &&
|
|
41
|
+
action.version.length > 0 &&
|
|
42
|
+
action.version.length <= 128 &&
|
|
43
|
+
Object.keys(action).length === 2);
|
|
44
|
+
}
|
|
45
|
+
/** Reads a child route only when its role, label and host are valid.
|
|
46
|
+
* @param url - Current same-origin application URL.
|
|
47
|
+
* @param label - Native current webview label.
|
|
48
|
+
* @returns Validated child route or null for the ordinary host app.
|
|
49
|
+
*/
|
|
50
|
+
export function childRoute(url, label) {
|
|
51
|
+
const params = new URL(url).searchParams;
|
|
52
|
+
const kind = params.get(CHILD_QUERY);
|
|
53
|
+
if (kind !== 'reader' && kind !== 'update')
|
|
54
|
+
return null;
|
|
55
|
+
const host = params.get('__makers_hq_host') ?? '';
|
|
56
|
+
const token = params.get('__makers_hq_token') ?? '';
|
|
57
|
+
if (label !== CHILD_PREFIX + kind ||
|
|
58
|
+
!/^[a-zA-Z0-9_:/-]{1,128}$/.test(host) ||
|
|
59
|
+
!/^[a-f0-9-]{36}$/.test(token))
|
|
60
|
+
throw new Error('Invalid release notes window route.');
|
|
61
|
+
return { kind, host, token };
|
|
62
|
+
}
|
|
63
|
+
/** Validates the complete scalar presentation command.
|
|
64
|
+
* @param value - Untrusted peer command.
|
|
65
|
+
* @returns Whether the command is supported with an exact payload.
|
|
66
|
+
*/
|
|
67
|
+
export function isPresentationAction(value) {
|
|
68
|
+
if (!value || typeof value !== 'object')
|
|
69
|
+
return false;
|
|
70
|
+
const action = value;
|
|
71
|
+
if (['dismiss', 'cancel'].includes(String(action.type)))
|
|
72
|
+
return Object.keys(action).length === 1;
|
|
73
|
+
if (['install', 'skip'].includes(String(action.type)))
|
|
74
|
+
return (typeof action.version === 'string' &&
|
|
75
|
+
action.version.length > 0 &&
|
|
76
|
+
action.version.length <= 128 &&
|
|
77
|
+
Object.keys(action).length === 2);
|
|
78
|
+
return (action.type === 'rendered' &&
|
|
79
|
+
typeof action.version === 'string' &&
|
|
80
|
+
action.version.length > 0 &&
|
|
81
|
+
action.version.length <= 128 &&
|
|
82
|
+
typeof action.cached === 'boolean' &&
|
|
83
|
+
Object.keys(action).length === 3);
|
|
84
|
+
}
|
|
85
|
+
/** Checks the serializable presentation fields before authenticated snapshots reach hooks.
|
|
86
|
+
* @param state - Authenticated state object from the host.
|
|
87
|
+
* @returns Whether readiness, mode and private presentation identities are valid.
|
|
88
|
+
*/
|
|
89
|
+
export function hasPresentationState(state) {
|
|
90
|
+
function request(value) {
|
|
91
|
+
if (value === null)
|
|
92
|
+
return true;
|
|
93
|
+
if (!value || typeof value !== 'object')
|
|
94
|
+
return false;
|
|
95
|
+
const record = value;
|
|
96
|
+
return (Number.isSafeInteger(record.generation) &&
|
|
97
|
+
Number(record.generation) > 0 &&
|
|
98
|
+
typeof record.originWindowLabel === 'string' &&
|
|
99
|
+
/^[a-zA-Z0-9_:/-]{1,128}$/.test(record.originWindowLabel));
|
|
100
|
+
}
|
|
101
|
+
return (typeof state.ready === 'boolean' &&
|
|
102
|
+
(state.presentation === 'native' || state.presentation === 'headless') &&
|
|
103
|
+
(state.readerVersion === null || typeof state.readerVersion === 'string') &&
|
|
104
|
+
request(state.readerRequest) &&
|
|
105
|
+
request(state.updateRequest));
|
|
106
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** Connects an existing local settings window to the one native main host.
|
|
2
|
+
*
|
|
3
|
+
* Receives presentation snapshots and forwards only bounded settings actions.
|
|
4
|
+
*
|
|
5
|
+
* Keep updater resources, installation and background notifications in the main window.
|
|
6
|
+
*/
|
|
7
|
+
import type { NativeState } from './contracts.js';
|
|
8
|
+
import { type ChildKind, type PresentationAction } from './protocol.js';
|
|
9
|
+
/** Internal read/presentation client for one existing settings window. */
|
|
10
|
+
export declare class RemoteSettingsClient {
|
|
11
|
+
private projectId;
|
|
12
|
+
private hostLabel;
|
|
13
|
+
private state;
|
|
14
|
+
private listeners;
|
|
15
|
+
private token;
|
|
16
|
+
private snapshotRevision;
|
|
17
|
+
private nonce;
|
|
18
|
+
private disposers;
|
|
19
|
+
private pending;
|
|
20
|
+
private connectionWaiters;
|
|
21
|
+
private connectionFailure;
|
|
22
|
+
private disposed;
|
|
23
|
+
private label;
|
|
24
|
+
/** Connects to the main host without invoking consumer updater callbacks.
|
|
25
|
+
* @param projectId - Expected release-note project.
|
|
26
|
+
* @param hostLabel - Existing callback-owning main window.
|
|
27
|
+
*/
|
|
28
|
+
constructor(projectId: string, hostLabel: string);
|
|
29
|
+
/** Subscribes to main-host state.
|
|
30
|
+
* @param listener - React external-store listener.
|
|
31
|
+
* @returns Unsubscribe callback.
|
|
32
|
+
*/
|
|
33
|
+
subscribe: (listener: () => void) => (() => void);
|
|
34
|
+
/** Reads the stable presentation snapshot.
|
|
35
|
+
* @returns Latest authenticated main-host state.
|
|
36
|
+
*/
|
|
37
|
+
getSnapshot: () => NativeState;
|
|
38
|
+
private patch;
|
|
39
|
+
private initialize;
|
|
40
|
+
private settleConnection;
|
|
41
|
+
private waitForConnection;
|
|
42
|
+
private send;
|
|
43
|
+
/** Opens a reader owned by main and returning focus to this settings window.
|
|
44
|
+
* @returns Completion after the native reader is ready.
|
|
45
|
+
*/
|
|
46
|
+
open: () => Promise<void>;
|
|
47
|
+
/** Runs the main host's manual check, bypassing its skipped candidate.
|
|
48
|
+
* @returns Completion after the host finishes presenting its result.
|
|
49
|
+
*/
|
|
50
|
+
check: () => Promise<void>;
|
|
51
|
+
/** Saves the main host's shared preference.
|
|
52
|
+
* @param value - New after-update preference.
|
|
53
|
+
* @returns Completion after host persistence and synchronization.
|
|
54
|
+
*/
|
|
55
|
+
setShowAfterUpdate: (value: boolean) => Promise<void>;
|
|
56
|
+
/** Sends one bounded command for a captured headless presentation.
|
|
57
|
+
* @param kind - Reader or update role.
|
|
58
|
+
* @param generation - Private identity from the authenticated snapshot.
|
|
59
|
+
* @param action - Bounded presentation command.
|
|
60
|
+
* @param action.type - Fixed command discriminator.
|
|
61
|
+
* @param action.version - Exact displayed candidate or rendered release version.
|
|
62
|
+
* @param action.cached - Whether rendered content came from offline storage.
|
|
63
|
+
* @returns Command acceptance; long operations report through synchronized state.
|
|
64
|
+
*/
|
|
65
|
+
presentationAction: (kind: ChildKind, generation: number, action: PresentationAction) => Promise<void>;
|
|
66
|
+
/** Rejects secondary-window background notifications.
|
|
67
|
+
* @returns A rejected promise; consumer background checking belongs in the main host.
|
|
68
|
+
*/
|
|
69
|
+
notifyUpdateAvailable: () => Promise<void>;
|
|
70
|
+
/** Releases secondary-window listeners without touching main's updater resources. */
|
|
71
|
+
dispose(): void;
|
|
72
|
+
}
|