-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Agents] Module feedback / recrutement (#955)
* feat: add feedback widget for agents - add feedback modal component - add feedback button when agent is logged in - add form to send feedback to crisp - add registration to beta-tester list - various error handling * refactor: use httpclient instead of crisp sdk * test: add TVA tests * style: change following code review * fix: changes following PR review * chore: PR review
- Loading branch information
1 parent
2f9ae22
commit 7f50160
Showing
40 changed files
with
1,768 additions
and
949 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import { Metadata } from 'next'; | ||
import { Question } from '#components-ui/question'; | ||
import { HeaderServer } from '#components/header/header-server'; | ||
import { meta } from '#components/meta/meta-server'; | ||
import getSession from '#utils/server-side-helper/app/get-session'; | ||
import QuestionOrFeedback from 'app/_component/question-or-feedback'; | ||
|
||
export const metadata: Metadata = meta({}); | ||
|
||
export default function HomeLayout({ | ||
export default async function HomeLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
const session = await getSession(); | ||
return ( | ||
<> | ||
<HeaderServer useSearchBar={false} useAgentCTA={false} /> | ||
<main className="fr-container">{children}</main> | ||
<Question /> | ||
<QuestionOrFeedback session={session} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
import { Metadata } from 'next'; | ||
import { Question } from '#components-ui/question'; | ||
import { meta } from '#components/meta/meta-server'; | ||
import getSession from '#utils/server-side-helper/app/get-session'; | ||
import QuestionOrFeedback from 'app/_component/question-or-feedback'; | ||
|
||
export const metadata: Metadata = meta({}); | ||
|
||
export default function HomeLayout({ | ||
export default async function HomeLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
const session = await getSession(); | ||
return ( | ||
<> | ||
{children} | ||
<Question /> | ||
<QuestionOrFeedback session={session} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import FeedbackModal from '#components/feedback-modal'; | ||
import { IAgentContactInfo } from '#components/feedback-modal/type'; | ||
import { Question } from '#components/question'; | ||
import { EScope, hasRights } from '#models/user/rights'; | ||
import { ISession } from '#models/user/session'; | ||
|
||
export default function QuestionOrFeedback({ | ||
session, | ||
}: { | ||
session: ISession | null; | ||
}) { | ||
const agentContactInfo = getAgentContactInfo(session); | ||
if (!agentContactInfo) { | ||
return <Question />; | ||
} | ||
return <FeedbackModal agentContactInfo={agentContactInfo} />; | ||
} | ||
|
||
const getAgentContactInfo = ( | ||
session: ISession | null | ||
): IAgentContactInfo | null => { | ||
if (!hasRights(session, EScope.isAgent) || !session?.user?.email) { | ||
return null; | ||
} | ||
return { | ||
email: session.user.email, | ||
name: session.user.fullName, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
type IProps = { | ||
onClick: () => void; | ||
ariaControls: string; | ||
ariaLabel: string; | ||
className?: string; | ||
}; | ||
|
||
export default function ButtonClose({ | ||
onClick, | ||
ariaControls, | ||
ariaLabel, | ||
className, | ||
}: IProps) { | ||
return ( | ||
<button | ||
onClick={onClick} | ||
className={'fr-btn fr-btn--tertiary-no-outline ' + (className ?? '')} | ||
aria-label={ariaLabel} | ||
aria-controls={ariaControls} | ||
> | ||
× Fermer | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.