@blogmcp/sdk 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/community/channels.d.ts +12 -0
  2. package/dist/community/channels.js +7 -0
  3. package/dist/community/client.d.ts +211 -0
  4. package/dist/community/client.js +188 -0
  5. package/dist/community/index.d.ts +34 -0
  6. package/dist/community/index.js +92 -0
  7. package/dist/community/links.d.ts +65 -0
  8. package/dist/community/links.js +81 -0
  9. package/dist/community/messages.cs.d.ts +331 -0
  10. package/dist/community/messages.cs.js +342 -0
  11. package/dist/community/messages.d.ts +40 -0
  12. package/dist/community/messages.en.d.ts +315 -0
  13. package/dist/community/messages.en.js +313 -0
  14. package/dist/community/messages.js +66 -0
  15. package/dist/community/outcome.d.ts +96 -0
  16. package/dist/community/outcome.js +211 -0
  17. package/dist/community/poll.d.ts +35 -0
  18. package/dist/community/poll.js +70 -0
  19. package/dist/community/routes.d.ts +110 -0
  20. package/dist/community/routes.js +66 -0
  21. package/dist/community/server/bff.d.ts +123 -0
  22. package/dist/community/server/bff.js +214 -0
  23. package/dist/community/server/env.d.ts +20 -0
  24. package/dist/community/server/env.js +16 -0
  25. package/dist/community/server/host-routes.d.ts +15 -0
  26. package/dist/community/server/host-routes.js +35 -0
  27. package/dist/community/server/http.d.ts +64 -0
  28. package/dist/community/server/http.js +90 -0
  29. package/dist/community/server/index.d.ts +45 -0
  30. package/dist/community/server/index.js +19 -0
  31. package/dist/community/server/route-decision.d.ts +70 -0
  32. package/dist/community/server/route-decision.js +89 -0
  33. package/dist/community/server/unknown-path.d.ts +21 -0
  34. package/dist/community/server/unknown-path.js +11 -0
  35. package/dist/community/shapes.d.ts +457 -0
  36. package/dist/community/shapes.js +51 -0
  37. package/dist/community/store.d.ts +183 -0
  38. package/dist/community/store.js +423 -0
  39. package/dist/community/transport.d.ts +42 -0
  40. package/dist/community/transport.js +59 -0
  41. package/dist/core/client.d.ts +17 -0
  42. package/dist/core/client.js +58 -55
  43. package/dist/core/comments-legacy.d.ts +19 -0
  44. package/dist/core/comments-legacy.js +18 -0
  45. package/dist/core/index.d.ts +3 -0
  46. package/dist/core/index.js +107 -101
  47. package/dist/core/queries.d.ts +46 -0
  48. package/dist/core/queries.js +128 -84
  49. package/dist/core/seo.js +40 -39
  50. package/dist/core/translations/cs.json.js +6 -6
  51. package/dist/core/translations/en.json.js +1 -1
  52. package/dist/core/types.d.ts +23 -1
  53. package/dist/core/view-model.d.ts +7 -0
  54. package/dist/core/view-model.js +29 -25
  55. package/dist/react/KbMdxContent.js +4 -3
  56. package/dist/vue/components/KbMdxContent.vue2.js +3 -2
  57. package/dist/vue/composables/useKbComments.d.ts +8 -0
  58. package/package.json +13 -4
  59. package/src/community/channels.ts +12 -0
  60. package/src/community/client.ts +437 -0
  61. package/src/community/index.ts +190 -0
  62. package/src/community/links.ts +166 -0
  63. package/src/community/messages.cs.ts +371 -0
  64. package/src/community/messages.en.ts +341 -0
  65. package/src/community/messages.ts +112 -0
  66. package/src/community/outcome.ts +317 -0
  67. package/src/community/poll.ts +154 -0
  68. package/src/community/routes.ts +139 -0
  69. package/src/community/server/bff.ts +530 -0
  70. package/src/community/server/env.ts +42 -0
  71. package/src/community/server/host-routes.ts +48 -0
  72. package/src/community/server/http.ts +175 -0
  73. package/src/community/server/index.ts +55 -0
  74. package/src/community/server/route-decision.ts +226 -0
  75. package/src/community/server/unknown-path.ts +32 -0
  76. package/src/community/shapes.ts +513 -0
  77. package/src/community/store.ts +786 -0
  78. package/src/community/transport.ts +111 -0
  79. package/src/core/client.ts +24 -1
  80. package/src/core/comments-legacy.ts +39 -0
  81. package/src/core/index.ts +8 -0
  82. package/src/core/queries.ts +93 -0
  83. package/src/core/seo.ts +5 -1
  84. package/src/core/translations/cs.json +3 -1
  85. package/src/core/translations/en.json +3 -1
  86. package/src/core/types.ts +19 -1
  87. package/src/core/view-model.ts +12 -1
  88. package/src/vue/composables/useKbComments.ts +8 -0
@@ -0,0 +1,513 @@
1
+ /**
2
+ * What the community's operations answer (docs/internal/m1-contracts.md §7.3, §7.4, §7.7, §8.3) — the shapes of
3
+ * kb-api's `routes/community-public.ts` and `routes/trust-notices.ts`, as types.
4
+ *
5
+ * The enums a newer kb-api may extend are OPEN (community.md §3.7: the client is shaped so later surfaces add on
6
+ * without breaking it): a message's `state`, an author's `kind`, a `need`, a restriction's `kind` and a
7
+ * notification's `code` are `KnownX | (string & {})`. A page renders only what it knows and skips the rest — the
8
+ * `isKnownX` guards below say which is which, and the discussion store (store.ts) drops a message whose author
9
+ * kind or state it does not know, and a need it does not know, without throwing.
10
+ *
11
+ * Types and pure guards only: nothing here does I/O.
12
+ */
13
+
14
+ /** A string that is none of the known values (a newer kb-api's): keeps the known ones' autocompletion. */
15
+ type Open<Known extends string> = Known | (string & {})
16
+
17
+ const has = (list: readonly string[], value: unknown): boolean => typeof value === 'string' && list.includes(value)
18
+
19
+ // ───────────────────────── the open enums ─────────────────────────
20
+
21
+ /** A message's state: held and removed ones their author sees with the state; others get a placeholder or nothing. */
22
+ export const MESSAGE_STATES = Object.freeze(['visible', 'held', 'removed', 'deleted'] as const)
23
+ export type KnownMessageState = (typeof MESSAGE_STATES)[number]
24
+ export type MessageState = Open<KnownMessageState>
25
+ export const isKnownState = (state: unknown): state is KnownMessageState => has(MESSAGE_STATES, state)
26
+
27
+ export const AUTHOR_KINDS = Object.freeze(['member', 'staff', 'system'] as const)
28
+ export type KnownAuthorKind = (typeof AUTHOR_KINDS)[number]
29
+ export type AuthorKind = Open<KnownAuthorKind>
30
+ export const isKnownAuthorKind = (kind: unknown): kind is KnownAuthorKind => has(AUTHOR_KINDS, kind)
31
+
32
+ /** What a viewer still needs before writing (kb-api computes it on every read and write). */
33
+ export const NEEDS = Object.freeze(['sign_in', 'onboarding', 'reconsent_rules', 'art9_consent'] as const)
34
+ export type KnownNeed = (typeof NEEDS)[number]
35
+ export type Need = Open<KnownNeed>
36
+ export const isKnownNeed = (need: unknown): need is KnownNeed => has(NEEDS, need)
37
+
38
+ export const RESTRICTION_KINDS = Object.freeze(['restriction', 'suspension', 'ban'] as const)
39
+ export type KnownRestrictionKind = (typeof RESTRICTION_KINDS)[number]
40
+ export type RestrictionKind = Open<KnownRestrictionKind>
41
+ export const isKnownRestrictionKind = (kind: unknown): kind is KnownRestrictionKind => has(RESTRICTION_KINDS, kind)
42
+
43
+ /** In-app notifications: codes and ids only (`appeal_resolved` is a decision that supersedes another). */
44
+ export const NOTIFICATION_CODES = Object.freeze(['decision', 'appeal_resolved', 'erasure_scheduled', 'inactivity_warning'] as const)
45
+ export type KnownNotificationCode = (typeof NOTIFICATION_CODES)[number]
46
+ export type NotificationCode = Open<KnownNotificationCode>
47
+ export const isKnownNotificationCode = (code: unknown): code is KnownNotificationCode => has(NOTIFICATION_CODES, code)
48
+
49
+ // ───────────────────────── closed vocabularies (kb-api validates them) ─────────────────────────
50
+
51
+ /** The report and notice categories (kb-api's CASE_CATEGORIES; test/community/codes-drift.spec.ts pins them). */
52
+ export const CASE_CATEGORIES = Object.freeze([
53
+ 'fraud_spam',
54
+ 'harassment',
55
+ 'hate',
56
+ 'threats',
57
+ 'sexual_content',
58
+ 'child_at_risk',
59
+ 'self_harm',
60
+ 'doxxing',
61
+ 'copyright',
62
+ 'terrorism',
63
+ 'drugs',
64
+ 'other_illegal',
65
+ 'rules',
66
+ 'adverse_event',
67
+ 'third_party_health_data',
68
+ 'suspected_minor',
69
+ ] as const)
70
+ export type CaseCategory = (typeof CASE_CATEGORIES)[number]
71
+ export const isCaseCategory = (value: unknown): value is CaseCategory => has(CASE_CATEGORIES, value)
72
+
73
+ /** The one category whose notice never carries a notifier's name or e-mail (kb-api: NOTIFIER_NOT_ALLOWED). */
74
+ export const CATEGORY_WITHOUT_NOTIFIER: CaseCategory = 'child_at_risk'
75
+
76
+ export const AGE_BANDS = Object.freeze(['16_17', '18_plus'] as const)
77
+ export type AgeBand = (typeof AGE_BANDS)[number]
78
+
79
+ export const LEGAL_TEXT_KINDS = Object.freeze(['rules', 'terms', 'privacy', 'art9_consent'] as const)
80
+ export type LegalTextKind = (typeof LEGAL_TEXT_KINDS)[number]
81
+
82
+ export type AcceptanceState = 'accepted' | 'reconsent_required' | 'never'
83
+
84
+ // ───────────────────────── a discussion (§7.3) ─────────────────────────
85
+
86
+ export interface MemberAuthor {
87
+ readonly kind: 'member'
88
+ readonly memberId: string
89
+ readonly handle: string
90
+ readonly displayName: string
91
+ readonly avatarPreset: string | null
92
+ readonly deleted?: undefined
93
+ }
94
+
95
+ /** An erased member, a member without a profile, and every placeholder: the author is not told. */
96
+ export interface DeletedMemberAuthor {
97
+ readonly kind: 'member'
98
+ readonly memberId: null
99
+ readonly handle: null
100
+ readonly displayName: null
101
+ readonly avatarPreset: null
102
+ readonly deleted: true
103
+ }
104
+
105
+ export interface StaffAuthor {
106
+ readonly kind: 'staff'
107
+ readonly staffId: string
108
+ readonly displayName: string
109
+ /** The badge identity's label code (`team` by default). */
110
+ readonly badge: string
111
+ }
112
+
113
+ export interface SystemAuthor {
114
+ readonly kind: 'system'
115
+ }
116
+
117
+ export type KnownAuthor = MemberAuthor | DeletedMemberAuthor | StaffAuthor | SystemAuthor
118
+
119
+ /** An author kind a newer kb-api added: skip what it wrote. */
120
+ export interface UnknownAuthor {
121
+ readonly kind: string & {}
122
+ }
123
+
124
+ export type Author = KnownAuthor | UnknownAuthor
125
+
126
+ /** An author of a kind this SDK renders (a plain object whose `kind` is known). */
127
+ export function isKnownAuthor(author: unknown): author is KnownAuthor {
128
+ return typeof author === 'object' && author !== null && isKnownAuthorKind((author as { kind?: unknown }).kind)
129
+ }
130
+
131
+ export interface ReactionSummary {
132
+ /** Emoji → count; in public spaces counts only, never who. */
133
+ readonly counts: Readonly<Record<string, number>>
134
+ /** The viewer's own reaction, or null. */
135
+ readonly mine: string | null
136
+ }
137
+
138
+ /**
139
+ * One message as the viewer may see it. Another member's held, removed, held-back or tombstoned message reaches the
140
+ * viewer as a placeholder kb-api has already scrubbed (m1-contracts.md §7.14 P-RV11): `rev` 0 (it never moves while
141
+ * the hidden message is edited or moderated), `body`/`displayBody`/`displayLanguageCode`/`sourceLanguageCode` null,
142
+ * `isEdited`/`isTranslated` false, `editedAt`/`translationVersionId` null, no reactions and the author's place only —
143
+ * its place in the thread, its state and when it was written, nothing else. Their author reads their own such
144
+ * message whole, with its state.
145
+ */
146
+ export interface PublicMessage {
147
+ readonly conversationId: string
148
+ readonly seq: number
149
+ readonly id: string
150
+ /** 0 on a placeholder: it never moves while the hidden message changes. */
151
+ readonly rev: number
152
+ readonly replyToSeq: number | null
153
+ readonly author: Author
154
+ readonly state: MessageState
155
+ /** null on a placeholder and on a tombstone. */
156
+ readonly body: string | null
157
+ /** The viewer's language when a translation of the current text exists, else `body`. */
158
+ readonly displayBody: string | null
159
+ readonly displayLanguageCode: string | null
160
+ readonly sourceLanguageCode: string | null
161
+ readonly isTranslated: boolean
162
+ readonly isEdited: boolean
163
+ readonly createdAt: string
164
+ readonly editedAt: string | null
165
+ /** The viewer blocked the author (public-context blocks). */
166
+ readonly collapsed: boolean
167
+ readonly reactions: ReactionSummary
168
+ readonly translationVersionId: string | null
169
+ /** The filters' notes for the author (`identification_safety`, `report_to_manufacturer`): post and edit answers only. */
170
+ readonly notes?: readonly string[]
171
+ /**
172
+ * `true` on the author's OWN message that the tenant's art. 9 policy (`require_art9_consent` with
173
+ * `art9_legacy_posts = 'hide_until_consent'`) keeps from everyone else until the author gives the art. 9
174
+ * consent; its `state` is then `held` (m1-contracts.md §7.14 P-RV3). Absent otherwise — never on another
175
+ * member's placeholder: nobody else learns a member's consent. Render it apart from a message awaiting review:
176
+ * nothing is being reviewed, the author's consent releases it.
177
+ */
178
+ readonly hiddenUntilConsent?: boolean
179
+ /** On a top-level message: its replies, oldest first. */
180
+ readonly replies: readonly PublicMessage[]
181
+ /** On a top-level message with more replies than COMMUNITY_REPLIES_MAX. */
182
+ readonly repliesTruncated?: boolean
183
+ }
184
+
185
+ export interface RestrictionInEffect {
186
+ readonly kind: RestrictionKind
187
+ readonly scope: string
188
+ readonly endsAt: string | null
189
+ /** The decision that imposed it: its statement explains it (statementPath). */
190
+ readonly decisionId: string
191
+ }
192
+
193
+ export interface DiscussionViewerState {
194
+ readonly memberId: string | null
195
+ /** kb-api's verdict: the composer may post now. */
196
+ readonly canPost: boolean
197
+ readonly needs: readonly Need[]
198
+ readonly restrictions: readonly RestrictionInEffect[]
199
+ }
200
+
201
+ /** `discussions/list`: one page of an article's discussion. */
202
+ export interface Discussion {
203
+ readonly articleId: string
204
+ /** null until the first message is posted. */
205
+ readonly conversationId: string | null
206
+ /** The messages everyone is shown. */
207
+ readonly count: number
208
+ /** The conversation's counter (every message, any state). */
209
+ readonly lastSeq: number
210
+ /** The newest change of a message or a reaction. */
211
+ readonly lastChangeAt: string | null
212
+ /** Top-level, oldest first, COMMUNITY_PAGE_SIZE a page. */
213
+ readonly messages: readonly PublicMessage[]
214
+ /** The next page's cursor (the last top-level `seq`), or null on the last page. */
215
+ readonly nextCursor: number | null
216
+ readonly articleReactions: ReactionSummary
217
+ /** The emoji a member may react with (the tenant's `reaction_set`). */
218
+ readonly reactionSet: readonly string[]
219
+ /** The tenant's preset id, or null. */
220
+ readonly preset: string | null
221
+ readonly viewer: DiscussionViewerState
222
+ }
223
+
224
+ /** `discussions/head`: the polling signal of one article. */
225
+ export interface DiscussionHead {
226
+ readonly articleId: string
227
+ readonly count: number
228
+ readonly lastSeq: number
229
+ readonly lastChangeAt: string | null
230
+ }
231
+
232
+ /** `messages/post`, `messages/edit`: the message as its author sees it. */
233
+ export interface WriteAnswer {
234
+ readonly message: PublicMessage
235
+ /** The codes that hit with action `warn` (the message is visible). */
236
+ readonly warnings: readonly string[]
237
+ }
238
+
239
+ /** A reaction's target: the article, or one message. */
240
+ export type ReactionTarget = { readonly articleId: string } | { readonly conversationId: string; readonly seq: number }
241
+
242
+ export interface BlockEntry {
243
+ readonly memberId: string
244
+ readonly author: Author
245
+ readonly blockedAt: string
246
+ }
247
+
248
+ /** `profile/get`: the public projection. */
249
+ export interface PublicProfile {
250
+ readonly author: Author
251
+ /** `YYYY-MM` (UTC). */
252
+ readonly memberSince: string
253
+ readonly bio: string | null
254
+ }
255
+
256
+ /** The member's own profile (MyState, `me/profile/update`). */
257
+ export interface OwnProfile {
258
+ readonly handle: string
259
+ readonly displayName: string
260
+ readonly avatarPreset: string | null
261
+ readonly bio: string | null
262
+ readonly handleChangedAt: string | null
263
+ }
264
+
265
+ // ───────────────────────── the member's own surface (§7.3, §7.4, §8.3) ─────────────────────────
266
+
267
+ /** `me/get` and `me/onboard`. Anonymous: `member: null`, `needs: ['sign_in']`. */
268
+ export interface MyState {
269
+ readonly member: { readonly memberId: string; readonly status: string; readonly identity: string; readonly ageBand: AgeBand | null } | null
270
+ readonly profile: OwnProfile | null
271
+ readonly acceptances: { readonly rules: AcceptanceState; readonly art9Consent: AcceptanceState | null }
272
+ readonly needs: readonly Need[]
273
+ readonly restrictions: readonly RestrictionInEffect[]
274
+ readonly unreadDecisions: number
275
+ readonly preset: string | null
276
+ /** The tenant's own deep links (community.settings), when it set them. */
277
+ readonly links: { readonly statementPath: string | null; readonly myCommunityPath: string | null }
278
+ }
279
+
280
+ export interface NotificationItem {
281
+ readonly id: string
282
+ readonly code: NotificationCode
283
+ readonly conversationId: string | null
284
+ readonly seq: number | null
285
+ readonly caseId: string | null
286
+ readonly decisionId: string | null
287
+ readonly createdAt: string
288
+ readonly readAt: string | null
289
+ }
290
+
291
+ /** A keyset page, newest first: `cursor` is the last item's id. */
292
+ export interface CommunityPage<T> {
293
+ readonly items: readonly T[]
294
+ readonly nextCursor: string | null
295
+ }
296
+
297
+ export interface DecisionSummary {
298
+ readonly decisionId: string
299
+ readonly caseId: string
300
+ readonly provider: 'tenant' | 'platform' | (string & {})
301
+ /** Who decided: the controller named in the statement (art. 17(3)). */
302
+ readonly providerEntity: string
303
+ readonly restriction: string
304
+ readonly restrictionUntil: string | null
305
+ readonly basis: string
306
+ readonly category: string
307
+ readonly decidedAt: string
308
+ readonly supersedes: string | null
309
+ readonly appealWindowClosesAt: string
310
+ readonly canAppeal: boolean
311
+ }
312
+
313
+ /** What a statement is about, as its author may see it. */
314
+ export type StatementSubject =
315
+ | { readonly kind: 'message'; readonly conversationId: string; readonly seq: number; readonly message: PublicMessage | null }
316
+ | { readonly kind: 'profile' | 'member'; readonly memberId: string }
317
+ | { readonly kind: 'article'; readonly articleId: string }
318
+
319
+ /** `me/decisions/get`: the stored art. 17(3) fields, the rendered statement and the redress. */
320
+ export interface Statement extends DecisionSummary {
321
+ readonly territorialScope: string
322
+ /** The facts and circumstances: plain text, render it as text (`<pre>`). */
323
+ readonly facts: string
324
+ readonly automatedDetection: boolean
325
+ readonly automated: boolean
326
+ readonly legalGround: string | null
327
+ readonly legalExplanation: string | null
328
+ readonly contractualGround: string | null
329
+ readonly contractualExplanation: string | null
330
+ readonly redress: string
331
+ readonly templateId: string
332
+ readonly locale: string
333
+ /** The whole statement as kb-api rendered it (plain text). */
334
+ readonly statement: string
335
+ readonly appeal: { readonly appealId: string; readonly status: string; readonly submittedAt: string } | null
336
+ readonly subject: StatementSubject
337
+ }
338
+
339
+ export interface AppealItem {
340
+ readonly appealId: string
341
+ readonly decisionId: string
342
+ readonly caseId: string
343
+ readonly status: string
344
+ readonly submittedAt: string
345
+ readonly resolvedAt: string | null
346
+ readonly resolutionDecisionId: string | null
347
+ }
348
+
349
+ /** One of the member's reports: never the package. */
350
+ export interface ReportItem {
351
+ readonly caseId: string
352
+ readonly category: string
353
+ readonly status: string
354
+ readonly reportedAt: string
355
+ readonly decidedAt: string | null
356
+ }
357
+
358
+ /** `legal/current`: the tenant's current text of a kind. */
359
+ export interface CurrentLegalText {
360
+ readonly kind: LegalTextKind
361
+ readonly textId: string
362
+ readonly version: string
363
+ readonly locale: string
364
+ /**
365
+ * HTML with anchors, the tenant's own words — for a host page that renders it on its server (the rules page).
366
+ * An element renders text only: it shows `communityRulesOf(bodyJson)` and links to that page.
367
+ */
368
+ readonly body: string
369
+ /** The machine-readable form (DSA art. 14(1)); for `rules` `{ version, rules: [{ id, title, summary?, anchor }] }`. */
370
+ readonly bodyJson: Readonly<Record<string, unknown>> | null
371
+ readonly reconsentRequired: boolean
372
+ readonly publishedAt: string | null
373
+ }
374
+
375
+ /** One rule of the tenant's rules text: its stable id is what a report and a statement cite. */
376
+ export interface CommunityRule {
377
+ readonly id: string
378
+ readonly title: string
379
+ readonly summary: string | null
380
+ /** The rule's anchor on the rules page (`#<anchor>`). */
381
+ readonly anchor: string
382
+ }
383
+
384
+ /** The rules of a `rules` text's `bodyJson`, in order; an entry without a string id, title and anchor is skipped. */
385
+ export function communityRulesOf(bodyJson: unknown): CommunityRule[] {
386
+ const rules = typeof bodyJson === 'object' && bodyJson !== null ? (bodyJson as { rules?: unknown }).rules : undefined
387
+ if (!Array.isArray(rules)) return []
388
+ const out: CommunityRule[] = []
389
+ for (const r of rules) {
390
+ if (typeof r !== 'object' || r === null) continue
391
+ const { id, title, summary, anchor } = r as Record<string, unknown>
392
+ if (typeof id !== 'string' || typeof title !== 'string' || typeof anchor !== 'string') continue
393
+ out.push(Object.freeze({ id, title, summary: typeof summary === 'string' ? summary : null, anchor }))
394
+ }
395
+ return out
396
+ }
397
+
398
+ /** `me/export`: every section, `providerEntity` on every row; offer it as a JSON download. */
399
+ export interface MemberExport {
400
+ readonly generatedAt: string
401
+ readonly providerEntity: string
402
+ readonly [section: string]: unknown
403
+ }
404
+
405
+ // ───────────────────────── the notice form (§7.7) ─────────────────────────
406
+
407
+ /** What a notice names: a message, a member (by id or handle), or an article. */
408
+ export type NoticeTarget =
409
+ | { readonly conversationId: string; readonly seq: number }
410
+ | { readonly memberId: string }
411
+ | { readonly handle: string }
412
+ | { readonly articleId: string }
413
+
414
+ export interface NoticeReceipt {
415
+ readonly caseId: string
416
+ /** The notifier's capability for `notices/status` and the appeal: put it in a link's fragment only (links.ts). */
417
+ readonly receipt: string
418
+ /**
419
+ * The case keeps this notice's contact: the confirmation and the outcome go to its e-mail, and the receipt may
420
+ * appeal. False without a contact, or when another notifier's contact is kept: the receipt still reads the outcome.
421
+ */
422
+ readonly contactKept: boolean
423
+ }
424
+
425
+ export interface NoticeStatus {
426
+ readonly status: 'open' | 'decided' | 'appealed' | 'closed' | (string & {})
427
+ readonly category: CaseCategory
428
+ readonly submittedAt: string
429
+ readonly decidedAt: string | null
430
+ /** The statement once decided (plain text), never the package. */
431
+ readonly statement: string | null
432
+ readonly appeal: {
433
+ readonly canAppeal: boolean
434
+ readonly closesAt: string | null
435
+ readonly open: { readonly submittedAt: string } | null
436
+ }
437
+ }
438
+
439
+ // ───────────────────────── the operations' inputs ─────────────────────────
440
+
441
+ export interface DiscussionListInput {
442
+ articleId: string
443
+ /** The page's language: a translation of each message into it when one exists. */
444
+ languageCode?: string | null
445
+ /** The previous page's `nextCursor`; absent for the first page. */
446
+ cursor?: number | null
447
+ }
448
+
449
+ export interface MessagePostInput {
450
+ articleId: string
451
+ body: string
452
+ /** A reply names a top-level message of the same discussion. */
453
+ replyToSeq?: number | null
454
+ /** newClientMsgId(), the same on a retry. */
455
+ clientMsgId: string
456
+ /** The page's language (the language the member writes in). */
457
+ languageCode: string
458
+ /** The codes of CONFIRMATION_REQUIRED the author confirmed. */
459
+ confirmations?: string[]
460
+ }
461
+
462
+ export interface MessageEditInput {
463
+ conversationId: string
464
+ seq: number
465
+ body: string
466
+ confirmations?: string[]
467
+ }
468
+
469
+ export interface MessageReportInput {
470
+ conversationId: string
471
+ seq: number
472
+ category: CaseCategory
473
+ /** For `rules`: the id of a rule of the current rules text. */
474
+ ruleId?: string | null
475
+ /** The report's one free text (≤ COMMUNITY_REPORT_NOTE_MAX), seen by the team only. */
476
+ note?: string | null
477
+ }
478
+
479
+ export interface OnboardInput {
480
+ ageBand: AgeBand
481
+ /** The current `rules` text's id (`legal/current`). */
482
+ rulesTextId: string
483
+ /** The current `art9_consent` text's id, when the tenant asks for the consent. */
484
+ art9TextId?: string | null
485
+ /** Required on a member's first onboarding (no profile yet). */
486
+ displayName?: string | null
487
+ /** Generated from the display name when absent. */
488
+ handle?: string | null
489
+ avatarPreset?: string | null
490
+ }
491
+
492
+ export interface ProfileUpdateInput {
493
+ displayName?: string
494
+ /** At most once in COMMUNITY_HANDLE_CHANGE_DAYS. */
495
+ handle?: string
496
+ avatarPreset?: string | null
497
+ /** null or empty clears it. */
498
+ bio?: string | null
499
+ }
500
+
501
+ export interface NoticeSubmitInput {
502
+ category: CaseCategory
503
+ target: NoticeTarget
504
+ /** Why the content is a problem (≤ COMMUNITY_NOTICE_DESCRIPTION_MAX). */
505
+ description: string
506
+ ruleId?: string | null
507
+ /** Optional; never for CATEGORY_WITHOUT_NOTIFIER. */
508
+ notifier?: { name?: string | null; email?: string | null; locale: string } | null
509
+ /** The Turnstile widget's one-shot token (action COMMUNITY_NOTICE_TURNSTILE_ACTION). */
510
+ turnstileToken?: string | null
511
+ /** Must contain COMMUNITY_GOOD_FAITH. */
512
+ confirmations?: string[]
513
+ }