@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
|
@@ -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>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
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
|
+
*/
|
|
7
|
+
import { computed } from 'vue'
|
|
8
|
+
import { legalTextBlocks } from '@blogmcp/sdk/community'
|
|
9
|
+
import type { PrivateLegalText } from '@blogmcp/sdk/community/private'
|
|
10
|
+
import type { Lang } from '../i18n'
|
|
11
|
+
import LegalBlocks from './LegalBlocks.vue'
|
|
12
|
+
import { fillBlocks } from './legal'
|
|
13
|
+
import { fillDisplay, screenText } from './text'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{ text: PrivateLegalText; lang: Lang; display: { approvalEmail: string | null; deviceLabel: string } | null; acceptedAt: string }>()
|
|
16
|
+
const tx = computed(() => screenText(props.lang))
|
|
17
|
+
const blocks = computed(() => fillBlocks(legalTextBlocks(props.text.body), (s) => fillDisplay(s, props.display, props.acceptedAt)))
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<article class="bcm-p-legal" :data-text-kind="text.kind">
|
|
22
|
+
<p class="bcm-p-muted">{{ tx.pt('private.activation.version', { version: text.version }) }}</p>
|
|
23
|
+
<div class="bcm-p-legal-doc"><LegalBlocks :blocks="blocks" /></div>
|
|
24
|
+
</article>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* One private screen with what every screen carries: the live region for the controller's announcements, the screen's
|
|
4
|
+
* own refusal, a way back to the overview, and the provider line (§5.11) — on every screen.
|
|
5
|
+
*/
|
|
6
|
+
import { computed, onMounted } from 'vue'
|
|
7
|
+
import type { PrivateScreen, PrivateViewController } from '../core/view'
|
|
8
|
+
import type { Lang } from '../i18n'
|
|
9
|
+
import ProviderLine from './ProviderLine.vue'
|
|
10
|
+
import ScreenActivation from './ScreenActivation.vue'
|
|
11
|
+
import ScreenAddress from './ScreenAddress.vue'
|
|
12
|
+
import ScreenApproval from './ScreenApproval.vue'
|
|
13
|
+
import ScreenDevices from './ScreenDevices.vue'
|
|
14
|
+
import ScreenHome from './ScreenHome.vue'
|
|
15
|
+
import ScreenNotifications from './ScreenNotifications.vue'
|
|
16
|
+
import ScreenReads from './ScreenReads.vue'
|
|
17
|
+
import ScreenSettings from './ScreenSettings.vue'
|
|
18
|
+
import DmScreens from '../dm/ui/DmScreens.vue'
|
|
19
|
+
import { screenText } from './text'
|
|
20
|
+
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
controller: PrivateViewController
|
|
23
|
+
lang: Lang
|
|
24
|
+
/** A dock window shows one screen; without it the view follows the controller's current screen. */
|
|
25
|
+
screen?: PrivateScreen
|
|
26
|
+
/** Where the overview's entries go (a dock opens a window); default: this view moves to that screen. */
|
|
27
|
+
navigate?: (screen: PrivateScreen) => void
|
|
28
|
+
/** Where a conversation opens (a dock opens a window of its own); default: in the `messages` screen. */
|
|
29
|
+
openConversation?: (conversationId: string) => void
|
|
30
|
+
}>()
|
|
31
|
+
const tx = computed(() => screenText(props.lang))
|
|
32
|
+
const s = computed(() => props.controller.state)
|
|
33
|
+
const current = computed<PrivateScreen>(() => props.screen ?? s.value.screen)
|
|
34
|
+
const go = (screen: PrivateScreen): void => {
|
|
35
|
+
if (props.navigate) props.navigate(screen)
|
|
36
|
+
else void props.controller.open(screen)
|
|
37
|
+
}
|
|
38
|
+
onMounted(() => {
|
|
39
|
+
if (props.screen && props.screen !== 'home') void props.controller.open(props.screen)
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div class="bcm-p-screens" :data-current="current">
|
|
45
|
+
<p class="bcm-p-sr" role="status" aria-live="polite">
|
|
46
|
+
<span v-if="s.announcement" :key="s.announceId">{{ tx.refText(s.announcement) }}</span>
|
|
47
|
+
</p>
|
|
48
|
+
<button v-if="!screen && current !== 'home'" type="button" class="bcm-p-link" data-action="back" @click="go('home')">{{ tx.pt('private.back') }}</button>
|
|
49
|
+
<ScreenHome v-if="current === 'home'" :controller="controller" :lang="lang" @navigate="go" />
|
|
50
|
+
<DmScreens v-else-if="current === 'messages'" :dm="s.dm" :lang="lang" :open-conversation="openConversation" />
|
|
51
|
+
<ScreenAddress v-else-if="current === 'address'" :controller="controller" :lang="lang" />
|
|
52
|
+
<ScreenActivation v-else-if="current === 'activation'" :controller="controller" :lang="lang" />
|
|
53
|
+
<ScreenApproval v-else-if="current === 'approval'" :controller="controller" :lang="lang" />
|
|
54
|
+
<ScreenDevices v-else-if="current === 'devices'" :controller="controller" :lang="lang" />
|
|
55
|
+
<ScreenReads v-else-if="current === 'reads'" :controller="controller" :lang="lang" />
|
|
56
|
+
<ScreenNotifications v-else-if="current === 'notifications'" :controller="controller" :lang="lang" />
|
|
57
|
+
<ScreenSettings v-else-if="current === 'settings'" :controller="controller" :lang="lang" />
|
|
58
|
+
<p v-if="s.screenFailures[current]" class="bcm-p-error" role="alert">{{ tx.refText(s.screenFailures[current] ?? null) }}</p>
|
|
59
|
+
<ProviderLine :provider="s.provider" :lang="lang" />
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* `<blogmcp-private-view>` (m4-contracts.md §6.2): the private screens on a page of their own (the host's
|
|
4
|
+
* `/komunita/zpravy`). Nothing renders on a dark instance; under `provider_page` only the link to the account host.
|
|
5
|
+
*/
|
|
6
|
+
import { computed, watch } from 'vue'
|
|
7
|
+
import type { PrivateClient } from '@blogmcp/sdk/community/private'
|
|
8
|
+
import type { CommunityTransport } from '@blogmcp/sdk/community'
|
|
9
|
+
import { PRIVATE_SCREENS, isFinalFailure, type PrivateScreen } from '../core/view'
|
|
10
|
+
import type { PrivatePushPort } from '../core/push'
|
|
11
|
+
import type { PrivateRealtimeInput } from '../core/realtime'
|
|
12
|
+
import PrivateScreens from './PrivateScreens.vue'
|
|
13
|
+
import { httpsHref, screenText } from './text'
|
|
14
|
+
import { usePrivateRoot } from './root'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
kbOrigin?: string
|
|
18
|
+
apiBase?: string
|
|
19
|
+
siteBase?: string
|
|
20
|
+
routes?: string
|
|
21
|
+
lang?: string
|
|
22
|
+
siteName?: string
|
|
23
|
+
swPath?: string
|
|
24
|
+
accountOrigin?: string
|
|
25
|
+
/** The screen to open first once ready (else the one the member's state asks for). */
|
|
26
|
+
screen?: string
|
|
27
|
+
transport?: CommunityTransport
|
|
28
|
+
client?: PrivateClient
|
|
29
|
+
push?: PrivatePushPort | null
|
|
30
|
+
/** The live inbox (core/realtime.ts): the SDK's `createPrivateRealtime`, or a source of the host's own. */
|
|
31
|
+
realtime?: PrivateRealtimeInput
|
|
32
|
+
}>()
|
|
33
|
+
const { setup, lang } = usePrivateRoot(props)
|
|
34
|
+
const tx = computed(() => screenText(lang.value))
|
|
35
|
+
const controller = computed(() => setup.value?.controller ?? null)
|
|
36
|
+
const phase = computed(() => controller.value?.state.phase ?? 'idle')
|
|
37
|
+
const accountUrl = computed(() => httpsHref(setup.value?.accountUrl ?? null))
|
|
38
|
+
const requested = computed<PrivateScreen | null>(() => ((PRIVATE_SCREENS as readonly string[]).includes(props.screen ?? '') ? (props.screen as PrivateScreen) : null))
|
|
39
|
+
const ready = computed(() => phase.value === 'ready')
|
|
40
|
+
/**
|
|
41
|
+
* A reload of a view that was ready (a `resync`) keeps the phase `ready` while it runs (core/view.ts `reloading`), so the
|
|
42
|
+
* screens stay mounted: the DM controller lives on through it, and unmounting the messages screen would close its
|
|
43
|
+
* threads mid-refresh and lose an edit in progress. Only a first load shows the loading line.
|
|
44
|
+
*/
|
|
45
|
+
const reloading = computed(() => controller.value?.state.reloading === true)
|
|
46
|
+
/** A refusal a retry cannot cure (FINAL_REFUSALS) is said without the retry button. */
|
|
47
|
+
const retryable = computed(() => !(controller.value && isFinalFailure(controller.value.state)))
|
|
48
|
+
const live = computed(() => controller.value?.state.realtime ?? 'off')
|
|
49
|
+
// The host's `screen` opens once, when the view is first ready (a later reload keeps where the member went).
|
|
50
|
+
watch(ready, (now, before) => {
|
|
51
|
+
const c = controller.value
|
|
52
|
+
if (now && !before && c && requested.value) void c.open(requested.value)
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<div class="bcm-p-root bcm-p-view" :data-phase="phase" :data-realtime="live" :data-reloading="reloading ? '' : undefined">
|
|
58
|
+
<p v-if="phase === 'loading'" class="bcm-p-muted">{{ tx.pt('private.loading') }}</p>
|
|
59
|
+
<p v-else-if="phase === 'signIn'">{{ tx.pt('private.signIn') }}</p>
|
|
60
|
+
<p v-else-if="phase === 'link' && accountUrl">
|
|
61
|
+
{{ tx.pt('private.link.providerPage') }}
|
|
62
|
+
<a :href="accountUrl" rel="noopener" data-account-link>{{ tx.pt('private.link.open') }}</a>
|
|
63
|
+
</p>
|
|
64
|
+
<div v-else-if="phase === 'failed'">
|
|
65
|
+
<p role="alert">{{ tx.refText(controller?.state.failure ?? null) }}</p>
|
|
66
|
+
<button v-if="retryable" type="button" class="bcm-p-btn" data-action="retry" @click="controller?.load()">{{ tx.pt('private.retry') }}</button>
|
|
67
|
+
</div>
|
|
68
|
+
<PrivateScreens v-else-if="ready && controller" :controller="controller" :lang="lang" />
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The promise (invariant 12): the sentences of the keys PU1's matrix gives for this member — the elements never pick
|
|
4
|
+
* or word them themselves (test/private/promise.spec.ts renders every combination against the matrix).
|
|
5
|
+
*/
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import type { PrivatePromiseKey } from '@blogmcp/sdk/community/private'
|
|
8
|
+
import { promiseMessage, type Lang } from '../i18n'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{ keys: readonly PrivatePromiseKey[]; lang: Lang; params: Record<string, string> }>()
|
|
11
|
+
const sentences = computed(() => props.keys.map((k) => ({ k, text: promiseMessage(props.lang, k, props.params) })))
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="bcm-p-promise" data-promise>
|
|
16
|
+
<p v-for="s in sentences" :key="s.k" :data-promise-key="s.k">{{ s.text }}</p>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** The provider line (§5.11, §9.1): the provider's name, IČO, address and links, on every private screen. */
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import type { ProviderLine } from '../core/view'
|
|
5
|
+
import type { Lang } from '../i18n'
|
|
6
|
+
import { screenText } from './text'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{ provider: ProviderLine | null; lang: Lang }>()
|
|
9
|
+
const tx = computed(() => screenText(props.lang))
|
|
10
|
+
const links = computed(() => (['contact', 'rules', 'terms', 'privacy'] as const).filter((k) => props.provider?.links[k]).map((k) => ({ k, href: props.provider!.links[k]! })))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<footer v-if="provider" class="bcm-p-provider" data-provider-line>
|
|
15
|
+
<p>{{ tx.pt('private.provider.line', { name: provider.name, ico: provider.ico, address: provider.address }) }}</p>
|
|
16
|
+
<p v-if="links.length > 0" class="bcm-p-provider-links">
|
|
17
|
+
<a v-for="l in links" :key="l.k" :href="l.href" target="_blank" rel="noopener noreferrer">{{ tx.pt(`private.provider.${l.k}`) }}</a>
|
|
18
|
+
</p>
|
|
19
|
+
</footer>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The activation (§5.11): the texts as kb-api served them (the variants and placeholders resolved server-side; the
|
|
4
|
+
* session's placeholders filled from `display`), the announced versions beside the current ones, the art. 9 consent in
|
|
5
|
+
* the tenant's layout — `joint` one consent, `split` the tenant's text (when kb-api serves it) and the platform's —, the
|
|
6
|
+
* promise, and the withdrawal once active. Accepting sends the ids and the two hashes of what was shown (the proof).
|
|
7
|
+
* Declining the art. 9 consent posts nothing (kb-api stores no refusal): the screen says nothing was recorded.
|
|
8
|
+
*/
|
|
9
|
+
import { computed, ref } from 'vue'
|
|
10
|
+
import type { PrivateViewController } from '../core/view'
|
|
11
|
+
import type { Lang } from '../i18n'
|
|
12
|
+
import LegalText from './LegalText.vue'
|
|
13
|
+
import PromiseBlock from './PromiseBlock.vue'
|
|
14
|
+
import { screenText } from './text'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
17
|
+
const tx = computed(() => screenText(props.lang))
|
|
18
|
+
const s = computed(() => props.controller.state)
|
|
19
|
+
const a = computed(() => s.value.activation)
|
|
20
|
+
const acceptTerms = ref(false)
|
|
21
|
+
const art9 = ref(false)
|
|
22
|
+
const art9Tenant = ref(false)
|
|
23
|
+
const confirming = ref(false)
|
|
24
|
+
const acceptedAt = computed(() => tx.value.when(a.value?.activation.activatedAt ?? null))
|
|
25
|
+
const display = computed(() => a.value?.display ?? null)
|
|
26
|
+
const addressReady = computed(() => s.value.state?.address.state === 'verified')
|
|
27
|
+
const deviceReady = computed(() => s.value.state?.device.state !== 'pending')
|
|
28
|
+
const canSubmit = computed(() => acceptTerms.value && art9.value && (!a.value?.art9Tenant || art9Tenant.value) && addressReady.value && deviceReady.value && !s.value.busy)
|
|
29
|
+
const canRefuse = computed(() => !s.value.busy)
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<section v-if="a" class="bcm-p-screen" data-screen="activation">
|
|
34
|
+
<h2>{{ tx.pt('private.activation.title') }}</h2>
|
|
35
|
+
<template v-if="a.activation.state === 'active'">
|
|
36
|
+
<p data-activation-state="active">{{ tx.pt('private.activation.active', { date: acceptedAt }) }}</p>
|
|
37
|
+
<PromiseBlock v-if="s.promise" :keys="s.promise.keys" :lang="lang" :params="controller.promiseParams()" />
|
|
38
|
+
<div v-if="a.announced.length > 0" class="bcm-p-announced">
|
|
39
|
+
<template v-for="t in a.announced" :key="t.id">
|
|
40
|
+
<p class="bcm-p-note">{{ tx.pt('private.activation.announced', { date: tx.when(t.effectiveAt, false) }) }}</p>
|
|
41
|
+
<LegalText :text="t" :lang="lang" :display="display" :accepted-at="acceptedAt" />
|
|
42
|
+
</template>
|
|
43
|
+
</div>
|
|
44
|
+
<p v-if="confirming" class="bcm-p-note">{{ tx.pt('private.activation.withdrawConfirm') }}</p>
|
|
45
|
+
<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>
|
|
47
|
+
<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>
|
|
49
|
+
<button type="button" class="bcm-p-btn" @click="confirming = false">{{ tx.pt('private.cancel') }}</button>
|
|
50
|
+
</template>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<template v-else>
|
|
54
|
+
<p v-if="a.activation.state === 'refused'" data-activation-state="refused">{{ tx.pt('private.activation.refused') }}</p>
|
|
55
|
+
<p v-else data-activation-state="needed">{{ tx.pt('private.activation.intro') }}</p>
|
|
56
|
+
<p v-if="!addressReady" class="bcm-p-note">{{ tx.pt('private.activation.addressFirst') }}</p>
|
|
57
|
+
<p v-else-if="!deviceReady" class="bcm-p-note">{{ tx.pt('private.activation.approvedOnly') }}</p>
|
|
58
|
+
<PromiseBlock v-if="s.promise" :keys="s.promise.keys" :lang="lang" :params="controller.promiseParams()" />
|
|
59
|
+
<LegalText v-for="t in a.texts" :key="t.id" :text="t" :lang="lang" :display="display" :accepted-at="acceptedAt" />
|
|
60
|
+
<div v-if="a.announced.length > 0" class="bcm-p-announced">
|
|
61
|
+
<template v-for="t in a.announced" :key="t.id">
|
|
62
|
+
<p class="bcm-p-note">{{ tx.pt('private.activation.announced', { date: tx.when(t.effectiveAt, false) }) }}</p>
|
|
63
|
+
<LegalText :text="t" :lang="lang" :display="display" :accepted-at="acceptedAt" />
|
|
64
|
+
</template>
|
|
65
|
+
</div>
|
|
66
|
+
<label class="bcm-p-check"><input v-model="acceptTerms" type="checkbox" data-check="terms" />{{ tx.pt('private.activation.acceptTerms') }}</label>
|
|
67
|
+
<template v-if="a.art9Tenant">
|
|
68
|
+
<LegalText :text="a.art9Tenant" :lang="lang" :display="display" :accepted-at="acceptedAt" />
|
|
69
|
+
<label class="bcm-p-check"><input v-model="art9Tenant" type="checkbox" data-check="art9-tenant" />{{ tx.pt('private.activation.art9Tenant') }}</label>
|
|
70
|
+
</template>
|
|
71
|
+
<template v-if="a.art9">
|
|
72
|
+
<LegalText :text="a.art9" :lang="lang" :display="display" :accepted-at="acceptedAt" />
|
|
73
|
+
<label class="bcm-p-check"><input v-model="art9" type="checkbox" data-check="art9" />{{ tx.pt('private.activation.art9') }}</label>
|
|
74
|
+
</template>
|
|
75
|
+
<p v-if="s.art9Declined" class="bcm-p-note" data-art9-declined>{{ tx.pt('private.activation.declined') }}</p>
|
|
76
|
+
<div class="bcm-p-actions">
|
|
77
|
+
<button type="button" class="bcm-p-btn bcm-p-primary" :disabled="!canSubmit" data-action="activate" @click="controller.activate({ acceptTerms, art9: 'accept', art9Tenant })">{{ tx.pt('private.activation.submit') }}</button>
|
|
78
|
+
<button type="button" class="bcm-p-btn" :disabled="!canRefuse" data-action="refuse" @click="controller.activate({ acceptTerms, art9: 'refuse', art9Tenant: false })">{{ tx.pt('private.activation.art9Refuse') }}</button>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
</section>
|
|
82
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The address step (§5.10, B-31): the member sets the approval address on the account host, never on the website —
|
|
4
|
+
* this screen offers only the link (`address/link`) and says the address's state, masked (B-63).
|
|
5
|
+
*/
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import type { PrivateViewController } from '../core/view'
|
|
8
|
+
import type { Lang } from '../i18n'
|
|
9
|
+
import { httpsHref, screenText } from './text'
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
12
|
+
const tx = computed(() => screenText(props.lang))
|
|
13
|
+
const s = computed(() => props.controller.state)
|
|
14
|
+
const address = computed(() => s.value.state?.address ?? null)
|
|
15
|
+
const link = computed(() => (s.value.addressLink ? httpsHref(s.value.addressLink.url) : null))
|
|
16
|
+
const email = computed(() => s.value.activation?.display.approvalEmail ?? '')
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<section class="bcm-p-screen" data-screen="address">
|
|
21
|
+
<h2>{{ tx.pt('private.address.title') }}</h2>
|
|
22
|
+
<p>{{ tx.pt('private.address.why') }}</p>
|
|
23
|
+
<p v-if="address?.state === 'verified'" data-address-state="verified">{{ tx.pt('private.address.verified', { email }) }}</p>
|
|
24
|
+
<p v-else-if="address?.state === 'pending'" data-address-state="pending">{{ tx.pt('private.address.pending') }}</p>
|
|
25
|
+
<p v-else data-address-state="none">{{ tx.pt('private.address.none') }}</p>
|
|
26
|
+
<p v-if="address?.resetLockUntil" class="bcm-p-note">{{ tx.pt('private.address.resetLock', { date: tx.when(address.resetLockUntil) }) }}</p>
|
|
27
|
+
<template v-if="address?.state !== 'verified'">
|
|
28
|
+
<p v-if="link && s.addressLink">
|
|
29
|
+
{{ tx.pt('private.address.linkReady', { time: tx.when(s.addressLink.expiresAt) }) }}
|
|
30
|
+
<a :href="link" rel="noopener noreferrer" data-address-link>{{ tx.pt('private.address.linkOpen') }}</a>
|
|
31
|
+
</p>
|
|
32
|
+
<button v-else type="button" class="bcm-p-btn bcm-p-primary" :disabled="s.busy" data-action="address-link" @click="controller.requestAddressLink()">
|
|
33
|
+
{{ tx.pt('private.address.open') }}
|
|
34
|
+
</button>
|
|
35
|
+
</template>
|
|
36
|
+
</section>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Device approval (§5.10). On a pending device: by a code an approved device shows (`approval/start { via: 'code' }`,
|
|
4
|
+
* then the code typed here, `approval/redeem`), or by e-mail — the e-mail path shows the code the account page will ask
|
|
5
|
+
* for (B-57), with where a code legitimately appears. On an approved device: the requests waiting, the network
|
|
6
|
+
* warning when the request came from another network, the code shown on the member's click, and the denial. A start
|
|
7
|
+
* the rate limits refuse (429: the network's hour, the member's day, the device's failed requests) says which and when
|
|
8
|
+
* to try again, in place of the two ways to start, until the member asks to try again.
|
|
9
|
+
*/
|
|
10
|
+
import { computed, ref } from 'vue'
|
|
11
|
+
import type { PrivateViewController } from '../core/view'
|
|
12
|
+
import type { Lang } from '../i18n'
|
|
13
|
+
import { screenText } from './text'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
16
|
+
const tx = computed(() => screenText(props.lang))
|
|
17
|
+
const s = computed(() => props.controller.state)
|
|
18
|
+
const pending = computed(() => s.value.state?.device.state === 'pending')
|
|
19
|
+
const start = computed(() => s.value.approvalStart)
|
|
20
|
+
const code = ref('')
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<section class="bcm-p-screen" data-screen="approval">
|
|
25
|
+
<template v-if="pending">
|
|
26
|
+
<h2>{{ tx.pt('private.approval.title') }}</h2>
|
|
27
|
+
<p>{{ tx.pt('private.approval.pending') }}</p>
|
|
28
|
+
<template v-if="start?.state === 'pending' && start.via === 'email'">
|
|
29
|
+
<p>{{ tx.pt('private.approval.emailSent') }}</p>
|
|
30
|
+
<p v-if="start.code" class="bcm-p-code" data-approval-code>{{ start.code }}</p>
|
|
31
|
+
<p class="bcm-p-note">{{ tx.pt('private.approval.emailWhere') }}</p>
|
|
32
|
+
<p class="bcm-p-muted">{{ tx.pt('private.approval.expires', { time: tx.when(start.expiresAt) }) }}</p>
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else-if="start?.state === 'pending' && start.via === 'code'">
|
|
35
|
+
<p>{{ tx.pt('private.approval.codeStarted') }}</p>
|
|
36
|
+
<div class="bcm-p-row">
|
|
37
|
+
<input v-model="code" class="bcm-p-input" autocomplete="one-time-code" inputmode="text" :aria-label="tx.pt('private.approval.codeLabel')" data-input="code" @keydown.enter.prevent="controller.approvalRedeem(code)" />
|
|
38
|
+
<button type="button" class="bcm-p-btn bcm-p-primary" :disabled="s.busy || code.trim() === ''" data-action="redeem" @click="controller.approvalRedeem(code)">{{ tx.pt('private.approval.redeem') }}</button>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
<div v-else-if="s.approvalLimited" class="bcm-p-actions" :data-approval-limited="s.approvalLimited">
|
|
42
|
+
<p role="alert">{{ tx.pt(`private.approval.limited.${s.approvalLimited}`) }}</p>
|
|
43
|
+
<button type="button" class="bcm-p-btn" data-action="approval-retry" @click="controller.approvalRetry()">{{ tx.pt('private.approval.tryAgain') }}</button>
|
|
44
|
+
</div>
|
|
45
|
+
<div v-else class="bcm-p-actions">
|
|
46
|
+
<button type="button" class="bcm-p-btn bcm-p-primary" :disabled="s.busy" data-action="by-code" @click="controller.approvalStart('code')">{{ tx.pt('private.approval.byCode') }}</button>
|
|
47
|
+
<button type="button" class="bcm-p-btn" :disabled="s.busy" data-action="by-email" @click="controller.approvalStart('email')">{{ tx.pt('private.approval.byEmail') }}</button>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<template v-else>
|
|
51
|
+
<h2>{{ tx.pt('private.approval.requests') }}</h2>
|
|
52
|
+
<p v-if="s.approvals && s.approvals.length === 0">{{ tx.pt('private.approval.noRequests') }}</p>
|
|
53
|
+
<ul v-else-if="s.approvals" class="bcm-p-list">
|
|
54
|
+
<li v-for="r in s.approvals" :key="r.approvalId" :data-approval="r.approvalId">
|
|
55
|
+
<p>{{ tx.pt('private.approval.request', { label: r.label, time: tx.when(r.createdAt), ip: r.ipPrefix ?? '' }) }}</p>
|
|
56
|
+
<p v-if="!r.sameNetwork" class="bcm-p-warning" data-other-network>{{ tx.pt('private.approval.otherNetwork') }}</p>
|
|
57
|
+
<template v-if="s.shownCode?.approvalId === r.approvalId">
|
|
58
|
+
<p class="bcm-p-code" data-shown-code>{{ tx.pt('private.approval.shownCode', { code: s.shownCode.code }) }}</p>
|
|
59
|
+
<p class="bcm-p-muted">{{ tx.pt('private.approval.expires', { time: tx.when(s.shownCode.expiresAt) }) }}</p>
|
|
60
|
+
</template>
|
|
61
|
+
<div class="bcm-p-actions">
|
|
62
|
+
<button v-if="r.via === 'code' && s.shownCode?.approvalId !== r.approvalId" type="button" class="bcm-p-btn bcm-p-primary" :disabled="s.busy" data-action="show" @click="controller.approvalShow(r.approvalId)">
|
|
63
|
+
{{ tx.pt('private.approval.show') }}
|
|
64
|
+
</button>
|
|
65
|
+
<button type="button" class="bcm-p-btn" :disabled="s.busy" data-action="deny" @click="controller.approvalDeny(r.approvalId)">{{ tx.pt('private.approval.deny') }}</button>
|
|
66
|
+
</div>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</template>
|
|
70
|
+
</section>
|
|
71
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** The devices (§5.10): the list with the signals a member checks a stranger by, sign out, sign out everywhere, forget. */
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
|
+
import type { PrivateViewController } from '../core/view'
|
|
5
|
+
import type { Lang } from '../i18n'
|
|
6
|
+
import { screenText } from './text'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
9
|
+
const tx = computed(() => screenText(props.lang))
|
|
10
|
+
const s = computed(() => props.controller.state)
|
|
11
|
+
const confirmingForget = ref(false)
|
|
12
|
+
const others = computed(() => (s.value.devices ?? []).some((d) => !d.this))
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<section class="bcm-p-screen" data-screen="devices">
|
|
17
|
+
<h2>{{ tx.pt('private.devices.title') }}</h2>
|
|
18
|
+
<ul v-if="s.devices" class="bcm-p-list">
|
|
19
|
+
<li v-for="d in s.devices" :key="d.id" :data-device="d.id">
|
|
20
|
+
<p>
|
|
21
|
+
<strong>{{ d.label }}</strong>
|
|
22
|
+
<span v-if="d.this" class="bcm-p-badge">{{ tx.pt('private.devices.this') }}</span>
|
|
23
|
+
<span class="bcm-p-badge">{{ tx.pt(`private.devices.state.${d.state}`) }}</span>
|
|
24
|
+
</p>
|
|
25
|
+
<p class="bcm-p-muted">{{ tx.pt('private.devices.signIn', { date: tx.when(d.signIn.at ?? d.createdAt), ip: d.signIn.ipPrefix ?? '' }) }}</p>
|
|
26
|
+
<p class="bcm-p-muted">{{ tx.pt('private.devices.lastSeen', { date: tx.when(d.lastSeenAt) }) }}</p>
|
|
27
|
+
<button v-if="!d.this" type="button" class="bcm-p-btn" :disabled="s.busy" data-action="sign-out" @click="controller.signOutDevice(d.id)">{{ tx.pt('private.devices.signOut') }}</button>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
<div class="bcm-p-actions">
|
|
31
|
+
<button v-if="others" type="button" class="bcm-p-btn" :disabled="s.busy" data-action="sign-out-all" @click="controller.signOutAll()">{{ tx.pt('private.devices.signOutAll') }}</button>
|
|
32
|
+
<button v-if="!confirmingForget" type="button" class="bcm-p-btn bcm-p-danger" data-action="forget" @click="confirmingForget = true">{{ tx.pt('private.devices.forget') }}</button>
|
|
33
|
+
</div>
|
|
34
|
+
<template v-if="confirmingForget">
|
|
35
|
+
<p class="bcm-p-note">{{ tx.pt('private.devices.forgetConfirm') }}</p>
|
|
36
|
+
<div class="bcm-p-actions">
|
|
37
|
+
<button type="button" class="bcm-p-btn bcm-p-danger" :disabled="s.busy" data-action="forget-confirm" @click="confirmingForget = false; controller.forget()">{{ tx.pt('private.confirm') }}</button>
|
|
38
|
+
<button type="button" class="bcm-p-btn" @click="confirmingForget = false">{{ tx.pt('private.cancel') }}</button>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
</section>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** The overview: the promise and the account's screens. */
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import type { PrivateScreen, PrivateViewController } from '../core/view'
|
|
5
|
+
import type { Lang } from '../i18n'
|
|
6
|
+
import PromiseBlock from './PromiseBlock.vue'
|
|
7
|
+
import { screenText } from './text'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
10
|
+
const emit = defineEmits<{ navigate: [screen: PrivateScreen] }>()
|
|
11
|
+
const tx = computed(() => screenText(props.lang))
|
|
12
|
+
const s = computed(() => props.controller.state)
|
|
13
|
+
const entries: PrivateScreen[] = ['messages', 'address', 'activation', 'approval', 'devices', 'reads', 'notifications', 'settings']
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<section class="bcm-p-screen" data-screen="home">
|
|
18
|
+
<h2>{{ tx.pt('private.menu.title') }}</h2>
|
|
19
|
+
<p v-if="s.block?.state === 'read_only'" class="bcm-p-note">{{ tx.pt('private.readOnly') }}</p>
|
|
20
|
+
<PromiseBlock v-if="s.promise" :keys="s.promise.keys" :lang="lang" :params="controller.promiseParams()" />
|
|
21
|
+
<ul class="bcm-p-menu">
|
|
22
|
+
<li v-for="e in entries" :key="e">
|
|
23
|
+
<button type="button" class="bcm-p-link" :data-open="e" @click="emit('navigate', e)">
|
|
24
|
+
{{ tx.pt(`private.menu.${e}`) }}<span v-if="e === 'notifications' && s.unread > 0" class="bcm-p-dot" :aria-label="tx.pt('private.dock.unread')" />
|
|
25
|
+
</button>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</section>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The private notifications (§6.3, content-free account events) and this browser's private push: on and off on the
|
|
4
|
+
* member's click, and once on, the sentence the `private_activation` text gives for it (§7.5). Offered only where the
|
|
5
|
+
* tenant's `private_push` is on (the texts' `private_push` variant) and the host serves a worker.
|
|
6
|
+
*/
|
|
7
|
+
import { computed } from 'vue'
|
|
8
|
+
import type { PrivateViewController } from '../core/view'
|
|
9
|
+
import type { Lang } from '../i18n'
|
|
10
|
+
import { screenText } from './text'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
13
|
+
const tx = computed(() => screenText(props.lang))
|
|
14
|
+
const s = computed(() => props.controller.state)
|
|
15
|
+
const sentence = computed(() => props.controller.pushSentence())
|
|
16
|
+
// The count covers rows this screen does not word or has not paged to yet, so it offers „mark all read" too.
|
|
17
|
+
const unreadAny = computed(() => s.value.unread > 0 || (s.value.notifications ?? []).some((n) => n.readAt === null))
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<section class="bcm-p-screen" data-screen="notifications">
|
|
22
|
+
<h2>{{ tx.pt('private.notifications.title') }}</h2>
|
|
23
|
+
<div v-if="s.push.offered" class="bcm-p-push" data-push>
|
|
24
|
+
<h3>{{ tx.pt('private.push.title') }}</h3>
|
|
25
|
+
<p v-if="s.push.status === 'unsupported'">{{ tx.pt('private.push.unsupported') }}</p>
|
|
26
|
+
<template v-else>
|
|
27
|
+
<p v-if="s.push.status === 'on'" data-push-state="on">{{ tx.pt('private.push.on') }}</p>
|
|
28
|
+
<p v-if="sentence" class="bcm-p-note" data-push-sentence>{{ sentence }}</p>
|
|
29
|
+
<p v-if="s.push.note" class="bcm-p-warning">{{ tx.pt(`private.push.${s.push.note}`) }}</p>
|
|
30
|
+
<button v-if="s.push.status === 'on'" type="button" class="bcm-p-btn" data-action="push-off" @click="controller.disablePush()">{{ tx.pt('private.push.disable') }}</button>
|
|
31
|
+
<button v-else type="button" class="bcm-p-btn bcm-p-primary" :disabled="s.push.status === 'busy'" data-action="push-on" @click="controller.enablePush()">{{ tx.pt('private.push.enable') }}</button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
<p v-if="s.notifications && s.notifications.length === 0">{{ tx.pt('private.notifications.empty') }}</p>
|
|
35
|
+
<ul v-else-if="s.notifications" class="bcm-p-list">
|
|
36
|
+
<li v-for="n in s.notifications" :key="n.id" :class="{ 'bcm-p-unread': n.readAt === null }" :data-notification="n.code">
|
|
37
|
+
<p>{{ tx.pt(`private.notifications.code.${n.code}`) }}</p>
|
|
38
|
+
<p class="bcm-p-muted">{{ tx.when(n.createdAt) }}</p>
|
|
39
|
+
</li>
|
|
40
|
+
</ul>
|
|
41
|
+
<button v-if="s.notificationsCursor" type="button" class="bcm-p-link" data-action="more-notifications" @click="controller.moreNotifications()">{{ tx.pt('private.notifications.more') }}</button>
|
|
42
|
+
<button v-if="unreadAny" type="button" class="bcm-p-btn" :disabled="s.busy" data-action="mark-read" @click="controller.markAllRead()">{{ tx.pt('private.notifications.markAll') }}</button>
|
|
43
|
+
</section>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** The read log (§5.10): the member's reads by hour and device over the last 90 days. */
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import type { PrivateViewController } from '../core/view'
|
|
5
|
+
import type { Lang } from '../i18n'
|
|
6
|
+
import { screenText } from './text'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{ controller: PrivateViewController; lang: Lang }>()
|
|
9
|
+
const tx = computed(() => screenText(props.lang))
|
|
10
|
+
const s = computed(() => props.controller.state)
|
|
11
|
+
const labelOf = (id: string): string => s.value.devices?.find((d) => d.id === id)?.label ?? id.slice(0, 8)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<section class="bcm-p-screen" data-screen="reads">
|
|
16
|
+
<h2>{{ tx.pt('private.reads.title') }}</h2>
|
|
17
|
+
<p>{{ tx.pt('private.reads.why') }}</p>
|
|
18
|
+
<p v-if="s.reads && s.reads.length === 0">{{ tx.pt('private.reads.empty') }}</p>
|
|
19
|
+
<ul v-else-if="s.reads" class="bcm-p-list">
|
|
20
|
+
<li v-for="r in s.reads" :key="`${r.deviceId}-${r.hour}`" data-read>{{ tx.pt('private.reads.row', { hour: tx.when(r.hour), device: labelOf(r.deviceId), count: r.reads }) }}</li>
|
|
21
|
+
</ul>
|
|
22
|
+
</section>
|
|
23
|
+
</template>
|