From 7c2d14ea2d0d8d33ce8321191ca8b7c960a55fdc Mon Sep 17 00:00:00 2001 From: Jorim Theuns Date: Mon, 30 Nov 2026 11:08:34 +0100 Subject: [PATCH 1/6] fix: redact PII on manual Verify artifact edits in anonymised projects --- dembrane/platform/PACKAGES.md | 6 +- dembrane/platform/bun.lock | 1 + .../platform/packages/verify/package.json | 1 + .../platform/packages/verify/src/service.ts | 54 +++++- .../verify/test/manual-edit-redaction.test.ts | 168 ++++++++++++++++++ .../test/prompt-privacy.integration.test.ts | 34 ++++ 6 files changed, 255 insertions(+), 9 deletions(-) create mode 100644 dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts diff --git a/dembrane/platform/PACKAGES.md b/dembrane/platform/PACKAGES.md index 6c76efecc..bc10da1e8 100644 --- a/dembrane/platform/PACKAGES.md +++ b/dembrane/platform/PACKAGES.md @@ -21,7 +21,7 @@ Most namespaces use core, observability, db, http, access, queue, legacy-shape, - **analysis** (in 5, out 11): The analysis engine: recipes, runs, snapshots and revisions that maps and popcorn build on. Used by popcorn, map, present, api and 1 more. Uses realtime, llm. - **notifications** (in 5, out 5): In-app notifications and announcements, and the Notifier other namespaces emit through. Used by account, agentic, reports, api and 1 more. Uses only the common ones. - **samples** (in 5, out 5): Sample data: the best-practices sample every workspace gets its own copy of, and the Millbrook (sample) workspace in the Acme Civic (sample) org that every PR preview carries. Used by account, tenancy, api, migrate and 1 more. Uses config, llm. -- **conversations** (in 5, out 18): Conversations, the participant portal, the audio pipeline, live monitoring and search. Used by agentic, verify, agent-access, api and 1 more. Uses projects, webhooks, prompts, transcription, audio and 4 more. +- **conversations** (in 5, out 18): Conversations, the participant portal, the audio pipeline, live monitoring and search. Used by agentic, verify, agent-access, api and 1 more. Uses projects, webhooks, prompts, audio, transcription and 4 more. - **account** (in 4, out 16): The signed-in user's own account: profile, onboarding, settings, invites, transactional email. Used by accounts, reports, api, worker. Uses tenancy, notifications, samples, billing, auth and 4 more. - **popcorn** (in 4, out 14): Popcorn: one live deck per project, refreshed on a tick, with demos and translations. Used by accounts, present, api, worker. Uses analysis, analytics, realtime, config, llm. - **tenancy** (in 3, out 14): Orgs and workspaces: members, settings, access requests, support access, project shares. Used by account, api, worker. Uses samples, billing, projects, mail, i18n and 1 more. @@ -34,7 +34,7 @@ Most namespaces use core, observability, db, http, access, queue, legacy-shape, - **present** (in 2, out 12): Present: the published, audience-facing view of a popcorn deck and a map. Used by api, worker. Uses map, popcorn, analysis, realtime. - **pricing** (in 2, out 8): The pricing configurator and the bookings it forwards. Used by api, worker. Uses storage. - **reports** (in 2, out 13): Report generation and the report timeline. Used by api, worker. Uses account, notifications, projects, webhooks, llm. -- **verify** (in 2, out 13): Verification topics and artifacts participants see in the portal. Used by api, migrate. Uses conversations, projects, prompts, i18n, llm. +- **verify** (in 2, out 14): Verification topics and artifacts participants see in the portal. Used by api, migrate. Uses conversations, projects, prompts, transcription, i18n and 1 more. - **agent-access** (in 1, out 11): Outside AI agents reaching dembrane: the MCP server, OAuth, and the tools it exposes. Used by api. Uses conversations, webhooks, analytics, realtime. - **staff** (in 1, out 13): The staff console: support tools, billing rollups, privacy exports and erasure. Used by api. Uses billing, metering, mail, i18n, storage. - **stats** (in 1, out 4): Public usage numbers the website shows. Used by api. Uses only the common ones. @@ -59,8 +59,8 @@ Most namespaces use core, observability, db, http, access, queue, legacy-shape, - **analytics** (in 8, out 1): Product analytics capture (PostHog). Used by conversations, popcorn, accounts, chats and 4 more. Uses observability. - **mail** (in 8, out 0): Sending email (SendGrid, or memory in tests). Used by billing, account, tenancy, accounts and 4 more. Uses nothing. - **audio** (in 4, out 0): ffmpeg and ffprobe wrappers, audio formats, and the client for the media app. Used by conversations, api, media, worker. Uses nothing. +- **transcription** (in 4, out 3): Speech to text with Gemini, plus PII redaction and a fake for tests. Used by conversations, verify, api, worker. Uses prompts, llm, observability. - **prompts** (in 3, out 0): The Jinja prompt templates carried over from Python, rendered the same way. Used by transcription, conversations, verify. Uses nothing. -- **transcription** (in 3, out 3): Speech to text with Gemini, plus PII redaction and a fake for tests. Used by conversations, api, worker. Uses prompts, llm, observability. - **auth** (in 3, out 2): Sign-in and sessions (Better Auth) and the identity sync from Directus. Used by account, api, migrate. Uses db, core. - **metering** (in 3, out 6): What each model call cost: one log line and one model_call row per call, which the obs views aggregate. Used by staff, api, worker. Uses allowance, llm, queue, db, core and 1 more. diff --git a/dembrane/platform/bun.lock b/dembrane/platform/bun.lock index c06ca8c3d..947043b78 100644 --- a/dembrane/platform/bun.lock +++ b/dembrane/platform/bun.lock @@ -837,6 +837,7 @@ "@dembrane/projects": "workspace:*", "@dembrane/prompts": "workspace:*", "@dembrane/ratelimit": "workspace:*", + "@dembrane/transcription": "workspace:*", "ai": "^7.0.118", "drizzle-orm": "^0.45.3", "hono": "^4.9.0", diff --git a/dembrane/platform/packages/verify/package.json b/dembrane/platform/packages/verify/package.json index fc606ccf1..ee5702fca 100644 --- a/dembrane/platform/packages/verify/package.json +++ b/dembrane/platform/packages/verify/package.json @@ -31,6 +31,7 @@ "@dembrane/projects": "workspace:*", "@dembrane/prompts": "workspace:*", "@dembrane/ratelimit": "workspace:*", + "@dembrane/transcription": "workspace:*", "ai": "^7.0.118", "drizzle-orm": "^0.45.3", "hono": "^4.9.0" diff --git a/dembrane/platform/packages/verify/src/service.ts b/dembrane/platform/packages/verify/src/service.ts index 529520abe..61ce29d59 100644 --- a/dembrane/platform/packages/verify/src/service.ts +++ b/dembrane/platform/packages/verify/src/service.ts @@ -18,6 +18,7 @@ import { modelErrorShape, speechHint } from "@dembrane/llm"; import { withPayer } from "@dembrane/observability"; import { PROJECT_TEMPLATES } from "@dembrane/projects"; import { renderPrompt } from "@dembrane/prompts"; +import { regexRedactPii } from "@dembrane/transcription"; import { type FilePart, generateText, type TextPart } from "ai"; import { DEFAULT_TOPIC_KEY, defaultTopicPrompt } from "./defaults"; import { type ArtifactRow, type VerifyStorage, verifyStorage } from "./storage"; @@ -251,7 +252,11 @@ function artifactView(a: ArtifactRow, fallbackConversation: string) { * The portal's capability on a conversation (Q7): a participant token, when sent, must * name it; without one the conversation id still works unless tokens are required. */ -function checkToken(ctx: Ctx, header: string | undefined, conversationId: string) { +function checkToken( + ctx: { readonly d: Pick }, + header: string | undefined, + conversationId: string, +) { ctx.d.tokens.check(header, conversationId); } @@ -291,7 +296,14 @@ export async function getArtifact(ctx: Ctx, artifactId: string, token: string | * project too, and the project must have verify switched on. The Python API checked * none of these. */ -async function verifiableConversation(ctx: Ctx, conversationId: string, token: string | undefined) { +async function verifiableConversation( + ctx: { + readonly d: Pick; + readonly store: Pick; + }, + conversationId: string, + token: string | undefined, +) { const row = await ctx.store.conversation(conversationId); if (!row || row.conversation.deleted_at || !row.project || row.project.deleted_at) throw new NotFoundError("conversation.not_found"); @@ -330,7 +342,10 @@ function audioChunks(chunks: Chunk[], after: number | null): Chunk[] { }); } -async function audioParts(ctx: Ctx, chunks: Chunk[]) { +async function audioParts( + ctx: { readonly d: Pick }, + chunks: Chunk[], +) { const out: (TextPart | FilePart)[] = []; for (const c of chunks) { out.push({ type: "text", text: `Audio chunk ${c.id} captured at ${pyIsoformat(c.timestamp)}` }); @@ -352,7 +367,7 @@ async function audioParts(ctx: Ctx, chunks: Chunk[]) { } async function complete( - ctx: Ctx, + ctx: { readonly d: Pick }, system: string, content: (TextPart | FilePart)[], failure: string, @@ -580,8 +595,32 @@ export async function generateArtifact( return { artifact_list: [artifactView(created, conv.id)] }; } +export interface VerifiableProject extends VerifyProject { + readonly deleted_at: string | null; + readonly is_verify_enabled: boolean | null; +} + +export interface UpdateArtifactCtx { + readonly d: Pick< + VerifyDeps, + "db" | "audio" | "audioUrls" | "models" | "tokens" | "logger" | "now" + >; + readonly store: { + artifact(id: string): Promise; + conversation(id: string): Promise<{ + conversation: { readonly id: string; readonly deleted_at: string | null }; + project: VerifiableProject | null; + } | null>; + chunks(conversationId: string): ReturnType; + updateArtifact( + id: string, + fields: { content?: string; approved_at?: string }, + ): Promise; + }; +} + export async function updateArtifact( - ctx: Ctx, + ctx: UpdateArtifactCtx, artifactId: string, body: { useConversation: { conversationId: string; timestamp: Date } | null; @@ -644,7 +683,10 @@ export async function updateArtifact( "Failed to revise verification artifact", project.language || "en", ); - } else if (body.content !== null) updates.content = body.content; + } else if (body.content !== null) { + updates.content = + project.anonymize_transcripts === true ? regexRedactPii(body.content) : body.content; + } if (!Object.keys(updates).length) throw new BadRequestError("request.nothing_to_update", { message: "No valid fields to update", diff --git a/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts b/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts new file mode 100644 index 000000000..0a00d21d1 --- /dev/null +++ b/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts @@ -0,0 +1,168 @@ +import { afterAll, describe, expect, test } from "bun:test"; +import { mkdtempSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { Writable } from "node:stream"; +import { AudioUrls, ParticipantTokens } from "@dembrane/conversations"; +import { createDb } from "@dembrane/db"; +import { fakeModels } from "@dembrane/llm"; +import { createLogger } from "@dembrane/observability"; +import { FilesystemStorage } from "@dembrane/storage"; +import { type UpdateArtifactCtx, updateArtifact } from "../src/service"; +import type { ArtifactRow } from "../src/storage"; + +const PROJECT_ID = "f9100000-0000-4000-8000-000000000001"; +const CONVERSATION_ID = "c9200000-0000-4000-8000-000000000001"; +const ARTIFACT_ID = "a9300000-0000-4000-8000-000000000001"; + +const PII_INPUT = + "Contact jan@example.nl or +31 6 12345678 (alt 06-87654321), postcode 1234 AB, IBAN NL91 ABNA 0417 1643 0012, BSN 123456789."; +const PII_REDACTED = + "Contact or (alt ), postcode , IBAN , BSN ."; + +const database = createDb({ url: "postgres://unused:unused@127.0.0.1:1/unused", poolMax: 1 }); +const audio = new FilesystemStorage( + mkdtempSync(join(tmpdir(), "verify-redact-")), + "http://t", + "/a", +); +const logger = createLogger( + { service: "t", release: "r", env: "test", level: "error" }, + new Writable({ write: (_c, _e, cb) => cb() }), +); + +afterAll(async () => { + await database.close(); +}); + +function setup(anonymizeTranscripts: boolean | null) { + let stored: ArtifactRow = { + id: ARTIFACT_ID, + conversation_id: CONVERSATION_ID, + key: "agreements", + topic_label: "Agreements", + content: "Initial draft", + approved_at: null, + date_created: "2026-11-30T10:00:00.000Z", + last_updated_at: null, + read_aloud_stream_url: "", + user_created: null, + user_updated: null, + }; + let lastWrite: { content?: string; approved_at?: string } | null = null; + + const ctx: UpdateArtifactCtx = { + d: { + db: database.db, + audio, + audioUrls: new AudioUrls("http://s3.test", "bucket"), + models: fakeModels({ text: "unused" }), + tokens: new ParticipantTokens("s".repeat(48), false), + logger, + now: () => new Date("2026-11-30T12:00:00Z"), + }, + store: { + async artifact(id) { + return id === ARTIFACT_ID ? stored : null; + }, + async conversation(id) { + if (id !== CONVERSATION_ID) return null; + return { + conversation: { id: CONVERSATION_ID, deleted_at: null }, + project: { + id: PROJECT_ID, + name: "Park feedback", + language: "en", + context: null, + default_conversation_transcript_prompt: null, + anonymize_transcripts: anonymizeTranscripts, + template_key: null, + deleted_at: null, + is_verify_enabled: true, + }, + }; + }, + async chunks() { + return []; + }, + async updateArtifact(id, fields) { + if (id !== ARTIFACT_ID) return null; + lastWrite = { ...fields }; + stored = { + ...stored, + ...(fields.content !== undefined ? { content: fields.content } : {}), + ...(fields.approved_at !== undefined ? { approved_at: fields.approved_at } : {}), + }; + return stored; + }, + }, + }; + + return { + ctx, + stored: () => stored, + lastWrite: () => lastWrite, + }; +} + +describe("manual Verify artifact edit PII redaction", () => { + test("redacts PII before storing and returning when anonymize_transcripts is true", async () => { + const { ctx, stored, lastWrite } = setup(true); + const result = await updateArtifact( + ctx, + ARTIFACT_ID, + { + useConversation: null, + content: PII_INPUT, + approvedAt: "2026-11-30T12:00:00Z", + }, + undefined, + ); + + expect(lastWrite()?.content).toBe(PII_REDACTED); + expect(stored().content).toBe(PII_REDACTED); + expect(result.content).toBe(PII_REDACTED); + expect(result.content).not.toContain("jan@example.nl"); + expect(result.content).not.toContain("12345678"); + expect(result.content).not.toContain("87654321"); + expect(result.content).not.toContain("1234 AB"); + expect(result.content).not.toContain("NL91 ABNA"); + expect(result.content).not.toContain("123456789"); + }); + + test("leaves manual edits unchanged when anonymize_transcripts is false", async () => { + const { ctx, stored, lastWrite } = setup(false); + const result = await updateArtifact( + ctx, + ARTIFACT_ID, + { + useConversation: null, + content: PII_INPUT, + approvedAt: null, + }, + undefined, + ); + + expect(lastWrite()?.content).toBe(PII_INPUT); + expect(stored().content).toBe(PII_INPUT); + expect(result.content).toBe(PII_INPUT); + }); + + test("leaves manual edits unchanged when anonymize_transcripts is null", async () => { + const { ctx, stored, lastWrite } = setup(null); + const result = await updateArtifact( + ctx, + ARTIFACT_ID, + { + useConversation: null, + content: PII_INPUT, + approvedAt: null, + }, + undefined, + ); + + expect(lastWrite()?.content).toBe(PII_INPUT); + expect(stored().content).toBe(PII_INPUT); + expect(result.content).toBe(PII_INPUT); + }); +}); diff --git a/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts b/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts index 9b6304952..72896e473 100644 --- a/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts +++ b/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts @@ -177,6 +177,40 @@ run("verify prompt privacy", () => { expect(written).not.toContain(SAID); }); + test("manual edits redact PII when anonymize_transcripts is true and keep text when false", async () => { + const [artifact] = await sql<{ id: string }[]>` + select id from conversation_artifact where conversation_id = ${conversation} limit 1`; + const input = "Mail jan@example.nl or call 06-12345678, postcode 1234 AB."; + const redacted = + "Mail or call , postcode ."; + + await sql`update project set anonymize_transcripts = true where id = ${project}`; + try { + const resOn = await send(ok, `/api/verify/artifact/${artifact?.id}`, "PUT", { + content: input, + }); + expect(resOn.status).toBe(200); + const bodyOn = (await resOn.json()) as { content: string }; + expect(bodyOn.content).toBe(redacted); + const [rowOn] = await sql<{ content: string | null }[]>` + select content from conversation_artifact where id = ${artifact?.id ?? ""}`; + expect(rowOn?.content).toBe(redacted); + + await sql`update project set anonymize_transcripts = false where id = ${project}`; + const resOff = await send(ok, `/api/verify/artifact/${artifact?.id}`, "PUT", { + content: input, + }); + expect(resOff.status).toBe(200); + const bodyOff = (await resOff.json()) as { content: string }; + expect(bodyOff.content).toBe(input); + const [rowOff] = await sql<{ content: string | null }[]>` + select content from conversation_artifact where id = ${artifact?.id ?? ""}`; + expect(rowOff?.content).toBe(input); + } finally { + await sql`update project set anonymize_transcripts = false where id = ${project}`; + } + }); + test("the logs of the whole run never held the email", () => { expect(logs.join("")).not.toContain(EMAIL); }); From 30393f67d75003caa3519882c572e14c657ad0da Mon Sep 17 00:00:00 2001 From: Jorim Theuns Date: Mon, 30 Nov 2026 11:21:14 +0100 Subject: [PATCH 2/6] feat: strict ParticipantTokens.require and portal X-Participant-Token plumbing --- dembrane/frontend/src/lib/api.ts | 59 ++++- .../frontend/src/lib/participantToken.test.ts | 237 ++++++++++++++++++ dembrane/frontend/src/lib/participantToken.ts | 144 +++++++++++ ...rticipantConversationAudioContent.test.tsx | 41 ++- .../ParticipantConversationAudioContent.tsx | 2 + .../portal/components/verify/hooks/index.ts | 7 +- .../conversations/src/participant-token.ts | 20 +- .../conversations/test/portal-units.test.ts | 17 ++ 8 files changed, 514 insertions(+), 13 deletions(-) create mode 100644 dembrane/frontend/src/lib/participantToken.test.ts create mode 100644 dembrane/frontend/src/lib/participantToken.ts diff --git a/dembrane/frontend/src/lib/api.ts b/dembrane/frontend/src/lib/api.ts index d30e574a5..5269b45a6 100644 --- a/dembrane/frontend/src/lib/api.ts +++ b/dembrane/frontend/src/lib/api.ts @@ -8,6 +8,14 @@ import { VOICE_TRANSCRIBE_TIMEOUT_MS } from "@/components/voice/voiceInput"; import { API_BASE_URL } from "@/config"; import { bff } from "./bff"; import { loadErrorMessages } from "./errors/present"; +import { + conversationIdFromRequest, + getParticipantToken, + PARTICIPANT_TOKEN_HEADER, + participantTokenHeaders, + readResponseHeader, + setParticipantToken, +} from "./participantToken"; export const apiCommonConfig: CreateAxiosDefaults = { baseURL: API_BASE_URL, @@ -16,8 +24,35 @@ export const apiCommonConfig: CreateAxiosDefaults = { export const apiNoAuth = axios.create(apiCommonConfig); +apiNoAuth.interceptors.request.use((config) => { + if (!config.headers.has(PARTICIPANT_TOKEN_HEADER)) { + const conversationId = conversationIdFromRequest(config.url, config.data); + const token = getParticipantToken(conversationId); + if (token) { + config.headers.set(PARTICIPANT_TOKEN_HEADER, token); + } + } + return config; +}); + apiNoAuth.interceptors.response.use( - (response) => response.data, + (response) => { + const token = readResponseHeader( + response.headers, + PARTICIPANT_TOKEN_HEADER, + ); + const conversationId = + response.data && + typeof response.data === "object" && + "id" in response.data && + typeof (response.data as { id?: unknown }).id === "string" + ? (response.data as { id: string }).id + : null; + if (token && conversationId) { + setParticipantToken(conversationId, token); + } + return response.data; + }, (error) => { // Start loading the error messages now, so the screen that shows this error has // them by the time it renders (see lib/errors/present.ts). @@ -412,7 +447,10 @@ export const pingConversationLeft = ( state: "left", }), credentials: "include", - headers: { "Content-Type": "application/json" }, + headers: { + "Content-Type": "application/json", + ...participantTokenHeaders(conversationId), + }, keepalive: true, method: "POST", }, @@ -1661,6 +1699,7 @@ export const generateVerificationArtefact = async (payload: { export type UpdateVerificationArtefactPayload = { artifactId: string; + conversationId?: string; useConversation?: { conversationId: string; timestamp: string; @@ -1671,10 +1710,14 @@ export type UpdateVerificationArtefactPayload = { export const updateVerificationArtefact = async ({ artifactId, + conversationId, useConversation, content, approvedAt, }: UpdateVerificationArtefactPayload) => { + const tokenHeaders = participantTokenHeaders( + conversationId ?? useConversation?.conversationId, + ); const response = await apiNoAuth.put( `/verify/artifact/${artifactId}`, { @@ -1687,6 +1730,9 @@ export const updateVerificationArtefact = async ({ } : undefined, }, + Object.keys(tokenHeaders).length > 0 + ? { headers: tokenHeaders } + : undefined, ); return response; }; @@ -1697,9 +1743,16 @@ export const getVerificationArtefacts = async (conversationId: string) => { ); }; -export const getVerificationArtefactById = async (artifactId: string) => { +export const getVerificationArtefactById = async ( + artifactId: string, + conversationId?: string, +) => { + const tokenHeaders = participantTokenHeaders(conversationId); return apiNoAuth.get( `/verify/artifact/${artifactId}`, + Object.keys(tokenHeaders).length > 0 + ? { headers: tokenHeaders } + : undefined, ); }; diff --git a/dembrane/frontend/src/lib/participantToken.test.ts b/dembrane/frontend/src/lib/participantToken.test.ts new file mode 100644 index 000000000..5232ac28a --- /dev/null +++ b/dembrane/frontend/src/lib/participantToken.test.ts @@ -0,0 +1,237 @@ +// @vitest-environment jsdom +import axios, { type AxiosAdapter } from "axios"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { + apiNoAuth, + checkS3Connectivity, + confirmConversationChunkUpload, + deleteParticipantConversationChunk, + finishConversation, + generateVerificationArtefact, + getParticipantConversationById, + getParticipantConversationChunks, + getParticipantConversationReplies, + getParticipantProjectById, + getVerificationArtefactById, + getVerificationArtefacts, + initiateConversation, + pingConversation, + pingConversationLeft, + submitNotificationParticipant, + updateVerificationArtefact, + uploadConversationChunkWithPresignedUrl, + uploadConversationText, +} from "./api"; +import { + clearParticipantToken, + clearParticipantTokensInMemory, + getParticipantToken, + PARTICIPANT_TOKEN_HEADER, + participantTokenKey, + setParticipantToken, +} from "./participantToken"; + +vi.mock("@/components/common/Toaster", () => ({ + toast: Object.assign(vi.fn(), { error: vi.fn(), success: vi.fn() }), +})); + +const originalAdapter = apiNoAuth.defaults.adapter; + +beforeEach(() => { + localStorage.clear(); + clearParticipantTokensInMemory(); +}); + +afterEach(() => { + apiNoAuth.defaults.adapter = originalAdapter; + localStorage.clear(); + clearParticipantTokensInMemory(); + vi.restoreAllMocks(); +}); + +describe("participantToken storage", () => { + it("stores and reads tokens in localStorage under portal:token:", () => { + setParticipantToken("conv-1", "p1.body.sig"); + expect(localStorage.getItem("portal:token:conv-1")).toBe("p1.body.sig"); + expect(getParticipantToken("conv-1")).toBe("p1.body.sig"); + + clearParticipantToken("conv-1"); + expect(localStorage.getItem("portal:token:conv-1")).toBeNull(); + expect(getParticipantToken("conv-1")).toBeNull(); + }); + + it("falls back to in-memory storage when localStorage throws in private browsing", () => { + vi.spyOn(Storage.prototype, "setItem").mockImplementation(() => { + throw new DOMException("QuotaExceededError"); + }); + vi.spyOn(Storage.prototype, "getItem").mockImplementation(() => { + throw new DOMException("SecurityError"); + }); + + setParticipantToken("conv-private", "p1.private.sig"); + expect(getParticipantToken("conv-private")).toBe("p1.private.sig"); + expect(getParticipantToken("conv-other")).toBeNull(); + }); +}); + +describe("apiNoAuth participant token plumbing", () => { + it("stores X-Participant-Token from initiate and attaches it to subsequent participant requests", async () => { + const seenHeaders = new Map(); + + const adapter = vi.fn(async (config) => { + const method = (config.method ?? "get").toUpperCase(); + const key = `${method} ${config.url}`; + seenHeaders.set( + key, + config.headers.get(PARTICIPANT_TOKEN_HEADER)?.toString(), + ); + + if (config.url === "/participant/projects/p-1/conversations/initiate") { + return { + config, + data: { id: "c-1", project_id: "p-1" }, + headers: { "x-participant-token": "p1.c1.sig" }, + status: 200, + statusText: "OK", + }; + } + if (config.url === "/participant/conversations/c-1/get-upload-url") { + return { + config, + data: { + chunk_id: "chunk-1", + fields: {}, + file_url: "https://storage.example/chunk-1.webm", + upload_url: "https://storage.example/upload", + }, + headers: {}, + status: 200, + statusText: "OK", + }; + } + if (config.url === "/participant/conversations/c-1/check-s3") { + return { + config, + data: { probe_url: "https://storage.example/probe" }, + headers: {}, + status: 200, + statusText: "OK", + }; + } + if (config.url === "/verify/generate") { + return { + config, + data: { artifact_list: [] }, + headers: {}, + status: 200, + statusText: "OK", + }; + } + return { + config, + data: {}, + headers: {}, + status: 200, + statusText: "OK", + }; + }); + apiNoAuth.defaults.adapter = adapter; + + vi.spyOn(axios, "post").mockResolvedValue({}); + const fetchSpy = vi + .spyOn(globalThis, "fetch") + .mockResolvedValue(new Response(null, { status: 200 })); + vi.spyOn(console, "log").mockImplementation(() => {}); + + const conversation = await initiateConversation({ + name: "Alex", + pin: "1234", + projectId: "p-1", + source: "PORTAL_AUDIO", + tagIdList: [], + }); + expect(conversation.id).toBe("c-1"); + expect(localStorage.getItem(participantTokenKey("c-1"))).toBe("p1.c1.sig"); + expect( + seenHeaders.get("POST /participant/projects/p-1/conversations/initiate"), + ).toBeUndefined(); + + const upload = await uploadConversationChunkWithPresignedUrl({ + chunk: new File(["audio"], "part1.webm", { type: "audio/webm" }), + conversationId: "c-1", + source: "PORTAL_AUDIO", + timestamp: new Date("2026-11-30T10:00:00Z"), + }); + await confirmConversationChunkUpload(upload); + await uploadConversationText({ + content: "Typed note", + conversationId: "c-1", + source: "PORTAL_TEXT", + timestamp: new Date("2026-11-30T10:01:00Z"), + }); + await finishConversation("c-1"); + await getParticipantConversationById("p-1", "c-1"); + await getParticipantConversationChunks("p-1", "c-1"); + await getParticipantConversationReplies("p-1", "c-1"); + await deleteParticipantConversationChunk("p-1", "c-1", "chunk-1"); + await checkS3Connectivity("c-1"); + await pingConversation("c-1", { state: "recording" }); + pingConversationLeft("c-1", "p-1"); + await submitNotificationParticipant(["a@example.com"], "p-1", "c-1"); + await generateVerificationArtefact({ + conversationId: "c-1", + topicList: ["summary"], + }); + await getVerificationArtefacts("c-1"); + await getVerificationArtefactById("art-1", "c-1"); + await updateVerificationArtefact({ + approvedAt: "2026-11-30T10:05:00Z", + artifactId: "art-1", + content: "Approved summary", + conversationId: "c-1", + }); + await getParticipantProjectById("p-1"); + await finishConversation("c-other"); + + const expectedWithToken = [ + "POST /participant/conversations/c-1/get-upload-url", + "POST /participant/conversations/c-1/confirm-upload", + "POST /participant/conversations/c-1/upload-text", + "POST /participant/conversations/c-1/finish", + "GET /participant/projects/p-1/conversations/c-1", + "GET participant/projects/p-1/conversations/c-1/chunks", + "GET /participant/projects/p-1/conversations/c-1/replies", + "DELETE /participant/projects/p-1/conversations/c-1/chunks/chunk-1", + "POST /participant/conversations/c-1/check-s3", + "POST /participant/conversations/c-1/ping", + "POST /participant/report/subscribe", + "POST /verify/generate", + "GET /verify/artifacts/c-1", + "GET /verify/artifact/art-1", + "PUT /verify/artifact/art-1", + ]; + + for (const key of expectedWithToken) { + expect(seenHeaders.get(key), key).toBe("p1.c1.sig"); + } + + // Project-level call and another conversation without a stored token send no token. + expect(seenHeaders.get("GET /participant/projects/p-1")).toBeUndefined(); + expect( + seenHeaders.get("POST /participant/conversations/c-other/finish"), + ).toBeUndefined(); + + // Keepalive beacon sent the token too. + const pingLeftCall = fetchSpy.mock.calls.find( + ([url]) => + typeof url === "string" && + url.endsWith("/participant/conversations/c-1/ping"), + ); + expect(pingLeftCall).toBeTruthy(); + expect( + (pingLeftCall?.[1]?.headers as Record)?.[ + PARTICIPANT_TOKEN_HEADER + ], + ).toBe("p1.c1.sig"); + }); +}); diff --git a/dembrane/frontend/src/lib/participantToken.ts b/dembrane/frontend/src/lib/participantToken.ts new file mode 100644 index 000000000..c4f0888ad --- /dev/null +++ b/dembrane/frontend/src/lib/participantToken.ts @@ -0,0 +1,144 @@ +export const PARTICIPANT_TOKEN_HEADER = "X-Participant-Token"; + +const STORAGE_PREFIX = "portal:token:"; +const memoryStore = new Map(); + +export const participantTokenKey = (conversationId: string): string => + `${STORAGE_PREFIX}${conversationId}`; + +export const setParticipantToken = ( + conversationId: string, + token: string, +): void => { + if (!conversationId || !token) return; + const key = participantTokenKey(conversationId); + try { + globalThis.localStorage.setItem(key, token); + memoryStore.delete(key); + } catch { + // Private browsing or storage quota: keep the token for this page session. + memoryStore.set(key, token); + } +}; + +export const getParticipantToken = ( + conversationId: string | null | undefined, +): string | null => { + if (!conversationId) return null; + const key = participantTokenKey(conversationId); + try { + const stored = globalThis.localStorage.getItem(key); + if (stored) return stored; + } catch { + // Private browsing: fall back to the in-memory store. + } + return memoryStore.get(key) ?? null; +}; + +export const clearParticipantToken = (conversationId: string): void => { + if (!conversationId) return; + const key = participantTokenKey(conversationId); + memoryStore.delete(key); + try { + globalThis.localStorage.removeItem(key); + } catch { + // Ignore storage access failures. + } +}; + +export const clearParticipantTokensInMemory = (): void => { + memoryStore.clear(); +}; + +export const participantTokenHeaders = ( + conversationId: string | null | undefined, +): Record => { + const token = getParticipantToken(conversationId); + return token ? { [PARTICIPANT_TOKEN_HEADER]: token } : {}; +}; + +export const readResponseHeader = ( + headers: unknown, + name: string, +): string | null => { + if (!headers || typeof headers !== "object") return null; + if ( + "get" in headers && + typeof (headers as { get: unknown }).get === "function" + ) { + const value = (headers as { get: (headerName: string) => unknown }).get( + name, + ); + if (typeof value === "string" && value.length > 0) return value; + } + const target = name.toLowerCase(); + for (const [key, value] of Object.entries(headers)) { + if (key.toLowerCase() === target) { + if (typeof value === "string" && value.length > 0) return value; + if ( + Array.isArray(value) && + typeof value[0] === "string" && + value[0].length > 0 + ) { + return value[0]; + } + } + } + return null; +}; + +/** + * Resolve the conversationId targeted by a participant API request from its URL + * or JSON body so apiNoAuth can attach X-Participant-Token automatically. + */ +export const conversationIdFromRequest = ( + url: string | undefined, + data?: unknown, +): string | null => { + if (url) { + let rawPath = url; + if (/^https?:\/\//i.test(url)) { + try { + rawPath = new URL(url).pathname; + } catch { + rawPath = url; + } + } else { + rawPath = url.split(/[?#]/, 1)[0]; + } + const path = rawPath.replace(/^\/+/, "").replace(/^api\//, ""); + const match = + path.match( + /^participant\/projects\/[^/]+\/conversations\/([^/]+)(?:\/|$)/, + ) ?? + path.match(/^participant\/conversations\/([^/]+)(?:\/|$)/) ?? + path.match(/^verify\/artifacts\/([^/]+)(?:\/|$)/) ?? + path.match(/^conversations\/([^/]+)(?:\/|$)/); + if (match?.[1] && match[1] !== "initiate") { + try { + return decodeURIComponent(match[1]); + } catch { + return match[1]; + } + } + } + + if (data && typeof data === "object") { + const record = data as Record; + if ( + typeof record.conversation_id === "string" && + record.conversation_id.length > 0 + ) { + return record.conversation_id; + } + const useConv = record.useConversation; + if (useConv && typeof useConv === "object") { + const nestedId = (useConv as Record).conversationId; + if (typeof nestedId === "string" && nestedId.length > 0) { + return nestedId; + } + } + } + + return null; +}; diff --git a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx index a2eb8d999..02c37a7b6 100644 --- a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx +++ b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx @@ -5,22 +5,31 @@ import { MantineProvider } from "@mantine/core"; import { cleanup, render, screen } from "@testing-library/react"; import { MemoryRouter, Outlet, Route, Routes } from "react-router"; import { afterEach, beforeAll, expect, it, vi } from "vitest"; +import { + clearParticipantTokensInMemory, + PARTICIPANT_TOKEN_HEADER, + setParticipantToken, +} from "@/lib/participantToken"; import { ParticipantConversationAudioContent } from "./ParticipantConversationAudioContent"; const state = vi.hoisted(() => ({ + chatOptions: undefined as { headers?: Record } | undefined, echoError: undefined as Error | undefined, project: {} as Record, })); vi.mock("@ai-sdk/react", () => ({ - useChat: () => ({ - data: undefined, - error: state.echoError, - handleSubmit: vi.fn(), - isLoading: false, - messages: [], - status: state.echoError ? "error" : "ready", - }), + useChat: (options: { headers?: Record }) => { + state.chatOptions = options; + return { + data: undefined, + error: state.echoError, + handleSubmit: vi.fn(), + isLoading: false, + messages: [], + status: state.echoError ? "error" : "ready", + }; + }, })); vi.mock("@/portal/components/conversation/queries", () => ({ useConversationQuery: () => ({ data: undefined }), @@ -68,6 +77,9 @@ beforeAll(() => { afterEach(() => { cleanup(); + localStorage.clear(); + clearParticipantTokensInMemory(); + state.chatOptions = undefined; state.echoError = undefined; state.project = {}; }); @@ -125,3 +137,16 @@ it("keeps the generic error for other Explore failures", () => { expect(screen.getByText(/Something went wrong/)).toBeTruthy(); expect(screen.queryByText("Not available right now")).toBeNull(); }); + +it("attaches X-Participant-Token to Explore replies when stored for the conversation", () => { + setParticipantToken("c-1", "p1.explore.sig"); + renderPage(); + expect(state.chatOptions?.headers).toEqual({ + [PARTICIPANT_TOKEN_HEADER]: "p1.explore.sig", + }); +}); + +it("omits X-Participant-Token from Explore replies when no token is stored", () => { + renderPage(); + expect(state.chatOptions?.headers).toEqual({}); +}); diff --git a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx index 0d4f42b2e..f11286b3a 100644 --- a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx +++ b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx @@ -13,6 +13,7 @@ import { import { API_BASE_URL } from "@/config"; import { useLanguage } from "@/hooks/useLanguage"; import { useLoadNotification } from "@/hooks/useLoadNotification"; +import { participantTokenHeaders } from "@/lib/participantToken"; import { useConversationQuery, useConversationRepliesQuery, @@ -78,6 +79,7 @@ export const ParticipantConversationAudioContent = () => { language: iso639_1, }; }, + headers: participantTokenHeaders(conversationId), initialMessages: repliesQuery.data?.map((msg) => ({ content: msg.content_text ?? "", diff --git a/dembrane/frontend/src/portal/components/verify/hooks/index.ts b/dembrane/frontend/src/portal/components/verify/hooks/index.ts index 00aeddc31..b23c34a40 100644 --- a/dembrane/frontend/src/portal/components/verify/hooks/index.ts +++ b/dembrane/frontend/src/portal/components/verify/hooks/index.ts @@ -75,6 +75,7 @@ export const useUpdateVerificationArtefact = () => { return useMutation({ mutationFn: async ({ artifactId, + conversationId, useConversation, content, approvedAt, @@ -83,6 +84,7 @@ export const useUpdateVerificationArtefact = () => { approvedAt, artifactId, content, + conversationId, useConversation, }; return updateVerificationArtefact(payload); @@ -113,7 +115,10 @@ export const useVerificationArtefactById = ( return cachedArtifact; } - const artefact = await getVerificationArtefactById(artifactId); + const artefact = await getVerificationArtefactById( + artifactId, + conversationId, + ); queryClient.setQueryData( ["verify", "artifact_by_id", artifactId], diff --git a/dembrane/platform/packages/conversations/src/participant-token.ts b/dembrane/platform/packages/conversations/src/participant-token.ts index d82b3be96..bf33693f3 100644 --- a/dembrane/platform/packages/conversations/src/participant-token.ts +++ b/dembrane/platform/packages/conversations/src/participant-token.ts @@ -53,6 +53,24 @@ export class ParticipantTokens { if (this.required) throw new UnauthenticatedError("participant.token_required"); return false; } + this.verify(header, conversationId, projectId); + return true; + } + + /** + * Strict check for routes that always require a valid participant token regardless + * of PARTICIPANT_TOKEN_REQUIRED (landscape, handoff, public-intake). + */ + require( + header: string | undefined, + conversationId: string, + projectId?: string, + ): ParticipantClaims { + if (!header) throw new UnauthenticatedError("participant.token_required"); + return this.verify(header, conversationId, projectId); + } + + private verify(header: string, conversationId: string, projectId?: string): ParticipantClaims { const claims = this.read(header); if ( !claims || @@ -60,7 +78,7 @@ export class ParticipantTokens { (projectId !== undefined && claims.projectId !== projectId) ) throw new ForbiddenError("participant.token_invalid"); - return true; + return claims; } private sign(body: string): string { diff --git a/dembrane/platform/packages/conversations/test/portal-units.test.ts b/dembrane/platform/packages/conversations/test/portal-units.test.ts index 0c0a4c749..f772973b4 100644 --- a/dembrane/platform/packages/conversations/test/portal-units.test.ts +++ b/dembrane/platform/packages/conversations/test/portal-units.test.ts @@ -24,6 +24,23 @@ test("without a token the conversation id still works, until tokens are required ); }); +test("require rejects missing, wrong, and forged tokens even when PARTICIPANT_TOKEN_REQUIRED is false", () => { + const t = new ParticipantTokens("s".repeat(48), false); + const token = t.issue({ conversationId: C, projectId: P }); + + expect(() => t.require(undefined, C, P)).toThrow(UnauthenticatedError); + expect(() => t.require("", C, P)).toThrow(UnauthenticatedError); + expect(() => t.require(token, "other", P)).toThrow(ForbiddenError); + expect(() => t.require(token, C, "other")).toThrow(ForbiddenError); + expect(() => t.require(`${token}x`, C, P)).toThrow(ForbiddenError); + expect(() => new ParticipantTokens("x".repeat(48), false).require(token, C, P)).toThrow( + ForbiddenError, + ); + + expect(t.require(token, C, P)).toEqual({ conversationId: C, projectId: P }); + expect(t.require(token, C)).toEqual({ conversationId: C, projectId: P }); +}); + test("stored audio paths round-trip to keys the way get_sanitized_s3_key parsed them", () => { const u = new AudioUrls("https://ams3.digitaloceanspaces.com", "dembrane"); const key = `conversation/${C}/chunks/x-a.webm`; From 3fd7cc1a73f33fc02f9558504174b4e5b24914b3 Mon Sep 17 00:00:00 2001 From: Jorim Theuns Date: Mon, 30 Nov 2026 11:36:18 +0100 Subject: [PATCH 3/6] chore(frontend): refresh lingui catalog line references --- dembrane/frontend/src/locales/cs-CZ.po | 6 +++--- dembrane/frontend/src/locales/de-DE.po | 6 +++--- dembrane/frontend/src/locales/en-US.po | 6 +++--- dembrane/frontend/src/locales/es-ES.po | 6 +++--- dembrane/frontend/src/locales/fr-FR.po | 6 +++--- dembrane/frontend/src/locales/it-IT.po | 6 +++--- dembrane/frontend/src/locales/nl-NL.po | 6 +++--- dembrane/frontend/src/locales/uk-UA.po | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dembrane/frontend/src/locales/cs-CZ.po b/dembrane/frontend/src/locales/cs-CZ.po index d681e80c0..5b4f3d832 100644 --- a/dembrane/frontend/src/locales/cs-CZ.po +++ b/dembrane/frontend/src/locales/cs-CZ.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} souborů se nepodařilo nahrát. Zkuste to znovu." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Všech {0} souborů bylo úspěšně nahráno" @@ -17797,7 +17797,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Výzvy k ověření umožňují až 10 000 znaků a ověřené výstupy mají tlačítko pro kopírování." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verification required" diff --git a/dembrane/frontend/src/locales/de-DE.po b/dembrane/frontend/src/locales/de-DE.po index 651f07a49..f0e823095 100644 --- a/dembrane/frontend/src/locales/de-DE.po +++ b/dembrane/frontend/src/locales/de-DE.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} gelöscht" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} Datei(en) konnten nicht hochgeladen werden. Versuche es erneut." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alle" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} Datei(en) erfolgreich hochgeladen" @@ -17796,7 +17796,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verifizierungs-Prompts erlauben 10.000 Zeichen, und verifizierte Ergebnisse haben einen Kopier-Button." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verifizierung erforderlich" diff --git a/dembrane/frontend/src/locales/en-US.po b/dembrane/frontend/src/locales/en-US.po index e6596f0d7..b2e856452 100644 --- a/dembrane/frontend/src/locales/en-US.po +++ b/dembrane/frontend/src/locales/en-US.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} file(s) failed to upload. Try those again." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "All {0} file(s) uploaded successfully" @@ -17797,7 +17797,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verification prompts allow 10,000 characters, and verified outcomes have a copy button." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verification required" diff --git a/dembrane/frontend/src/locales/es-ES.po b/dembrane/frontend/src/locales/es-ES.po index 97f4f1da8..5aede94be 100644 --- a/dembrane/frontend/src/locales/es-ES.po +++ b/dembrane/frontend/src/locales/es-ES.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminadas" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "Error al subir {0} archivo(s). Vuelve a intentarlo." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Todo" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Los {0} archivo(s) se subieron correctamente" @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Las instrucciones de verificación admiten hasta 10.000 caracteres, y los resultados verificados tienen un botón para copiar." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verificación requerida" diff --git a/dembrane/frontend/src/locales/fr-FR.po b/dembrane/frontend/src/locales/fr-FR.po index cfaa393c1..3e77862fb 100644 --- a/dembrane/frontend/src/locales/fr-FR.po +++ b/dembrane/frontend/src/locales/fr-FR.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} supprimé(s)" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "Échec de l'importation de {0} fichier(s). Veuillez réessayer." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Tout" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Les {0} fichier(s) ont bien été importés" @@ -17795,7 +17795,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Les invites de vérification autorisent 10 000 caractères, et les résultats vérifiés ont un bouton de copie." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Vérification requise" diff --git a/dembrane/frontend/src/locales/it-IT.po b/dembrane/frontend/src/locales/it-IT.po index 9d04d4908..928062633 100644 --- a/dembrane/frontend/src/locales/it-IT.po +++ b/dembrane/frontend/src/locales/it-IT.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminati" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "Impossibile caricare {0} file. Riprova." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Tutti i {0} file caricati con successo" @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "I prompt di verifica consentono 10.000 caratteri e i risultati verificati hanno un pulsante Copia." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verification required" diff --git a/dembrane/frontend/src/locales/nl-NL.po b/dembrane/frontend/src/locales/nl-NL.po index c056b06c0..97d5a5d80 100644 --- a/dembrane/frontend/src/locales/nl-NL.po +++ b/dembrane/frontend/src/locales/nl-NL.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} verwijderd" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} bestand(en) uploaden mislukt. Probeer die opnieuw." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alles" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} bestand(en) succesvol geüpload" @@ -17792,7 +17792,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verificatieprompts mogen 10.000 tekens bevatten en geverifieerde uitkomsten hebben een kopieerknop." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verificatie vereist" diff --git a/dembrane/frontend/src/locales/uk-UA.po b/dembrane/frontend/src/locales/uk-UA.po index 3b13516b1..890c9ab06 100644 --- a/dembrane/frontend/src/locales/uk-UA.po +++ b/dembrane/frontend/src/locales/uk-UA.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "Видалено: {0}" #. placeholder {0}: failed.length -#: src/lib/api.ts:622 +#: src/lib/api.ts:660 msgid "{0} file(s) failed to upload. Try those again." msgstr "Не вдалося завантажити {0} файл(ів). Спробуйте ще раз." @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:752 +#: src/lib/api.ts:790 msgid "All {0} file(s) uploaded successfully" msgstr "Усі файли ({0}) успішно завантажено" @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Підказки для перевірки можуть містити до 10 000 символів, а перевірені результати мають кнопку копіювання." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:167 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 msgid "participant.banner.verification_required" msgstr "Verification required" From ee3da7402e0eeae93514c6b88dc53ad30949fda5 Mon Sep 17 00:00:00 2001 From: Jorim Theuns Date: Tue, 1 Dec 2026 23:31:04 +0100 Subject: [PATCH 4/6] refactor(portal): sessionStorage participant tokens, 403/finish clearing, single header helper --- dembrane/frontend/src/lib/api.ts | 88 +++++++----- .../frontend/src/lib/participantToken.test.ts | 113 ++++++++++++++-- dembrane/frontend/src/lib/participantToken.ts | 125 ++++++++++-------- dembrane/frontend/src/locales/cs-CZ.po | 38 +++--- dembrane/frontend/src/locales/de-DE.po | 38 +++--- dembrane/frontend/src/locales/en-US.po | 38 +++--- dembrane/frontend/src/locales/es-ES.po | 38 +++--- dembrane/frontend/src/locales/fr-FR.po | 38 +++--- dembrane/frontend/src/locales/it-IT.po | 38 +++--- dembrane/frontend/src/locales/nl-NL.po | 38 +++--- dembrane/frontend/src/locales/uk-UA.po | 38 +++--- ...rticipantConversationAudioContent.test.tsx | 29 +++- .../ParticipantConversationAudioContent.tsx | 9 +- .../ParticipantPostConversation.test.tsx | 107 +++++++++++++++ .../routes/ParticipantPostConversation.tsx | 28 +++- .../portal/routes/ParticipantStart.test.tsx | 13 ++ .../src/portal/routes/ParticipantStart.tsx | 5 + 17 files changed, 562 insertions(+), 259 deletions(-) create mode 100644 dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx diff --git a/dembrane/frontend/src/lib/api.ts b/dembrane/frontend/src/lib/api.ts index 5269b45a6..4d5e99080 100644 --- a/dembrane/frontend/src/lib/api.ts +++ b/dembrane/frontend/src/lib/api.ts @@ -9,9 +9,11 @@ import { API_BASE_URL } from "@/config"; import { bff } from "./bff"; import { loadErrorMessages } from "./errors/present"; import { - conversationIdFromRequest, - getParticipantToken, + clearParticipantToken, + clearParticipantTokenValue, + isParticipantTokenRejection, PARTICIPANT_TOKEN_HEADER, + participantTokenConfig, participantTokenHeaders, readResponseHeader, setParticipantToken, @@ -24,17 +26,6 @@ export const apiCommonConfig: CreateAxiosDefaults = { export const apiNoAuth = axios.create(apiCommonConfig); -apiNoAuth.interceptors.request.use((config) => { - if (!config.headers.has(PARTICIPANT_TOKEN_HEADER)) { - const conversationId = conversationIdFromRequest(config.url, config.data); - const token = getParticipantToken(conversationId); - if (token) { - config.headers.set(PARTICIPANT_TOKEN_HEADER, token); - } - } - return config; -}); - apiNoAuth.interceptors.response.use( (response) => { const token = readResponseHeader( @@ -54,6 +45,15 @@ apiNoAuth.interceptors.response.use( return response.data; }, (error) => { + if (isParticipantTokenRejection(error)) { + const sentToken = readResponseHeader( + (error as AxiosError)?.config?.headers, + PARTICIPANT_TOKEN_HEADER, + ); + if (sentToken) { + clearParticipantTokenValue(sentToken); + } + } // Start loading the error messages now, so the screen that shows this error has // them by the time it renders (see lib/errors/present.ts). void loadErrorMessages(i18n); @@ -75,6 +75,7 @@ export const getParticipantConversationById = async ( ) => { return apiNoAuth.get( `/participant/projects/${projectId}/conversations/${conversationId}`, + participantTokenConfig(conversationId), ); }; @@ -84,6 +85,7 @@ export const getParticipantConversationChunks = async ( ) => { return apiNoAuth.get( `participant/projects/${projectId}/conversations/${conversationId}/chunks`, + participantTokenConfig(conversationId), ); }; @@ -98,6 +100,7 @@ export const getParticipantConversationReplies = async ( ) => { return apiNoAuth.get( `/participant/projects/${projectId}/conversations/${conversationId}/replies`, + participantTokenConfig(conversationId), ); }; @@ -108,6 +111,7 @@ export const deleteParticipantConversationChunk = async ( ) => { return apiNoAuth.delete( `/participant/projects/${projectId}/conversations/${conversationId}/chunks/${chunkId}`, + participantTokenConfig(conversationId), ); }; @@ -313,6 +317,8 @@ export const checkS3Connectivity = async ( try { const { probe_url } = await apiNoAuth.post( `/participant/conversations/${conversationId}/check-s3`, + undefined, + participantTokenConfig(conversationId), ); await fetch(probe_url, { @@ -414,7 +420,7 @@ export const pingConversation = async ( await apiNoAuth.post( `/participant/conversations/${conversationId}/ping`, telemetry ?? undefined, - { timeout: PING_TIMEOUT_MS }, + { timeout: PING_TIMEOUT_MS, ...participantTokenConfig(conversationId) }, ); return true; } catch { @@ -507,11 +513,15 @@ export const uploadConversationChunkWithPresignedUrl = async (payload: { fields: Record; file_url: string; } - >(`/participant/conversations/${payload.conversationId}/get-upload-url`, { - content_type: payload.chunk.type, - conversation_id: payload.conversationId, - filename: fileName, - }); + >( + `/participant/conversations/${payload.conversationId}/get-upload-url`, + { + content_type: payload.chunk.type, + conversation_id: payload.conversationId, + filename: fileName, + }, + participantTokenConfig(payload.conversationId), + ); } catch (error) { console.error("[Upload] Failed to get presigned URL:", error); if (axios.isAxiosError(error)) { @@ -622,6 +632,7 @@ export const confirmConversationChunkUpload = async (payload: { source: payload.source, timestamp: payload.timestamp, }, + participantTokenConfig(payload.conversationId), ); // Report 100% after successful confirmation @@ -646,6 +657,7 @@ export const uploadConversationText = async (payload: { source: payload.source, timestamp: payload.timestamp.toISOString(), }, + participantTokenConfig(payload.conversationId), ); }; @@ -820,6 +832,8 @@ export const initiateAndUploadConversationChunk = async (payload: { `[Upload] Failed to finish conversation ${conversationId}:`, error, ); + } finally { + clearParticipantToken(conversationId); } }), ); @@ -1568,6 +1582,8 @@ export const getProjectParticipantCount = async (projectId: string) => { export const finishConversation = async (conversationId: string) => { return apiNoAuth.post( `/participant/conversations/${conversationId}/finish`, + undefined, + participantTokenConfig(conversationId), ); }; @@ -1575,7 +1591,11 @@ export const generateConversationSummary = async (conversationId: string) => { return apiNoAuth.post< unknown, { status: string; summary: string } | { status: string; message: string } - >(`/conversations/${conversationId}/summarize`); + >( + `/conversations/${conversationId}/summarize`, + undefined, + participantTokenConfig(conversationId), + ); }; export const generateConversationTitle = async (conversationId: string) => { @@ -1690,6 +1710,7 @@ export const generateVerificationArtefact = async (payload: { topic_list: payload.topicList, }, { + ...participantTokenConfig(payload.conversationId), signal: payload.signal, }, ); @@ -1715,9 +1736,6 @@ export const updateVerificationArtefact = async ({ content, approvedAt, }: UpdateVerificationArtefactPayload) => { - const tokenHeaders = participantTokenHeaders( - conversationId ?? useConversation?.conversationId, - ); const response = await apiNoAuth.put( `/verify/artifact/${artifactId}`, { @@ -1730,9 +1748,7 @@ export const updateVerificationArtefact = async ({ } : undefined, }, - Object.keys(tokenHeaders).length > 0 - ? { headers: tokenHeaders } - : undefined, + participantTokenConfig(conversationId ?? useConversation?.conversationId), ); return response; }; @@ -1740,6 +1756,7 @@ export const updateVerificationArtefact = async ({ export const getVerificationArtefacts = async (conversationId: string) => { return apiNoAuth.get( `/verify/artifacts/${conversationId}`, + participantTokenConfig(conversationId), ); }; @@ -1747,12 +1764,9 @@ export const getVerificationArtefactById = async ( artifactId: string, conversationId?: string, ) => { - const tokenHeaders = participantTokenHeaders(conversationId); return apiNoAuth.get( `/verify/artifact/${artifactId}`, - Object.keys(tokenHeaders).length > 0 - ? { headers: tokenHeaders } - : undefined, + participantTokenConfig(conversationId), ); }; @@ -1774,11 +1788,15 @@ export const submitNotificationParticipant = async ( conversationId: string, ) => { try { - const response = await apiNoAuth.post("/participant/report/subscribe", { - conversation_id: conversationId, - emails, - project_id: projectId, - }); + const response = await apiNoAuth.post( + "/participant/report/subscribe", + { + conversation_id: conversationId, + emails, + project_id: projectId, + }, + participantTokenConfig(conversationId), + ); return response; } catch (_error) { throw new Error("Failed to subscribe to notifications"); diff --git a/dembrane/frontend/src/lib/participantToken.test.ts b/dembrane/frontend/src/lib/participantToken.test.ts index 5232ac28a..9019f5876 100644 --- a/dembrane/frontend/src/lib/participantToken.test.ts +++ b/dembrane/frontend/src/lib/participantToken.test.ts @@ -1,5 +1,5 @@ // @vitest-environment jsdom -import axios, { type AxiosAdapter } from "axios"; +import axios, { type AxiosAdapter, AxiosError } from "axios"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { apiNoAuth, @@ -7,6 +7,7 @@ import { confirmConversationChunkUpload, deleteParticipantConversationChunk, finishConversation, + generateConversationSummary, generateVerificationArtefact, getParticipantConversationById, getParticipantConversationChunks, @@ -23,8 +24,8 @@ import { uploadConversationText, } from "./api"; import { + clearAllParticipantTokens, clearParticipantToken, - clearParticipantTokensInMemory, getParticipantToken, PARTICIPANT_TOKEN_HEADER, participantTokenKey, @@ -38,29 +39,44 @@ vi.mock("@/components/common/Toaster", () => ({ const originalAdapter = apiNoAuth.defaults.adapter; beforeEach(() => { + sessionStorage.clear(); localStorage.clear(); - clearParticipantTokensInMemory(); + clearAllParticipantTokens(); }); afterEach(() => { apiNoAuth.defaults.adapter = originalAdapter; + sessionStorage.clear(); localStorage.clear(); - clearParticipantTokensInMemory(); + clearAllParticipantTokens(); vi.restoreAllMocks(); }); describe("participantToken storage", () => { - it("stores and reads tokens in localStorage under portal:token:", () => { + it("stores and reads tokens in sessionStorage under portal:token:", () => { setParticipantToken("conv-1", "p1.body.sig"); - expect(localStorage.getItem("portal:token:conv-1")).toBe("p1.body.sig"); + expect(sessionStorage.getItem("portal:token:conv-1")).toBe("p1.body.sig"); + expect(localStorage.getItem("portal:token:conv-1")).toBeNull(); expect(getParticipantToken("conv-1")).toBe("p1.body.sig"); clearParticipantToken("conv-1"); - expect(localStorage.getItem("portal:token:conv-1")).toBeNull(); + expect(sessionStorage.getItem("portal:token:conv-1")).toBeNull(); + expect(getParticipantToken("conv-1")).toBeNull(); + }); + + it("clears only participant token keys on clearAllParticipantTokens", () => { + sessionStorage.setItem("unrelated-key", "keep"); + setParticipantToken("conv-1", "p1.one.sig"); + setParticipantToken("conv-2", "p1.two.sig"); + + clearAllParticipantTokens(); + expect(getParticipantToken("conv-1")).toBeNull(); + expect(getParticipantToken("conv-2")).toBeNull(); + expect(sessionStorage.getItem("unrelated-key")).toBe("keep"); }); - it("falls back to in-memory storage when localStorage throws in private browsing", () => { + it("falls back to in-memory storage when sessionStorage throws in private browsing", () => { vi.spyOn(Storage.prototype, "setItem").mockImplementation(() => { throw new DOMException("QuotaExceededError"); }); @@ -151,7 +167,10 @@ describe("apiNoAuth participant token plumbing", () => { tagIdList: [], }); expect(conversation.id).toBe("c-1"); - expect(localStorage.getItem(participantTokenKey("c-1"))).toBe("p1.c1.sig"); + expect(sessionStorage.getItem(participantTokenKey("c-1"))).toBe( + "p1.c1.sig", + ); + expect(localStorage.getItem(participantTokenKey("c-1"))).toBeNull(); expect( seenHeaders.get("POST /participant/projects/p-1/conversations/initiate"), ).toBeUndefined(); @@ -170,6 +189,7 @@ describe("apiNoAuth participant token plumbing", () => { timestamp: new Date("2026-11-30T10:01:00Z"), }); await finishConversation("c-1"); + await generateConversationSummary("c-1"); await getParticipantConversationById("p-1", "c-1"); await getParticipantConversationChunks("p-1", "c-1"); await getParticipantConversationReplies("p-1", "c-1"); @@ -198,6 +218,7 @@ describe("apiNoAuth participant token plumbing", () => { "POST /participant/conversations/c-1/confirm-upload", "POST /participant/conversations/c-1/upload-text", "POST /participant/conversations/c-1/finish", + "POST /conversations/c-1/summarize", "GET /participant/projects/p-1/conversations/c-1", "GET participant/projects/p-1/conversations/c-1/chunks", "GET /participant/projects/p-1/conversations/c-1/replies", @@ -234,4 +255,78 @@ describe("apiNoAuth participant token plumbing", () => { ], ).toBe("p1.c1.sig"); }); + + it("clears a stored token when a portal call gets a 403 participant.token_invalid error", async () => { + setParticipantToken("c-stale", "p1.stale.sig"); + setParticipantToken("c-fresh", "p1.fresh.sig"); + + const sentOnRetry: Array = []; + let attempt = 0; + const adapter = vi.fn(async (config) => { + attempt++; + sentOnRetry.push( + config.headers.get(PARTICIPANT_TOKEN_HEADER)?.toString(), + ); + if (attempt === 1) { + throw new AxiosError( + "Forbidden", + "ERR_BAD_REQUEST", + config, + {}, + { + config, + data: { code: "participant.token_invalid" }, + headers: {}, + status: 403, + statusText: "Forbidden", + }, + ); + } + return { + config, + data: { id: "c-stale" }, + headers: {}, + status: 200, + statusText: "OK", + }; + }); + apiNoAuth.defaults.adapter = adapter; + + await expect( + getParticipantConversationById("p-1", "c-stale"), + ).rejects.toThrow(); + + // Stale token was cleared; other conversations' tokens remain untouched. + expect(getParticipantToken("c-stale")).toBeNull(); + expect(getParticipantToken("c-fresh")).toBe("p1.fresh.sig"); + + // Subsequent retry sends no stale token. + await getParticipantConversationById("p-1", "c-stale"); + expect(sentOnRetry).toEqual(["p1.stale.sig", undefined]); + }); + + it("keeps the stored token on unrelated 403 errors", async () => { + setParticipantToken("c-1", "p1.valid.sig"); + + apiNoAuth.defaults.adapter = vi.fn(async (config) => { + throw new AxiosError( + "Forbidden", + "ERR_BAD_REQUEST", + config, + {}, + { + config, + data: { code: "billing.tier_required" }, + headers: {}, + status: 403, + statusText: "Forbidden", + }, + ); + }); + + await expect( + getParticipantConversationById("p-1", "c-1"), + ).rejects.toThrow(); + expect(getParticipantToken("c-1")).toBe("p1.valid.sig"); + }); }); diff --git a/dembrane/frontend/src/lib/participantToken.ts b/dembrane/frontend/src/lib/participantToken.ts index c4f0888ad..09da574cd 100644 --- a/dembrane/frontend/src/lib/participantToken.ts +++ b/dembrane/frontend/src/lib/participantToken.ts @@ -1,3 +1,5 @@ +import { readApiError } from "./errors/read"; + export const PARTICIPANT_TOKEN_HEADER = "X-Participant-Token"; const STORAGE_PREFIX = "portal:token:"; @@ -13,7 +15,7 @@ export const setParticipantToken = ( if (!conversationId || !token) return; const key = participantTokenKey(conversationId); try { - globalThis.localStorage.setItem(key, token); + globalThis.sessionStorage.setItem(key, token); memoryStore.delete(key); } catch { // Private browsing or storage quota: keep the token for this page session. @@ -27,7 +29,7 @@ export const getParticipantToken = ( if (!conversationId) return null; const key = participantTokenKey(conversationId); try { - const stored = globalThis.localStorage.getItem(key); + const stored = globalThis.sessionStorage.getItem(key); if (stored) return stored; } catch { // Private browsing: fall back to the in-memory store. @@ -35,19 +37,64 @@ export const getParticipantToken = ( return memoryStore.get(key) ?? null; }; -export const clearParticipantToken = (conversationId: string): void => { +export const clearParticipantToken = ( + conversationId: string | null | undefined, +): void => { if (!conversationId) return; const key = participantTokenKey(conversationId); memoryStore.delete(key); try { - globalThis.localStorage.removeItem(key); + globalThis.sessionStorage.removeItem(key); } catch { // Ignore storage access failures. } }; -export const clearParticipantTokensInMemory = (): void => { +/** + * Remove any stored participant token whose value matches a rejected token + * (for example after a server secret rotation returns 403). + */ +export const clearParticipantTokenValue = (token: string): void => { + if (!token) return; + for (const [key, value] of memoryStore.entries()) { + if (value === token) { + memoryStore.delete(key); + } + } + try { + const storage = globalThis.sessionStorage; + const keysToRemove: string[] = []; + for (let i = 0; i < storage.length; i++) { + const key = storage.key(i); + if (key?.startsWith(STORAGE_PREFIX) && storage.getItem(key) === token) { + keysToRemove.push(key); + } + } + for (const key of keysToRemove) { + storage.removeItem(key); + } + } catch { + // Ignore storage access failures. + } +}; + +export const clearAllParticipantTokens = (): void => { memoryStore.clear(); + try { + const storage = globalThis.sessionStorage; + const keysToRemove: string[] = []; + for (let i = 0; i < storage.length; i++) { + const key = storage.key(i); + if (key?.startsWith(STORAGE_PREFIX)) { + keysToRemove.push(key); + } + } + for (const key of keysToRemove) { + storage.removeItem(key); + } + } catch { + // Ignore storage access failures. + } }; export const participantTokenHeaders = ( @@ -57,6 +104,13 @@ export const participantTokenHeaders = ( return token ? { [PARTICIPANT_TOKEN_HEADER]: token } : {}; }; +export const participantTokenConfig = ( + conversationId: string | null | undefined, +): { headers: Record } | undefined => { + const headers = participantTokenHeaders(conversationId); + return Object.keys(headers).length > 0 ? { headers } : undefined; +}; + export const readResponseHeader = ( headers: unknown, name: string, @@ -88,57 +142,18 @@ export const readResponseHeader = ( }; /** - * Resolve the conversationId targeted by a participant API request from its URL - * or JSON body so apiNoAuth can attach X-Participant-Token automatically. + * Matches a 403 participant token rejection from either axios or a useChat stream. */ -export const conversationIdFromRequest = ( - url: string | undefined, - data?: unknown, -): string | null => { - if (url) { - let rawPath = url; - if (/^https?:\/\//i.test(url)) { - try { - rawPath = new URL(url).pathname; - } catch { - rawPath = url; - } - } else { - rawPath = url.split(/[?#]/, 1)[0]; - } - const path = rawPath.replace(/^\/+/, "").replace(/^api\//, ""); - const match = - path.match( - /^participant\/projects\/[^/]+\/conversations\/([^/]+)(?:\/|$)/, - ) ?? - path.match(/^participant\/conversations\/([^/]+)(?:\/|$)/) ?? - path.match(/^verify\/artifacts\/([^/]+)(?:\/|$)/) ?? - path.match(/^conversations\/([^/]+)(?:\/|$)/); - if (match?.[1] && match[1] !== "initiate") { - try { - return decodeURIComponent(match[1]); - } catch { - return match[1]; - } +export const isParticipantTokenRejection = (err: unknown): boolean => { + const parsed = readApiError(err); + if (parsed.code === "participant.token_invalid") return true; + if (parsed.status === 403 && parsed.code === null) return true; + if (err instanceof Error) { + try { + return JSON.parse(err.message)?.code === "participant.token_invalid"; + } catch { + return false; } } - - if (data && typeof data === "object") { - const record = data as Record; - if ( - typeof record.conversation_id === "string" && - record.conversation_id.length > 0 - ) { - return record.conversation_id; - } - const useConv = record.useConversation; - if (useConv && typeof useConv === "object") { - const nestedId = (useConv as Record).conversationId; - if (typeof nestedId === "string" && nestedId.length > 0) { - return nestedId; - } - } - } - - return null; + return false; }; diff --git a/dembrane/frontend/src/locales/cs-CZ.po b/dembrane/frontend/src/locales/cs-CZ.po index 5b4f3d832..ae272645d 100644 --- a/dembrane/frontend/src/locales/cs-CZ.po +++ b/dembrane/frontend/src/locales/cs-CZ.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} souborů se nepodařilo nahrát. Zkuste to znovu." @@ -1529,7 +1529,7 @@ msgstr "Aktivita" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Přidáno lidí: {granted}" msgid "Added by a host" msgstr "Přidal hostitel" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Všech {0} souborů bylo úspěšně nahráno" @@ -2160,7 +2160,7 @@ msgstr "E-mailové upozornění bude odesláno {participantCount, plural, one {# msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Účastníkům bude odesláno e-mailové upozornění. Chcete pokračovat?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Při načítání portálu došlo k chybě. Kontaktujte prosím tým podpory." @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Plánujete dembrane používat ve zdravotnictví, školství, náboru, správě kritické infrastruktury, vymáhání práva nebo justici?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Email verification | dembrane" msgid "error.action.contact_admin" msgstr "Napište svému správci" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Nahrát hlasovou zprávu" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Odebrat přístup" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Odebrat e-mail" @@ -14247,7 +14247,7 @@ msgstr "Sdílet s celým pracovním prostorem" msgid "Share with workspace" msgstr "Sdílet s pracovním prostorem" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Zobrazte popcorn až ve třech dalších jazycích najednou." msgid "Show projects" msgstr "Show projects" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Zobrazit QR kód" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Silné heslo" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Textové příspěvky a navazující formuláře." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Thank you!" @@ -16207,7 +16207,7 @@ msgstr "Toto nasazení zobrazuje až {applied} hran." msgid "This deployment shows up to {applied} nodes." msgstr "Toto nasazení zobrazuje až {applied} uzlů." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -17797,7 +17797,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Výzvy k ověření umožňují až 10 000 znaků a ověřené výstupy mají tlačítko pro kopírování." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verification required" @@ -18148,7 +18148,7 @@ msgstr "Nastavíme projekt, budeme vám v den akce po boku a pomůžeme s násle msgid "We still couldn't charge your method. Update it and try again." msgstr "Platbu se stále nepodařilo strhnout. Aktualizujte platební metodu a zkuste to znovu." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19415,7 +19415,7 @@ msgstr "Vaše nahrávka, {0}" #~ msgid "Your request is in." #~ msgstr "Vaše žádost byla přijata." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Vaše odpověď byla zaznamenána. Tuto kartu můžete zavřít. Můžete také sdílet QR kód, aby mohli přispět i ostatní, nebo nahrát další rozhovor." diff --git a/dembrane/frontend/src/locales/de-DE.po b/dembrane/frontend/src/locales/de-DE.po index f0e823095..ec0d218fe 100644 --- a/dembrane/frontend/src/locales/de-DE.po +++ b/dembrane/frontend/src/locales/de-DE.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} gelöscht" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} Datei(en) konnten nicht hochgeladen werden. Versuche es erneut." @@ -1529,7 +1529,7 @@ msgstr "Aktivität" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} Personen hinzugefügt" msgid "Added by a host" msgstr "Von einem Host hinzugefügt" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Hinzugefügte E-Mails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alle" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} Datei(en) erfolgreich hochgeladen" @@ -2160,7 +2160,7 @@ msgstr "Eine E-Mail-Benachrichtigung wird an {participantCount, plural, one {# T msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Eine E-Mail-Benachrichtigung wird an die Teilnehmer gesendet. Möchtest du fortfahren?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Beim Laden des Portals ist ein Fehler aufgetreten. Bitte kontaktiere das Support-Team." @@ -5405,7 +5405,7 @@ msgstr "Benötige ich dies?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Planst du, dembrane im Gesundheitswesen, in der Bildung, Personalbeschaffung, bei kritischen Infrastrukturen, bei Strafverfolgung oder Justiz einzusetzen?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Möchtest du auf dem Laufenden bleiben?" @@ -5822,7 +5822,7 @@ msgstr "E-Mail-Bestätigung | dembrane" msgid "error.action.contact_admin" msgstr "E-Mail an deinen Administrator" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Bitte überprüfe deine Eingaben auf Fehler." msgid "Please enable participation to enable sharing" msgstr "Bitte aktiviere die Teilnahme, um das Teilen zu ermöglichen" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Bitte gib eine gültige E-Mail-Adresse ein." @@ -12370,7 +12370,7 @@ msgstr "Aufnehmen" msgid "Record a voice message" msgstr "Sprachnachricht aufnehmen" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Ein weiteres Gespräch aufnehmen" @@ -12651,7 +12651,7 @@ msgstr "Zugriff entfernen" msgid "Remove avatar" msgstr "Profilbild entfernen" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "E-Mail entfernen" @@ -14247,7 +14247,7 @@ msgstr "Mit gesamtem Workspace teilen" msgid "Share with workspace" msgstr "Für Arbeitsbereich freigeben" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Teile hier deine Daten" @@ -14429,7 +14429,7 @@ msgstr "Zeige Popcorn in bis zu drei zusätzlichen Sprachen gleichzeitig." msgid "Show projects" msgstr "Projekte anzeigen" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "QR-Code anzeigen" @@ -15085,7 +15085,7 @@ msgstr "Strategische Planung" msgid "Strong password" msgstr "Sicheres Passwort" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Absenden" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Textbeiträge und Formulare zur Nachbereitung." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Vielen Dank für deine Teilnahme!" #~ msgid "Thank You Page Content" #~ msgstr "Danke-Seite Inhalt" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Vielen Dank!" @@ -16208,7 +16208,7 @@ msgstr "Diese Bereitstellung zeigt bis zu {applied} Kanten." msgid "This deployment shows up to {applied} nodes." msgstr "Diese Bereitstellung zeigt bis zu {applied} Knoten." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "Diese E-Mail ist bereits in der Liste." @@ -17796,7 +17796,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verifizierungs-Prompts erlauben 10.000 Zeichen, und verifizierte Ergebnisse haben einen Kopier-Button." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verifizierung erforderlich" @@ -18148,7 +18148,7 @@ msgstr "Wir richten das Projekt ein, stehen dir am Tag der Veranstaltung zur Sei msgid "We still couldn't charge your method. Update it and try again." msgstr "Deine Zahlungsmethode konnte noch immer nicht belastet werden. Bitte aktualisiere sie und versuche es erneut." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Wir werden dir nur eine Nachricht senden, wenn dein Gastgeber einen Bericht erstellt. Wir geben deine Daten niemals an Dritte weiter. Du kannst dich jederzeit abmelden." @@ -19415,7 +19415,7 @@ msgstr "Deine Aufnahme, {0}" #~ msgid "Your request is in." #~ msgstr "Ihre Anfrage ist eingegangen." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Deine Antwort wurde aufgezeichnet. Du kannst diesen Tab jetzt schließen. Du kannst auch den QR-Code teilen, damit andere beitragen können, oder ein weiteres Gespräch aufnehmen." diff --git a/dembrane/frontend/src/locales/en-US.po b/dembrane/frontend/src/locales/en-US.po index b2e856452..6928b2301 100644 --- a/dembrane/frontend/src/locales/en-US.po +++ b/dembrane/frontend/src/locales/en-US.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} file(s) failed to upload. Try those again." @@ -1529,7 +1529,7 @@ msgstr "Activity" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Added {granted} people" msgid "Added by a host" msgstr "Added by a host" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "All {0} file(s) uploaded successfully" @@ -2160,7 +2160,7 @@ msgstr "An email notification will be sent to {participantCount, plural, one {# msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "An email notification will be sent to participants. Do you want to proceed?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "An error occurred while loading the portal. Please contact the support team." @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Email verification | dembrane" msgid "error.action.contact_admin" msgstr "Email your admin" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Record a voice message" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Remove access" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Remove email" @@ -14247,7 +14247,7 @@ msgstr "Share with whole workspace" msgid "Share with workspace" msgstr "Share with workspace" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Show popcorn in up to three extra languages at once." msgid "Show projects" msgstr "Show projects" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Show QR code" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Strong password" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Text contributions and follow-up forms." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Thank you!" @@ -16207,7 +16207,7 @@ msgstr "This deployment shows up to {applied} edges." msgid "This deployment shows up to {applied} nodes." msgstr "This deployment shows up to {applied} nodes." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -17797,7 +17797,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verification prompts allow 10,000 characters, and verified outcomes have a copy button." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verification required" @@ -18148,7 +18148,7 @@ msgstr "We set up the project, stand beside you on the day, and help write the r msgid "We still couldn't charge your method. Update it and try again." msgstr "We still couldn't charge your method. Update it and try again." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19415,7 +19415,7 @@ msgstr "Your recording, {0}" #~ msgid "Your request is in." #~ msgstr "Your request is in." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." diff --git a/dembrane/frontend/src/locales/es-ES.po b/dembrane/frontend/src/locales/es-ES.po index 5aede94be..2558ecf7d 100644 --- a/dembrane/frontend/src/locales/es-ES.po +++ b/dembrane/frontend/src/locales/es-ES.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminadas" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "Error al subir {0} archivo(s). Vuelve a intentarlo." @@ -1529,7 +1529,7 @@ msgstr "Actividad" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} personas añadidas" msgid "Added by a host" msgstr "Añadido por un host" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "E-mails añadidos" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Todo" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Los {0} archivo(s) se subieron correctamente" @@ -2160,7 +2160,7 @@ msgstr "Se enviará una notificación por correo electrónico a {participantCoun msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Se enviará una notificación por correo electrónico a los participantes. ¿Quieres continuar?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Ocurrió un error al cargar el portal. Ponte en contacto con el equipo de soporte." @@ -5405,7 +5405,7 @@ msgstr "¿Necesito esto?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "¿Planeas usar dembrane en contextos de salud, educación, selección de personal, gestión de infraestructuras críticas, orden público o justicia?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "¿Quieres estar en el bucle?" @@ -5822,7 +5822,7 @@ msgstr "Verificación de correo | dembrane" msgid "error.action.contact_admin" msgstr "Escribe a tu administrador" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@trabajo.com" @@ -11425,7 +11425,7 @@ msgstr "Por favor, revisa tus entradas para errores." msgid "Please enable participation to enable sharing" msgstr "Por favor, habilite la participación para habilitar el uso compartido" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Por favor, ingrese un correo electrónico válido." @@ -12370,7 +12370,7 @@ msgstr "Grabar" msgid "Record a voice message" msgstr "Grabar un mensaje de voz" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Registrar otra conversación" @@ -12651,7 +12651,7 @@ msgstr "Quitar acceso" msgid "Remove avatar" msgstr "Eliminar avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Eliminar correo electrónico" @@ -14247,7 +14247,7 @@ msgstr "Compartir con todo el espacio de trabajo" msgid "Share with workspace" msgstr "Compartir con el espacio de trabajo" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Comparte tus detalles aquí" @@ -14429,7 +14429,7 @@ msgstr "Muestra popcorn en hasta tres idiomas adicionales a la vez." msgid "Show projects" msgstr "Mostrar proyectos" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Mostrar código QR" @@ -15085,7 +15085,7 @@ msgstr "Planificación Estratégica" msgid "Strong password" msgstr "Contraseña segura" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Enviar" @@ -15479,14 +15479,14 @@ msgstr "Texto" msgid "Text contributions and follow-up forms." msgstr "Aportaciones de texto y formularios de seguimiento." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "¡Gracias por participar!" #~ msgid "Thank You Page Content" #~ msgstr "Contenido de la Página de Gracias" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "¡Gracias!" @@ -16208,7 +16208,7 @@ msgstr "Este despliegue muestra hasta {applied} conexiones." msgid "This deployment shows up to {applied} nodes." msgstr "Este despliegue muestra hasta {applied} nodos." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "Este correo electrónico ya está en la lista." @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Las instrucciones de verificación admiten hasta 10.000 caracteres, y los resultados verificados tienen un botón para copiar." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verificación requerida" @@ -18150,7 +18150,7 @@ msgstr "Configuramos el proyecto, te acompañamos el día del evento y te ayudam msgid "We still couldn't charge your method. Update it and try again." msgstr "Seguimos sin poder cobrar a tu método de pago. Actualízalo e inténtalo de nuevo." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Solo te enviaremos un mensaje si tu host genera un informe, nunca compartimos tus detalles con nadie. Puedes optar por no recibir más mensajes en cualquier momento." @@ -19417,7 +19417,7 @@ msgstr "Tu grabación, {0}" #~ msgid "Your request is in." #~ msgstr "Hemos recibido tu solicitud." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Tu respuesta ha sido registrada. Puedes cerrar esta pestaña ahora. También puedes compartir el código QR para que otras personas puedan contribuir, o registrar otra conversación." diff --git a/dembrane/frontend/src/locales/fr-FR.po b/dembrane/frontend/src/locales/fr-FR.po index 3e77862fb..49c1dcd28 100644 --- a/dembrane/frontend/src/locales/fr-FR.po +++ b/dembrane/frontend/src/locales/fr-FR.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} supprimé(s)" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "Échec de l'importation de {0} fichier(s). Veuillez réessayer." @@ -1529,7 +1529,7 @@ msgstr "Activité" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} personnes ajoutées" msgid "Added by a host" msgstr "Ajouté par un hôte" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "E-mails ajoutés" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Tout" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Les {0} fichier(s) ont bien été importés" @@ -2160,7 +2160,7 @@ msgstr "Une notification par e-mail sera envoyée à {participantCount, plural, msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Une notification par e-mail sera envoyée aux participants. Voulez-vous continuer ?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Une erreur s'est produite lors du chargement du portail. Veuillez contacter l'équipe de support." @@ -5405,7 +5405,7 @@ msgstr "Dois-je avoir cela ?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Prévoyez-vous d'utiliser dembrane dans les domaines de la santé, de l'éducation, du recrutement, de la gestion d'infrastructures critiques, du maintien de l'ordre ou de la justice ?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Voulez-vous rester dans la boucle ?" @@ -5822,7 +5822,7 @@ msgstr "Vérification de l'adresse e-mail | dembrane" msgid "error.action.contact_admin" msgstr "Envoyer un e-mail à votre administrateur" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@travail.com" @@ -11425,7 +11425,7 @@ msgstr "Veuillez vérifier vos entrées pour les erreurs." msgid "Please enable participation to enable sharing" msgstr "Veuillez activer la participation pour activer le partage" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Veuillez entrer une adresse e-mail valide." @@ -12370,7 +12370,7 @@ msgstr "Enregistrer" msgid "Record a voice message" msgstr "Enregistrer un message vocal" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Enregistrer une autre conversation" @@ -12651,7 +12651,7 @@ msgstr "Retirer l'accès" msgid "Remove avatar" msgstr "Supprimer l'avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Supprimer l'e-mail" @@ -14247,7 +14247,7 @@ msgstr "Partager avec tout l'espace de travail" msgid "Share with workspace" msgstr "Partager avec l'espace de travail" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Partager vos informations ici" @@ -14429,7 +14429,7 @@ msgstr "Affichez le popcorn dans jusqu'à trois langues supplémentaires à la f msgid "Show projects" msgstr "Afficher les projets" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Afficher le QR code" @@ -15085,7 +15085,7 @@ msgstr "Planification Stratégique" msgid "Strong password" msgstr "Mot de passe robuste" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Soumettre" @@ -15479,14 +15479,14 @@ msgstr "Texte" msgid "Text contributions and follow-up forms." msgstr "Des contributions écrites et des formulaires de suivi." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Merci pour votre participation !" #~ msgid "Thank You Page Content" #~ msgstr "Contenu de la page Merci" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Merci !" @@ -16208,7 +16208,7 @@ msgstr "Ce déploiement affiche jusqu'à {applied} liens." msgid "This deployment shows up to {applied} nodes." msgstr "Ce déploiement affiche jusqu'à {applied} nœuds." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "Cette e-mail est déjà dans la liste." @@ -17795,7 +17795,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Les invites de vérification autorisent 10 000 caractères, et les résultats vérifiés ont un bouton de copie." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Vérification requise" @@ -18147,7 +18147,7 @@ msgstr "Nous configurons le projet, vous accompagnons le jour J et vous aidons e msgid "We still couldn't charge your method. Update it and try again." msgstr "Impossible de débiter votre moyen de paiement. Mettez-le à jour et réessayez." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Nous vous envoyerons un message uniquement si votre hôte génère un rapport, nous ne partageons jamais vos informations avec personne. Vous pouvez vous désinscrire à tout moment." @@ -19414,7 +19414,7 @@ msgstr "Votre enregistrement, {0}" #~ msgid "Your request is in." #~ msgstr "Votre demande a bien été envoyée." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Votre réponse a été enregistrée. Vous pouvez maintenant fermer cette page. Vous pouvez également partager le code QR pour que d'autres puissent contribuer, ou enregistrer une autre conversation." diff --git a/dembrane/frontend/src/locales/it-IT.po b/dembrane/frontend/src/locales/it-IT.po index 928062633..6c2037360 100644 --- a/dembrane/frontend/src/locales/it-IT.po +++ b/dembrane/frontend/src/locales/it-IT.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminati" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "Impossibile caricare {0} file. Riprova." @@ -1529,7 +1529,7 @@ msgstr "Attività" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} persone aggiunte" msgid "Added by a host" msgstr "Aggiunto da un host" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Tutti i {0} file caricati con successo" @@ -2160,7 +2160,7 @@ msgstr "Verrà inviata una notifica via email a {participantCount, plural, one { msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Verrà inviata una notifica via email ai partecipanti. Vuoi procedere?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Si è verificato un errore durante il caricamento del portale. Contatta il team di supporto." @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Hai intenzione di usare dembrane in contesti sanitari, educativi, di selezione del personale, gestione di infrastrutture critiche, ordine pubblico o giustizia?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Verifica email | dembrane" msgid "error.action.contact_admin" msgstr "Invia un'email al tuo amministratore" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Registra un messaggio vocale" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Rimuovi accesso" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Rimuovi email" @@ -14247,7 +14247,7 @@ msgstr "Condividi con tutto il workspace" msgid "Share with workspace" msgstr "Condividi con lo spazio di lavoro" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Mostra il popcorn in un massimo di tre lingue aggiuntive contemporaneame msgid "Show projects" msgstr "Mostra progetti" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Mostra il codice QR" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Password efficace" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Contributi scritti e moduli dopo la conversazione." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Thank you!" @@ -16208,7 +16208,7 @@ msgstr "Questa distribuzione mostra fino a {applied} collegamenti." msgid "This deployment shows up to {applied} nodes." msgstr "Questa distribuzione mostra fino a {applied} nodi." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "I prompt di verifica consentono 10.000 caratteri e i risultati verificati hanno un pulsante Copia." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verification required" @@ -18150,7 +18150,7 @@ msgstr "Configuriamo il progetto, siamo al tuo fianco il giorno dell'evento e ti msgid "We still couldn't charge your method. Update it and try again." msgstr "Non siamo ancora riusciti ad addebitare il tuo metodo. Aggiornalo e riprova." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19417,7 +19417,7 @@ msgstr "La tua registrazione, {0}" #~ msgid "Your request is in." #~ msgstr "La tua richiesta è stata ricevuta." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "La tua risposta è stata registrata. Ora puoi chiudere questa scheda. Puoi anche condividere il codice QR così che altri possano contribuire, o registrare un'altra conversazione." diff --git a/dembrane/frontend/src/locales/nl-NL.po b/dembrane/frontend/src/locales/nl-NL.po index 97d5a5d80..a326de7a6 100644 --- a/dembrane/frontend/src/locales/nl-NL.po +++ b/dembrane/frontend/src/locales/nl-NL.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} verwijderd" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} bestand(en) uploaden mislukt. Probeer die opnieuw." @@ -1529,7 +1529,7 @@ msgstr "Activiteit" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} mensen toegevoegd" msgid "Added by a host" msgstr "Toegevoegd door een host" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Toegevoegde e-mails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alles" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} bestand(en) succesvol geüpload" @@ -2160,7 +2160,7 @@ msgstr "Er wordt een e-mailmelding verstuurd naar {participantCount, plural, one msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Er wordt een e-mailmelding naar de deelnemers verstuurd. Wil je doorgaan?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Er is een fout opgetreden bij het laden van het portaal. Neem contact op met het supportteam." @@ -5402,7 +5402,7 @@ msgstr "Ben ik dit nodig?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Ben je van plan dembrane te gebruiken in de zorg, het onderwijs, werving, het beheer van kritieke infrastructuur, rechtshandhaving of de rechtspraak?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Wil je op de hoogte blijven?" @@ -5819,7 +5819,7 @@ msgstr "E-mailverificatie | dembrane" msgid "error.action.contact_admin" msgstr "E-mail je beheerder" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@werk.com" @@ -11422,7 +11422,7 @@ msgstr "Controleer uw invoer voor fouten." msgid "Please enable participation to enable sharing" msgstr "Schakel deelneming in om delen mogelijk te maken" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Voer een geldig e-mailadres in." @@ -12367,7 +12367,7 @@ msgstr "Opname starten" msgid "Record a voice message" msgstr "Spraakbericht opnemen" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Neem nog een gesprek op" @@ -12648,7 +12648,7 @@ msgstr "Toegang intrekken" msgid "Remove avatar" msgstr "Avatar verwijderen" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "E-mail verwijderen" @@ -14244,7 +14244,7 @@ msgstr "Delen met hele werkruimte" msgid "Share with workspace" msgstr "Deel met werkruimte" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Deel je gegevens hier" @@ -14426,7 +14426,7 @@ msgstr "Toon popcorn in maximaal drie extra talen tegelijk." msgid "Show projects" msgstr "Toon projecten" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "QR-code tonen" @@ -15082,7 +15082,7 @@ msgstr "Strategische Planning" msgid "Strong password" msgstr "Sterk wachtwoord" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Stuur in" @@ -15476,14 +15476,14 @@ msgstr "Tekst" msgid "Text contributions and follow-up forms." msgstr "Tekstbijdragen en vervolgformulieren." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Dank je wel voor je deelname!" #~ msgid "Thank You Page Content" #~ msgstr "Bedankt pagina inhoud" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Bedankt!" @@ -16204,7 +16204,7 @@ msgstr "Deze implementatie toont maximaal {applied} randen." msgid "This deployment shows up to {applied} nodes." msgstr "Deze implementatie toont maximaal {applied} knooppunten." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "Deze e-mail is al in de lijst." @@ -17792,7 +17792,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Verificatieprompts mogen 10.000 tekens bevatten en geverifieerde uitkomsten hebben een kopieerknop." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verificatie vereist" @@ -18143,7 +18143,7 @@ msgstr "We zetten samen het project op, draaien op de dag zelf met je mee en hel msgid "We still couldn't charge your method. Update it and try again." msgstr "We konden je methode nog steeds niet belasten. Werk deze bij en probeer het opnieuw." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We sturen u alleen een bericht als uw gastgever een rapport genereert, we delen uw gegevens niet met iemand. U kunt op elk moment afmelden." @@ -19410,7 +19410,7 @@ msgstr "Je opname, {0}" #~ msgid "Your request is in." #~ msgstr "Je aanvraag is binnen." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Je antwoord is opgeslagen. Je kunt dit tabblad sluiten. Je kunt ook de QR-code delen zodat anderen kunnen bijdragen, of nog een gesprek opnemen." diff --git a/dembrane/frontend/src/locales/uk-UA.po b/dembrane/frontend/src/locales/uk-UA.po index 890c9ab06..4c0cbd73d 100644 --- a/dembrane/frontend/src/locales/uk-UA.po +++ b/dembrane/frontend/src/locales/uk-UA.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "Видалено: {0}" #. placeholder {0}: failed.length -#: src/lib/api.ts:660 +#: src/lib/api.ts:672 msgid "{0} file(s) failed to upload. Try those again." msgstr "Не вдалося завантажити {0} файл(ів). Спробуйте ще раз." @@ -1529,7 +1529,7 @@ msgstr "Активність" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:199 +#: src/portal/routes/ParticipantPostConversation.tsx:223 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Додано {granted} користувачів" msgid "Added by a host" msgstr "Додано ведучим" -#: src/portal/routes/ParticipantPostConversation.tsx:208 +#: src/portal/routes/ParticipantPostConversation.tsx:232 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:790 +#: src/lib/api.ts:802 msgid "All {0} file(s) uploaded successfully" msgstr "Усі файли ({0}) успішно завантажено" @@ -2160,7 +2160,7 @@ msgstr "Сповіщення електронною поштою буде над msgid "An email notification will be sent to participants. Do you want to proceed?" msgstr "Учасникам буде надіслано сповіщення електронною поштою. Продовжити?" -#: src/portal/routes/ParticipantStart.tsx:85 +#: src/portal/routes/ParticipantStart.tsx:90 msgid "An error occurred while loading the portal. Please contact the support team." msgstr "Під час завантаження порталу сталася помилка. Зверніться до служби підтримки." @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Чи плануєте ви використовувати dembrane у сфері охорони здоров’я, освіти, найму персоналу, управління критичною інфраструктурою, правоохоронної діяльності чи правосуддя?" -#: src/portal/routes/ParticipantPostConversation.tsx:174 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Підтвердження електронної пошти | dembrane" msgid "error.action.contact_admin" msgstr "Написати адміністратору" -#: src/portal/routes/ParticipantPostConversation.tsx:183 +#: src/portal/routes/ParticipantPostConversation.tsx:207 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:92 +#: src/portal/routes/ParticipantPostConversation.tsx:116 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Записати голосове повідомлення" -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:185 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Скасувати доступ" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:214 +#: src/portal/routes/ParticipantPostConversation.tsx:238 msgid "Remove email" msgstr "Видалити адресу" @@ -14247,7 +14247,7 @@ msgstr "Поділитися з усім робочим простором" msgid "Share with workspace" msgstr "Поділитися з робочим простором" -#: src/portal/routes/ParticipantPostConversation.tsx:177 +#: src/portal/routes/ParticipantPostConversation.tsx:201 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Показуйте popcorn одночасно ще до трьох мо msgid "Show projects" msgstr "Показати проєкти" -#: src/portal/routes/ParticipantPostConversation.tsx:152 +#: src/portal/routes/ParticipantPostConversation.tsx:176 msgid "Show QR code" msgstr "Показати QR-код" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Надійний пароль" -#: src/portal/routes/ParticipantPostConversation.tsx:247 +#: src/portal/routes/ParticipantPostConversation.tsx:271 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Текстові внески та форми для подальшого зв’язку." -#: src/portal/routes/ParticipantPostConversation.tsx:133 +#: src/portal/routes/ParticipantPostConversation.tsx:157 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:256 +#: src/portal/routes/ParticipantPostConversation.tsx:280 msgid "Thank you!" msgstr "Thank you!" @@ -16208,7 +16208,7 @@ msgstr "У цьому розгортанні показується до {applie msgid "This deployment shows up to {applied} nodes." msgstr "У цьому розгортанні показується до {applied} вузлів." -#: src/portal/routes/ParticipantPostConversation.tsx:88 +#: src/portal/routes/ParticipantPostConversation.tsx:112 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -17798,7 +17798,7 @@ msgid "Verification prompts allow 10,000 characters, and verified outcomes have msgstr "Підказки для перевірки можуть містити до 10 000 символів, а перевірені результати мають кнопку копіювання." #. js-lingui-explicit-id -#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:169 +#: src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx:176 msgid "participant.banner.verification_required" msgstr "Verification required" @@ -18150,7 +18150,7 @@ msgstr "Ми налаштовуємо проєкт, підтримуємо ва msgid "We still couldn't charge your method. Update it and try again." msgstr "Усе ще не вдалося списати кошти. Оновіть спосіб оплати та спробуйте знову." -#: src/portal/routes/ParticipantPostConversation.tsx:267 +#: src/portal/routes/ParticipantPostConversation.tsx:291 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19417,7 +19417,7 @@ msgstr "Ваш запис, {0}" #~ msgid "Your request is in." #~ msgstr "Ваш запит надіслано." -#: src/portal/routes/ParticipantPostConversation.tsx:137 +#: src/portal/routes/ParticipantPostConversation.tsx:161 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Вашу відповідь записано. Тепер ви можете закрити цю вкладку. Ви також можете поділитися QR-кодом, щоб інші могли долучитися, або записати ще одну розмову." diff --git a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx index 02c37a7b6..b14e44fcf 100644 --- a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx +++ b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.test.tsx @@ -6,20 +6,29 @@ import { cleanup, render, screen } from "@testing-library/react"; import { MemoryRouter, Outlet, Route, Routes } from "react-router"; import { afterEach, beforeAll, expect, it, vi } from "vitest"; import { - clearParticipantTokensInMemory, + clearAllParticipantTokens, + getParticipantToken, PARTICIPANT_TOKEN_HEADER, setParticipantToken, } from "@/lib/participantToken"; import { ParticipantConversationAudioContent } from "./ParticipantConversationAudioContent"; const state = vi.hoisted(() => ({ - chatOptions: undefined as { headers?: Record } | undefined, + chatOptions: undefined as + | { + headers?: Record; + onError?: (error: Error) => void; + } + | undefined, echoError: undefined as Error | undefined, project: {} as Record, })); vi.mock("@ai-sdk/react", () => ({ - useChat: (options: { headers?: Record }) => { + useChat: (options: { + headers?: Record; + onError?: (error: Error) => void; + }) => { state.chatOptions = options; return { data: undefined, @@ -77,8 +86,8 @@ beforeAll(() => { afterEach(() => { cleanup(); - localStorage.clear(); - clearParticipantTokensInMemory(); + sessionStorage.clear(); + clearAllParticipantTokens(); state.chatOptions = undefined; state.echoError = undefined; state.project = {}; @@ -150,3 +159,13 @@ it("omits X-Participant-Token from Explore replies when no token is stored", () renderPage(); expect(state.chatOptions?.headers).toEqual({}); }); + +it("clears the stored token when Explore fails with participant.token_invalid", () => { + vi.spyOn(console, "error").mockImplementation(() => {}); + setParticipantToken("c-1", "p1.rotated.sig"); + renderPage(); + state.chatOptions?.onError?.( + new Error(JSON.stringify({ code: "participant.token_invalid" })), + ); + expect(getParticipantToken("c-1")).toBeNull(); +}); diff --git a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx index f11286b3a..f952c10c7 100644 --- a/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx +++ b/dembrane/frontend/src/portal/components/conversation/audio/ParticipantConversationAudioContent.tsx @@ -13,7 +13,11 @@ import { import { API_BASE_URL } from "@/config"; import { useLanguage } from "@/hooks/useLanguage"; import { useLoadNotification } from "@/hooks/useLoadNotification"; -import { participantTokenHeaders } from "@/lib/participantToken"; +import { + clearParticipantToken, + isParticipantTokenRejection, + participantTokenHeaders, +} from "@/lib/participantToken"; import { useConversationQuery, useConversationRepliesQuery, @@ -87,6 +91,9 @@ export const ParticipantConversationAudioContent = () => { role: msg.type === "assistant_reply" ? "assistant" : "user", })) ?? [], onError: (error) => { + if (isParticipantTokenRejection(error)) { + clearParticipantToken(conversationId); + } console.error("onError", error); removeValue(); }, diff --git a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx new file mode 100644 index 000000000..d0fccc5a8 --- /dev/null +++ b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx @@ -0,0 +1,107 @@ +// @vitest-environment jsdom +import { i18n } from "@lingui/core"; +import { I18nProvider } from "@lingui/react"; +import { MantineProvider } from "@mantine/core"; +import { cleanup, render } from "@testing-library/react"; +import { MemoryRouter, Route, Routes } from "react-router"; +import { afterEach, beforeAll, expect, it, vi } from "vitest"; +import { + clearAllParticipantTokens, + getParticipantToken, + setParticipantToken, +} from "@/lib/participantToken"; +import { ParticipantPostConversation } from "./ParticipantPostConversation"; + +const projectState = vi.hoisted(() => ({ + data: { + default_conversation_ask_for_participant_email: false, + default_conversation_finish_text: null, + id: "p-1", + is_dembrane_event_cta_enabled: false, + is_project_notification_subscription_allowed: false, + }, +})); + +vi.mock("@/portal/hooks/useParticipantProjectById", () => ({ + useParticipantProjectById: () => ({ + data: projectState.data, + isLoading: false, + }), +})); + +vi.mock("@/portal/routes/useSubmitNotificationParticipant", () => ({ + useSubmitNotificationParticipant: () => ({ + isPending: false, + mutate: vi.fn(), + }), +})); + +vi.mock("@/portal/components/ParticipantShareModal", () => ({ + ParticipantShareModal: () => null, +})); + +vi.mock("@/portal/components/finish/DembraneEventCta", () => ({ + DembraneEventCta: () => null, +})); + +beforeAll(() => { + i18n.load("en", {}); + i18n.activate("en"); + window.matchMedia = + window.matchMedia || + ((query: string) => ({ + addEventListener: () => {}, + addListener: () => {}, + dispatchEvent: () => false, + matches: false, + media: query, + onchange: null, + removeEventListener: () => {}, + removeListener: () => {}, + })); +}); + +afterEach(() => { + cleanup(); + sessionStorage.clear(); + clearAllParticipantTokens(); + projectState.data = { + default_conversation_ask_for_participant_email: false, + default_conversation_finish_text: null, + id: "p-1", + is_dembrane_event_cta_enabled: false, + is_project_notification_subscription_allowed: false, + }; +}); + +const renderFinish = () => + render( + + + + + } + /> + + + + , + ); + +it("clears the participant token on finish when no email subscription form is shown", () => { + setParticipantToken("c-1", "p1.done.sig"); + renderFinish(); + expect(getParticipantToken("c-1")).toBeNull(); +}); + +it("keeps the token while the finish email form is open and clears it on exit", () => { + projectState.data.default_conversation_ask_for_participant_email = true; + setParticipantToken("c-1", "p1.email.sig"); + const view = renderFinish(); + expect(getParticipantToken("c-1")).toBe("p1.email.sig"); + + view.unmount(); + expect(getParticipantToken("c-1")).toBeNull(); +}); diff --git a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx index 15f62d210..cddf823bd 100644 --- a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx +++ b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx @@ -20,10 +20,11 @@ import { QrCodeIcon, RepeatIcon, } from "@phosphor-icons/react"; -import { type KeyboardEvent, useRef, useState } from "react"; +import { type KeyboardEvent, useEffect, useRef, useState } from "react"; import { useParams } from "react-router"; import { I18nLink } from "@/components/common/i18nLink"; import { Markdown } from "@/components/common/Markdown"; +import { clearParticipantToken } from "@/lib/participantToken"; import { testId } from "@/lib/testUtils"; import { DembraneEventCta } from "@/portal/components/finish/DembraneEventCta"; import { ParticipantShareModal } from "@/portal/components/ParticipantShareModal"; @@ -44,6 +45,26 @@ export const ParticipantPostConversation = () => { const initiateLink = `/${projectId}/start`; + // Keep the token only while the optional report-subscribe form on this screen + // still needs it; clear immediately otherwise and whenever leaving /finish. + useEffect(() => { + if (!conversationId) return; + if ( + project.data && + !project.data.default_conversation_ask_for_participant_email + ) { + clearParticipantToken(conversationId); + } + }, [conversationId, project.data]); + + useEffect(() => { + return () => { + if (conversationId) { + clearParticipantToken(conversationId); + } + }; + }, [conversationId]); + const variables = { "{{CONVERSATION_ID}}": conversationId ?? "null", "{{PROJECT_ID}}": projectId ?? "null", @@ -62,7 +83,10 @@ export const ParticipantPostConversation = () => { mutate( { conversationId: conversationId ?? "", emails, projectId }, { - onSuccess: () => setIsSubmitted(true), + onSuccess: () => { + clearParticipantToken(conversationId); + setIsSubmitted(true); + }, }, ); }; diff --git a/dembrane/frontend/src/portal/routes/ParticipantStart.test.tsx b/dembrane/frontend/src/portal/routes/ParticipantStart.test.tsx index c3ecbe8db..91369ead7 100644 --- a/dembrane/frontend/src/portal/routes/ParticipantStart.test.tsx +++ b/dembrane/frontend/src/portal/routes/ParticipantStart.test.tsx @@ -5,6 +5,11 @@ import { MantineProvider } from "@mantine/core"; import { cleanup, render, screen } from "@testing-library/react"; import { MemoryRouter, Route, Routes } from "react-router"; import { afterEach, beforeAll, expect, it, vi } from "vitest"; +import { + clearAllParticipantTokens, + getParticipantToken, + setParticipantToken, +} from "@/lib/participantToken"; import { ParticipantStartRoute } from "./ParticipantStart"; vi.mock("posthog-js", () => ({ default: { capture: vi.fn() } })); @@ -48,6 +53,8 @@ beforeAll(() => { afterEach(() => { cleanup(); + sessionStorage.clear(); + clearAllParticipantTokens(); project.current = { id: "p-1", is_ai_available: true, @@ -114,3 +121,9 @@ it("shows the not-taking-recordings page under the portal logo", () => { expect(header.contains(screen.getByTestId("logo"))).toBe(true); expect(screen.queryByTestId("onboarding")).toBeNull(); }); + +it("clears leftover participant tokens when starting a new session", () => { + setParticipantToken("c-previous", "p1.old.sig"); + renderStart("/p-1/start?mode=text"); + expect(getParticipantToken("c-previous")).toBeNull(); +}); diff --git a/dembrane/frontend/src/portal/routes/ParticipantStart.tsx b/dembrane/frontend/src/portal/routes/ParticipantStart.tsx index c3dcda6f6..2882ac92f 100644 --- a/dembrane/frontend/src/portal/routes/ParticipantStart.tsx +++ b/dembrane/frontend/src/portal/routes/ParticipantStart.tsx @@ -9,6 +9,7 @@ import DembraneLoadingSpinner from "@/components/common/DembraneLoadingSpinner"; import { Logo } from "@/components/common/Logo"; import { ENABLE_MONITOR } from "@/config"; import { useVisitorBeacon } from "@/hooks/useVisitorBeacon"; +import { clearAllParticipantTokens } from "@/lib/participantToken"; import { testId } from "@/lib/testUtils"; import { NotTakingRecordings } from "@/portal/components/NotTakingRecordings"; import { resolvePortalMode } from "@/portal/components/recordingCap"; @@ -26,6 +27,10 @@ export const ParticipantStartRoute = () => { const { projectId } = useParams<{ projectId: string }>(); const [searchParams] = useSearchParams(); + useEffect(() => { + clearAllParticipantTokens(); + }, []); + // One visitor beacon for the whole portal onboarding, owned here so it // fires "scanned" the moment the QR link opens — before the project even // loads and before the onboarding deck mounts. The deck reports its finer From 546edc8fd0319598c7dc4a746e1ad548c1d2c8e7 Mon Sep 17 00:00:00 2001 From: Usama Date: Wed, 2 Dec 2026 17:36:25 +0500 Subject: [PATCH 5/6] fix(portal): retry a rejected participant token once without it; keep it on finish - A participant.token_invalid answer clears the stored token and resends the call once without it (the server checks the token before doing anything), so a chunk upload is not lost. The retry logs a warning. - Only participant.token_invalid counts as a rejection; other 403s keep the token. - The finish screen keeps the token while open (report sign-up, the landscape step) and clears it on leaving, deferred so StrictMode's dev remount does not count; /start still clears every token. - Verify helpers take the conversation id as a required string. --- dembrane/frontend/src/lib/api.ts | 37 +++++-- .../frontend/src/lib/participantToken.test.ts | 101 +++++++++++++++++- dembrane/frontend/src/lib/participantToken.ts | 4 +- dembrane/frontend/src/locales/cs-CZ.po | 34 +++--- dembrane/frontend/src/locales/de-DE.po | 34 +++--- dembrane/frontend/src/locales/en-US.po | 34 +++--- dembrane/frontend/src/locales/es-ES.po | 34 +++--- dembrane/frontend/src/locales/fr-FR.po | 34 +++--- dembrane/frontend/src/locales/it-IT.po | 34 +++--- dembrane/frontend/src/locales/nl-NL.po | 34 +++--- dembrane/frontend/src/locales/uk-UA.po | 34 +++--- .../ParticipantPostConversation.test.tsx | 37 +++++-- .../routes/ParticipantPostConversation.tsx | 33 +++--- 13 files changed, 303 insertions(+), 181 deletions(-) diff --git a/dembrane/frontend/src/lib/api.ts b/dembrane/frontend/src/lib/api.ts index 4d5e99080..84841cb25 100644 --- a/dembrane/frontend/src/lib/api.ts +++ b/dembrane/frontend/src/lib/api.ts @@ -2,7 +2,11 @@ import { i18n } from "@lingui/core"; import { t } from "@lingui/core/macro"; -import axios, { type AxiosError, type CreateAxiosDefaults } from "axios"; +import axios, { + type AxiosError, + type CreateAxiosDefaults, + type InternalAxiosRequestConfig, +} from "axios"; import { toast } from "@/components/common/Toaster"; import { VOICE_TRANSCRIBE_TIMEOUT_MS } from "@/components/voice/voiceInput"; import { API_BASE_URL } from "@/config"; @@ -45,13 +49,24 @@ apiNoAuth.interceptors.response.use( return response.data; }, (error) => { - if (isParticipantTokenRejection(error)) { - const sentToken = readResponseHeader( - (error as AxiosError)?.config?.headers, - PARTICIPANT_TOKEN_HEADER, - ); - if (sentToken) { - clearParticipantTokenValue(sentToken); + const config = (error as AxiosError)?.config as + | (InternalAxiosRequestConfig & { tokenRetried?: boolean }) + | undefined; + const sentToken = readResponseHeader( + config?.headers, + PARTICIPANT_TOKEN_HEADER, + ); + if (sentToken && isParticipantTokenRejection(error)) { + clearParticipantTokenValue(sentToken); + // The server checks the token before it does anything, so the rejected call did + // nothing: once more without it keeps a recording's chunk instead of losing it. + if (config && !config.tokenRetried) { + console.warn( + `[participant token] rejected on ${config.method?.toUpperCase()} ${config.url}; retrying without it`, + ); + config.headers.delete(PARTICIPANT_TOKEN_HEADER); + const retry: typeof config = { ...config, tokenRetried: true }; + return apiNoAuth.request(retry); } } // Start loading the error messages now, so the screen that shows this error has @@ -1720,7 +1735,7 @@ export const generateVerificationArtefact = async (payload: { export type UpdateVerificationArtefactPayload = { artifactId: string; - conversationId?: string; + conversationId: string; useConversation?: { conversationId: string; timestamp: string; @@ -1748,7 +1763,7 @@ export const updateVerificationArtefact = async ({ } : undefined, }, - participantTokenConfig(conversationId ?? useConversation?.conversationId), + participantTokenConfig(conversationId), ); return response; }; @@ -1762,7 +1777,7 @@ export const getVerificationArtefacts = async (conversationId: string) => { export const getVerificationArtefactById = async ( artifactId: string, - conversationId?: string, + conversationId: string, ) => { return apiNoAuth.get( `/verify/artifact/${artifactId}`, diff --git a/dembrane/frontend/src/lib/participantToken.test.ts b/dembrane/frontend/src/lib/participantToken.test.ts index 9019f5876..58402b494 100644 --- a/dembrane/frontend/src/lib/participantToken.test.ts +++ b/dembrane/frontend/src/lib/participantToken.test.ts @@ -256,7 +256,7 @@ describe("apiNoAuth participant token plumbing", () => { ).toBe("p1.c1.sig"); }); - it("clears a stored token when a portal call gets a 403 participant.token_invalid error", async () => { + it("on participant.token_invalid clears the token and sends the call once more without it", async () => { setParticipantToken("c-stale", "p1.stale.sig"); setParticipantToken("c-fresh", "p1.fresh.sig"); @@ -292,17 +292,108 @@ describe("apiNoAuth participant token plumbing", () => { }); apiNoAuth.defaults.adapter = adapter; + // The caller gets the answer of the retry, not the rejection. await expect( getParticipantConversationById("p-1", "c-stale"), - ).rejects.toThrow(); + ).resolves.toEqual({ id: "c-stale" }); + expect(sentOnRetry).toEqual(["p1.stale.sig", undefined]); // Stale token was cleared; other conversations' tokens remain untouched. expect(getParticipantToken("c-stale")).toBeNull(); expect(getParticipantToken("c-fresh")).toBe("p1.fresh.sig"); + }); - // Subsequent retry sends no stale token. - await getParticipantConversationById("p-1", "c-stale"); - expect(sentOnRetry).toEqual(["p1.stale.sig", undefined]); + it("a chunk upload rejected for its token is not lost", async () => { + setParticipantToken("c-1", "p1.rotated.sig"); + const calls: Array = []; + apiNoAuth.defaults.adapter = vi.fn(async (config) => { + const token = config.headers.get(PARTICIPANT_TOKEN_HEADER)?.toString(); + calls.push(token); + if (token) { + throw new AxiosError( + "Forbidden", + "ERR_BAD_REQUEST", + config, + {}, + { + config, + data: { code: "participant.token_invalid" }, + headers: {}, + status: 403, + statusText: "Forbidden", + }, + ); + } + return { + config, + data: { chunk_id: "chunk-1" }, + headers: {}, + status: 200, + statusText: "OK", + }; + }); + + await expect( + confirmConversationChunkUpload({ + chunk_id: "chunk-1", + conversationId: "c-1", + file_url: "https://s3/x", + source: "PORTAL_AUDIO", + timestamp: "2026-11-30T10:00:00Z", + }), + ).resolves.toBeDefined(); + expect(calls).toEqual(["p1.rotated.sig", undefined]); + }); + + it("retries a token rejection only once", async () => { + setParticipantToken("c-1", "p1.bad.sig"); + const adapter = vi.fn(async (config) => { + throw new AxiosError( + "Forbidden", + "ERR_BAD_REQUEST", + config, + {}, + { + config, + data: { code: "participant.token_invalid" }, + headers: {}, + status: 403, + statusText: "Forbidden", + }, + ); + }); + apiNoAuth.defaults.adapter = adapter; + + await expect( + getParticipantConversationById("p-1", "c-1"), + ).rejects.toThrow(); + expect(adapter).toHaveBeenCalledTimes(2); + }); + + it("keeps the token and does not retry on a 403 without a code", async () => { + setParticipantToken("c-1", "p1.valid.sig"); + const adapter = vi.fn(async (config) => { + throw new AxiosError( + "Forbidden", + "ERR_BAD_REQUEST", + config, + {}, + { + config, + data: "Forbidden", + headers: {}, + status: 403, + statusText: "Forbidden", + }, + ); + }); + apiNoAuth.defaults.adapter = adapter; + + await expect( + getParticipantConversationById("p-1", "c-1"), + ).rejects.toThrow(); + expect(adapter).toHaveBeenCalledTimes(1); + expect(getParticipantToken("c-1")).toBe("p1.valid.sig"); }); it("keeps the stored token on unrelated 403 errors", async () => { diff --git a/dembrane/frontend/src/lib/participantToken.ts b/dembrane/frontend/src/lib/participantToken.ts index 09da574cd..d7b4935b5 100644 --- a/dembrane/frontend/src/lib/participantToken.ts +++ b/dembrane/frontend/src/lib/participantToken.ts @@ -142,12 +142,12 @@ export const readResponseHeader = ( }; /** - * Matches a 403 participant token rejection from either axios or a useChat stream. + * Matches the server's participant.token_invalid from either axios or a useChat stream. + * Other 403s (a closed project, a Verify switched off) say nothing about the token. */ export const isParticipantTokenRejection = (err: unknown): boolean => { const parsed = readApiError(err); if (parsed.code === "participant.token_invalid") return true; - if (parsed.status === 403 && parsed.code === null) return true; if (err instanceof Error) { try { return JSON.parse(err.message)?.code === "participant.token_invalid"; diff --git a/dembrane/frontend/src/locales/cs-CZ.po b/dembrane/frontend/src/locales/cs-CZ.po index ae272645d..6c2673f85 100644 --- a/dembrane/frontend/src/locales/cs-CZ.po +++ b/dembrane/frontend/src/locales/cs-CZ.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} souborů se nepodařilo nahrát. Zkuste to znovu." @@ -1529,7 +1529,7 @@ msgstr "Aktivita" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Přidáno lidí: {granted}" msgid "Added by a host" msgstr "Přidal hostitel" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Všech {0} souborů bylo úspěšně nahráno" @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Plánujete dembrane používat ve zdravotnictví, školství, náboru, správě kritické infrastruktury, vymáhání práva nebo justici?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Email verification | dembrane" msgid "error.action.contact_admin" msgstr "Napište svému správci" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Nahrát hlasovou zprávu" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Odebrat přístup" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Odebrat e-mail" @@ -14247,7 +14247,7 @@ msgstr "Sdílet s celým pracovním prostorem" msgid "Share with workspace" msgstr "Sdílet s pracovním prostorem" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Zobrazte popcorn až ve třech dalších jazycích najednou." msgid "Show projects" msgstr "Show projects" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Zobrazit QR kód" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Silné heslo" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Textové příspěvky a navazující formuláře." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Thank you!" @@ -16207,7 +16207,7 @@ msgstr "Toto nasazení zobrazuje až {applied} hran." msgid "This deployment shows up to {applied} nodes." msgstr "Toto nasazení zobrazuje až {applied} uzlů." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -18148,7 +18148,7 @@ msgstr "Nastavíme projekt, budeme vám v den akce po boku a pomůžeme s násle msgid "We still couldn't charge your method. Update it and try again." msgstr "Platbu se stále nepodařilo strhnout. Aktualizujte platební metodu a zkuste to znovu." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19415,7 +19415,7 @@ msgstr "Vaše nahrávka, {0}" #~ msgid "Your request is in." #~ msgstr "Vaše žádost byla přijata." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Vaše odpověď byla zaznamenána. Tuto kartu můžete zavřít. Můžete také sdílet QR kód, aby mohli přispět i ostatní, nebo nahrát další rozhovor." diff --git a/dembrane/frontend/src/locales/de-DE.po b/dembrane/frontend/src/locales/de-DE.po index ec0d218fe..18e49c2b9 100644 --- a/dembrane/frontend/src/locales/de-DE.po +++ b/dembrane/frontend/src/locales/de-DE.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} gelöscht" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} Datei(en) konnten nicht hochgeladen werden. Versuche es erneut." @@ -1529,7 +1529,7 @@ msgstr "Aktivität" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} Personen hinzugefügt" msgid "Added by a host" msgstr "Von einem Host hinzugefügt" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Hinzugefügte E-Mails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alle" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} Datei(en) erfolgreich hochgeladen" @@ -5405,7 +5405,7 @@ msgstr "Benötige ich dies?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Planst du, dembrane im Gesundheitswesen, in der Bildung, Personalbeschaffung, bei kritischen Infrastrukturen, bei Strafverfolgung oder Justiz einzusetzen?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Möchtest du auf dem Laufenden bleiben?" @@ -5822,7 +5822,7 @@ msgstr "E-Mail-Bestätigung | dembrane" msgid "error.action.contact_admin" msgstr "E-Mail an deinen Administrator" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Bitte überprüfe deine Eingaben auf Fehler." msgid "Please enable participation to enable sharing" msgstr "Bitte aktiviere die Teilnahme, um das Teilen zu ermöglichen" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Bitte gib eine gültige E-Mail-Adresse ein." @@ -12370,7 +12370,7 @@ msgstr "Aufnehmen" msgid "Record a voice message" msgstr "Sprachnachricht aufnehmen" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Ein weiteres Gespräch aufnehmen" @@ -12651,7 +12651,7 @@ msgstr "Zugriff entfernen" msgid "Remove avatar" msgstr "Profilbild entfernen" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "E-Mail entfernen" @@ -14247,7 +14247,7 @@ msgstr "Mit gesamtem Workspace teilen" msgid "Share with workspace" msgstr "Für Arbeitsbereich freigeben" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Teile hier deine Daten" @@ -14429,7 +14429,7 @@ msgstr "Zeige Popcorn in bis zu drei zusätzlichen Sprachen gleichzeitig." msgid "Show projects" msgstr "Projekte anzeigen" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "QR-Code anzeigen" @@ -15085,7 +15085,7 @@ msgstr "Strategische Planung" msgid "Strong password" msgstr "Sicheres Passwort" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Absenden" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Textbeiträge und Formulare zur Nachbereitung." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Vielen Dank für deine Teilnahme!" #~ msgid "Thank You Page Content" #~ msgstr "Danke-Seite Inhalt" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Vielen Dank!" @@ -16208,7 +16208,7 @@ msgstr "Diese Bereitstellung zeigt bis zu {applied} Kanten." msgid "This deployment shows up to {applied} nodes." msgstr "Diese Bereitstellung zeigt bis zu {applied} Knoten." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "Diese E-Mail ist bereits in der Liste." @@ -18148,7 +18148,7 @@ msgstr "Wir richten das Projekt ein, stehen dir am Tag der Veranstaltung zur Sei msgid "We still couldn't charge your method. Update it and try again." msgstr "Deine Zahlungsmethode konnte noch immer nicht belastet werden. Bitte aktualisiere sie und versuche es erneut." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Wir werden dir nur eine Nachricht senden, wenn dein Gastgeber einen Bericht erstellt. Wir geben deine Daten niemals an Dritte weiter. Du kannst dich jederzeit abmelden." @@ -19415,7 +19415,7 @@ msgstr "Deine Aufnahme, {0}" #~ msgid "Your request is in." #~ msgstr "Ihre Anfrage ist eingegangen." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Deine Antwort wurde aufgezeichnet. Du kannst diesen Tab jetzt schließen. Du kannst auch den QR-Code teilen, damit andere beitragen können, oder ein weiteres Gespräch aufnehmen." diff --git a/dembrane/frontend/src/locales/en-US.po b/dembrane/frontend/src/locales/en-US.po index 6928b2301..5960acfce 100644 --- a/dembrane/frontend/src/locales/en-US.po +++ b/dembrane/frontend/src/locales/en-US.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} deleted" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} file(s) failed to upload. Try those again." @@ -1529,7 +1529,7 @@ msgstr "Activity" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Added {granted} people" msgid "Added by a host" msgstr "Added by a host" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "All {0} file(s) uploaded successfully" @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Email verification | dembrane" msgid "error.action.contact_admin" msgstr "Email your admin" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Record a voice message" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Remove access" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Remove email" @@ -14247,7 +14247,7 @@ msgstr "Share with whole workspace" msgid "Share with workspace" msgstr "Share with workspace" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Show popcorn in up to three extra languages at once." msgid "Show projects" msgstr "Show projects" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Show QR code" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Strong password" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Text contributions and follow-up forms." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Thank you!" @@ -16207,7 +16207,7 @@ msgstr "This deployment shows up to {applied} edges." msgid "This deployment shows up to {applied} nodes." msgstr "This deployment shows up to {applied} nodes." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -18148,7 +18148,7 @@ msgstr "We set up the project, stand beside you on the day, and help write the r msgid "We still couldn't charge your method. Update it and try again." msgstr "We still couldn't charge your method. Update it and try again." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19415,7 +19415,7 @@ msgstr "Your recording, {0}" #~ msgid "Your request is in." #~ msgstr "Your request is in." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." diff --git a/dembrane/frontend/src/locales/es-ES.po b/dembrane/frontend/src/locales/es-ES.po index 2558ecf7d..b22dbe7e9 100644 --- a/dembrane/frontend/src/locales/es-ES.po +++ b/dembrane/frontend/src/locales/es-ES.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminadas" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "Error al subir {0} archivo(s). Vuelve a intentarlo." @@ -1529,7 +1529,7 @@ msgstr "Actividad" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} personas añadidas" msgid "Added by a host" msgstr "Añadido por un host" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "E-mails añadidos" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Todo" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Los {0} archivo(s) se subieron correctamente" @@ -5405,7 +5405,7 @@ msgstr "¿Necesito esto?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "¿Planeas usar dembrane en contextos de salud, educación, selección de personal, gestión de infraestructuras críticas, orden público o justicia?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "¿Quieres estar en el bucle?" @@ -5822,7 +5822,7 @@ msgstr "Verificación de correo | dembrane" msgid "error.action.contact_admin" msgstr "Escribe a tu administrador" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@trabajo.com" @@ -11425,7 +11425,7 @@ msgstr "Por favor, revisa tus entradas para errores." msgid "Please enable participation to enable sharing" msgstr "Por favor, habilite la participación para habilitar el uso compartido" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Por favor, ingrese un correo electrónico válido." @@ -12370,7 +12370,7 @@ msgstr "Grabar" msgid "Record a voice message" msgstr "Grabar un mensaje de voz" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Registrar otra conversación" @@ -12651,7 +12651,7 @@ msgstr "Quitar acceso" msgid "Remove avatar" msgstr "Eliminar avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Eliminar correo electrónico" @@ -14247,7 +14247,7 @@ msgstr "Compartir con todo el espacio de trabajo" msgid "Share with workspace" msgstr "Compartir con el espacio de trabajo" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Comparte tus detalles aquí" @@ -14429,7 +14429,7 @@ msgstr "Muestra popcorn en hasta tres idiomas adicionales a la vez." msgid "Show projects" msgstr "Mostrar proyectos" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Mostrar código QR" @@ -15085,7 +15085,7 @@ msgstr "Planificación Estratégica" msgid "Strong password" msgstr "Contraseña segura" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Enviar" @@ -15479,14 +15479,14 @@ msgstr "Texto" msgid "Text contributions and follow-up forms." msgstr "Aportaciones de texto y formularios de seguimiento." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "¡Gracias por participar!" #~ msgid "Thank You Page Content" #~ msgstr "Contenido de la Página de Gracias" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "¡Gracias!" @@ -16208,7 +16208,7 @@ msgstr "Este despliegue muestra hasta {applied} conexiones." msgid "This deployment shows up to {applied} nodes." msgstr "Este despliegue muestra hasta {applied} nodos." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "Este correo electrónico ya está en la lista." @@ -18150,7 +18150,7 @@ msgstr "Configuramos el proyecto, te acompañamos el día del evento y te ayudam msgid "We still couldn't charge your method. Update it and try again." msgstr "Seguimos sin poder cobrar a tu método de pago. Actualízalo e inténtalo de nuevo." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Solo te enviaremos un mensaje si tu host genera un informe, nunca compartimos tus detalles con nadie. Puedes optar por no recibir más mensajes en cualquier momento." @@ -19417,7 +19417,7 @@ msgstr "Tu grabación, {0}" #~ msgid "Your request is in." #~ msgstr "Hemos recibido tu solicitud." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Tu respuesta ha sido registrada. Puedes cerrar esta pestaña ahora. También puedes compartir el código QR para que otras personas puedan contribuir, o registrar otra conversación." diff --git a/dembrane/frontend/src/locales/fr-FR.po b/dembrane/frontend/src/locales/fr-FR.po index 49c1dcd28..74937951b 100644 --- a/dembrane/frontend/src/locales/fr-FR.po +++ b/dembrane/frontend/src/locales/fr-FR.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} supprimé(s)" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "Échec de l'importation de {0} fichier(s). Veuillez réessayer." @@ -1529,7 +1529,7 @@ msgstr "Activité" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} personnes ajoutées" msgid "Added by a host" msgstr "Ajouté par un hôte" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "E-mails ajoutés" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Tout" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Les {0} fichier(s) ont bien été importés" @@ -5405,7 +5405,7 @@ msgstr "Dois-je avoir cela ?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Prévoyez-vous d'utiliser dembrane dans les domaines de la santé, de l'éducation, du recrutement, de la gestion d'infrastructures critiques, du maintien de l'ordre ou de la justice ?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Voulez-vous rester dans la boucle ?" @@ -5822,7 +5822,7 @@ msgstr "Vérification de l'adresse e-mail | dembrane" msgid "error.action.contact_admin" msgstr "Envoyer un e-mail à votre administrateur" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@travail.com" @@ -11425,7 +11425,7 @@ msgstr "Veuillez vérifier vos entrées pour les erreurs." msgid "Please enable participation to enable sharing" msgstr "Veuillez activer la participation pour activer le partage" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Veuillez entrer une adresse e-mail valide." @@ -12370,7 +12370,7 @@ msgstr "Enregistrer" msgid "Record a voice message" msgstr "Enregistrer un message vocal" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Enregistrer une autre conversation" @@ -12651,7 +12651,7 @@ msgstr "Retirer l'accès" msgid "Remove avatar" msgstr "Supprimer l'avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Supprimer l'e-mail" @@ -14247,7 +14247,7 @@ msgstr "Partager avec tout l'espace de travail" msgid "Share with workspace" msgstr "Partager avec l'espace de travail" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Partager vos informations ici" @@ -14429,7 +14429,7 @@ msgstr "Affichez le popcorn dans jusqu'à trois langues supplémentaires à la f msgid "Show projects" msgstr "Afficher les projets" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Afficher le QR code" @@ -15085,7 +15085,7 @@ msgstr "Planification Stratégique" msgid "Strong password" msgstr "Mot de passe robuste" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Soumettre" @@ -15479,14 +15479,14 @@ msgstr "Texte" msgid "Text contributions and follow-up forms." msgstr "Des contributions écrites et des formulaires de suivi." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Merci pour votre participation !" #~ msgid "Thank You Page Content" #~ msgstr "Contenu de la page Merci" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Merci !" @@ -16208,7 +16208,7 @@ msgstr "Ce déploiement affiche jusqu'à {applied} liens." msgid "This deployment shows up to {applied} nodes." msgstr "Ce déploiement affiche jusqu'à {applied} nœuds." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "Cette e-mail est déjà dans la liste." @@ -18147,7 +18147,7 @@ msgstr "Nous configurons le projet, vous accompagnons le jour J et vous aidons e msgid "We still couldn't charge your method. Update it and try again." msgstr "Impossible de débiter votre moyen de paiement. Mettez-le à jour et réessayez." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "Nous vous envoyerons un message uniquement si votre hôte génère un rapport, nous ne partageons jamais vos informations avec personne. Vous pouvez vous désinscrire à tout moment." @@ -19414,7 +19414,7 @@ msgstr "Votre enregistrement, {0}" #~ msgid "Your request is in." #~ msgstr "Votre demande a bien été envoyée." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Votre réponse a été enregistrée. Vous pouvez maintenant fermer cette page. Vous pouvez également partager le code QR pour que d'autres puissent contribuer, ou enregistrer une autre conversation." diff --git a/dembrane/frontend/src/locales/it-IT.po b/dembrane/frontend/src/locales/it-IT.po index 6c2037360..6be33d255 100644 --- a/dembrane/frontend/src/locales/it-IT.po +++ b/dembrane/frontend/src/locales/it-IT.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} eliminati" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "Impossibile caricare {0} file. Riprova." @@ -1529,7 +1529,7 @@ msgstr "Attività" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} persone aggiunte" msgid "Added by a host" msgstr "Aggiunto da un host" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Tutti i {0} file caricati con successo" @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Hai intenzione di usare dembrane in contesti sanitari, educativi, di selezione del personale, gestione di infrastrutture critiche, ordine pubblico o giustizia?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Verifica email | dembrane" msgid "error.action.contact_admin" msgstr "Invia un'email al tuo amministratore" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Registra un messaggio vocale" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Rimuovi accesso" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Rimuovi email" @@ -14247,7 +14247,7 @@ msgstr "Condividi con tutto il workspace" msgid "Share with workspace" msgstr "Condividi con lo spazio di lavoro" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Mostra il popcorn in un massimo di tre lingue aggiuntive contemporaneame msgid "Show projects" msgstr "Mostra progetti" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Mostra il codice QR" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Password efficace" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Contributi scritti e moduli dopo la conversazione." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Thank you!" @@ -16208,7 +16208,7 @@ msgstr "Questa distribuzione mostra fino a {applied} collegamenti." msgid "This deployment shows up to {applied} nodes." msgstr "Questa distribuzione mostra fino a {applied} nodi." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -18150,7 +18150,7 @@ msgstr "Configuriamo il progetto, siamo al tuo fianco il giorno dell'evento e ti msgid "We still couldn't charge your method. Update it and try again." msgstr "Non siamo ancora riusciti ad addebitare il tuo metodo. Aggiornalo e riprova." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19417,7 +19417,7 @@ msgstr "La tua registrazione, {0}" #~ msgid "Your request is in." #~ msgstr "La tua richiesta è stata ricevuta." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "La tua risposta è stata registrata. Ora puoi chiudere questa scheda. Puoi anche condividere il codice QR così che altri possano contribuire, o registrare un'altra conversazione." diff --git a/dembrane/frontend/src/locales/nl-NL.po b/dembrane/frontend/src/locales/nl-NL.po index a326de7a6..2eee4307c 100644 --- a/dembrane/frontend/src/locales/nl-NL.po +++ b/dembrane/frontend/src/locales/nl-NL.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "{0} verwijderd" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "{0} bestand(en) uploaden mislukt. Probeer die opnieuw." @@ -1529,7 +1529,7 @@ msgstr "Activiteit" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "{granted} mensen toegevoegd" msgid "Added by a host" msgstr "Toegevoegd door een host" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Toegevoegde e-mails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "Alles" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Alle {0} bestand(en) succesvol geüpload" @@ -5402,7 +5402,7 @@ msgstr "Ben ik dit nodig?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Ben je van plan dembrane te gebruiken in de zorg, het onderwijs, werving, het beheer van kritieke infrastructuur, rechtshandhaving of de rechtspraak?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Wil je op de hoogte blijven?" @@ -5819,7 +5819,7 @@ msgstr "E-mailverificatie | dembrane" msgid "error.action.contact_admin" msgstr "E-mail je beheerder" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@werk.com" @@ -11422,7 +11422,7 @@ msgstr "Controleer uw invoer voor fouten." msgid "Please enable participation to enable sharing" msgstr "Schakel deelneming in om delen mogelijk te maken" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Voer een geldig e-mailadres in." @@ -12367,7 +12367,7 @@ msgstr "Opname starten" msgid "Record a voice message" msgstr "Spraakbericht opnemen" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Neem nog een gesprek op" @@ -12648,7 +12648,7 @@ msgstr "Toegang intrekken" msgid "Remove avatar" msgstr "Avatar verwijderen" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "E-mail verwijderen" @@ -14244,7 +14244,7 @@ msgstr "Delen met hele werkruimte" msgid "Share with workspace" msgstr "Deel met werkruimte" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Deel je gegevens hier" @@ -14426,7 +14426,7 @@ msgstr "Toon popcorn in maximaal drie extra talen tegelijk." msgid "Show projects" msgstr "Toon projecten" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "QR-code tonen" @@ -15082,7 +15082,7 @@ msgstr "Strategische Planning" msgid "Strong password" msgstr "Sterk wachtwoord" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Stuur in" @@ -15476,14 +15476,14 @@ msgstr "Tekst" msgid "Text contributions and follow-up forms." msgstr "Tekstbijdragen en vervolgformulieren." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Dank je wel voor je deelname!" #~ msgid "Thank You Page Content" #~ msgstr "Bedankt pagina inhoud" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Bedankt!" @@ -16204,7 +16204,7 @@ msgstr "Deze implementatie toont maximaal {applied} randen." msgid "This deployment shows up to {applied} nodes." msgstr "Deze implementatie toont maximaal {applied} knooppunten." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "Deze e-mail is al in de lijst." @@ -18143,7 +18143,7 @@ msgstr "We zetten samen het project op, draaien op de dag zelf met je mee en hel msgid "We still couldn't charge your method. Update it and try again." msgstr "We konden je methode nog steeds niet belasten. Werk deze bij en probeer het opnieuw." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We sturen u alleen een bericht als uw gastgever een rapport genereert, we delen uw gegevens niet met iemand. U kunt op elk moment afmelden." @@ -19410,7 +19410,7 @@ msgstr "Je opname, {0}" #~ msgid "Your request is in." #~ msgstr "Je aanvraag is binnen." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Je antwoord is opgeslagen. Je kunt dit tabblad sluiten. Je kunt ook de QR-code delen zodat anderen kunnen bijdragen, of nog een gesprek opnemen." diff --git a/dembrane/frontend/src/locales/uk-UA.po b/dembrane/frontend/src/locales/uk-UA.po index 4c0cbd73d..f0434bf36 100644 --- a/dembrane/frontend/src/locales/uk-UA.po +++ b/dembrane/frontend/src/locales/uk-UA.po @@ -422,7 +422,7 @@ msgid "{0} deleted" msgstr "Видалено: {0}" #. placeholder {0}: failed.length -#: src/lib/api.ts:672 +#: src/lib/api.ts:687 msgid "{0} file(s) failed to upload. Try those again." msgstr "Не вдалося завантажити {0} файл(ів). Спробуйте ще раз." @@ -1529,7 +1529,7 @@ msgstr "Активність" #: src/routes/organisation/OrganisationRoute.tsx:2106 #: src/routes/organisation/OrganisationRoute.tsx:2119 #: src/routes/organisation/OrganisationRoute.tsx:2142 -#: src/portal/routes/ParticipantPostConversation.tsx:223 +#: src/portal/routes/ParticipantPostConversation.tsx:220 #: src/components/chat/TagsUpdateSuggestionCard.tsx:185 #: src/components/billing/BillingManager.tsx:1392 msgid "Add" @@ -1742,7 +1742,7 @@ msgstr "Додано {granted} користувачів" msgid "Added by a host" msgstr "Додано ведучим" -#: src/portal/routes/ParticipantPostConversation.tsx:232 +#: src/portal/routes/ParticipantPostConversation.tsx:229 msgid "Added emails" msgstr "Added emails" @@ -1964,7 +1964,7 @@ msgid "All" msgstr "All" #. placeholder {0}: payload.chunks.length -#: src/lib/api.ts:802 +#: src/lib/api.ts:817 msgid "All {0} file(s) uploaded successfully" msgstr "Усі файли ({0}) успішно завантажено" @@ -5405,7 +5405,7 @@ msgstr "Do I need this?" msgid "Do you plan to use dembrane in health, education, recruitment, critical infrastructure management, law enforcement or justice contexts?" msgstr "Чи плануєте ви використовувати dembrane у сфері охорони здоров’я, освіти, найму персоналу, управління критичною інфраструктурою, правоохоронної діяльності чи правосуддя?" -#: src/portal/routes/ParticipantPostConversation.tsx:198 +#: src/portal/routes/ParticipantPostConversation.tsx:195 msgid "Do you want to stay in the loop?" msgstr "Do you want to stay in the loop?" @@ -5822,7 +5822,7 @@ msgstr "Підтвердження електронної пошти | dembrane" msgid "error.action.contact_admin" msgstr "Написати адміністратору" -#: src/portal/routes/ParticipantPostConversation.tsx:207 +#: src/portal/routes/ParticipantPostConversation.tsx:204 msgid "email@work.com" msgstr "email@work.com" @@ -11425,7 +11425,7 @@ msgstr "Please check your inputs for errors." msgid "Please enable participation to enable sharing" msgstr "Please enable participation to enable sharing" -#: src/portal/routes/ParticipantPostConversation.tsx:116 +#: src/portal/routes/ParticipantPostConversation.tsx:113 msgid "Please enter a valid email." msgstr "Please enter a valid email." @@ -12370,7 +12370,7 @@ msgstr "Record" msgid "Record a voice message" msgstr "Записати голосове повідомлення" -#: src/portal/routes/ParticipantPostConversation.tsx:185 +#: src/portal/routes/ParticipantPostConversation.tsx:182 msgid "Record another conversation" msgstr "Record another conversation" @@ -12651,7 +12651,7 @@ msgstr "Скасувати доступ" msgid "Remove avatar" msgstr "Remove avatar" -#: src/portal/routes/ParticipantPostConversation.tsx:238 +#: src/portal/routes/ParticipantPostConversation.tsx:235 msgid "Remove email" msgstr "Видалити адресу" @@ -14247,7 +14247,7 @@ msgstr "Поділитися з усім робочим простором" msgid "Share with workspace" msgstr "Поділитися з робочим простором" -#: src/portal/routes/ParticipantPostConversation.tsx:201 +#: src/portal/routes/ParticipantPostConversation.tsx:198 msgid "Share your details here" msgstr "Share your details here" @@ -14429,7 +14429,7 @@ msgstr "Показуйте popcorn одночасно ще до трьох мо msgid "Show projects" msgstr "Показати проєкти" -#: src/portal/routes/ParticipantPostConversation.tsx:176 +#: src/portal/routes/ParticipantPostConversation.tsx:173 msgid "Show QR code" msgstr "Показати QR-код" @@ -15085,7 +15085,7 @@ msgstr "Strategic Planning" msgid "Strong password" msgstr "Надійний пароль" -#: src/portal/routes/ParticipantPostConversation.tsx:271 +#: src/portal/routes/ParticipantPostConversation.tsx:268 msgid "Submit" msgstr "Submit" @@ -15479,14 +15479,14 @@ msgstr "Text" msgid "Text contributions and follow-up forms." msgstr "Текстові внески та форми для подальшого зв’язку." -#: src/portal/routes/ParticipantPostConversation.tsx:157 +#: src/portal/routes/ParticipantPostConversation.tsx:154 msgid "Thank you for participating!" msgstr "Thank you for participating!" #~ msgid "Thank You Page Content" #~ msgstr "Thank You Page Content" -#: src/portal/routes/ParticipantPostConversation.tsx:280 +#: src/portal/routes/ParticipantPostConversation.tsx:277 msgid "Thank you!" msgstr "Thank you!" @@ -16208,7 +16208,7 @@ msgstr "У цьому розгортанні показується до {applie msgid "This deployment shows up to {applied} nodes." msgstr "У цьому розгортанні показується до {applied} вузлів." -#: src/portal/routes/ParticipantPostConversation.tsx:112 +#: src/portal/routes/ParticipantPostConversation.tsx:109 msgid "This email is already in the list." msgstr "This email is already in the list." @@ -18150,7 +18150,7 @@ msgstr "Ми налаштовуємо проєкт, підтримуємо ва msgid "We still couldn't charge your method. Update it and try again." msgstr "Усе ще не вдалося списати кошти. Оновіть спосіб оплати та спробуйте знову." -#: src/portal/routes/ParticipantPostConversation.tsx:291 +#: src/portal/routes/ParticipantPostConversation.tsx:288 msgid "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." msgstr "We will only send you a message if your host generates a report, we never share your details with anyone. You can opt out at any time." @@ -19417,7 +19417,7 @@ msgstr "Ваш запис, {0}" #~ msgid "Your request is in." #~ msgstr "Ваш запит надіслано." -#: src/portal/routes/ParticipantPostConversation.tsx:161 +#: src/portal/routes/ParticipantPostConversation.tsx:158 msgid "Your response has been recorded. You may now close this tab. You may also share the QR code so others can contribute, or record another conversation." msgstr "Вашу відповідь записано. Тепер ви можете закрити цю вкладку. Ви також можете поділитися QR-кодом, щоб інші могли долучитися, або записати ще одну розмову." diff --git a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx index d0fccc5a8..47b0a3f0e 100644 --- a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx +++ b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.test.tsx @@ -3,6 +3,7 @@ import { i18n } from "@lingui/core"; import { I18nProvider } from "@lingui/react"; import { MantineProvider } from "@mantine/core"; import { cleanup, render } from "@testing-library/react"; +import { StrictMode } from "react"; import { MemoryRouter, Route, Routes } from "react-router"; import { afterEach, beforeAll, expect, it, vi } from "vitest"; import { @@ -90,18 +91,36 @@ const renderFinish = () => , ); -it("clears the participant token on finish when no email subscription form is shown", () => { +// The finish screen is where a participant still acts on their conversation (report +// sign-up, and the landscape choice that follows), so the token stays while it is open. +it("keeps the participant token on the finish screen and clears it on leaving", async () => { setParticipantToken("c-1", "p1.done.sig"); - renderFinish(); - expect(getParticipantToken("c-1")).toBeNull(); -}); - -it("keeps the token while the finish email form is open and clears it on exit", () => { - projectState.data.default_conversation_ask_for_participant_email = true; - setParticipantToken("c-1", "p1.email.sig"); const view = renderFinish(); - expect(getParticipantToken("c-1")).toBe("p1.email.sig"); + expect(getParticipantToken("c-1")).toBe("p1.done.sig"); view.unmount(); + await new Promise((r) => setTimeout(r, 0)); expect(getParticipantToken("c-1")).toBeNull(); }); + +it("a remount, as StrictMode does in dev, keeps the token", async () => { + setParticipantToken("c-1", "p1.done.sig"); + render( + + + + + + } + /> + + + + + , + ); + await new Promise((r) => setTimeout(r, 0)); + expect(getParticipantToken("c-1")).toBe("p1.done.sig"); +}); diff --git a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx index cddf823bd..5814e0389 100644 --- a/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx +++ b/dembrane/frontend/src/portal/routes/ParticipantPostConversation.tsx @@ -31,6 +31,9 @@ import { ParticipantShareModal } from "@/portal/components/ParticipantShareModal import { useParticipantProjectById } from "@/portal/hooks/useParticipantProjectById"; import { useSubmitNotificationParticipant } from "@/portal/routes/useSubmitNotificationParticipant"; +// Pending token clears per conversation, so a remount of the same one cancels only its own. +const leaving = new Map>(); + export const ParticipantPostConversation = () => { const { projectId, conversationId } = useParams(); const project = useParticipantProjectById(projectId ?? ""); @@ -45,23 +48,20 @@ export const ParticipantPostConversation = () => { const initiateLink = `/${projectId}/start`; - // Keep the token only while the optional report-subscribe form on this screen - // still needs it; clear immediately otherwise and whenever leaving /finish. + // The token serves this screen (report sign-up, the landscape choice) and goes when the + // participant leaves it, so a shared tablet does not carry it on. Deferred, so + // StrictMode's dev remount does not count as leaving. useEffect(() => { if (!conversationId) return; - if ( - project.data && - !project.data.default_conversation_ask_for_participant_email - ) { - clearParticipantToken(conversationId); - } - }, [conversationId, project.data]); - - useEffect(() => { + clearTimeout(leaving.get(conversationId)); return () => { - if (conversationId) { - clearParticipantToken(conversationId); - } + leaving.set( + conversationId, + setTimeout(() => { + leaving.delete(conversationId); + clearParticipantToken(conversationId); + }, 0), + ); }; }, [conversationId]); @@ -83,10 +83,7 @@ export const ParticipantPostConversation = () => { mutate( { conversationId: conversationId ?? "", emails, projectId }, { - onSuccess: () => { - clearParticipantToken(conversationId); - setIsSubmitted(true); - }, + onSuccess: () => setIsSubmitted(true), }, ); }; From f5ef6900cdffde6f131f80fb53124c1f3834dc1d Mon Sep 17 00:00:00 2001 From: Usama Date: Wed, 2 Dec 2026 17:36:31 +0500 Subject: [PATCH 6/6] fix(verify): redact names too in hand edits on anonymised projects The regex pass alone let names through. After it, a fast model call names the personal details left and code replaces exactly those spans (any casing, whole words, capitalised name parts too, never a joining word like van/los/des alone), so the markdown and the rest of the text stay as typed. - Only edited text is checked; approving the unedited draft makes no call. - A failed or non-JSON answer (after one retry) saves nothing: verify.generation_failed. - content is capped at 20,000 characters and the check is rate limited per conversation (20 per 10 minutes), since it runs outside the AI allowance. --- .../src/lib/errors/catalog/verify.gen.ts | 2 +- .../packages/core/src/catalog/verify.ts | 2 +- .../platform/packages/verify/src/routes.ts | 2 +- .../platform/packages/verify/src/service.ts | 134 ++++++++- .../verify/test/manual-edit-redaction.test.ts | 261 +++++++++++++++--- .../test/prompt-privacy.integration.test.ts | 10 +- .../verify/test/verify.integration.test.ts | 9 + 7 files changed, 367 insertions(+), 53 deletions(-) diff --git a/dembrane/frontend/src/lib/errors/catalog/verify.gen.ts b/dembrane/frontend/src/lib/errors/catalog/verify.gen.ts index ecf6e5640..d6e6d06b7 100644 --- a/dembrane/frontend/src/lib/errors/catalog/verify.gen.ts +++ b/dembrane/frontend/src/lib/errors/catalog/verify.gen.ts @@ -52,7 +52,7 @@ export const verify = { action: "retry", detail: "Failed to generate verification artifact", description: - "The model call behind an artefact (made or revised) failed; sent as a 500 with the old text.", + "The model call behind an artefact (made, revised, or a hand edit redacted on an anonymised project) failed; sent as a 500 with the old text.", }, "verify.content_conflict": { action: "fix_input", diff --git a/dembrane/platform/packages/core/src/catalog/verify.ts b/dembrane/platform/packages/core/src/catalog/verify.ts index 01431a0f2..3e92b2b13 100644 --- a/dembrane/platform/packages/core/src/catalog/verify.ts +++ b/dembrane/platform/packages/core/src/catalog/verify.ts @@ -50,7 +50,7 @@ export const verify = { action: "retry", detail: "Failed to generate verification artifact", description: - "The model call behind an artefact (made or revised) failed; sent as a 500 with the old text.", + "The model call behind an artefact (made, revised, or a hand edit redacted on an anonymised project) failed; sent as a 500 with the old text.", }, "verify.content_conflict": { action: "fix_input", diff --git a/dembrane/platform/packages/verify/src/routes.ts b/dembrane/platform/packages/verify/src/routes.ts index a7c621c88..0c7169612 100644 --- a/dembrane/platform/packages/verify/src/routes.ts +++ b/dembrane/platform/packages/verify/src/routes.ts @@ -46,7 +46,7 @@ const useConversation = nested( // ignored by pydantic 2, so approved_at and use_conversation were silently dropped. const updateArtifactBody = model({ useConversation: optional(nullable(useConversation), null), - content: optional(nullable(str()), null), + content: optional(nullable(str({ max: 20_000 })), null), approvedAt: optional(nullable(str()), null), }); diff --git a/dembrane/platform/packages/verify/src/service.ts b/dembrane/platform/packages/verify/src/service.ts index 61ce29d59..8452afab3 100644 --- a/dembrane/platform/packages/verify/src/service.ts +++ b/dembrane/platform/packages/verify/src/service.ts @@ -18,6 +18,7 @@ import { modelErrorShape, speechHint } from "@dembrane/llm"; import { withPayer } from "@dembrane/observability"; import { PROJECT_TEMPLATES } from "@dembrane/projects"; import { renderPrompt } from "@dembrane/prompts"; +import type { Limit } from "@dembrane/ratelimit"; import { regexRedactPii } from "@dembrane/transcription"; import { type FilePart, generateText, type TextPart } from "ai"; import { DEFAULT_TOPIC_KEY, defaultTopicPrompt } from "./defaults"; @@ -603,7 +604,7 @@ export interface VerifiableProject extends VerifyProject { export interface UpdateArtifactCtx { readonly d: Pick< VerifyDeps, - "db" | "audio" | "audioUrls" | "models" | "tokens" | "logger" | "now" + "db" | "audio" | "audioUrls" | "models" | "tokens" | "limiter" | "logger" | "now" >; readonly store: { artifact(id: string): Promise; @@ -639,7 +640,7 @@ export async function updateArtifact( if (!artifact.conversation_id) throw new NotFoundError("conversation.not_found"); const row = await verifiableConversation(ctx, artifact.conversation_id, token); const project = row.project as NonNullable; - // Only a revision calls the model; hand edits and approvals always work. + // Only a revision spends the AI allowance; hand edits and approvals always work. if (body.useConversation) await requirePortalAi(ctx.d.db, project.id, ctx.d.now()); const updates: { content?: string; approved_at?: string } = {}; if (body.approvedAt !== null) updates.approved_at = body.approvedAt; @@ -684,8 +685,13 @@ export async function updateArtifact( project.language || "en", ); } else if (body.content !== null) { + // The stored text is the model's draft or an edit already redacted, so only a change + // needs the check. + const edited = body.content !== (artifact.content ?? "") && body.content.trim() !== ""; updates.content = - project.anonymize_transcripts === true ? regexRedactPii(body.content) : body.content; + edited && project.anonymize_transcripts === true + ? await redactEdit(ctx, artifact.conversation_id, body.content) + : body.content; } if (!Object.keys(updates).length) throw new BadRequestError("request.nothing_to_update", { @@ -700,4 +706,126 @@ export async function updateArtifact( }; } +const EDIT_PII_SYSTEM = `You find personal details in text a participant typed. +Answer with JSON only: {"spans":[{"text":"...","kind":"..."}]} +- "text" is copied exactly from the input, character for character, without the surrounding words. +- "kind" is one of: name, email, phone, address, username, id, iban, card, license_plate. +- Include names of people (first, last or full names), email addresses, phone numbers, street addresses and postcodes, usernames and handles, national ID or passport numbers, IBANs, card numbers and licence plates. +- Leave out names of places, organisations, products and events, job titles, dates, years, amounts and counts. +- Placeholders such as are already safe; leave them out. +- When there are none, answer {"spans":[]}.`; + +export const EDIT_REDACTION_LIMIT: Limit = { + name: "verify.edit_redaction", + capacity: 20, + windowSeconds: 600, +}; + +// Joining words of names (Dutch, German, Spanish, Portuguese, French, Italian, Arabic), +// never redacted on their own: "los" of "Carlos de los Santos" stays elsewhere. +const NAME_PARTICLES = new Set( + ( + "van von der den ter ten het aan uit vom zum zur und " + + "del los las dos das des les une " + + "dei dal dai dall dalla dalle degli delle della dello " + + "bin ibn bint abu" + ).split(" "), +); + +const PLACEHOLDER: Record = { + name: "", + email: "", + phone: "", + address: "", + username: "", + id: "", + iban: "", + card: "", + license_plate: "", +}; + +/** The spans the model named, or null when its answer is not the JSON asked for. */ +function parseSpans(raw: string): { text: string; kind: string }[] | null { + const body = raw + .trim() + .replace(/^```(?:json)?\s*/i, "") + .replace(/```$/, ""); + try { + const spans = (JSON.parse(body) as { spans?: unknown }).spans; + if (!Array.isArray(spans)) return null; + return spans.filter( + (x): x is { text: string; kind: string } => + typeof x?.text === "string" && typeof x?.kind === "string", + ); + } catch { + return null; + } +} + +/** + * A participant's hand edit on an anonymised project: the regex pass transcripts get, then + * the model names the personal details left (names above all) and code replaces exactly + * those, so the markdown and the rest of the words stay as typed. Not gated on the AI + * allowance: privacy is not a feature. Any failure saves nothing, so raw text never lands. + */ +async function redactEdit( + ctx: { readonly d: Pick }, + conversationId: string, + text: string, +): Promise { + // Each check is a model call outside the AI allowance; cap them per conversation. + await ctx.d.limiter.check(EDIT_REDACTION_LIMIT, conversationId); + const fail = () => + new StatusError(500, "verify.generation_failed", { + message: "Failed to redact the edited verification artifact", + }); + let out = regexRedactPii(text); + let spans: { text: string; kind: string }[] | null = null; + for (let attempt = 0; attempt < 2 && spans === null; attempt++) { + try { + const { text: raw } = await withPayer({ ref: "conversation", id: conversationId }, () => + generateText({ + model: ctx.d.models.model("text_fast"), + system: EDIT_PII_SYSTEM, + messages: [{ role: "user", content: [{ type: "text", text: out }] }], + providerOptions: { vertex: { thinkingConfig: { thinkingBudget: 0 } } }, + }), + ); + spans = parseSpans(raw); + } catch (err) { + ctx.d.logger.error({ error: modelErrorShape(err) }, "verify edit redaction failed"); + throw fail(); + } + } + if (spans === null) { + ctx.d.logger.error({ conversationId }, "verify edit redaction answered no JSON"); + throw fail(); + } + // A span in any casing, then each capitalised part of a name ("Jan" of "Jan de Vries") + // in any casing too, but never a joining word alone, so "van" or "los" in a sentence + // stays. Whole words only, longest first. + const swaps: { value: string; placeholder: string }[] = []; + for (const span of spans) { + const value = span.text.trim(); + if (value.length < 2 || /^$/.test(value)) continue; + const placeholder = Object.hasOwn(PLACEHOLDER, span.kind) + ? (PLACEHOLDER[span.kind] as string) + : ""; + swaps.push({ value, placeholder }); + if (span.kind === "name") + // A part written lowercase inside the name is a joining word too. + for (const part of value.split(/\s+/)) + if (part.length >= 3 && /^\p{Lu}/u.test(part) && !NAME_PARTICLES.has(part.toLowerCase())) + swaps.push({ value: part, placeholder }); + } + for (const { value, placeholder } of swaps.sort((a, b) => b.value.length - a.value.length)) { + const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + out = out.replace( + new RegExp(`(? placeholder, + ); + } + return out; +} + export { PARTICIPANT_TOKEN_HEADER }; diff --git a/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts b/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts index 0a00d21d1..c5ba4c1f9 100644 --- a/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts +++ b/dembrane/platform/packages/verify/test/manual-edit-redaction.test.ts @@ -7,6 +7,7 @@ import { AudioUrls, ParticipantTokens } from "@dembrane/conversations"; import { createDb } from "@dembrane/db"; import { fakeModels } from "@dembrane/llm"; import { createLogger } from "@dembrane/observability"; +import { MemoryRateCounter, RateLimiter } from "@dembrane/ratelimit"; import { FilesystemStorage } from "@dembrane/storage"; import { type UpdateArtifactCtx, updateArtifact } from "../src/service"; import type { ArtifactRow } from "../src/storage"; @@ -35,7 +36,25 @@ afterAll(async () => { await database.close(); }); -function setup(anonymizeTranscripts: boolean | null) { +/** A model that names "Jan de Vries" when it is in the text, and records what it read. */ +function namingModel(seen: string[], answer?: (text: string) => string | null) { + return fakeModels({ + text: (prompt) => { + const user = prompt.find((m) => m.role === "user"); + const text = + user && Array.isArray(user.content) + ? user.content.map((c) => ("text" in c ? c.text : "")).join("") + : ""; + seen.push(text); + if (answer) return answer(text); + return JSON.stringify({ + spans: text.includes("Jan de Vries") ? [{ text: "Jan de Vries", kind: "name" }] : [], + }); + }, + }); +} + +function setup(anonymizeTranscripts: boolean | null, models = namingModel([])) { let stored: ArtifactRow = { id: ARTIFACT_ID, conversation_id: CONVERSATION_ID, @@ -56,7 +75,8 @@ function setup(anonymizeTranscripts: boolean | null) { db: database.db, audio, audioUrls: new AudioUrls("http://s3.test", "bucket"), - models: fakeModels({ text: "unused" }), + models, + limiter: new RateLimiter(new MemoryRateCounter()), tokens: new ParticipantTokens("s".repeat(48), false), logger, now: () => new Date("2026-11-30T12:00:00Z"), @@ -105,64 +125,217 @@ function setup(anonymizeTranscripts: boolean | null) { }; } +const EDIT = `Draft for you to correct. + +* Benches along the **Lindenpad**. +* My name is Jan de Vries. ${PII_INPUT} + +Is this right?`; +const EDIT_REDACTED = `Draft for you to correct. + +* Benches along the **Lindenpad**. +* My name is . ${PII_REDACTED} + +Is this right?`; + +const edit = (content: string, approvedAt: string | null = "2026-11-30T12:00:00Z") => ({ + useConversation: null, + content, + approvedAt, +}); + describe("manual Verify artifact edit PII redaction", () => { - test("redacts PII before storing and returning when anonymize_transcripts is true", async () => { - const { ctx, stored, lastWrite } = setup(true); - const result = await updateArtifact( + test("an edit on an anonymised project loses names and contact details, keeps the markdown", async () => { + const seen: string[] = []; + const { ctx, stored, lastWrite } = setup(true, namingModel(seen)); + const result = await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined); + + expect(lastWrite()?.content).toBe(EDIT_REDACTED); + expect(stored().content).toBe(EDIT_REDACTED); + expect(result.content).toBe(EDIT_REDACTED); + // The model reads the text after the regex pass, never the raw contact details. + expect(seen).toHaveLength(1); + expect(seen[0]).not.toContain("jan@example.nl"); + expect(seen[0]).toContain("Jan de Vries"); + }); + + test.each([false, null])("anonymize_transcripts %p keeps the edit as typed", async (flag) => { + const seen: string[] = []; + const { ctx, stored } = setup(flag, namingModel(seen)); + const result = await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT, null), undefined); + + expect(seen).toHaveLength(0); + expect(stored().content).toBe(EDIT); + expect(result.content).toBe(EDIT); + }); + + test("approving the unedited draft makes no model call", async () => { + const seen: string[] = []; + const { ctx, lastWrite } = setup(true, namingModel(seen)); + await updateArtifact(ctx, ARTIFACT_ID, edit("Initial draft"), undefined); + + expect(seen).toHaveLength(0); + expect(lastWrite()).toEqual({ content: "Initial draft", approved_at: "2026-11-30T12:00:00Z" }); + }); + + test("spans the text does not hold, and placeholders, change nothing", async () => { + const answer = () => + JSON.stringify({ + spans: [ + { text: "Piet Jansen", kind: "name" }, + { text: "", kind: "email" }, + { text: "Jan de Vries", kind: "name" }, + ], + }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined); + + expect(stored().content).toBe(EDIT_REDACTED); + }); + + test("other casings, a bare first name and a possessive go too; words that merely contain a span stay", async () => { + const text = + "Jan de Vries said so. Later JAN DE VRIES and jan de vries agreed, and Jan's dog too. vries came, jan stayed. Also Alma."; + const answer = () => + JSON.stringify({ + spans: [ + { text: "Jan de Vries", kind: "name" }, + { text: "Al", kind: "name" }, + ], + }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(text), undefined); + + expect(stored().content).toBe( + " said so. Later and agreed, and 's dog too. came, stayed. Also Alma.", + ); + }); + + test("particles of a name stay when they stand alone", async () => { + const answer = () => JSON.stringify({ spans: [{ text: "Joost van der Berg", kind: "name" }] }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact( ctx, ARTIFACT_ID, - { - useConversation: null, - content: PII_INPUT, - approvedAt: "2026-11-30T12:00:00Z", - }, + edit( + "Joost van der Berg wants a park. Berg says the van der Pek market moved; joost agrees.", + ), undefined, ); - expect(lastWrite()?.content).toBe(PII_REDACTED); - expect(stored().content).toBe(PII_REDACTED); - expect(result.content).toBe(PII_REDACTED); - expect(result.content).not.toContain("jan@example.nl"); - expect(result.content).not.toContain("12345678"); - expect(result.content).not.toContain("87654321"); - expect(result.content).not.toContain("1234 AB"); - expect(result.content).not.toContain("NL91 ABNA"); - expect(result.content).not.toContain("123456789"); + expect(stored().content).toBe( + " wants a park. says the van der Pek market moved; agrees.", + ); }); - test("leaves manual edits unchanged when anonymize_transcripts is false", async () => { - const { ctx, stored, lastWrite } = setup(false); - const result = await updateArtifact( + test.each([ + [ + "Carlos de los Santos", + "Carlos de los Santos lo dijo. Todos los vecinos y santos estuvieron.", + " lo dijo. Todos los vecinos y estuvieron.", + ], + [ + "Pierre des Champs", + "Pierre des Champs parle des parcs. pierre aussi.", + " parle des parcs. aussi.", + ], + [ + "Giovanni dei Medici", + "Giovanni dei Medici e i parchi dei quartieri.", + " e i parchi dei quartieri.", + ], + [ + "Anna von und zu Lichtenstein", + "Anna von und zu Lichtenstein kam und blieb.", + " kam und blieb.", + ], + ])("joining words of %s stay elsewhere in the text", async (name, text, expected) => { + const answer = () => JSON.stringify({ spans: [{ text: name, kind: "name" }] }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(text), undefined); + + expect(stored().content).toBe(expected); + }); + + test("a lowercase part of a name is a joining word, wherever it comes from", async () => { + const answer = () => + JSON.stringify({ spans: [{ text: "Maria da Silva e Souza", kind: "name" }] }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact( ctx, ARTIFACT_ID, - { - useConversation: null, - content: PII_INPUT, - approvedAt: null, - }, + edit("Maria da Silva e Souza falou. Silva concorda e souza também."), undefined, ); - expect(lastWrite()?.content).toBe(PII_INPUT); - expect(stored().content).toBe(PII_INPUT); - expect(result.content).toBe(PII_INPUT); + expect(stored().content).toBe( + " falou. concorda e também.", + ); }); - test("leaves manual edits unchanged when anonymize_transcripts is null", async () => { - const { ctx, stored, lastWrite } = setup(null); - const result = await updateArtifact( - ctx, - ARTIFACT_ID, - { - useConversation: null, - content: PII_INPUT, - approvedAt: null, - }, - undefined, + test("a kind outside the list still redacts, as a name", async () => { + const answer = () => JSON.stringify({ spans: [{ text: "Jan de Vries", kind: "constructor" }] }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined); + + expect(stored().content).toBe(EDIT_REDACTED); + }); + + test("a second answer is used when the first is not JSON", async () => { + let n = 0; + const answer = () => + ++n === 1 + ? "Sure! Here you go" + : JSON.stringify({ spans: [{ text: "Jan de Vries", kind: "name" }] }); + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined); + + expect(n).toBe(2); + expect(stored().content).toBe(EDIT_REDACTED); + }); + + test("edit checks are rate limited per conversation", async () => { + const seen: string[] = []; + const { ctx } = setup(true, namingModel(seen)); + for (let i = 0; i < 20; i++) + await updateArtifact(ctx, ARTIFACT_ID, edit(`${EDIT} ${i}`, null), undefined); + + await expect( + updateArtifact(ctx, ARTIFACT_ID, edit(`${EDIT} again`, null), undefined), + ).rejects.toMatchObject({ code: "rate_limit.exceeded" }); + expect(seen).toHaveLength(20); + }); + + test("a fenced JSON answer is read too", async () => { + const answer = () => '```json\n{"spans":[{"text":"Jan de Vries","kind":"name"}]}\n```'; + const { ctx, stored } = setup(true, namingModel([], answer)); + await updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined); + + expect(stored().content).toBe(EDIT_REDACTED); + }); + + test("a failing model saves nothing and answers verify.generation_failed", async () => { + const { ctx, stored, lastWrite } = setup(true, fakeModels({ fail: new Error("model down") })); + + await expect(updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined)).rejects.toMatchObject({ + status: 500, + code: "verify.generation_failed", + }); + expect(lastWrite()).toBeNull(); + expect(stored().content).toBe("Initial draft"); + }); + + test("an answer that is not the JSON asked for, twice, saves nothing", async () => { + const seen: string[] = []; + const { ctx, lastWrite } = setup( + true, + namingModel(seen, () => "Sorry, I cannot help."), ); - expect(lastWrite()?.content).toBe(PII_INPUT); - expect(stored().content).toBe(PII_INPUT); - expect(result.content).toBe(PII_INPUT); + await expect(updateArtifact(ctx, ARTIFACT_ID, edit(EDIT), undefined)).rejects.toMatchObject({ + code: "verify.generation_failed", + }); + expect(seen).toHaveLength(2); + expect(lastWrite()).toBeNull(); }); }); diff --git a/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts b/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts index 72896e473..0658bb5a6 100644 --- a/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts +++ b/dembrane/platform/packages/verify/test/prompt-privacy.integration.test.ts @@ -84,7 +84,11 @@ run("verify prompt privacy", () => { ok = verifyRoutes({ ...base, models: fakeModels({ - text: "Draft for this table to correct.\n- Benches.\nIs this right?", + // The edit redaction call gets the spans it asks for; every other call a draft. + text: (prompt) => + JSON.stringify(prompt).includes("You find personal details") + ? JSON.stringify({ spans: [{ text: NAME, kind: "name" }] }) + : "Draft for this table to correct.\n- Benches.\nIs this right?", calls: calls as never, }), }); @@ -180,9 +184,9 @@ run("verify prompt privacy", () => { test("manual edits redact PII when anonymize_transcripts is true and keep text when false", async () => { const [artifact] = await sql<{ id: string }[]>` select id from conversation_artifact where conversation_id = ${conversation} limit 1`; - const input = "Mail jan@example.nl or call 06-12345678, postcode 1234 AB."; + const input = `I am ${NAME}.\n\n- Mail jan@example.nl or call 06-12345678, postcode 1234 AB.`; const redacted = - "Mail or call , postcode ."; + "I am .\n\n- Mail or call , postcode ."; await sql`update project set anonymize_transcripts = true where id = ${project}`; try { diff --git a/dembrane/platform/packages/verify/test/verify.integration.test.ts b/dembrane/platform/packages/verify/test/verify.integration.test.ts index 8487e3c97..2c7b46b37 100644 --- a/dembrane/platform/packages/verify/test/verify.integration.test.ts +++ b/dembrane/platform/packages/verify/test/verify.integration.test.ts @@ -157,6 +157,15 @@ run("verify generation against the seed", () => { }); }); + test("an edit longer than 20,000 characters is refused before anything runs", async () => { + const [artifact] = + await sql`select id from conversation_artifact where conversation_id = ${c1} limit 1`; + const asked = prompts.length; + const res = await post(`/api/verify/artifact/${artifact?.id}`, { content: "x".repeat(20_001) }); + expect(res.status).toBe(422); + expect(prompts.length).toBe(asked); + }); + test("revision uses feedback after the timestamp, only on the artifact's own conversation", async () => { const [artifact] = await sql`select id from conversation_artifact where conversation_id = ${c1} limit 1`;