@blogmcp/community 0.4.1 → 0.5.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/dist/blogmcp-community-private.global.js +8 -0
- package/dist/blogmcp-community.global.js +3 -3
- package/dist/chunks/{mount-Ts_r2fwt.js → mount-SKmc4NgD.js} +39 -9
- package/dist/chunks/private-mount-BgfUSd3g.js +5548 -0
- package/dist/core/attrs.d.ts +15 -0
- package/dist/core/settings.d.ts +5 -0
- package/dist/index.js +2 -2
- package/dist/private/core/dock.d.ts +38 -0
- package/dist/private/core/push.d.ts +49 -0
- package/dist/private/core/realtime.d.ts +57 -0
- package/dist/private/core/setup.d.ts +43 -0
- package/dist/private/core/view.d.ts +179 -0
- package/dist/private/dm/composer.d.ts +34 -0
- package/dist/private/dm/controller.d.ts +162 -0
- package/dist/private/dm/index.d.ts +14 -0
- package/dist/private/dm/links.d.ts +33 -0
- package/dist/private/dm/muted.d.ts +37 -0
- package/dist/private/dm/search.d.ts +7 -0
- package/dist/private/dm/text.d.ts +27 -0
- package/dist/private/dm/ui/DmBlocks.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmCases.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmComposer.vue.d.ts +20 -0
- package/dist/private/dm/ui/DmInbox.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmLinkWarning.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmLocalAids.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmMessageText.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmNew.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmReport.vue.d.ts +8 -0
- package/dist/private/dm/ui/DmRequests.vue.d.ts +12 -0
- package/dist/private/dm/ui/DmScreens.vue.d.ts +9 -0
- package/dist/private/dm/ui/DmThread.vue.d.ts +9 -0
- package/dist/private/element.d.ts +23 -0
- package/dist/private/global.d.ts +10 -0
- package/dist/private/i18n.d.ts +41 -0
- package/dist/private/index.d.ts +32 -0
- package/dist/private/index.js +57 -0
- package/dist/private/mount.d.ts +55 -0
- package/dist/private/pages/api.d.ts +44 -0
- package/dist/private/pages/element.d.ts +6 -0
- package/dist/private/pages/fragment.d.ts +43 -0
- package/dist/private/pages/i18n.d.ts +25 -0
- package/dist/private/pages/index.d.ts +1 -0
- package/dist/private/pages/pages.d.ts +276 -0
- package/dist/private/pages/proof.d.ts +36 -0
- package/dist/private/pages/provider-view.d.ts +33 -0
- package/dist/private/pages/setup.d.ts +42 -0
- package/dist/private/pages/ui/AccountPageRoot.vue.d.ts +9 -0
- package/dist/private/pages/ui/PageActivation.vue.d.ts +9 -0
- package/dist/private/pages/ui/PageAddress.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageDeviceApprove.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageDevices.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageExport.vue.d.ts +8 -0
- package/dist/private/pages/ui/PageMessages.vue.d.ts +9 -0
- package/dist/private/react.d.ts +12 -0
- package/dist/private/react.js +36 -0
- package/dist/private/ui/ChatDockRoot.vue.d.ts +20 -0
- package/dist/private/ui/LegalBlocks.vue.d.ts +10 -0
- package/dist/private/ui/LegalRun.vue.d.ts +7 -0
- package/dist/private/ui/LegalRuns.vue.d.ts +6 -0
- package/dist/private/ui/LegalText.vue.d.ts +13 -0
- package/dist/private/ui/PrivateScreens.vue.d.ts +14 -0
- package/dist/private/ui/PrivateViewRoot.vue.d.ts +23 -0
- package/dist/private/ui/PromiseBlock.vue.d.ts +9 -0
- package/dist/private/ui/ProviderLine.vue.d.ts +8 -0
- package/dist/private/ui/ScreenActivation.vue.d.ts +8 -0
- package/dist/private/ui/ScreenAddress.vue.d.ts +8 -0
- package/dist/private/ui/ScreenApproval.vue.d.ts +8 -0
- package/dist/private/ui/ScreenDevices.vue.d.ts +8 -0
- package/dist/private/ui/ScreenHome.vue.d.ts +12 -0
- package/dist/private/ui/ScreenNotifications.vue.d.ts +8 -0
- package/dist/private/ui/ScreenReads.vue.d.ts +8 -0
- package/dist/private/ui/ScreenSettings.vue.d.ts +8 -0
- package/dist/private/ui/legal.d.ts +15 -0
- package/dist/private/ui/root.d.ts +35 -0
- package/dist/private/ui/text.d.ts +22 -0
- package/dist/private/vue.d.ts +88 -0
- package/dist/private/vue.js +72 -0
- package/dist/react.js +14 -14
- package/dist/vue.js +14 -14
- package/package.json +23 -6
- package/src/core/attrs.ts +19 -0
- package/src/core/settings.ts +55 -12
- package/src/private/core/dock.ts +105 -0
- package/src/private/core/push.ts +166 -0
- package/src/private/core/realtime.ts +109 -0
- package/src/private/core/setup.ts +75 -0
- package/src/private/core/view.ts +920 -0
- package/src/private/dm/composer.ts +74 -0
- package/src/private/dm/controller.ts +636 -0
- package/src/private/dm/index.ts +14 -0
- package/src/private/dm/links.ts +55 -0
- package/src/private/dm/muted.ts +160 -0
- package/src/private/dm/search.ts +18 -0
- package/src/private/dm/text.ts +60 -0
- package/src/private/dm/ui/DmBlocks.vue +27 -0
- package/src/private/dm/ui/DmCases.vue +58 -0
- package/src/private/dm/ui/DmComposer.vue +68 -0
- package/src/private/dm/ui/DmInbox.vue +34 -0
- package/src/private/dm/ui/DmLinkWarning.vue +27 -0
- package/src/private/dm/ui/DmLocalAids.vue +43 -0
- package/src/private/dm/ui/DmMessageText.vue +16 -0
- package/src/private/dm/ui/DmNew.vue +46 -0
- package/src/private/dm/ui/DmReport.vue +93 -0
- package/src/private/dm/ui/DmRequests.vue +50 -0
- package/src/private/dm/ui/DmScreens.vue +66 -0
- package/src/private/dm/ui/DmThread.vue +235 -0
- package/src/private/element.ts +90 -0
- package/src/private/global.ts +14 -0
- package/src/private/i18n.ts +127 -0
- package/src/private/index.ts +68 -0
- package/src/private/messages/cs.json +311 -0
- package/src/private/messages/en.json +319 -0
- package/src/private/mount.ts +103 -0
- package/src/private/pages/api.ts +96 -0
- package/src/private/pages/build.d.mts +2 -0
- package/src/private/pages/build.mjs +72 -0
- package/src/private/pages/element.ts +49 -0
- package/src/private/pages/fragment.ts +63 -0
- package/src/private/pages/i18n.ts +82 -0
- package/src/private/pages/index.ts +10 -0
- package/src/private/pages/messages/cs.json +97 -0
- package/src/private/pages/messages/en.json +97 -0
- package/src/private/pages/pages.ts +410 -0
- package/src/private/pages/proof.ts +110 -0
- package/src/private/pages/provider-view.ts +121 -0
- package/src/private/pages/setup.ts +79 -0
- package/src/private/pages/ui/AccountPageRoot.vue +45 -0
- package/src/private/pages/ui/PageActivation.vue +42 -0
- package/src/private/pages/ui/PageAddress.vue +39 -0
- package/src/private/pages/ui/PageDeviceApprove.vue +62 -0
- package/src/private/pages/ui/PageDevices.vue +84 -0
- package/src/private/pages/ui/PageExport.vue +35 -0
- package/src/private/pages/ui/PageMessages.vue +39 -0
- package/src/private/pages/ui/account.css +6 -0
- package/src/private/react.ts +49 -0
- package/src/private/shims.d.ts +6 -0
- package/src/private/ui/ChatDockRoot.vue +119 -0
- package/src/private/ui/LegalBlocks.vue +30 -0
- package/src/private/ui/LegalRun.vue +13 -0
- package/src/private/ui/LegalRuns.vue +20 -0
- package/src/private/ui/LegalText.vue +25 -0
- package/src/private/ui/PrivateScreens.vue +61 -0
- package/src/private/ui/PrivateViewRoot.vue +70 -0
- package/src/private/ui/PromiseBlock.vue +18 -0
- package/src/private/ui/ProviderLine.vue +20 -0
- package/src/private/ui/ScreenActivation.vue +82 -0
- package/src/private/ui/ScreenAddress.vue +37 -0
- package/src/private/ui/ScreenApproval.vue +71 -0
- package/src/private/ui/ScreenDevices.vue +42 -0
- package/src/private/ui/ScreenHome.vue +29 -0
- package/src/private/ui/ScreenNotifications.vue +44 -0
- package/src/private/ui/ScreenReads.vue +23 -0
- package/src/private/ui/ScreenSettings.vue +44 -0
- package/src/private/ui/legal.ts +29 -0
- package/src/private/ui/private.css +90 -0
- package/src/private/ui/root.ts +89 -0
- package/src/private/ui/text.ts +40 -0
- package/src/private/vue.ts +87 -0
package/dist/core/attrs.d.ts
CHANGED
|
@@ -68,6 +68,18 @@ export interface CommunityRoutes {
|
|
|
68
68
|
topicPath?: string;
|
|
69
69
|
/** M3: the forum's search (the forum's search box goes there with the query in the fragment, `#q=…`). */
|
|
70
70
|
searchPath?: string;
|
|
71
|
+
/**
|
|
72
|
+
* M4 PU2 (m4-contracts.md §6.2, A.9): the private view's page (`/komunita/zpravy`); the dock links it, and the host
|
|
73
|
+
* centre's content-free „Soukromé zprávy" link leads there.
|
|
74
|
+
*/
|
|
75
|
+
messagesPath?: string;
|
|
76
|
+
/**
|
|
77
|
+
* M4: the host's grant route (POST, `createPrivateGrantHandler`), on its own origin: the private view posts its key's
|
|
78
|
+
* thumbprint there for a one-minute grant. Only `@blogmcp/community/private` reads it; the public elements never call it.
|
|
79
|
+
*/
|
|
80
|
+
grantPath?: string;
|
|
81
|
+
/** M4: the host's hand-off route (GET, `createPrivateGrantHandoff`) for `provider_page`: the link to the account host goes through it. */
|
|
82
|
+
grantHandoffPath?: string;
|
|
71
83
|
}
|
|
72
84
|
/** A path on the host's own site (the SDK's links.ts rule). */
|
|
73
85
|
export declare function isSitePath(path: unknown): path is string;
|
|
@@ -107,6 +119,9 @@ export declare function routesWithDefaults(routes: CommunityRoutes, tenant?: {
|
|
|
107
119
|
categoryPath: string;
|
|
108
120
|
topicPath: string;
|
|
109
121
|
searchPath: string;
|
|
122
|
+
messagesPath: string;
|
|
123
|
+
grantPath: string;
|
|
124
|
+
grantHandoffPath: string;
|
|
110
125
|
};
|
|
111
126
|
/** O-16: the terms page beside a rules page of the managed blog's shape (`…/community/rules`), else null. */
|
|
112
127
|
export declare function termsBeside(rulesPath: string): string | null;
|
package/dist/core/settings.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type CommunityClient, type CommunityFailure, type MemberSettings, type ModuleInfo } from '@blogmcp/sdk/community';
|
|
2
2
|
import type { TextRef } from './i18n';
|
|
3
3
|
import { type PushSupport } from './push';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a subscription was made for this VAPID key: true or false from its `options.applicationServerKey`, null when
|
|
6
|
+
* the browser does not say (an older engine) — then `subscribe` itself decides (B-55, `enablePush`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function sameApplicationServerKey(sub: PushSubscription, key: Uint8Array): boolean | null;
|
|
4
9
|
/** The six switches, in the order the page shows them. */
|
|
5
10
|
export declare const SETTING_KEYS: readonly ["notifyReply", "notifyMention", "notifyTopic", "pushEnabled", "digestEmail", "quietHours"];
|
|
6
11
|
export type SettingKey = (typeof SETTING_KEYS)[number];
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ab, B, S, ac, D, t, r, F, u, s, q, M, N, p, P, V, T, W, R, Q, a0, Z, a5, $, U, a6, a7, O, a9, a8, X, a2, a1, _, Y, f, d, a, n, k, j, o, m, g, c, b, e, h, l, i, z, v, K, G, H, L, J, A, x, w, y, C, I, E, aa, a3, a4 } from "./chunks/mount-
|
|
2
|
-
const VERSION = "0.
|
|
1
|
+
import { ab, B, S, ac, D, t, r, F, u, s, q, M, N, p, P, V, T, W, R, Q, a0, Z, a5, $, U, a6, a7, O, a9, a8, X, a2, a1, _, Y, f, d, a, n, k, j, o, m, g, c, b, e, h, l, i, z, v, K, G, H, L, J, A, x, w, y, C, I, E, aa, a3, a4 } from "./chunks/mount-SKmc4NgD.js";
|
|
2
|
+
const VERSION = "0.5.1";
|
|
3
3
|
export {
|
|
4
4
|
ab as AVATAR_PRESETS,
|
|
5
5
|
B as BADGE_ELEMENT_TAG,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PrivateRealtimeInput } from './realtime';
|
|
2
|
+
import type { PrivateScreen } from './view';
|
|
3
|
+
/** How many windows stay open side by side on a desktop; opening one more closes the oldest. */
|
|
4
|
+
export declare const DOCK_MAX_WINDOWS = 3;
|
|
5
|
+
/** At or below this width a window takes the whole screen and only one is open. */
|
|
6
|
+
export declare const DOCK_MOBILE_QUERY = "(max-width:640px)";
|
|
7
|
+
/**
|
|
8
|
+
* The dock's `realtime` property (§6.3, C.8): the SDK's `createPrivateRealtime`, which the dock's controller starts
|
|
9
|
+
* with its own private client, or a source of the host's own (`{ subscribe(listener) }`, the inbox's `{ k }`).
|
|
10
|
+
*/
|
|
11
|
+
export type PrivateDockRealtime = PrivateRealtimeInput;
|
|
12
|
+
export interface DockWindow {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly screen: PrivateScreen;
|
|
15
|
+
/** A conversation's window (its screen is `messages`); absent for an account screen's window. */
|
|
16
|
+
readonly conversationId?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DockUi {
|
|
19
|
+
panelOpen: boolean;
|
|
20
|
+
windows: DockWindow[];
|
|
21
|
+
mobile: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface DockController {
|
|
24
|
+
readonly state: DockUi;
|
|
25
|
+
togglePanel(): void;
|
|
26
|
+
openWindow(screen: PrivateScreen): void;
|
|
27
|
+
/** One conversation's window (DM8b); an open one comes to the front. */
|
|
28
|
+
openConversation(conversationId: string): void;
|
|
29
|
+
closeWindow(id: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Every conversation's window goes (the account screens' stay): the conversations ended — a sign-out, another
|
|
32
|
+
* member on this browser, a forgotten key —, and a window of the previous member's conversation must not wait for
|
|
33
|
+
* the next member's controller to fill it.
|
|
34
|
+
*/
|
|
35
|
+
closeConversations(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare function createDock(): DockController;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This browser's private push (m4-contracts.md §6.2, §6.3, B-55). One service worker gives one `PushSubscription`, the
|
|
3
|
+
* same endpoint for the host's push and the private push; kb-api keeps one row per origin (`UNIQUE (endpoint,
|
|
4
|
+
* origin)`), so each surface manages only its own row:
|
|
5
|
+
*
|
|
6
|
+
* - on the member's click the private view reuses the browser's subscription when it was made for the tenant's VAPID
|
|
7
|
+
* key (`subscribe` with the same key answers it), or subscribes when there is none, and posts it to
|
|
8
|
+
* `private/push/subscribe` with this device's session;
|
|
9
|
+
* - „Vypnout" posts `private/push/unsubscribe` for the endpoint and leaves the browser's subscription alone, because
|
|
10
|
+
* the host's row may use it; when kb-api does not take it, the device stays recorded as the one that turned push
|
|
11
|
+
* on (the private row is still live, and nothing else would end it), and the view keeps the switch on;
|
|
12
|
+
* - **the private view never calls `PushSubscription.unsubscribe()`** (test/private/text.spec.ts scans for it);
|
|
13
|
+
* - on every start it re-reads `getSubscription()` and re-posts `private/push/subscribe` for a device that turned the
|
|
14
|
+
* private push on here, so a changed endpoint (the browser rotated it, the host's element made a new one for a new
|
|
15
|
+
* key) replaces the device's private row.
|
|
16
|
+
*
|
|
17
|
+
* After a VAPID key rotation the browser's subscription belongs to the old key, and `subscribe` with the new key is
|
|
18
|
+
* refused while it exists. The private view still never ends it: `enable` and `resync` compare the subscription's key
|
|
19
|
+
* with `me/push/vapid` and answer `stale`, and the screen asks the member to switch the website's notifications off and
|
|
20
|
+
* on (the public element ends a subscription made for another key), after which the next start re-posts the endpoint.
|
|
21
|
+
*
|
|
22
|
+
* Which device turned it on here is kept per browser as the device key's thumbprint (a public value, never a token):
|
|
23
|
+
* another member's device on a shared browser, or this member's key after a `forget`, is not this device. The worker,
|
|
24
|
+
* the permission and the VAPID key are the public element's glue (`../../core/push.ts`, the one module that may touch
|
|
25
|
+
* the service worker) and the host's `me/push/vapid`.
|
|
26
|
+
*/
|
|
27
|
+
import type { CommunityClient } from '@blogmcp/sdk/community';
|
|
28
|
+
import type { PrivateClient } from '@blogmcp/sdk/community/private';
|
|
29
|
+
export type PrivatePushResult = 'on' | 'denied' | 'refused' | 'unsupported' | 'stale';
|
|
30
|
+
/** What the private view needs of this browser's push (a stub in the unit specs). */
|
|
31
|
+
export interface PrivatePushPort {
|
|
32
|
+
supported(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Re-post this device's subscription when it turned the private push on here: true when it is on, `stale` when the
|
|
35
|
+
* subscription was made for a key the tenant no longer serves (nothing is posted then).
|
|
36
|
+
*/
|
|
37
|
+
resync(client: PrivateClient): Promise<boolean | 'stale'>;
|
|
38
|
+
enable(client: PrivateClient): Promise<PrivatePushResult>;
|
|
39
|
+
/** Delete this device's private row; false when kb-api did not take it (the private push is still on). */
|
|
40
|
+
disable(client: PrivateClient): Promise<boolean>;
|
|
41
|
+
}
|
|
42
|
+
export interface BrowserPrivatePushOptions {
|
|
43
|
+
/** The host's worker script (`<site-base>/sw.js`). */
|
|
44
|
+
swPath: string;
|
|
45
|
+
/** The host's public client, for `me/push/vapid` (the tenant's one VAPID key serves both rows). */
|
|
46
|
+
host: CommunityClient;
|
|
47
|
+
}
|
|
48
|
+
/** The browser's glue (see the module doc). */
|
|
49
|
+
export declare function browserPrivatePush(o: BrowserPrivatePushOptions): PrivatePushPort;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The private elements' live inbox (m4-contracts.md §6.2, §6.3, C.8): the `realtime` the host passes to
|
|
3
|
+
* `<blogmcp-chat-dock>`, `<blogmcp-private-view>` and `createPrivateView`. The elements own no socket; it is either
|
|
4
|
+
*
|
|
5
|
+
* - the SDK's factory, `createPrivateRealtime` of `@blogmcp/sdk/community/private` (or any function of its shape):
|
|
6
|
+
* the controller calls it with ITS private client once the view is ready, so the connection's tokens are asked
|
|
7
|
+
* with this device's session, and closes it when the view goes (unmounted, signed out, dark, a final refusal); or
|
|
8
|
+
* - a source the host runs itself, `{ subscribe(listener) }` (the shape C.8 names): the controller only subscribes
|
|
9
|
+
* and unsubscribes, and never closes what it did not open.
|
|
10
|
+
*
|
|
11
|
+
* Either way the events are the inbox's content-free `{ k }` (with at most `c`, `s` and `r`).
|
|
12
|
+
*/
|
|
13
|
+
import { type PrivateClient } from '@blogmcp/sdk/community/private';
|
|
14
|
+
/** One inbox event, as far as the elements read it. */
|
|
15
|
+
export interface PrivateInboxEvent {
|
|
16
|
+
readonly k: string;
|
|
17
|
+
}
|
|
18
|
+
/** A source of inbox events: `subscribe` returns the function that removes the listener. */
|
|
19
|
+
export interface PrivateRealtimeSource {
|
|
20
|
+
subscribe(listener: (event: PrivateInboxEvent) => void): () => void;
|
|
21
|
+
close?(): void;
|
|
22
|
+
}
|
|
23
|
+
/** What the controller calls a factory with. */
|
|
24
|
+
export interface PrivateRealtimeFactoryOptions {
|
|
25
|
+
client: PrivateClient;
|
|
26
|
+
onMode?: (mode: string) => void;
|
|
27
|
+
onEnd?: (end: {
|
|
28
|
+
reason: string;
|
|
29
|
+
code: string | null;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
/** `createPrivateRealtime`, or any function of its shape. */
|
|
33
|
+
export type PrivateRealtimeFactory = (options: PrivateRealtimeFactoryOptions) => PrivateRealtimeSource;
|
|
34
|
+
/** What a host passes as `realtime`. */
|
|
35
|
+
export type PrivateRealtimeInput = PrivateRealtimeFactory | PrivateRealtimeSource;
|
|
36
|
+
/** The live inbox as the view states it: none passed, connecting, live, or ended (its reason kept for the screen). */
|
|
37
|
+
export type PrivateRealtimeState = 'off' | 'connecting' | 'live' | 'ended';
|
|
38
|
+
export interface RunningRealtime {
|
|
39
|
+
stop(): void;
|
|
40
|
+
}
|
|
41
|
+
/** Whether a value can be used as `realtime` (a factory, or an object with `subscribe`). */
|
|
42
|
+
export declare function isRealtimeInput(value: unknown): value is PrivateRealtimeInput;
|
|
43
|
+
/**
|
|
44
|
+
* Start the inbox for `client` and hand its events to `onEvent`; `onState` follows the connection. Never throws: a
|
|
45
|
+
* factory or a source that fails leaves the view without live updates (it still reads on every open).
|
|
46
|
+
*/
|
|
47
|
+
export declare function startRealtime(input: PrivateRealtimeInput, client: PrivateClient, onEvent: (event: PrivateInboxEvent) => void, onState: (state: PrivateRealtimeState, end?: {
|
|
48
|
+
reason: string;
|
|
49
|
+
code: string | null;
|
|
50
|
+
}) => void): RunningRealtime;
|
|
51
|
+
/**
|
|
52
|
+
* Whether an inbox event can move the private unread count (the dot): the account's events, `resync`, and of the
|
|
53
|
+
* conversations' kinds only those `dmEventEffect` says move the inbox (`m`, `d`, `rq`). Typing (`t`), a read receipt
|
|
54
|
+
* (`rd`) and an edit (`e`) cannot, and a busy conversation would otherwise spend the private session's limiter on
|
|
55
|
+
* `notifications/unread-count` calls that change nothing (C.11 RF8-C (h)).
|
|
56
|
+
*/
|
|
57
|
+
export declare function refreshesUnread(event: PrivateInboxEvent): boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From an element's attributes to its controller (m4-contracts.md §6.2). The host names:
|
|
3
|
+
* - `kb-origin` — kb-api's public origin (`https://<slug>.blogmcp.ai`): the only origin the private client talks to,
|
|
4
|
+
* with no credentials (§5.8); never the host's own base;
|
|
5
|
+
* - `api-base` / `site-base` — the host's relative base for its own `me/get` (the public client, as every public
|
|
6
|
+
* element);
|
|
7
|
+
* - `routes` — the host's pages and its grant routes (`grantPath`, default `<site-base>/community/grant`);
|
|
8
|
+
* - `account-origin` — the account host (`https://<slug>--account.<base>`), for `provider_page`'s link;
|
|
9
|
+
* - `site-name` — the website's name in the promise; `sw-path` — the host's worker, for this browser's private push.
|
|
10
|
+
* A test or a host that builds its own private client passes it as the `client` property; the live inbox is the
|
|
11
|
+
* `realtime` property (the SDK's `createPrivateRealtime`, core/realtime.ts).
|
|
12
|
+
*/
|
|
13
|
+
import { type PrivateClient } from '@blogmcp/sdk/community/private';
|
|
14
|
+
import type { CommunityClient, CommunityTransport } from '@blogmcp/sdk/community';
|
|
15
|
+
import { routesWithDefaults, type CommunityRoutes } from '../../core/attrs';
|
|
16
|
+
import { type PrivatePushPort } from './push';
|
|
17
|
+
import type { PrivateRealtimeInput } from './realtime';
|
|
18
|
+
import { type PrivateViewController } from './view';
|
|
19
|
+
export interface PrivateElementInput {
|
|
20
|
+
kbOrigin?: string | null;
|
|
21
|
+
apiBase?: string | null;
|
|
22
|
+
siteBase?: string | null;
|
|
23
|
+
routes?: string | CommunityRoutes | null;
|
|
24
|
+
siteName?: string | null;
|
|
25
|
+
swPath?: string | null;
|
|
26
|
+
accountOrigin?: string | null;
|
|
27
|
+
transport?: CommunityTransport | null;
|
|
28
|
+
/** A private client the host made itself (or a test's stub). */
|
|
29
|
+
client?: PrivateClient | null;
|
|
30
|
+
/** A push port in place of the browser's (a test's stub; null turns this browser's private push off). */
|
|
31
|
+
push?: PrivatePushPort | null;
|
|
32
|
+
/** The host's live inbox (core/realtime.ts): the SDK's `createPrivateRealtime`, or a source of its own. */
|
|
33
|
+
realtime?: PrivateRealtimeInput | null;
|
|
34
|
+
}
|
|
35
|
+
export interface PrivateSetup {
|
|
36
|
+
controller: PrivateViewController;
|
|
37
|
+
routes: ReturnType<typeof routesWithDefaults>;
|
|
38
|
+
/** The account host's `/zpravy` (the `provider_page` link), or null when the host named no account origin. */
|
|
39
|
+
accountUrl: string | null;
|
|
40
|
+
host: CommunityClient;
|
|
41
|
+
}
|
|
42
|
+
/** The controller for an element, or null (the developer told once) when a required attribute is unusable. */
|
|
43
|
+
export declare function privateSetupFor(i: PrivateElementInput): PrivateSetup | null;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type PrivateActivationState, type PrivateApprovalRequest, type PrivateApprovalStart, type PrivateClient, type PrivateDevice, type PrivateLegalText, type PrivateModuleBlock, type PrivatePromiseKey, type PrivateReadHour, type PrivateStateAnswer } from '@blogmcp/sdk/community/private';
|
|
2
|
+
import type { CommunityClient } from '@blogmcp/sdk/community';
|
|
3
|
+
import { type DmViewController } from '../dm/controller';
|
|
4
|
+
import { type MutedStore } from '../dm/muted';
|
|
5
|
+
import type { PrivatePushPort } from './push';
|
|
6
|
+
import { type PrivateRealtimeInput, type PrivateRealtimeState } from './realtime';
|
|
7
|
+
/** The screens of M2b, and `messages` — the conversations, whose own screens are DM8b's (src/private/dm/**). */
|
|
8
|
+
export declare const PRIVATE_SCREENS: readonly ["home", "messages", "address", "activation", "approval", "devices", "reads", "notifications", "settings"];
|
|
9
|
+
export type PrivateScreen = (typeof PRIVATE_SCREENS)[number];
|
|
10
|
+
export type PrivatePhase = 'idle' | 'loading' | 'ready' | 'signIn' | 'dark' | 'link' | 'failed';
|
|
11
|
+
/** A text and its params, turned into words by the view. */
|
|
12
|
+
export interface PrivateTextRef {
|
|
13
|
+
readonly msg: string;
|
|
14
|
+
readonly params?: Record<string, string | number>;
|
|
15
|
+
}
|
|
16
|
+
/** The provider line (§5.11): `body_json.provider` of the current `private_contact` text. */
|
|
17
|
+
export interface ProviderLine {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly ico: string;
|
|
20
|
+
readonly address: string;
|
|
21
|
+
readonly links: Readonly<Partial<Record<'contact' | 'rules' | 'terms' | 'privacy', string>>>;
|
|
22
|
+
}
|
|
23
|
+
/** One private notification as the screen shows it (PU3 serves `notifications/list`). */
|
|
24
|
+
export interface PrivateNotificationItem {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly code: string;
|
|
27
|
+
readonly createdAt: string | null;
|
|
28
|
+
readonly readAt: string | null;
|
|
29
|
+
}
|
|
30
|
+
export type DmAudience = 'nobody' | 'shared' | 'anyone';
|
|
31
|
+
export declare const DM_AUDIENCES: readonly DmAudience[];
|
|
32
|
+
/** The private settings (DM3's `settings/get|set`: `dm_audience` within the ceiling, read receipts, typing). */
|
|
33
|
+
export interface PrivateSettingsValues {
|
|
34
|
+
dmAudience: DmAudience;
|
|
35
|
+
dmReadReceipts: boolean;
|
|
36
|
+
dmTyping: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The codes the account's notification screen words: Appendix A.5's private codes but the conversations' own
|
|
40
|
+
* (`dm_message`, `dm_request`), which DM8b's conversation screens word. Any other code is left out, never shown raw;
|
|
41
|
+
* „mark all read" marks every row (`{ all: true }`), so a row left out never keeps the unread dot on.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PRIVATE_NOTIFICATION_CODES: readonly ["device_new", "device_request", "private_decision", "private_statement", "private_terms_change", "private_read_only", "private_erasure_pending"];
|
|
44
|
+
/** The account events after which the member's state is read again (§6.3's inbox codes of M2b). */
|
|
45
|
+
export declare const ACCOUNT_STATE_EVENTS: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* `approval/start`'s rate refusals (HTTP 429): the member's daily cap, the network's hourly cap, and a device's failed
|
|
48
|
+
* requests (§5.10). The approval screen says which and when to try again instead of the generic failure.
|
|
49
|
+
*/
|
|
50
|
+
export declare const APPROVAL_LIMIT_CODES: Readonly<Record<string, 'day' | 'hour' | 'device'>>;
|
|
51
|
+
export interface PrivateViewUi {
|
|
52
|
+
phase: PrivatePhase;
|
|
53
|
+
/**
|
|
54
|
+
* A ready view reloading (a `resync`, a forget): the phase stays `ready` meanwhile, so the screens, the dock's panel
|
|
55
|
+
* and the conversation windows stay as they are — no loading placeholder flashes — and the inbox events reach the
|
|
56
|
+
* conversations; it ends with the reload, which then sets the phase it found.
|
|
57
|
+
*/
|
|
58
|
+
reloading: boolean;
|
|
59
|
+
failure: PrivateTextRef | null;
|
|
60
|
+
block: PrivateModuleBlock | null;
|
|
61
|
+
screen: PrivateScreen;
|
|
62
|
+
state: PrivateStateAnswer | null;
|
|
63
|
+
activation: PrivateActivationState | null;
|
|
64
|
+
provider: ProviderLine | null;
|
|
65
|
+
promise: {
|
|
66
|
+
keys: readonly PrivatePromiseKey[];
|
|
67
|
+
delegated: boolean;
|
|
68
|
+
} | null;
|
|
69
|
+
/** The texts' placeholders the screen fills (`display` of activation/state, §5.11). */
|
|
70
|
+
busy: boolean;
|
|
71
|
+
announcement: PrivateTextRef | null;
|
|
72
|
+
announceId: number;
|
|
73
|
+
/** Each screen's own refusal, shown on that screen only (cleared when the screen opens again or acts again). */
|
|
74
|
+
screenFailures: Partial<Record<PrivateScreen, PrivateTextRef>>;
|
|
75
|
+
/** The member declined the art. 9 consent on this screen: nothing was recorded (see the module comment). */
|
|
76
|
+
art9Declined: boolean;
|
|
77
|
+
devices: readonly PrivateDevice[] | null;
|
|
78
|
+
reads: readonly PrivateReadHour[] | null;
|
|
79
|
+
approvals: readonly PrivateApprovalRequest[] | null;
|
|
80
|
+
approvalStart: PrivateApprovalStart | null;
|
|
81
|
+
/** A start the rate limits refused (APPROVAL_LIMIT_CODES), until the member tries again. */
|
|
82
|
+
approvalLimited: 'day' | 'hour' | 'device' | null;
|
|
83
|
+
/** The code an approved device shows for a request, and until when. */
|
|
84
|
+
shownCode: {
|
|
85
|
+
approvalId: string;
|
|
86
|
+
code: string;
|
|
87
|
+
expiresAt: string;
|
|
88
|
+
} | null;
|
|
89
|
+
addressLink: {
|
|
90
|
+
url: string;
|
|
91
|
+
expiresAt: string;
|
|
92
|
+
} | null;
|
|
93
|
+
notifications: readonly PrivateNotificationItem[] | null;
|
|
94
|
+
/** The next page of the notifications (`nextCursor`), or null when the list is complete. */
|
|
95
|
+
notificationsCursor: string | null;
|
|
96
|
+
unread: number;
|
|
97
|
+
settings: {
|
|
98
|
+
values: PrivateSettingsValues;
|
|
99
|
+
ceiling: DmAudience;
|
|
100
|
+
} | null;
|
|
101
|
+
settingsUnavailable: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* `stale`: the browser's subscription was made for a VAPID key the tenant no longer serves (a rotation). The private
|
|
104
|
+
* view never ends a subscription (B-55), so it asks the member to switch the website's notifications off and on —
|
|
105
|
+
* the public element ends a subscription made for another key — and the next start re-posts the new endpoint.
|
|
106
|
+
*/
|
|
107
|
+
push: {
|
|
108
|
+
offered: boolean;
|
|
109
|
+
status: 'off' | 'on' | 'busy' | 'unsupported';
|
|
110
|
+
note: 'denied' | 'refused' | 'stale' | null;
|
|
111
|
+
};
|
|
112
|
+
/** The live inbox (see the module comment): `off` when the host passed none. */
|
|
113
|
+
realtime: PrivateRealtimeState;
|
|
114
|
+
/** The conversations (DM8b), once the view is ready; null before, and where the private client offers no calls. */
|
|
115
|
+
dm: DmViewController | null;
|
|
116
|
+
}
|
|
117
|
+
export interface PrivateViewController {
|
|
118
|
+
readonly state: PrivateViewUi;
|
|
119
|
+
load(): Promise<void>;
|
|
120
|
+
open(screen: PrivateScreen): Promise<void>;
|
|
121
|
+
/** The screen a member should see first (address → approval of a pending device → activation → overview). */
|
|
122
|
+
firstScreen(): PrivateScreen;
|
|
123
|
+
refreshUnread(): Promise<void>;
|
|
124
|
+
approvalStart(via: 'code' | 'email'): Promise<void>;
|
|
125
|
+
/** Clears a rate refusal of `approvalStart`, so the two ways to start are offered again. */
|
|
126
|
+
approvalRetry(): void;
|
|
127
|
+
approvalRedeem(code: string): Promise<void>;
|
|
128
|
+
approvalShow(approvalId: string): Promise<void>;
|
|
129
|
+
approvalDeny(approvalId: string): Promise<void>;
|
|
130
|
+
requestAddressLink(): Promise<void>;
|
|
131
|
+
activate(input: {
|
|
132
|
+
acceptTerms: boolean;
|
|
133
|
+
art9: 'accept' | 'refuse';
|
|
134
|
+
art9Tenant: boolean;
|
|
135
|
+
}): Promise<void>;
|
|
136
|
+
withdraw(): Promise<void>;
|
|
137
|
+
signOutDevice(deviceId: string): Promise<void>;
|
|
138
|
+
signOutAll(): Promise<void>;
|
|
139
|
+
forget(): Promise<void>;
|
|
140
|
+
markAllRead(): Promise<void>;
|
|
141
|
+
moreNotifications(): Promise<void>;
|
|
142
|
+
setSetting<K extends keyof PrivateSettingsValues>(key: K, value: PrivateSettingsValues[K]): Promise<void>;
|
|
143
|
+
enablePush(): Promise<void>;
|
|
144
|
+
disablePush(): Promise<void>;
|
|
145
|
+
/** The sentence the activation's `private_activation` text shows once notifications are on (§7.5), or null. */
|
|
146
|
+
pushSentence(): string | null;
|
|
147
|
+
/** The promise's `{site}`, `{entity}`, `{ico}`. */
|
|
148
|
+
promiseParams(): Record<string, string>;
|
|
149
|
+
dispose(): void;
|
|
150
|
+
}
|
|
151
|
+
export interface PrivateViewOptions {
|
|
152
|
+
/** The host's public client (its relative base): `me/get` says who is signed in and what the module allows. */
|
|
153
|
+
host: CommunityClient;
|
|
154
|
+
/** The private client, made once the host's `me/get` admits it (never before: a dark instance is not asked). */
|
|
155
|
+
client: () => PrivateClient;
|
|
156
|
+
/** This browser's push glue (null where the host offers no worker). */
|
|
157
|
+
push: PrivatePushPort | null;
|
|
158
|
+
/** The website's name for the promise's `{site}` (the host's `site-name`; default the page's host name). */
|
|
159
|
+
siteName: string;
|
|
160
|
+
/** The host's live inbox (core/realtime.ts): the SDK's `createPrivateRealtime`, or a source of its own. */
|
|
161
|
+
realtime?: PrivateRealtimeInput | null;
|
|
162
|
+
/** The site's poradna (`routes.consultationPath`), for a report's „Nahlásit výrobci“ (§7.5). */
|
|
163
|
+
consultationPath?: string | null;
|
|
164
|
+
/** The member's muted words' store (default: this browser's IndexedDB, dm/muted.ts); a test passes its own. */
|
|
165
|
+
mutedStore?: (memberId: string) => MutedStore;
|
|
166
|
+
}
|
|
167
|
+
/** Whether the view ended on a refusal no retry cures (FINAL_REFUSALS): nothing private shows on this page. */
|
|
168
|
+
export declare function isFinalFailure(state: Pick<PrivateViewUi, 'phase' | 'failure'>): boolean;
|
|
169
|
+
/** The provider line of a `private_contact` text, or null when its `body_json.provider` is incomplete. */
|
|
170
|
+
export declare function providerOf(texts: readonly PrivateLegalText[] | null | undefined): ProviderLine | null;
|
|
171
|
+
/**
|
|
172
|
+
* The promise for this member, from the variants kb-api resolved for this session (§5.11): `delegated` (a delegated
|
|
173
|
+
* identity, or a native one through the tenant's host), `same_entity`, the rendering and the host kind — the same facts
|
|
174
|
+
* the texts were rendered from, so the promise and the accepted texts cannot disagree.
|
|
175
|
+
*/
|
|
176
|
+
export declare function promiseFor(a: PrivateActivationState | null, block: PrivateModuleBlock | null): import("@blogmcp/sdk/community/private").PrivatePromise;
|
|
177
|
+
/** The `push` section of the `private_activation` text (§7.5: the sentence shown once notifications are on). */
|
|
178
|
+
export declare function pushSectionOf(a: PrivateActivationState | null): string | null;
|
|
179
|
+
export declare function createPrivateView(o: PrivateViewOptions): PrivateViewController;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the composer says, and what a message still allows (m4-contracts.md §7.8 DM8b, §3.5, invariant 12).
|
|
3
|
+
*
|
|
4
|
+
* **The composer sentence** is read from the capability matrix (`privatePromise`'s `receivers` and `keys`, PU1), never
|
|
5
|
+
* worded on its own, and it says no more than the promise does: one short line under the text box per party that
|
|
6
|
+
* receives what the member is about to write — the other participant; the website's code, which puts it on the screen
|
|
7
|
+
* under tenant rendering (and, where the website and blogmcp are the same legal person, `same_entity`, the line that
|
|
8
|
+
* says this person writes that code and is barred by the law, not by a contract it would sign with itself); whoever
|
|
9
|
+
* handles a report, with the at most 10 preceding messages the matrix gives them; the court or police order, which is in
|
|
10
|
+
* every row, so the list never reads as complete without it; the delegated addendum where the website can sign in as the
|
|
11
|
+
* member (under both renderings); and that the messages are not end-to-end encrypted. test/private/dm/composer.spec.ts
|
|
12
|
+
* checks every space × identity × rendering × same-entity × host combination against the promise's own keys, and the
|
|
13
|
+
* tone test covers its words with the rest of the conversations' catalogue.
|
|
14
|
+
*
|
|
15
|
+
* **The windows.** An edit is taken within `private_edit_window_minutes` of the message (15) and a delete for everyone
|
|
16
|
+
* within `private_delete_for_all_hours` (48) — platform settings the browser is not told. The affordances follow those
|
|
17
|
+
* defaults; kb-api's `EDIT_WINDOW` / `DELETE_WINDOW` stays the authority, and the thread then offers „Smazat u mě“
|
|
18
|
+
* (hide), which has no window.
|
|
19
|
+
*/
|
|
20
|
+
import type { PrivateDmMessage, PrivatePromise } from '@blogmcp/sdk/community/private';
|
|
21
|
+
export declare const DM_COMPOSER_KEYS: readonly ["private.dm.composer.participants", "private.dm.composer.display", "private.dm.composer.sameEntity", "private.dm.composer.reports", "private.dm.composer.orders", "private.dm.composer.delegated", "private.dm.composer.notE2e"];
|
|
22
|
+
export type DmComposerKey = (typeof DM_COMPOSER_KEYS)[number];
|
|
23
|
+
/** The composer sentence's keys for this member, in the order they are shown (see the module doc). */
|
|
24
|
+
export declare function composerKeys(promise: Pick<PrivatePromise, 'receivers' | 'keys' | 'delegated'> | null): DmComposerKey[];
|
|
25
|
+
/** `private_edit_window_minutes`' default (§5.11's settings). */
|
|
26
|
+
export declare const DM_EDIT_WINDOW_MS: number;
|
|
27
|
+
/** `private_delete_for_all_hours`' default. */
|
|
28
|
+
export declare const DM_DELETE_FOR_ALL_MS: number;
|
|
29
|
+
/** The member's own visible message, still within the edit window. */
|
|
30
|
+
export declare function canEdit(m: PrivateDmMessage, now?: number): boolean;
|
|
31
|
+
/** The member's own visible message, still within the window of a delete for everyone. */
|
|
32
|
+
export declare function canDeleteForAll(m: PrivateDmMessage, now?: number): boolean;
|
|
33
|
+
/** A message the member can report: the other participant's, with its text (a tombstone or a removed one has none). */
|
|
34
|
+
export declare function canReport(m: PrivateDmMessage): boolean;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { CaseCategory } from '@blogmcp/sdk/community';
|
|
2
|
+
import { type PrivateDmAudience, type PrivateDmBlock, type PrivateDmCase, type PrivateDmClient, type PrivateDmConversation, type PrivateDmCounterpart, type PrivateDmMessage, type PrivateDmReportLine, type PrivateDmReportPreview, type PrivateDmRequest, type PrivateDmStatement, type PrivateDmThreadState, type PrivatePromise } from '@blogmcp/sdk/community/private';
|
|
3
|
+
import { type DmComposerKey } from './composer';
|
|
4
|
+
import { type MutedStore } from './muted';
|
|
5
|
+
/** The conversations' own screens inside the private view's `messages` screen. */
|
|
6
|
+
export declare const DM_SCREENS: readonly ["inbox", "conversation", "new", "requests", "blocks", "cases"];
|
|
7
|
+
export type DmScreen = (typeof DM_SCREENS)[number];
|
|
8
|
+
/** The areas a refusal is said in (one screen's refusal never shows in another). */
|
|
9
|
+
export type DmArea = 'inbox' | 'requests' | 'new' | 'thread' | 'report' | 'blocks' | 'cases' | 'statement' | 'appeal' | 'muted';
|
|
10
|
+
/** The rules line's categories (kb-api's `lineOf`: every other report category is the illegal line's). */
|
|
11
|
+
export declare const DM_RULES_CATEGORIES: readonly CaseCategory[];
|
|
12
|
+
/**
|
|
13
|
+
* The illegal line's categories: the SDK's `ESCALATION_CATEGORIES`, spelt out so that the private bundles need not load
|
|
14
|
+
* the public SDK entry for one list (test/private/dm/screens.spec.ts holds the two equal).
|
|
15
|
+
*/
|
|
16
|
+
export declare const DM_ILLEGAL_CATEGORIES: readonly CaseCategory[];
|
|
17
|
+
/** The categories a line offers, in the SDK's order. */
|
|
18
|
+
export declare function categoriesOf(line: PrivateDmReportLine): readonly CaseCategory[];
|
|
19
|
+
/** The one category whose report also points to the manufacturer's poradna (§7.5: „Nahlásit výrobci“). */
|
|
20
|
+
export declare const DM_ADVERSE_EVENT: CaseCategory;
|
|
21
|
+
/** The report in progress (§7.5): what is reported, on which line, what goes to whom, and the reporter's choices. */
|
|
22
|
+
export interface DmReportFlow {
|
|
23
|
+
/**
|
|
24
|
+
* A message of a conversation, or a request (`requests/block-report`: the request is the package). Both choose the
|
|
25
|
+
* line: block-report takes no line, kb-api derives it from the category (`lineOf`), so a request's illegal content
|
|
26
|
+
* reaches blogmcp's T&S only when the reporter can pick the illegal line's categories.
|
|
27
|
+
*/
|
|
28
|
+
readonly kind: 'message' | 'request';
|
|
29
|
+
readonly conversationId: string;
|
|
30
|
+
readonly seq: number | null;
|
|
31
|
+
line: PrivateDmReportLine | null;
|
|
32
|
+
category: CaseCategory | null;
|
|
33
|
+
/** „Kdo to dostane“: the range and the recipients, read before the reporter sends. */
|
|
34
|
+
preview: PrivateDmReportPreview | null;
|
|
35
|
+
/** Ticked by default (§7.5: the sender is blocked unless the reporter unticks it). */
|
|
36
|
+
block: boolean;
|
|
37
|
+
note: string;
|
|
38
|
+
done: {
|
|
39
|
+
caseId: string;
|
|
40
|
+
} | null;
|
|
41
|
+
}
|
|
42
|
+
export interface DmUi {
|
|
43
|
+
screen: DmScreen;
|
|
44
|
+
/** The conversation the full view shows (`screen = 'conversation'`). */
|
|
45
|
+
current: string | null;
|
|
46
|
+
inbox: PrivateDmConversation[] | null;
|
|
47
|
+
inboxCursor: string | null;
|
|
48
|
+
requests: PrivateDmRequest[] | null;
|
|
49
|
+
requestsCursor: string | null;
|
|
50
|
+
blocks: PrivateDmBlock[] | null;
|
|
51
|
+
cases: PrivateDmCase[] | null;
|
|
52
|
+
casesCursor: string | null;
|
|
53
|
+
statement: PrivateDmStatement | null;
|
|
54
|
+
appealDone: boolean;
|
|
55
|
+
/** Each watched thread's state (the SDK thread's snapshot), by conversation id. */
|
|
56
|
+
threads: Record<string, PrivateDmThreadState>;
|
|
57
|
+
/** The counterpart of a conversation, as the inbox or the requests named it (for a window's title). */
|
|
58
|
+
counterparts: Record<string, PrivateDmCounterpart>;
|
|
59
|
+
/** The handle check of a new conversation. */
|
|
60
|
+
audience: {
|
|
61
|
+
handle: string;
|
|
62
|
+
canWrite: PrivateDmAudience['canWrite'];
|
|
63
|
+
} | null;
|
|
64
|
+
report: DmReportFlow | null;
|
|
65
|
+
/** A link a member clicked in a message, waiting for the warning's „Pokračovat“. */
|
|
66
|
+
linkWarning: {
|
|
67
|
+
href: string;
|
|
68
|
+
host: string;
|
|
69
|
+
} | null;
|
|
70
|
+
muted: string[];
|
|
71
|
+
mutedPersistent: boolean;
|
|
72
|
+
/** Folded messages the member chose to show anyway (`<conversationId>:<seq>`), for this page only. */
|
|
73
|
+
unfolded: Record<string, true>;
|
|
74
|
+
failures: Partial<Record<DmArea, string>>;
|
|
75
|
+
busy: boolean;
|
|
76
|
+
announcement: {
|
|
77
|
+
msg: string;
|
|
78
|
+
params?: Record<string, string | number>;
|
|
79
|
+
} | null;
|
|
80
|
+
announceId: number;
|
|
81
|
+
}
|
|
82
|
+
export interface DmViewController {
|
|
83
|
+
readonly state: DmUi;
|
|
84
|
+
/** The words the composer shows for this member (composer.ts). */
|
|
85
|
+
composerKeys(): DmComposerKey[];
|
|
86
|
+
/** The website's rules (the provider line's `rules` link), for the reminder to the sender. */
|
|
87
|
+
rulesHref(): string | null;
|
|
88
|
+
/** The site's poradna for „Nahlásit výrobci“ (§7.5), or null when the host named none. */
|
|
89
|
+
consultationPath(): string | null;
|
|
90
|
+
/** The private surfaces are read-only (`read_only`): the history shows, the composer does not. */
|
|
91
|
+
readOnly(): boolean;
|
|
92
|
+
readonly drafts: PrivateDmClient['drafts'];
|
|
93
|
+
show(screen: DmScreen): Promise<void>;
|
|
94
|
+
loadInbox(more?: boolean): Promise<void>;
|
|
95
|
+
loadRequests(more?: boolean): Promise<void>;
|
|
96
|
+
/** Watch a conversation's thread (a window or the full view): loads it; the returned function stops watching. */
|
|
97
|
+
watch(conversationId: string): () => void;
|
|
98
|
+
openConversation(conversationId: string): Promise<void>;
|
|
99
|
+
checkHandle(handle: string): Promise<void>;
|
|
100
|
+
openHandle(handle: string): Promise<string | null>;
|
|
101
|
+
send(conversationId: string, text: string, replyToSeq?: number | null): void;
|
|
102
|
+
typing(conversationId: string): void;
|
|
103
|
+
markRead(conversationId: string): void;
|
|
104
|
+
loadOlder(conversationId: string): Promise<void>;
|
|
105
|
+
edit(conversationId: string, m: PrivateDmMessage, text: string): Promise<boolean>;
|
|
106
|
+
deleteForAll(conversationId: string, seq: number): Promise<boolean>;
|
|
107
|
+
hide(conversationId: string, seq: number): Promise<boolean>;
|
|
108
|
+
clear(conversationId: string): Promise<boolean>;
|
|
109
|
+
retry(clientMsgId: string): void;
|
|
110
|
+
discard(clientMsgId: string): void;
|
|
111
|
+
acceptRequest(conversationId: string): Promise<boolean>;
|
|
112
|
+
deleteRequest(conversationId: string): Promise<boolean>;
|
|
113
|
+
block(memberId: string): Promise<boolean>;
|
|
114
|
+
unblock(memberId: string): Promise<boolean>;
|
|
115
|
+
startReport(kind: 'message' | 'request', conversationId: string, seq?: number): void;
|
|
116
|
+
reportLine(line: PrivateDmReportLine): Promise<void>;
|
|
117
|
+
reportCategory(category: CaseCategory): void;
|
|
118
|
+
submitReport(): Promise<boolean>;
|
|
119
|
+
cancelReport(): void;
|
|
120
|
+
loadCases(more?: boolean): Promise<void>;
|
|
121
|
+
openStatement(decisionId: string): Promise<void>;
|
|
122
|
+
appeal(decisionId: string, text: string): Promise<boolean>;
|
|
123
|
+
warnLink(link: {
|
|
124
|
+
href: string;
|
|
125
|
+
host: string;
|
|
126
|
+
}): void;
|
|
127
|
+
dismissLink(): void;
|
|
128
|
+
addMuted(word: string): Promise<void>;
|
|
129
|
+
removeMuted(word: string): Promise<void>;
|
|
130
|
+
unfold(conversationId: string, seq: number): void;
|
|
131
|
+
/** One inbox event (core/view.ts hands every one over). */
|
|
132
|
+
apply(event: {
|
|
133
|
+
readonly k: string;
|
|
134
|
+
readonly c?: string;
|
|
135
|
+
readonly s?: number;
|
|
136
|
+
readonly r?: string;
|
|
137
|
+
}): void;
|
|
138
|
+
/** The browser is online again: wake every waiting send. */
|
|
139
|
+
online(): void;
|
|
140
|
+
dispose(): void;
|
|
141
|
+
}
|
|
142
|
+
export interface DmViewOptions {
|
|
143
|
+
dm: PrivateDmClient;
|
|
144
|
+
/** The matrix row for this member (core/view.ts `promiseFor`), for the composer sentence. */
|
|
145
|
+
promise: () => Pick<PrivatePromise, 'receivers' | 'keys' | 'delegated'> | null;
|
|
146
|
+
rulesHref: () => string | null;
|
|
147
|
+
consultationPath?: string | null;
|
|
148
|
+
/** False when the member switched typing off (the private settings): no `dm/typing` is sent then. */
|
|
149
|
+
typingAllowed?: () => boolean;
|
|
150
|
+
/** True while the private state is `read_only` (§5.11): kb-api refuses writes, so the composer is not offered. */
|
|
151
|
+
readOnly?: () => boolean;
|
|
152
|
+
muted: MutedStore;
|
|
153
|
+
/**
|
|
154
|
+
* A read of this conversation also read some of its private notifications (`dm_message`, `dm_request`; kb-api marks
|
|
155
|
+
* them with the cursor): the view refreshes its unread dot with its private client, which the DM controller does not
|
|
156
|
+
* hold.
|
|
157
|
+
*/
|
|
158
|
+
notificationsRead?: (conversationId: string) => void;
|
|
159
|
+
}
|
|
160
|
+
export declare function createDmView(o: DmViewOptions): DmViewController;
|
|
161
|
+
/** The catalogue key of a refusal in the conversations: their own codes by name, the account's through the view's. */
|
|
162
|
+
export declare function dmErrorKey(code: string | null | undefined, fallback: (code: string | null | undefined) => string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DM elements (m4-contracts.md §7.8 DM8b): the conversations inside `<blogmcp-private-view>` (its `messages`
|
|
3
|
+
* screen) and `<blogmcp-chat-dock>` (the panel's list and a window per conversation), over the SDK's DM client. The
|
|
4
|
+
* private entry re-exports what a host that builds its own screens around the controller may use.
|
|
5
|
+
*/
|
|
6
|
+
export { createDmView, dmErrorKey, categoriesOf, DM_SCREENS, DM_RULES_CATEGORIES, DM_ADVERSE_EVENT } from './controller';
|
|
7
|
+
export type { DmViewController, DmViewOptions, DmUi, DmScreen, DmArea, DmReportFlow } from './controller';
|
|
8
|
+
export { composerKeys, canEdit, canDeleteForAll, canReport, DM_COMPOSER_KEYS, DM_EDIT_WINDOW_MS, DM_DELETE_FOR_ALL_MS } from './composer';
|
|
9
|
+
export type { DmComposerKey } from './composer';
|
|
10
|
+
export { indexedDbMutedStore, memoryMutedStore, mutedMatch, foldText, MUTED_DB_NAME, MUTED_DB_STORE, MUTED_MAX_WORDS } from './muted';
|
|
11
|
+
export type { MutedStore } from './muted';
|
|
12
|
+
export { searchLoaded, DM_SEARCH_MIN_LENGTH } from './search';
|
|
13
|
+
export { segmentsOf, linkOf } from './links';
|
|
14
|
+
export type { DmTextSegment } from './links';
|