Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAI-134] Hotfix/chatbot/cai 134 unauthenticated user chatbot message #1113

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions .changeset/silent-bobcats-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": minor
---

Guest chatbot message
11 changes: 9 additions & 2 deletions apps/nextjs-website/src/components/molecules/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { compact } from 'lodash';
import { useTranslations } from 'next-intl';
import { ChatCatbotWriting } from '@/components/atoms/ChatChatbotWriting/ChatChatbotWriting';
import { ChatSkeleton } from '@/components/atoms/ChatSkeleton/ChatSkeleton';
import { useUser } from '@/helpers/user.helper';
import { baseUrl } from '@/config';

type ChatProps = {
queries: Query[];
Expand All @@ -31,9 +33,14 @@ const Chat = ({
const t = useTranslations();
const { palette } = useTheme();
const [instantScroll, setInstantScroll] = useState(scrollToBottom);
const { user } = useUser();
const messages = useMemo(
() => [
firstMessage(t('chatBot.welcomeMessage')),
firstMessage(
user
? t('chatBot.welcomeMessage')
: t('chatBot.guestMessage', { host: baseUrl })
),
...compact(
queries.flatMap((q) => [
q.question && q.queriedAt
Expand All @@ -57,7 +64,7 @@ const Chat = ({
])
),
],
[queries, t]
[queries, t, user]
) satisfies Message[];

const scrollRef = useRef<HTMLDivElement>(null);
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs-website/src/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@
"delete": "Elimina",
"feedbackGiven": "Feedback\nregistrato",
"copied": "Copiato",
"welcomeMessage": "Ciao, sono il chatbot di DevPortal!\n\nPosso aiutarti a trovare in modo semplice e rapido le informazioni presenti nella documentazione del Portale.\n\nPrima di incominciare con la prima domanda, ti invito a leggere l'[Informativa sulla Privacy](/privacy-policy)."
"welcomeMessage": "Ciao, sono il chatbot di DevPortal!\n\nPosso aiutarti a trovare in modo semplice e rapido le informazioni presenti nella documentazione del Portale.\n\nPrima di incominciare con la prima domanda, ti invito a leggere l'[Informativa sulla Privacy](/privacy-policy).",
"guestMessage": "Ciao sono _Discovery_ , il chatbot di DevPortal!\n\nPosso aiutarti a trovare in modo semplice e rapido le informazioni presenti nella documentazione del Portale.\n\nPer poter accedere al servizio, ti invito a [iscriverti a PagoPA DevPortal]({host}/auth/login)"
}
}
Loading