@blogmcp/community 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -20,46 +20,46 @@ function useMounted(kind, props, load) {
20
20
  return createElement("div", { ref: host, "data-blogmcp-community": kind });
21
21
  }
22
22
  function KbDiscussion(props) {
23
- return useMounted("discussion", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountDiscussion);
23
+ return useMounted("discussion", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountDiscussion);
24
24
  }
25
25
  function KbNoticeForm(props) {
26
- return useMounted("notice-form", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountNoticeForm);
26
+ return useMounted("notice-form", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountNoticeForm);
27
27
  }
28
28
  function KbMyCommunity(props) {
29
- return useMounted("my-community", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountMyCommunity);
29
+ return useMounted("my-community", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountMyCommunity);
30
30
  }
31
31
  function KbNotificationCentre(props) {
32
- return useMounted("notification-centre", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountNotificationCentre);
32
+ return useMounted("notification-centre", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountNotificationCentre);
33
33
  }
34
34
  function KbBadge(props) {
35
- return useMounted("badge", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountBadge);
35
+ return useMounted("badge", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountBadge);
36
36
  }
37
37
  function KbMemberSettings(props) {
38
- return useMounted("member-settings", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountMemberSettings);
38
+ return useMounted("member-settings", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountMemberSettings);
39
39
  }
40
40
  function KbProfile(props) {
41
- return useMounted("profile", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountProfile);
41
+ return useMounted("profile", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountProfile);
42
42
  }
43
43
  function KbWelcome(props) {
44
- return useMounted("welcome", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountWelcome);
44
+ return useMounted("welcome", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountWelcome);
45
45
  }
46
46
  function KbForum(props) {
47
- return useMounted("forum", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForum);
47
+ return useMounted("forum", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForum);
48
48
  }
49
49
  function KbForumCategory(props) {
50
- return useMounted("forum-category", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumCategory);
50
+ return useMounted("forum-category", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumCategory);
51
51
  }
52
52
  function KbTopic(props) {
53
- return useMounted("topic", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountTopic);
53
+ return useMounted("topic", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountTopic);
54
54
  }
55
55
  function KbForumSearch(props) {
56
- return useMounted("forum-search", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumSearch);
56
+ return useMounted("forum-search", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumSearch);
57
57
  }
58
58
  function KbFollowButton(props) {
59
- return useMounted("follow-button", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountFollowButton);
59
+ return useMounted("follow-button", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountFollowButton);
60
60
  }
61
61
  function KbForumModeration(props) {
62
- return useMounted("forum-moderation", props, async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumModeration);
62
+ return useMounted("forum-moderation", props, async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumModeration);
63
63
  }
64
64
  export {
65
65
  KbBadge,
@@ -6,6 +6,7 @@ type __VLS_Props = {
6
6
  lang: Lang;
7
7
  signInHref?: string;
8
8
  rulesHref: string;
9
+ termsHref?: string | null;
9
10
  };
10
11
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
12
  joined: () => any;
@@ -2,6 +2,7 @@ import { type OnboardingModel } from '../core/onboarding';
2
2
  type __VLS_Props = {
3
3
  model: OnboardingModel;
4
4
  rulesHref: string;
5
+ termsHref?: string | null;
5
6
  };
6
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
8
  cancel: () => any;
package/dist/vue.js CHANGED
@@ -47,7 +47,7 @@ const KbDiscussion = defineComponent({
47
47
  return useMount(
48
48
  "discussion",
49
49
  () => defined({ ...props }),
50
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountDiscussion
50
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountDiscussion
51
51
  );
52
52
  }
53
53
  });
@@ -68,7 +68,7 @@ const KbNoticeForm = defineComponent({
68
68
  return useMount(
69
69
  "notice-form",
70
70
  () => defined({ ...props }),
71
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountNoticeForm
71
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountNoticeForm
72
72
  );
73
73
  }
74
74
  });
@@ -88,7 +88,7 @@ const KbMyCommunity = defineComponent({
88
88
  return useMount(
89
89
  "my-community",
90
90
  () => defined({ ...props }),
91
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountMyCommunity
91
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountMyCommunity
92
92
  );
93
93
  }
94
94
  });
@@ -107,7 +107,7 @@ const KbNotificationCentre = defineComponent({
107
107
  return useMount(
108
108
  "notification-centre",
109
109
  () => defined({ ...props }),
110
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountNotificationCentre
110
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountNotificationCentre
111
111
  );
112
112
  }
113
113
  });
@@ -126,7 +126,7 @@ const KbBadge = defineComponent({
126
126
  return useMount(
127
127
  "badge",
128
128
  () => defined({ ...props }),
129
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountBadge
129
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountBadge
130
130
  );
131
131
  }
132
132
  });
@@ -146,7 +146,7 @@ const KbMemberSettings = defineComponent({
146
146
  return useMount(
147
147
  "member-settings",
148
148
  () => defined({ ...props }),
149
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountMemberSettings
149
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountMemberSettings
150
150
  );
151
151
  }
152
152
  });
@@ -166,7 +166,7 @@ const KbProfile = defineComponent({
166
166
  return useMount(
167
167
  "profile",
168
168
  () => defined({ ...props }),
169
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountProfile
169
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountProfile
170
170
  );
171
171
  }
172
172
  });
@@ -185,7 +185,7 @@ const KbWelcome = defineComponent({
185
185
  return useMount(
186
186
  "welcome",
187
187
  () => defined({ ...props }),
188
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountWelcome
188
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountWelcome
189
189
  );
190
190
  }
191
191
  });
@@ -204,7 +204,7 @@ const KbForum = defineComponent({
204
204
  return useMount(
205
205
  "forum",
206
206
  () => defined({ ...props }),
207
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForum
207
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForum
208
208
  );
209
209
  }
210
210
  });
@@ -224,7 +224,7 @@ const KbForumCategory = defineComponent({
224
224
  return useMount(
225
225
  "forum-category",
226
226
  () => defined({ ...props }),
227
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumCategory
227
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumCategory
228
228
  );
229
229
  }
230
230
  });
@@ -247,7 +247,7 @@ const KbTopic = defineComponent({
247
247
  return useMount(
248
248
  "topic",
249
249
  () => defined({ ...props }),
250
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountTopic
250
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountTopic
251
251
  );
252
252
  }
253
253
  });
@@ -266,7 +266,7 @@ const KbForumSearch = defineComponent({
266
266
  return useMount(
267
267
  "forum-search",
268
268
  () => defined({ ...props }),
269
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumSearch
269
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumSearch
270
270
  );
271
271
  }
272
272
  });
@@ -286,7 +286,7 @@ const KbFollowButton = defineComponent({
286
286
  return useMount(
287
287
  "follow-button",
288
288
  () => defined({ ...props }),
289
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountFollowButton
289
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountFollowButton
290
290
  );
291
291
  }
292
292
  });
@@ -305,7 +305,7 @@ const KbForumModeration = defineComponent({
305
305
  return useMount(
306
306
  "forum-moderation",
307
307
  () => defined({ ...props }),
308
- async () => (await import("./chunks/mount--2_V2q3M.js").then((n) => n.ad)).mountForumModeration
308
+ async () => (await import("./chunks/mount-Ts_r2fwt.js").then((n) => n.ad)).mountForumModeration
309
309
  );
310
310
  }
311
311
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blogmcp/community",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Community elements for your own site: the discussion under an article, the DSA notice form and the reader's „My community” panel. Custom elements + Vue/React wrappers + a script build, over @blogmcp/sdk/community.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -42,8 +42,8 @@
42
42
  "postpack": "node ../../scripts/pack-dist-types.mjs postpack"
43
43
  },
44
44
  "dependencies": {
45
- "@blogmcp/sanitize": "^0.11.0",
46
- "@blogmcp/sdk": "^0.11.0",
45
+ "@blogmcp/sanitize": "^0.12.0",
46
+ "@blogmcp/sdk": "^0.12.0",
47
47
  "vue": "^3.5.0"
48
48
  },
49
49
  "peerDependencies": {
package/src/core/attrs.ts CHANGED
@@ -22,6 +22,14 @@ export interface CommunityRoutes {
22
22
  myCommunityPath?: string
23
23
  /** The rules page (rendered by the host without JavaScript). */
24
24
  rulesPath?: string
25
+ /**
26
+ * O-16 / F-51: the discussion terms' page (DSA art. 14), linked beside the rules in a first join's onboarding, whose
27
+ * one tick accepts both. Default: `/community/terms` beside a rules page of the managed blog's shape (the default
28
+ * `/community/rules`, or a host's `…/community/rules` such as `/blog/en/community/rules` → `/blog/en/community/terms`);
29
+ * a host whose rules page has another shape and that names no terms page gets none (null), and the onboarding shows
30
+ * the terms' text in place instead.
31
+ */
32
+ termsPath?: string
25
33
  /** The notice form. */
26
34
  reportPath?: string
27
35
  /** A notifier's status page (the receipt goes in its fragment). */
@@ -67,6 +75,7 @@ const ROUTE_KEYS = [
67
75
  'statementPath',
68
76
  'myCommunityPath',
69
77
  'rulesPath',
78
+ 'termsPath',
70
79
  'reportPath',
71
80
  'noticesPath',
72
81
  'consultationPath',
@@ -126,7 +135,9 @@ export function siteBaseOf(value: unknown): string | null {
126
135
  /**
127
136
  * The pages with the managed blog's defaults filled in under the site's base (statementPath, profilePath, M3's
128
137
  * categoryPath and topicPath stay templates; articlePath, a template too, has no default).
129
- * A page the host or the tenant names is its own full path.
138
+ * A page the host or the tenant names is its own full path. termsPath (O-16) defaults only beside a rules page of the
139
+ * managed blog's shape (`…/community/rules` → `…/community/terms`, the locale prefix kept) — a host with a rules page of
140
+ * its own shape and no terms page gets null (never a `/community/terms` it may not serve).
130
141
  */
131
142
  export function routesWithDefaults(
132
143
  routes: CommunityRoutes,
@@ -138,6 +149,7 @@ export function routesWithDefaults(
138
149
  statementPath: routes.statementPath ?? site(tenant?.statementPath) ?? `${siteBase}${COMMUNITY_ROUTES.statement}`,
139
150
  myCommunityPath: routes.myCommunityPath ?? site(tenant?.myCommunityPath) ?? `${siteBase}${COMMUNITY_ROUTES.myCommunity}`,
140
151
  rulesPath: routes.rulesPath ?? `${siteBase}${COMMUNITY_ROUTES.rules}`,
152
+ termsPath: routes.termsPath ?? termsBeside(routes.rulesPath ?? `${siteBase}${COMMUNITY_ROUTES.rules}`),
141
153
  reportPath: routes.reportPath ?? `${siteBase}${COMMUNITY_ROUTES.report}`,
142
154
  noticesPath: routes.noticesPath ?? `${siteBase}${COMMUNITY_ROUTES.notices}`,
143
155
  consultationPath: routes.consultationPath ?? null,
@@ -155,6 +167,11 @@ export function routesWithDefaults(
155
167
  }
156
168
  }
157
169
 
170
+ /** O-16: the terms page beside a rules page of the managed blog's shape (`…/community/rules`), else null. */
171
+ export function termsBeside(rulesPath: string): string | null {
172
+ return rulesPath.endsWith(COMMUNITY_ROUTES.rules) ? `${rulesPath.slice(0, -COMMUNITY_ROUTES.rules.length)}${COMMUNITY_ROUTES.terms}` : null
173
+ }
174
+
158
175
  const ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
159
176
  const HANDLE_RE = /^[a-z0-9][a-z0-9_]{2,29}$/
160
177
  const isId = (v: unknown): v is string => typeof v === 'string' && ID_RE.test(v)
@@ -1018,6 +1018,9 @@ function createThread(o: ThreadControllerOptions, subject: Subject, realtime: An
1018
1018
  onDone: (me) => {
1019
1019
  state.me = me
1020
1020
  onboarding.value = null
1021
+ // F-S8-2: an ONBOARDING_REQUIRED that opened it (a write refused mid-page, e.g. a newer rules text) is answered —
1022
+ // the composer comes back with its text and without that sentence; the member sends it again.
1023
+ for (const d of [state.composer, state.inline]) if (d?.failure?.code === 'onboarding') d.failure = null
1021
1024
  // A refused art. 9 consent (`public_write`): the member joined, and is told what the refusal leaves.
1022
1025
  state.art9RefusedNote = model.state.art9RefusedSent
1023
1026
  if (offerArt9) {
@@ -209,6 +209,9 @@ export function createCategory(o: {
209
209
  onDone: (me) => {
210
210
  state.me = me
211
211
  onboarding.value = null
212
+ // F-S8-2: the ONBOARDING_REQUIRED that opened it is answered — the composer comes back with its text and without
213
+ // that sentence, as a topic's composer does after the consent; the member sends it again.
214
+ if (state.composer.failure?.code === 'onboarding') state.composer.failure = null
212
215
  announce({ key: model.state.art9RefusedSent ? 'onboarding.art9RefusedDone' : 'onboarding.done' })
213
216
  },
214
217
  onSignIn: () => {
@@ -6,7 +6,12 @@
6
6
  * age the age band, asked once and never offered again (`16_17`, `18_plus`); below the tenant's
7
7
  * minimum kb-api stores nothing and the reader is told from what age the discussion is open;
8
8
  * rules the rules' summary (`legal/current` → `bodyJson`, text only) with a link to the full text, and
9
- * the acceptance;
9
+ * the acceptance — on a first join where the tenant has terms, one acceptance of the rules AND the terms
10
+ * (O-16 / F-51, the owner's decision of 9. 11. 2026: the terms once, never again): the terms' link beside the
11
+ * rules', `termsTextId` sent with the rules' id. Asked only while kb-api's me/get answers
12
+ * `acceptances.terms` as `never` on a first join (viewerNeeds(me).terms) — an older kb-api answers no such
13
+ * field and would refuse the key, a member onboarded before is never asked, and a newer terms text asks
14
+ * nobody again;
10
15
  * art9 the art. 9 consent's text and the acceptance, when the tenant asks for it — or, M3, before a forum write,
11
16
  * whatever the tenant's setting says (`forceArt9`: m3-contracts.md §3.1 step 5, U14) — (M2 T9, m2-contracts.md §3.8:
12
17
  * the layout from me/get's `settings.art9ConsentLayout` — `joint` one consent, `split` one per controller of
@@ -32,6 +37,7 @@ import {
32
37
  art9RefusalOf,
33
38
  communityRulesOf,
34
39
  isKnownNeed,
40
+ viewerNeeds,
35
41
  type AgeBand,
36
42
  type Art9ConsentLayout,
37
43
  type Art9Refusal,
@@ -69,6 +75,16 @@ export interface OnboardingState {
69
75
  me: MyState | null
70
76
  rulesText: CurrentLegalText | null
71
77
  rules: CommunityRule[]
78
+ /**
79
+ * O-16 / F-51: the tenant's current terms text when this first join accepts them with the rules (one tick,
80
+ * `rulesAccepted`, covers both); null otherwise — then no `termsTextId` can go.
81
+ */
82
+ termsText: CurrentLegalText | null
83
+ /**
84
+ * The terms' text as paragraphs — shown in the step itself when the host names no terms page the step can link
85
+ * (OnboardingSteps: a host's own rules page and no `termsHref`), so the reader never ticks terms they cannot read.
86
+ */
87
+ termsParagraphs: string[]
72
88
  art9Text: CurrentLegalText | null
73
89
  art9Paragraphs: string[]
74
90
  /** me/get's `settings.art9ConsentLayout` (absent: `joint`). */
@@ -147,7 +163,7 @@ export interface OnboardingOptions {
147
163
  }
148
164
 
149
165
  const PROFILE_FIELDS = new Set(['displayName', 'handle', 'avatarPreset'])
150
- const TEXT_FIELDS = new Set(['rulesTextId', 'art9TextId'])
166
+ const TEXT_FIELDS = new Set(['rulesTextId', 'termsTextId', 'art9TextId'])
151
167
  /** kb-api's issue code for a refusal the tenant does not take (`art9Refusal = read_only`, §3.8). */
152
168
  export const ART9_REFUSAL_READ_ONLY = 'art9_refusal_read_only'
153
169
 
@@ -168,7 +184,8 @@ export function onboardingFailureText(failure: Pick<CommunityFailure, 'code' | '
168
184
  function stepsOf(me: MyState, needs: readonly string[], offerArt9: boolean, forceArt9: boolean): OnboardingStep[] {
169
185
  const steps: OnboardingStep[] = []
170
186
  if (!me.member?.ageBand) steps.push('age')
171
- if (me.acceptances.rules !== 'accepted') steps.push('rules')
187
+ // The terms ride on the rules step (O-16): a first join that still owes them shows it even with the rules accepted.
188
+ if (me.acceptances.rules !== 'accepted' || termsAsked(me)) steps.push('rules')
172
189
  const art9 = me.acceptances.art9Consent
173
190
  // A forum write: the consent, unless it is in force or refused where a refusal leaves public writes (kb-api's needs).
174
191
  const refusedOpen = me.acceptances.art9Refused === true && art9RefusalOf(me.settings?.art9Refusal) === 'public_write'
@@ -178,6 +195,13 @@ function stepsOf(me: MyState, needs: readonly string[], offerArt9: boolean, forc
178
195
  return steps
179
196
  }
180
197
 
198
+ /**
199
+ * O-16 / F-51: whether this join accepts the tenant's terms — a first join whose me/get answered `acceptances.terms`
200
+ * `never` (the SDK's rule: viewerNeeds(me).terms). Never for an onboarded member (the owner, 9. 11. 2026: asked once,
201
+ * never again) and never against a kb-api that answers no such field (it would refuse `termsTextId`).
202
+ */
203
+ const termsAsked = (me: MyState): boolean => viewerNeeds(me).terms
204
+
181
205
  /** The consents the step asks for: the text's two controllers under `split`, else one (its first, or the tenant). */
182
206
  function consentsOf(text: CurrentLegalText | null, layout: Art9ConsentLayout): Array<{ entity: string; label: string }> {
183
207
  if (!text) return []
@@ -189,6 +213,8 @@ function consentsOf(text: CurrentLegalText | null, layout: Art9ConsentLayout): A
189
213
  /** The texts of the steps shown. */
190
214
  interface Texts {
191
215
  rules: CurrentLegalText | null
216
+ /** O-16: the terms, only when this join accepts them with the rules. */
217
+ terms: CurrentLegalText | null
192
218
  art9: CurrentLegalText | null
193
219
  }
194
220
 
@@ -210,6 +236,8 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
210
236
  me: null,
211
237
  rulesText: null,
212
238
  rules: [],
239
+ termsText: null,
240
+ termsParagraphs: [],
213
241
  art9Text: null,
214
242
  art9Paragraphs: [],
215
243
  art9Layout: 'joint',
@@ -240,19 +268,24 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
240
268
  state.phase = 'failed'
241
269
  }
242
270
 
243
- /** The texts of these steps — none for a step that is not one, so its id can never be sent; null when one fails. */
244
- async function textsFor(steps: OnboardingStep[]): Promise<Texts | null> {
245
- const [rules, art9] = await Promise.all([
271
+ /**
272
+ * The texts of these steps — none for a step that is not one, so its id can never be sent; null when one fails.
273
+ * The terms only with the rules step and only when this join accepts them (`withTerms`, termsAsked).
274
+ */
275
+ async function textsFor(steps: OnboardingStep[], withTerms: boolean): Promise<Texts | null> {
276
+ const askTerms = withTerms && steps.includes('rules')
277
+ const [rules, terms, art9] = await Promise.all([
246
278
  steps.includes('rules') ? o.client.legal.current({ kind: 'rules', locale: o.lang }, call) : null,
279
+ askTerms ? o.client.legal.current({ kind: 'terms', locale: o.lang }, call) : null,
247
280
  steps.includes('art9') ? o.client.legal.current({ kind: 'art9_consent', locale: o.lang }, call) : null,
248
281
  ])
249
- for (const r of [rules, art9]) {
282
+ for (const r of [rules, terms, art9]) {
250
283
  if (r && !r.ok) {
251
284
  fail(r)
252
285
  return null
253
286
  }
254
287
  }
255
- return { rules: rules?.ok ? rules.value : null, art9: art9?.ok ? art9.value : null }
288
+ return { rules: rules?.ok ? rules.value : null, terms: terms?.ok ? terms.value : null, art9: art9?.ok ? art9.value : null }
256
289
  }
257
290
 
258
291
  /** me/get and what it leaves to ask, with the texts; null when it went elsewhere (a failure, a signed-out session). */
@@ -268,7 +301,7 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
268
301
  return null
269
302
  }
270
303
  const steps = stepsOf(me.value, needs, offerArt9, forceArt9)
271
- const texts = await textsFor(steps)
304
+ const texts = await textsFor(steps, termsAsked(me.value))
272
305
  return texts ? { me: me.value, steps, texts } : null
273
306
  }
274
307
 
@@ -277,7 +310,8 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
277
310
 
278
311
  /** What was read, shown at once; an acceptance holds only for the very text it was given to. */
279
312
  function apply(r: Read): void {
280
- if (r.texts.rules?.textId !== state.rulesText?.textId) state.rulesAccepted = false
313
+ // One tick covers the rules and (O-16) the terms: a new text of either asks for it again.
314
+ if (r.texts.rules?.textId !== state.rulesText?.textId || r.texts.terms?.textId !== state.termsText?.textId) state.rulesAccepted = false
281
315
  const layout = art9ConsentLayoutOf(r.me.settings?.art9ConsentLayout)
282
316
  const sameText = r.texts.art9 !== null && r.texts.art9.textId === state.art9Text?.textId
283
317
  // A tick holds for the same controller of the same text; anything else is asked again.
@@ -293,6 +327,8 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
293
327
  state.reconsent = r.me.acceptances.rules === 'reconsent_required'
294
328
  state.rulesText = r.texts.rules
295
329
  state.rules = r.texts.rules ? communityRulesOf(r.texts.rules.bodyJson) : []
330
+ state.termsText = r.texts.terms
331
+ state.termsParagraphs = r.texts.terms ? htmlToParagraphs(r.texts.terms.body) : []
296
332
  state.art9Text = r.texts.art9
297
333
  state.art9Paragraphs = r.texts.art9 ? htmlToParagraphs(r.texts.art9.body) : []
298
334
  }
@@ -367,6 +403,9 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
367
403
  ageBand: state.ageBand ?? state.me?.member?.ageBand ?? '18_plus',
368
404
  rulesTextId: state.steps.includes('rules') && state.rulesText ? state.rulesText.textId : '',
369
405
  }
406
+ // O-16 / F-51: the terms the reader ticked with the rules — set only when me/get answered `acceptances.terms`, so a
407
+ // kb-api older than O-16 (which would refuse the key) never gets it.
408
+ if (state.steps.includes('rules') && state.termsText) input.termsTextId = state.termsText.textId
370
409
  // A consent ticked wins over a refusal chosen before (the reader came back and ticked it).
371
410
  let refusing = false
372
411
  if (state.steps.includes('art9') && state.art9Text) {
@@ -440,7 +479,7 @@ export function createOnboarding(o: OnboardingOptions): OnboardingModel {
440
479
  const r = await read()
441
480
  if (!r) return
442
481
  apply(r)
443
- if (named.includes('rulesTextId')) state.rulesAccepted = false
482
+ if (named.includes('rulesTextId') || named.includes('termsTextId')) state.rulesAccepted = false
444
483
  if (named.includes('art9TextId')) state.art9Accepted = false
445
484
  state.failure = refusal
446
485
  state.fields = named
@@ -286,7 +286,7 @@ async function confirmDelete(): Promise<void> {
286
286
  <a v-if="signInHref()" class="bcm-btn bcm-primary" :href="signInHref() ?? undefined">{{ t('common.signIn') }}</a>
287
287
  </div>
288
288
  <template v-else-if="mode === 'onboarding'">
289
- <OnboardingSteps v-if="ctl.onboarding.value" :model="ctl.onboarding.value" :rules-href="routes.rulesPath" @cancel="ctl.cancelOnboarding()" />
289
+ <OnboardingSteps v-if="ctl.onboarding.value" :model="ctl.onboarding.value" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @cancel="ctl.cancelOnboarding()" />
290
290
  <div v-else class="bcm-row">
291
291
  <p>{{ t(needKey) }}</p>
292
292
  <button type="button" class="bcm-btn bcm-primary" @click="ctl.beginOnboarding()">{{ t('onboarding.continue') }}</button>
@@ -155,6 +155,13 @@ function onSort(e: Event): void {
155
155
  }
156
156
 
157
157
  const composerRef = ref<InstanceType<typeof MessageComposer> | null>(null)
158
+ // The onboarding finished where the composer was: the focus goes back to the composer, as a topic's composer takes it.
159
+ watch(
160
+ () => ctl.value?.onboarding.value ?? null,
161
+ (now, before) => {
162
+ if (now === null && before?.state.phase === 'done') void nextTick(() => composerRef.value?.focus())
163
+ },
164
+ )
158
165
  // One live region, present from the start; the same outcome twice is announced twice (cleared in between).
159
166
  const liveText = ref('')
160
167
  watch(
@@ -177,7 +184,7 @@ watch(
177
184
 
178
185
  <p v-if="state.phase === 'loading'" :id="`${id}-title`" class="bcm-muted" role="status">{{ t('forum.loading') }}</p>
179
186
  <div v-else-if="state.phase === 'membersOnly' && client" :id="`${id}-title`">
180
- <MembersOnly :failure="state.failure" :client="client" :lang="lang" :sign-in-href="signInHref" :rules-href="routes.rulesPath" @joined="ctl.load()" />
187
+ <MembersOnly :failure="state.failure" :client="client" :lang="lang" :sign-in-href="signInHref" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @joined="ctl.load()" />
181
188
  </div>
182
189
  <p v-else-if="state.phase === 'notFound'" :id="`${id}-title`" class="bcm-note">{{ t('forumCategory.notFound') }}</p>
183
190
  <div v-else-if="state.phase === 'failed'" class="bcm-banner" role="alert">
@@ -220,7 +227,7 @@ watch(
220
227
  with null, which a fragment's removal walks. -->
221
228
  <div v-if="ctl.canCreate()" class="bcm-new-topic">
222
229
  <h3 :id="`${id}-new`">{{ t('forumCategory.newTopic') }}</h3>
223
- <OnboardingSteps v-if="ctl.onboarding.value" :model="ctl.onboarding.value" :rules-href="routes.rulesPath" @cancel="ctl.cancelOnboarding()" />
230
+ <OnboardingSteps v-if="ctl.onboarding.value" :model="ctl.onboarding.value" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @cancel="ctl.cancelOnboarding()" />
224
231
  <MessageComposer
225
232
  v-else
226
233
  ref="composerRef"
@@ -110,6 +110,7 @@ const lastPage = computed(() => !!state && state.phase === 'ready' && state.page
110
110
  :lang="lang"
111
111
  :sign-in-href="signInHref"
112
112
  :rules-href="routes.rulesPath"
113
+ :terms-href="routes.termsPath"
113
114
  @joined="ctl.load()"
114
115
  />
115
116
 
@@ -83,6 +83,7 @@ const countText = (c: ForumCategory): string =>
83
83
  :lang="lang"
84
84
  :sign-in-href="signInHref"
85
85
  :rules-href="routes.rulesPath"
86
+ :terms-href="routes.termsPath"
86
87
  @joined="ctl.load()"
87
88
  />
88
89
  <div v-else-if="state.phase === 'failed'" class="bcm-banner" role="alert">
@@ -13,7 +13,7 @@ import { createOnboarding, type OnboardingModel } from '../core/onboarding'
13
13
  import OnboardingSteps from './OnboardingSteps.vue'
14
14
  import { useText } from './context'
15
15
 
16
- const props = defineProps<{ failure: CommunityFailure | null; client: CommunityClient; lang: Lang; signInHref?: string; rulesHref: string }>()
16
+ const props = defineProps<{ failure: CommunityFailure | null; client: CommunityClient; lang: Lang; signInHref?: string; rulesHref: string; termsHref?: string | null }>()
17
17
  const emit = defineEmits<{ joined: [] }>()
18
18
  const { t } = useText()
19
19
 
@@ -48,7 +48,7 @@ function join(): void {
48
48
  <template>
49
49
  <div class="bcm-section">
50
50
  <p class="bcm-note">{{ t('error.membersOnly') }}</p>
51
- <OnboardingSteps v-if="model" :model="model" :rules-href="rulesHref" @cancel="model = null" />
51
+ <OnboardingSteps v-if="model" :model="model" :rules-href="rulesHref" :terms-href="termsHref" @cancel="model = null" />
52
52
  <div v-else-if="ask === 'join'" class="bcm-row">
53
53
  <button type="button" class="bcm-btn bcm-primary" @click="join">{{ t('forum.join') }}</button>
54
54
  </div>
@@ -316,7 +316,7 @@ watch(
316
316
  </template>
317
317
  <template v-else-if="consentRefused">
318
318
  <p>{{ t('panel.art9Refused') }}</p>
319
- <OnboardingSteps v-if="ctl.consent.value" :model="ctl.consent.value" :rules-href="routes.rulesPath" @cancel="ctl.closeConsent()" />
319
+ <OnboardingSteps v-if="ctl.consent.value" :model="ctl.consent.value" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @cancel="ctl.closeConsent()" />
320
320
  <div v-else class="bcm-row">
321
321
  <button type="button" class="bcm-btn bcm-primary" @click="ctl.giveConsent()">{{ t('discussion.giveConsent') }}</button>
322
322
  </div>
@@ -4,15 +4,24 @@
4
4
  * the rules as text with a link to the full page, the art. 9 text as text paragraphs — shown once, with one consent
5
5
  * under `joint` and one per controller under `split` (each labelled with its controller, all required), and
6
6
  * „Nesouhlasím" where the tenant's refusal leaves the public discussion open (m2-contracts.md §3.8).
7
+ *
8
+ * O-16 / F-51 (the owner, 9. 11. 2026: the terms once, never again): on a first join where the tenant has terms, the
9
+ * rules step links the terms beside the rules and its one tick reads „…s pravidly diskuse a s podmínkami" — the model
10
+ * then sends `termsTextId`. The terms' page is `termsHref` (the callers pass `routes.termsPath`: the host's terms page,
11
+ * `…/community/terms` beside a `…/community/rules` page, or null — core/attrs.ts); a caller that passes none (undefined)
12
+ * gets the same derivation from `rulesHref` (termsBeside).
13
+ * With no terms page (null, or nothing derivable: a host's own rules page and no terms page) the step shows the terms'
14
+ * text itself, in a scrolled box like the art. 9 text — the combined tick never stands without a way to read the terms.
7
15
  */
8
16
  import { computed, nextTick, onMounted, ref, watch } from 'vue'
9
17
  import { AGE_BANDS, COMMUNITY_DISPLAY_NAME_MAX, COMMUNITY_HANDLE_CHANGE_DAYS, type AgeBand, type CommunityMessageKey } from '@blogmcp/sdk/community'
18
+ import { termsBeside } from '../core/attrs'
10
19
  import { AVATAR_PRESETS } from '../core/avatars'
11
20
  import { HANDLE_MAX, HANDLE_MIN } from '../core/names'
12
21
  import { onboardingFailureText, type OnboardingModel } from '../core/onboarding'
13
22
  import { uid, useText } from './context'
14
23
 
15
- const props = defineProps<{ model: OnboardingModel; rulesHref: string }>()
24
+ const props = defineProps<{ model: OnboardingModel; rulesHref: string; termsHref?: string | null }>()
16
25
  const emit = defineEmits<{ cancel: [] }>()
17
26
  const { t, lang } = useText()
18
27
 
@@ -21,6 +30,11 @@ const id = uid('bcm-onboarding')
21
30
  const heading = ref<HTMLElement | null>(null)
22
31
  const step = computed(() => props.model.step())
23
32
  const fresh = computed(() => s.steps.includes('profile'))
33
+ /**
34
+ * The terms' page: the caller's (`routes.termsPath`; null = none, the text shown in place), else — a caller that passes
35
+ * nothing — the page beside a `…/community/rules` rules page; null if neither.
36
+ */
37
+ const termsLink = computed((): string | null => (props.termsHref !== undefined ? props.termsHref : termsBeside(props.rulesHref)))
24
38
 
25
39
  const failure = computed(() => {
26
40
  const f = s.failure
@@ -83,10 +97,23 @@ onMounted(() => void nextTick(() => heading.value?.focus()))
83
97
  <span v-if="rule.summary" class="bcm-hint">{{ rule.summary }}</span>
84
98
  </li>
85
99
  </ol>
86
- <p><a :href="rulesHref" target="_blank" rel="noopener">{{ t('onboarding.rulesLink') }}</a></p>
100
+ <p>
101
+ <a :href="rulesHref" target="_blank" rel="noopener">{{ t('onboarding.rulesLink') }}</a>
102
+ <template v-if="s.termsText && termsLink">
103
+ ·
104
+ <a :href="termsLink" target="_blank" rel="noopener" data-terms-link>{{ t('onboarding.termsLink') }}</a>
105
+ </template>
106
+ </p>
107
+ <!-- No terms page to link (a host's own rules page, no termsHref): the terms are read here. -->
108
+ <template v-if="s.termsText && !termsLink">
109
+ <p :id="`${id}-terms`"><strong>{{ t('onboarding.termsLink') }}</strong></p>
110
+ <div class="bcm-consent" tabindex="0" role="document" :aria-labelledby="`${id}-terms`" data-terms-inline>
111
+ <p v-for="(paragraph, i) in s.termsParagraphs" :key="i" class="bcm-text">{{ paragraph }}</p>
112
+ </div>
113
+ </template>
87
114
  <label class="bcm-check">
88
115
  <input v-model="s.rulesAccepted" type="checkbox" />
89
- <span>{{ t('onboarding.rulesAccept') }}</span>
116
+ <span>{{ s.termsText ? t('onboarding.rulesTermsAccept') : t('onboarding.rulesAccept') }}</span>
90
117
  </label>
91
118
  </div>
92
119
 
@@ -290,7 +290,7 @@ async function confirmDelete(): Promise<void> {
290
290
  <p v-if="state.phase === 'loading'" :id="headingId" class="bcm-muted" role="status">{{ t('topic.loading') }}</p>
291
291
 
292
292
  <div v-else-if="state.phase === 'membersOnly' && client" :id="headingId">
293
- <MembersOnly :failure="state.failure" :client="client" :lang="lang" :sign-in-href="signInHref" :rules-href="routes.rulesPath" @joined="thread.refresh()" />
293
+ <MembersOnly :failure="state.failure" :client="client" :lang="lang" :sign-in-href="signInHref" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @joined="thread.refresh()" />
294
294
  </div>
295
295
 
296
296
  <p v-else-if="state.phase === 'notFound'" :id="headingId" class="bcm-note">{{ t('topic.notFound') }}</p>
@@ -347,7 +347,7 @@ async function confirmDelete(): Promise<void> {
347
347
  <p v-else-if="mode === 'locked'" class="bcm-note">{{ t('error.topicLocked') }}</p>
348
348
  <p v-else-if="mode === 'readOnly'" class="bcm-note">{{ t('error.readOnly') }}</p>
349
349
  <template v-else-if="mode === 'onboarding'">
350
- <OnboardingSteps v-if="thread.onboarding.value" :model="thread.onboarding.value" :rules-href="routes.rulesPath" @cancel="thread.cancelOnboarding()" />
350
+ <OnboardingSteps v-if="thread.onboarding.value" :model="thread.onboarding.value" :rules-href="routes.rulesPath" :terms-href="routes.termsPath" @cancel="thread.cancelOnboarding()" />
351
351
  <div v-else class="bcm-row">
352
352
  <p>{{ t(needKey) }}</p>
353
353
  <button type="button" class="bcm-btn bcm-primary" @click="thread.beginOnboarding()">{{ t('onboarding.continue') }}</button>