Skip to content

Commit

Permalink
Merge pull request #45 from SocialGouv/test/crisp-error
Browse files Browse the repository at this point in the history
fix: crisp token variable
  • Loading branch information
ClementNumericite authored Feb 29, 2024
2 parents 4484580 + b5e7799 commit 951b9c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ COPY yarn.lock .yarnrc.yml ./
COPY .yarn .yarn
RUN yarn fetch

ARG NEXT_PUBLIC_JWT_NAME
ENV NEXT_PUBLIC_JWT_NAME=$NEXT_PUBLIC_JWT_NAME
ARG NEXT_PUBLIC_MATOMO_URL
ENV NEXT_PUBLIC_MATOMO_URL=$NEXT_PUBLIC_MATOMO_URL
ARG NEXT_PUBLIC_MATOMO_SITE_ID
ENV NEXT_PUBLIC_MATOMO_SITE_ID=$NEXT_PUBLIC_MATOMO_SITE_ID
ARG NEXT_PUBLIC_MATOMO_TRACKING_ENABLED
ENV NEXT_PUBLIC_MATOMO_TRACKING_ENABLED=$NEXT_PUBLIC_MATOMO_TRACKING_ENABLED
ARG NEXT_PUBLIC_CRISP_TOKEN
ENV NEXT_PUBLIC_CRISP_TOKEN=$NEXT_PUBLIC_CRISP_TOKEN

COPY . .
RUN --mount=type=secret,id=sentry_auth_token export SENTRY_AUTH_TOKEN="$(cat /run/secrets/sentry_auth_token)"; \
yarn build
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/support/Crisp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { UserIncluded } from "~/server/api/routers/user";

type CrispProps = {
user: UserIncluded;
crispToken: string;
onClose: () => void;
}

const crispToken = process.env.NEXT_PUBLIC_CRISP_TOKEN as string

const CrispChat = (props: CrispProps) => {
const { user, onClose } = props;
const { user, onClose, crispToken } = props;
useEffect(() => {
if (crispToken) {
Crisp.configure(crispToken, {
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/pages/dashboard/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { UserIncluded } from "~/server/api/routers/user";
import NewPassComponent from "~/components/NewPassComponent";
import dynamic from "next/dynamic";

const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string

const displayDynamicCJECardMessage = (user: User) => {
if (!user.image) {
return (
Expand Down Expand Up @@ -260,7 +262,7 @@ export default function Account() {
onClose={() => setIsOpenNewPassComponent(false)}
/>
{
isOpenCrisp && user && (<CrispWithNoSSR user={user} onClose={() => {
isOpenCrisp && user && (<CrispWithNoSSR crispToken={CRISP_TOKEN} user={user} onClose={() => {
setIsOpenCrisp(false)
}} />)
}
Expand Down

0 comments on commit 951b9c9

Please sign in to comment.