Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion dembrane/frontend/src/lib/api.interceptor.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// @vitest-environment jsdom
import type { AxiosAdapter } from "axios";
import { afterEach, expect, it, vi } from "vitest";
import { api, apiNoAuth, initiateAndUploadConversationChunk } from "./api";
import {
api,
apiNoAuth,
initiateAndUploadConversationChunk,
initiateConversation,
} from "./api";

vi.mock("@/components/common/Toaster", () => ({
toast: Object.assign(vi.fn(), { error: vi.fn(), success: vi.fn() }),
Expand Down Expand Up @@ -53,3 +58,23 @@ it("an upload without a prefix is named after the file alone", async () => {
expect(url).toBe("/participant/projects/p1/conversations/initiate");
expect((body as { name: string }).name).toBe("sofia.mp3");
});

it("initiateConversation includes consent in the request body when provided", async () => {
const post = vi
.spyOn(apiNoAuth, "post")
.mockResolvedValue({ id: "c1" } as never);
await initiateConversation({
consent: { accepted: true, version: "2026-11-30" },
name: "Table 1",
pin: "",
projectId: "p1",
source: "PORTAL_AUDIO",
tagIdList: [],
});
expect(post).toHaveBeenCalledWith(
"/participant/projects/p1/conversations/initiate",
expect.objectContaining({
consent: { accepted: true, version: "2026-11-30" },
}),
);
});
7 changes: 7 additions & 0 deletions dembrane/frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export const cloneProjectById = async ({
});
};

export type InitiateConsentPayload = {
accepted: boolean;
version: string;
};

export const initiateConversation = async (payload: {
projectId: string;
email?: string;
Expand All @@ -174,10 +179,12 @@ export const initiateConversation = async (payload: {
source: string;
tagIdList: string[];
visitorId?: string;
consent?: InitiateConsentPayload;
}) => {
return apiNoAuth.post<unknown, TConversation>(
`/participant/projects/${payload.projectId}/conversations/initiate`,
{
consent: payload.consent,
email: payload.email ?? undefined,
name: payload.name,
pin: payload.pin,
Expand Down
26 changes: 13 additions & 13 deletions dembrane/frontend/src/locales/cs-CZ.po
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ msgid "{0} deleted"
msgstr "{0} deleted"

#. placeholder {0}: failed.length
#: src/lib/api.ts:687
#: src/lib/api.ts:694
msgid "{0} file(s) failed to upload. Try those again."
msgstr "{0} souborů se nepodařilo nahrát. Zkuste to znovu."

Expand Down Expand Up @@ -1555,7 +1555,7 @@ msgstr "Před uložením přidejte cíl projektu."
msgid "Add a subject"
msgstr "Přidejte předmět"

#: src/portal/components/start/ParticipantInitiateForm.tsx:308
#: src/portal/components/start/ParticipantInitiateForm.tsx:316
msgid "Add all that apply"
msgstr "Add all that apply"

Expand Down Expand Up @@ -1905,7 +1905,7 @@ msgid "All"
msgstr "All"

#. placeholder {0}: payload.chunks.length
#: src/lib/api.ts:817
#: src/lib/api.ts:824
msgid "All {0} file(s) uploaded successfully"
msgstr "Všech {0} souborů bylo úspěšně nahráno"

Expand Down Expand Up @@ -2753,7 +2753,7 @@ msgstr "Back"

#. js-lingui-explicit-id
#: src/portal/layout/ParticipantHeader.tsx:94
#: src/portal/components/start/ParticipantOnboardingCards.tsx:438
#: src/portal/components/start/ParticipantOnboardingCards.tsx:463
msgid "participant.button.back"
msgstr "Back"

Expand Down Expand Up @@ -3967,12 +3967,12 @@ msgid "participant.verify.instructions.button.next"
msgstr "Pokračovat"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:456
#: src/portal/components/start/ParticipantOnboardingCards.tsx:481
msgid "participant.button.next"
msgstr "Pokračovat"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantInitiateForm.tsx:345
#: src/portal/components/start/ParticipantInitiateForm.tsx:353
msgid "participant.ready.to.begin.button.text"
msgstr "Continue"

Expand Down Expand Up @@ -6651,7 +6651,7 @@ msgstr "Máte svou odpověď?"
msgid "Grant licenses"
msgstr "Udělit licence"

#: src/portal/components/start/ParticipantInitiateForm.tsx:297
#: src/portal/components/start/ParticipantInitiateForm.tsx:305
msgid "Group 1, Table 3, etc."
msgstr "Skupina 1, Stůl 3 atd."

Expand Down Expand Up @@ -8929,7 +8929,7 @@ msgid "No canvases yet. Ask in chat when you want a live view of the conversatio
msgstr "Zatím žádná plátna. Až budete chtít živý přehled rozhovorů, požádejte v chatu. První plátno zůstane tady."

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:286
#: src/portal/components/start/ParticipantOnboardingCards.tsx:301
msgid "participant.onboarding.no.card"
msgstr "Pro aktuální jazyk a sekci není k dispozici žádná karta."

Expand Down Expand Up @@ -10351,8 +10351,8 @@ msgstr "Placený tarif"
msgid "partially completed"
msgstr "částečně dokončeno"

#: src/portal/components/start/ParticipantInitiateForm.tsx:136
#: src/portal/components/start/ParticipantInitiateForm.tsx:197
#: src/portal/components/start/ParticipantInitiateForm.tsx:142
#: src/portal/components/start/ParticipantInitiateForm.tsx:204
#: src/components/report/ConversationStatusTable.tsx:56
msgid "Participant"
msgstr "Participant"
Expand Down Expand Up @@ -11485,7 +11485,7 @@ msgid "Ready by"
msgstr "Připraveno v"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:346
#: src/portal/components/start/ParticipantOnboardingCards.tsx:371
msgid "participant.ready.to.begin"
msgstr "Připraveni začít?"

Expand Down Expand Up @@ -13146,7 +13146,7 @@ msgstr "Samostatný (klient)"
msgid "Separate with commas, spaces, or new lines."
msgstr "Separate with commas, spaces, or new lines."

#: src/portal/components/start/ParticipantInitiateForm.tsx:291
#: src/portal/components/start/ParticipantInitiateForm.tsx:299
msgid "Session name"
msgstr "Název setkání"

Expand Down Expand Up @@ -14419,7 +14419,7 @@ msgstr "Štítek {0}"
msgid "Tag deleted"
msgstr "Tag deleted"

#: src/portal/components/start/ParticipantInitiateForm.tsx:307
#: src/portal/components/start/ParticipantInitiateForm.tsx:315
#: src/components/project/ProjectTagsInput.tsx:281
#: src/components/map/panels/MapSettingsMenu.tsx:267
#: src/components/conversation/ProjectConversationsPanel.tsx:732
Expand Down
26 changes: 13 additions & 13 deletions dembrane/frontend/src/locales/de-DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ msgid "{0} deleted"
msgstr "{0} gelöscht"

#. placeholder {0}: failed.length
#: src/lib/api.ts:687
#: src/lib/api.ts:694
msgid "{0} file(s) failed to upload. Try those again."
msgstr "{0} Datei(en) konnten nicht hochgeladen werden. Versuche es erneut."

Expand Down Expand Up @@ -1555,7 +1555,7 @@ msgstr "Vor dem Speichern ein Projektziel angeben."
msgid "Add a subject"
msgstr "Betreff hinzufügen"

#: src/portal/components/start/ParticipantInitiateForm.tsx:308
#: src/portal/components/start/ParticipantInitiateForm.tsx:316
msgid "Add all that apply"
msgstr "Alle zutreffenden hinzufügen"

Expand Down Expand Up @@ -1905,7 +1905,7 @@ msgid "All"
msgstr "Alle"

#. placeholder {0}: payload.chunks.length
#: src/lib/api.ts:817
#: src/lib/api.ts:824
msgid "All {0} file(s) uploaded successfully"
msgstr "Alle {0} Datei(en) erfolgreich hochgeladen"

Expand Down Expand Up @@ -2753,7 +2753,7 @@ msgstr "Zurück"

#. js-lingui-explicit-id
#: src/portal/layout/ParticipantHeader.tsx:94
#: src/portal/components/start/ParticipantOnboardingCards.tsx:438
#: src/portal/components/start/ParticipantOnboardingCards.tsx:463
msgid "participant.button.back"
msgstr "Zurück"

Expand Down Expand Up @@ -3967,12 +3967,12 @@ msgid "participant.verify.instructions.button.next"
msgstr "Weiter"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:456
#: src/portal/components/start/ParticipantOnboardingCards.tsx:481
msgid "participant.button.next"
msgstr "Weiter"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantInitiateForm.tsx:345
#: src/portal/components/start/ParticipantInitiateForm.tsx:353
msgid "participant.ready.to.begin.button.text"
msgstr "Weiter"

Expand Down Expand Up @@ -6651,7 +6651,7 @@ msgstr "Haben Sie Ihre Antwort?"
msgid "Grant licenses"
msgstr "Lizenzen vergeben"

#: src/portal/components/start/ParticipantInitiateForm.tsx:297
#: src/portal/components/start/ParticipantInitiateForm.tsx:305
msgid "Group 1, Table 3, etc."
msgstr "Gruppe 1, Tisch 3 usw."

Expand Down Expand Up @@ -8929,7 +8929,7 @@ msgid "No canvases yet. Ask in chat when you want a live view of the conversatio
msgstr "Noch keine Canvases. Frage im Chat, wenn du eine Live-Ansicht der Gespräche wünschst. Das erste Canvas bleibt hier."

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:286
#: src/portal/components/start/ParticipantOnboardingCards.tsx:301
msgid "participant.onboarding.no.card"
msgstr "Für die aktuelle Sprache und den aktuellen Abschnitt ist keine Karte verfügbar."

Expand Down Expand Up @@ -10351,8 +10351,8 @@ msgstr "Kostenpflichtiger Tarif"
msgid "partially completed"
msgstr "teilweise abgeschlossen"

#: src/portal/components/start/ParticipantInitiateForm.tsx:136
#: src/portal/components/start/ParticipantInitiateForm.tsx:197
#: src/portal/components/start/ParticipantInitiateForm.tsx:142
#: src/portal/components/start/ParticipantInitiateForm.tsx:204
#: src/components/report/ConversationStatusTable.tsx:56
msgid "Participant"
msgstr "Teilnehmer"
Expand Down Expand Up @@ -11485,7 +11485,7 @@ msgid "Ready by"
msgstr "Bereit um"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:346
#: src/portal/components/start/ParticipantOnboardingCards.tsx:371
msgid "participant.ready.to.begin"
msgstr "Bereit zum Start?"

Expand Down Expand Up @@ -13146,7 +13146,7 @@ msgstr "Separat (Kunde)"
msgid "Separate with commas, spaces, or new lines."
msgstr "Mit Kommas, Leerzeichen oder Zeilenumbrüchen trennen."

#: src/portal/components/start/ParticipantInitiateForm.tsx:291
#: src/portal/components/start/ParticipantInitiateForm.tsx:299
msgid "Session name"
msgstr "Sitzungsname"

Expand Down Expand Up @@ -14419,7 +14419,7 @@ msgstr "Tag {0}"
msgid "Tag deleted"
msgstr "Tag gelöscht"

#: src/portal/components/start/ParticipantInitiateForm.tsx:307
#: src/portal/components/start/ParticipantInitiateForm.tsx:315
#: src/components/project/ProjectTagsInput.tsx:281
#: src/components/map/panels/MapSettingsMenu.tsx:267
#: src/components/conversation/ProjectConversationsPanel.tsx:732
Expand Down
26 changes: 13 additions & 13 deletions dembrane/frontend/src/locales/en-US.po
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ msgid "{0} deleted"
msgstr "{0} deleted"

#. placeholder {0}: failed.length
#: src/lib/api.ts:687
#: src/lib/api.ts:694
msgid "{0} file(s) failed to upload. Try those again."
msgstr "{0} file(s) failed to upload. Try those again."

Expand Down Expand Up @@ -1555,7 +1555,7 @@ msgstr "Add a project goal before saving."
msgid "Add a subject"
msgstr "Add a subject"

#: src/portal/components/start/ParticipantInitiateForm.tsx:308
#: src/portal/components/start/ParticipantInitiateForm.tsx:316
msgid "Add all that apply"
msgstr "Add all that apply"

Expand Down Expand Up @@ -1905,7 +1905,7 @@ msgid "All"
msgstr "All"

#. placeholder {0}: payload.chunks.length
#: src/lib/api.ts:817
#: src/lib/api.ts:824
msgid "All {0} file(s) uploaded successfully"
msgstr "All {0} file(s) uploaded successfully"

Expand Down Expand Up @@ -2753,7 +2753,7 @@ msgstr "Back"

#. js-lingui-explicit-id
#: src/portal/layout/ParticipantHeader.tsx:94
#: src/portal/components/start/ParticipantOnboardingCards.tsx:438
#: src/portal/components/start/ParticipantOnboardingCards.tsx:463
msgid "participant.button.back"
msgstr "Back"

Expand Down Expand Up @@ -3967,12 +3967,12 @@ msgid "participant.verify.instructions.button.next"
msgstr "Continue"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:456
#: src/portal/components/start/ParticipantOnboardingCards.tsx:481
msgid "participant.button.next"
msgstr "Continue"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantInitiateForm.tsx:345
#: src/portal/components/start/ParticipantInitiateForm.tsx:353
msgid "participant.ready.to.begin.button.text"
msgstr "Continue"

Expand Down Expand Up @@ -6651,7 +6651,7 @@ msgstr "Got your answer?"
msgid "Grant licenses"
msgstr "Grant licenses"

#: src/portal/components/start/ParticipantInitiateForm.tsx:297
#: src/portal/components/start/ParticipantInitiateForm.tsx:305
msgid "Group 1, Table 3, etc."
msgstr "Group 1, Table 3, etc."

Expand Down Expand Up @@ -8929,7 +8929,7 @@ msgid "No canvases yet. Ask in chat when you want a live view of the conversatio
msgstr "No canvases yet. Ask in chat when you want a live view of the conversations. The first canvas will stay here."

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:286
#: src/portal/components/start/ParticipantOnboardingCards.tsx:301
msgid "participant.onboarding.no.card"
msgstr "No card available for the current language and section."

Expand Down Expand Up @@ -10351,8 +10351,8 @@ msgstr "Paid plan"
msgid "partially completed"
msgstr "partially completed"

#: src/portal/components/start/ParticipantInitiateForm.tsx:136
#: src/portal/components/start/ParticipantInitiateForm.tsx:197
#: src/portal/components/start/ParticipantInitiateForm.tsx:142
#: src/portal/components/start/ParticipantInitiateForm.tsx:204
#: src/components/report/ConversationStatusTable.tsx:56
msgid "Participant"
msgstr "Participant"
Expand Down Expand Up @@ -11485,7 +11485,7 @@ msgid "Ready by"
msgstr "Ready by"

#. js-lingui-explicit-id
#: src/portal/components/start/ParticipantOnboardingCards.tsx:346
#: src/portal/components/start/ParticipantOnboardingCards.tsx:371
msgid "participant.ready.to.begin"
msgstr "Ready to begin?"

Expand Down Expand Up @@ -13146,7 +13146,7 @@ msgstr "Separate (client)"
msgid "Separate with commas, spaces, or new lines."
msgstr "Separate with commas, spaces, or new lines."

#: src/portal/components/start/ParticipantInitiateForm.tsx:291
#: src/portal/components/start/ParticipantInitiateForm.tsx:299
msgid "Session name"
msgstr "Session name"

Expand Down Expand Up @@ -14419,7 +14419,7 @@ msgstr "Tag {0}"
msgid "Tag deleted"
msgstr "Tag deleted"

#: src/portal/components/start/ParticipantInitiateForm.tsx:307
#: src/portal/components/start/ParticipantInitiateForm.tsx:315
#: src/components/project/ProjectTagsInput.tsx:281
#: src/components/map/panels/MapSettingsMenu.tsx:267
#: src/components/conversation/ProjectConversationsPanel.tsx:732
Expand Down
Loading
Loading