@blogmcp/community 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,9 +6,10 @@
6
6
  * receives what the member is about to write — the other participant; the website's code, which puts it on the screen
7
7
  * under tenant rendering (and, where the website and blogmcp are the same legal person, `same_entity`, the line that
8
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
9
+ * handles a report, with the at most 10 preceding messages the matrix gives them; a court's order or a judge's
10
+ * consent (texts 20, 21, 23 and 24), which is in every row, so the list never reads as complete without it; the
11
+ * delegated addendum where the website can sign in as the member (under both renderings); and that the messages are
12
+ * not end-to-end encrypted. test/private/dm/composer.spec.ts
12
13
  * checks every space × identity × rendering × same-entity × host combination against the promise's own keys, and the
13
14
  * tone test covers its words with the rest of the conversations' catalogue.
14
15
  *
@@ -62,7 +62,10 @@
62
62
  "private.activation.submit": "Aktivovat soukromé zprávy",
63
63
  "private.activation.declined": "Bez souhlasu se zpracováním údajů o zdraví soukromé zprávy zapnout nejdou, proto zůstávají vypnuté. Tuto volbu si neukládáme, aktivovat je můžete kdykoli.",
64
64
  "private.activation.done": "Soukromé zprávy jsou aktivní.",
65
- "private.activation.withdraw": "Odvolat souhlas a ukončit aktivaci",
65
+ "private.activation.withdrawContract": "Odstoupit od smlouvy",
66
+ "private.activation.withdrawContractConfirm": "Potvrdit odstoupení od smlouvy",
67
+ "private.activation.endPrivate": "Ukončit soukromé zprávy",
68
+ "private.activation.endPrivateConfirm": "Potvrdit ukončení soukromých zpráv",
66
69
  "private.activation.withdrawConfirm": "Soukromé zprávy se vypnou a obsah, který na souhlasu stojí, se po lhůtě smaže. Do té doby to můžete vrátit novou aktivací.",
67
70
  "private.activation.withdrawn": "Souhlas je odvolaný.",
68
71
  "private.activation.addressFirst": "Před aktivací si nastavte adresu pro schvalování zařízení.",
@@ -225,7 +228,7 @@
225
228
  "private.dm.composer.display": "Na obrazovku ji dává tento web, který ji podle smlouvy nesmí číst, ukládat ani měřit.",
226
229
  "private.dm.composer.sameEntity": "Na obrazovku ji dává tento web. Web i blogmcp provozuje stejná osoba a píše i kód webu, takže by ji technicky mohla číst; zakazuje jí to zákon.",
227
230
  "private.dm.composer.reports": "Když ji kdokoli z vás nahlásí, uvidí ji i s nejvýš 10 předchozími zprávami ten, kdo hlášení vyřizuje.",
228
- "private.dm.composer.orders": "Na příkaz soudu nebo policie ji provozovatel musí vydat.",
231
+ "private.dm.composer.orders": "Na příkaz soudu nebo se souhlasem soudce ji provozovatel musí vydat.",
229
232
  "private.dm.composer.delegated": "Web, přes který se přihlašujete, se za vás umí přihlásit jako nové zařízení a nové zprávy by viděl. Každé takové přihlášení vám ohlásíme e-mailem.",
230
233
  "private.dm.composer.notE2e": "Zprávy nejsou šifrované koncově.",
231
234
  "private.dm.search.label": "Hledat v konverzaci",
@@ -62,7 +62,10 @@
62
62
  "private.activation.submit": "Activate private messages",
63
63
  "private.activation.declined": "Private messages cannot be turned on without the consent to processing health data, so they stay off. This choice is not stored; you can activate them at any time.",
64
64
  "private.activation.done": "Private messages are active.",
65
- "private.activation.withdraw": "Withdraw consent and end the activation",
65
+ "private.activation.withdrawContract": "Withdraw from the contract",
66
+ "private.activation.withdrawContractConfirm": "Confirm withdrawal from the contract",
67
+ "private.activation.endPrivate": "End private messages",
68
+ "private.activation.endPrivateConfirm": "Confirm ending private messages",
66
69
  "private.activation.withdrawConfirm": "Private messages switch off and the content that relies on the consent is erased after a waiting period. Until then you can undo this by activating again.",
67
70
  "private.activation.withdrawn": "Your consent is withdrawn.",
68
71
  "private.activation.addressFirst": "Set your device approval address before you activate.",
@@ -145,7 +148,7 @@
145
148
  "private.promise.display.tenant": "The {site} website puts them on your screen, and its contract forbids it to read, store or measure them.",
146
149
  "private.promise.same_entity": "Private messages are run by blogmcp. Today the website and blogmcp are run by the same person ({entity}, company ID {ico}), who also writes the website's code that displays your messages. They could technically read them; the law forbids it. Otherwise the content is opened outside your screen only for a reported message or on an authority's order, and every such opening is logged automatically.",
147
150
  "private.promise.reports": "The website's team has no tool for them, except for handling reported messages. If either of you reports a message, whoever handles reports for the operator of private messages sees it with at most 10 preceding messages. That may be an authorised moderator of the {site} website. Whoever reports sees their name before sending.",
148
- "private.promise.orders": "Data the operator must hand over on a court or police order are an exception too.",
151
+ "private.promise.orders": "Data the operator must hand over on a court's order or with a judge's consent are an exception too.",
149
152
  "private.promise.not_e2e": "They are not end-to-end encrypted.",
150
153
  "private.promise.delegated": "The website you sign in through can technically sign in as you as a new device. It would not see older messages there without your approval, but it would see new ones, and it could write in your name. That is why blogmcp announces every new sign-in to you by e-mail.",
151
154
  "private.error.memberReadOnly": "Your account can only read for now, so you cannot use private messages on this site.",
@@ -233,7 +236,7 @@
233
236
  "private.dm.composer.display": "This website puts it on the screen, and its contract forbids it to read, store or measure it.",
234
237
  "private.dm.composer.sameEntity": "This website puts it on the screen. The website and blogmcp are run by the same person, who also writes the website's code, so they could technically read it; the law forbids it.",
235
238
  "private.dm.composer.reports": "If either of you reports it, whoever handles the report sees it with at most 10 preceding messages.",
236
- "private.dm.composer.orders": "The operator must hand it over on a court or police order.",
239
+ "private.dm.composer.orders": "The operator must hand it over on a court's order or with a judge's consent.",
237
240
  "private.dm.composer.delegated": "The website you sign in through can sign in as you on a new device and would see new messages. We tell you of every such sign-in by e-mail.",
238
241
  "private.dm.composer.notE2e": "Messages are not end-to-end encrypted.",
239
242
  "private.dm.search.label": "Search the conversation",
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * A legal text's blocks (`legalTextBlocks`, §5.11 "Formatting") as elements with text in them, never as markup:
4
+ * headings two levels below the screen's `<h2>`, paragraphs, and lists whose items are this component again.
5
+ */
6
+ import type { LegalTextBlock } from '@blogmcp/sdk/community'
7
+ import LegalRuns from './LegalRuns.vue'
8
+ import { headingLevel } from './legal'
9
+
10
+ defineOptions({ name: 'LegalBlocks' })
11
+ defineProps<{ blocks: readonly LegalTextBlock[] }>()
12
+ </script>
13
+
14
+ <template>
15
+ <template v-for="(b, i) in blocks" :key="i">
16
+ <template v-if="b.type === 'heading'">
17
+ <h3 v-if="headingLevel(b.level) === 3"><LegalRuns :runs="b.runs" /></h3>
18
+ <h4 v-else-if="headingLevel(b.level) === 4"><LegalRuns :runs="b.runs" /></h4>
19
+ <h5 v-else-if="headingLevel(b.level) === 5"><LegalRuns :runs="b.runs" /></h5>
20
+ <h6 v-else><LegalRuns :runs="b.runs" /></h6>
21
+ </template>
22
+ <p v-else-if="b.type === 'paragraph'"><LegalRuns :runs="b.runs" /></p>
23
+ <ol v-else-if="b.type === 'list' && b.ordered" :start="b.start">
24
+ <li v-for="(item, k) in b.items" :key="k"><LegalBlocks :blocks="item.blocks" /></li>
25
+ </ol>
26
+ <ul v-else-if="b.type === 'list'">
27
+ <li v-for="(item, k) in b.items" :key="k"><LegalBlocks :blocks="item.blocks" /></li>
28
+ </ul>
29
+ </template>
30
+ </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ /** One run of a legal text: its text, inside `<strong>`, `<em>` and `<code>` as its marks say — text, never markup. */
3
+ import type { LegalTextRun } from '@blogmcp/sdk/community'
4
+
5
+ defineProps<{ run: LegalTextRun }>()
6
+ </script>
7
+
8
+ <template>
9
+ <strong v-if="run.strong"><em v-if="run.em"><code v-if="run.code">{{ run.text }}</code><template v-else>{{ run.text }}</template></em><code v-else-if="run.code">{{ run.text }}</code><template v-else>{{ run.text }}</template></strong>
10
+ <em v-else-if="run.em"><code v-if="run.code">{{ run.text }}</code><template v-else>{{ run.text }}</template></em>
11
+ <code v-else-if="run.code">{{ run.text }}</code>
12
+ <template v-else>{{ run.text }}</template>
13
+ </template>
@@ -0,0 +1,20 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * A block's runs: a link's runs in one `<a>` to the https: or mailto: address the blocks carry (never anything else),
4
+ * opened beside the private view so the screen stays where it is; every run through LegalRun.
5
+ */
6
+ import { computed } from 'vue'
7
+ import type { LegalTextRun } from '@blogmcp/sdk/community'
8
+ import LegalRun from './LegalRun.vue'
9
+ import { linkGroups } from './legal'
10
+
11
+ const props = defineProps<{ runs: readonly LegalTextRun[] }>()
12
+ const groups = computed(() => linkGroups(props.runs))
13
+ </script>
14
+
15
+ <template>
16
+ <template v-for="(g, i) in groups" :key="i">
17
+ <a v-if="g.href" :href="g.href" target="_blank" rel="noopener noreferrer"><LegalRun v-for="(r, k) in g.runs" :key="k" :run="r" /></a>
18
+ <template v-else><LegalRun v-for="(r, k) in g.runs" :key="k" :run="r" /></template>
19
+ </template>
20
+ </template>
@@ -1,18 +1,25 @@
1
1
  <script setup lang="ts">
2
- /** One text as kb-api served it (§5.11): its version and its body, as text — never as markup. */
2
+ /**
3
+ * One text as kb-api served it (§5.11): its version and its body. The body's Markdown subset (headings, paragraphs,
4
+ * lists, bold, links; §5.11 "Formatting") is parsed into blocks by the SDK and rendered by LegalBlocks as elements with
5
+ * text in them — never as markup; the session's placeholders are filled in the parsed runs.
6
+ */
3
7
  import { computed } from 'vue'
8
+ import { legalTextBlocks } from '@blogmcp/sdk/community'
4
9
  import type { PrivateLegalText } from '@blogmcp/sdk/community/private'
5
10
  import type { Lang } from '../i18n'
11
+ import LegalBlocks from './LegalBlocks.vue'
12
+ import { fillBlocks } from './legal'
6
13
  import { fillDisplay, screenText } from './text'
7
14
 
8
15
  const props = defineProps<{ text: PrivateLegalText; lang: Lang; display: { approvalEmail: string | null; deviceLabel: string } | null; acceptedAt: string }>()
9
16
  const tx = computed(() => screenText(props.lang))
10
- const body = computed(() => fillDisplay(props.text.body, props.display, props.acceptedAt))
17
+ const blocks = computed(() => fillBlocks(legalTextBlocks(props.text.body), (s) => fillDisplay(s, props.display, props.acceptedAt)))
11
18
  </script>
12
19
 
13
20
  <template>
14
21
  <article class="bcm-p-legal" :data-text-kind="text.kind">
15
22
  <p class="bcm-p-muted">{{ tx.pt('private.activation.version', { version: text.version }) }}</p>
16
- <div class="bcm-p-legal-body">{{ body }}</div>
23
+ <div class="bcm-p-legal-doc"><LegalBlocks :blocks="blocks" /></div>
17
24
  </article>
18
25
  </template>
@@ -22,6 +22,16 @@ const art9 = ref(false)
22
22
  const art9Tenant = ref(false)
23
23
  const confirming = ref(false)
24
24
  const acceptedAt = computed(() => tx.value.when(a.value?.activation.activatedAt ?? null))
25
+ /**
26
+ * Inside the 14 days of § 1829 odst. 1 OZ after the activation the end is a withdrawal from the contract, after them
27
+ * an ending; kb-api decides the same way (activation.ts contractEndKindAt). The labels are the ones text 20 promises and
28
+ * § 1830a OZ (from 1. 1. 2027) prescribes: „Odstoupit od smlouvy“, confirmed by „Potvrdit odstoupení od smlouvy“.
29
+ */
30
+ const WITHDRAWAL_DAYS = 14
31
+ const endIsWithdrawal = computed(() => {
32
+ const at = a.value?.activation.activatedAt
33
+ return at ? Date.now() < Date.parse(at) + WITHDRAWAL_DAYS * 86_400_000 : false
34
+ })
25
35
  const display = computed(() => a.value?.display ?? null)
26
36
  const addressReady = computed(() => s.value.state?.address.state === 'verified')
27
37
  const deviceReady = computed(() => s.value.state?.device.state !== 'pending')
@@ -43,9 +53,9 @@ const canRefuse = computed(() => !s.value.busy)
43
53
  </div>
44
54
  <p v-if="confirming" class="bcm-p-note">{{ tx.pt('private.activation.withdrawConfirm') }}</p>
45
55
  <div class="bcm-p-actions">
46
- <button v-if="!confirming" type="button" class="bcm-p-btn" data-action="withdraw" @click="confirming = true">{{ tx.pt('private.activation.withdraw') }}</button>
56
+ <button v-if="!confirming" type="button" class="bcm-p-btn" data-action="withdraw" :data-end="endIsWithdrawal ? 'withdrawal' : 'termination'" @click="confirming = true">{{ tx.pt(endIsWithdrawal ? 'private.activation.withdrawContract' : 'private.activation.endPrivate') }}</button>
47
57
  <template v-else>
48
- <button type="button" class="bcm-p-btn bcm-p-danger" :disabled="s.busy" data-action="withdraw-confirm" @click="confirming = false; controller.withdraw()">{{ tx.pt('private.confirm') }}</button>
58
+ <button type="button" class="bcm-p-btn bcm-p-danger" :disabled="s.busy" data-action="withdraw-confirm" @click="confirming = false; controller.withdraw()">{{ tx.pt(endIsWithdrawal ? 'private.activation.withdrawContractConfirm' : 'private.activation.endPrivateConfirm') }}</button>
49
59
  <button type="button" class="bcm-p-btn" @click="confirming = false">{{ tx.pt('private.cancel') }}</button>
50
60
  </template>
51
61
  </div>
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A legal text's blocks on a private screen (m4-contracts.md §5.11 "Formatting"): `legalTextBlocks` of the SDK parses
3
+ * the body's Markdown subset, and the components render the blocks as elements with text in them — never as markup.
4
+ * The session's placeholders are filled in the runs, after parsing, so a filled value is never read as Markdown.
5
+ */
6
+ import type { LegalTextBlock, LegalTextRun } from '@blogmcp/sdk/community'
7
+
8
+ /** The blocks with every run's text passed through `fill`. */
9
+ export function fillBlocks(blocks: readonly LegalTextBlock[], fill: (text: string) => string): LegalTextBlock[] {
10
+ return blocks.map((b): LegalTextBlock => {
11
+ if (b.type === 'list') return { ...b, items: b.items.map((item) => ({ blocks: fillBlocks(item.blocks, fill) })) }
12
+ return { ...b, runs: b.runs.map((r) => ({ ...r, text: fill(r.text) })) }
13
+ })
14
+ }
15
+
16
+ /** Consecutive runs of one link together (one `<a>`), the rest one by one with no href. */
17
+ export function linkGroups(runs: readonly LegalTextRun[]): Array<{ href: string | null; runs: LegalTextRun[] }> {
18
+ const out: Array<{ href: string | null; runs: LegalTextRun[] }> = []
19
+ for (const run of runs) {
20
+ const href = run.href ?? null
21
+ const last = out[out.length - 1]
22
+ if (href !== null && last && last.href === href) last.runs.push(run)
23
+ else out.push({ href, runs: [run] })
24
+ }
25
+ return out
26
+ }
27
+
28
+ /** A text's heading level on a screen: two below the screen's own `<h2>`, at most `<h6>`. */
29
+ export const headingLevel = (level: number): 3 | 4 | 5 | 6 => Math.min(6, Math.max(3, level + 2)) as 3 | 4 | 5 | 6
@@ -47,6 +47,15 @@
47
47
  .bcm-p-check { display: flex; gap: 0.5em; align-items: flex-start; margin: 0.4em 0; }
48
48
  .bcm-p-legal { margin: 0.75em 0; }
49
49
  .bcm-p-legal-body { white-space: pre-wrap; max-height: 18em; overflow: auto; border: 1px solid color-mix(in srgb, var(--bcm-p-muted) 35%, transparent); border-radius: var(--bcm-p-radius); padding: 0.6em; }
50
+ /* A legal text's blocks (LegalBlocks): the same scroll box; a run's `\n` is a hard line break. */
51
+ .bcm-p-legal-doc { max-height: 18em; overflow: auto; overflow-wrap: anywhere; white-space: pre-line; border: 1px solid color-mix(in srgb, var(--bcm-p-muted) 35%, transparent); border-radius: var(--bcm-p-radius); padding: 0 0.6em; }
52
+ .bcm-p-legal-doc h3, .bcm-p-legal-doc h4, .bcm-p-legal-doc h5, .bcm-p-legal-doc h6 { font-size: 1em; margin: 0.9em 0 0.3em; }
53
+ .bcm-p-legal-doc h3 { font-size: 1.08em; }
54
+ .bcm-p-legal-doc p { margin: 0.5em 0; }
55
+ .bcm-p-legal-doc ul, .bcm-p-legal-doc ol { margin: 0.5em 0; padding-left: 1.4em; }
56
+ .bcm-p-legal-doc li > p { margin: 0.2em 0; }
57
+ .bcm-p-legal-doc code { font-family: ui-monospace, monospace; font-size: 0.92em; }
58
+ .bcm-p-legal-doc a { color: inherit; }
50
59
  .bcm-p-provider { margin-top: 1em; font-size: 0.85em; color: var(--bcm-p-muted); }
51
60
  .bcm-p-provider-links a { margin-right: 0.8em; color: inherit; }
52
61
  .bcm-p-dot { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--bcm-p-danger); margin-left: 0.35em; vertical-align: middle; }