Skip to content

Commit

Permalink
Ajoute Crisp dans l'app panier
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-rutkowski committed Oct 7, 2024
1 parent 15452bf commit 7b26686
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd-panier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
--ENV_NAME=${{ github.event.inputs.target }}
--POSTHOG_HOST=${{ secrets.POSTHOG_HOST }} --POSTHOG_KEY=${{ secrets.POSTHOG_KEY }}
--AXEPTIO_ID=${{ vars.AXEPTIO_ID }}
--CRISP_WEBSITE_ID=${{ vars.CRISP_WEBSITE_ID }}
--ANON_KEY=${{ secrets.ANON_KEY }} --API_URL=${{ secrets.API_URL }}
- name: Deploy panier on Koyeb
Expand Down
2 changes: 2 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,15 @@ panier-build: ## construit l'image du panier
ARG POSTHOG_HOST
ARG POSTHOG_KEY
ARG AXEPTIO_ID
ARG CRISP_WEBSITE_ID
ARG vars
FROM +front-deps
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY
ENV NEXT_PUBLIC_SUPABASE_URL=$API_URL
ENV NEXT_PUBLIC_POSTHOG_HOST=$POSTHOG_HOST
ENV NEXT_PUBLIC_POSTHOG_KEY=$POSTHOG_KEY
ENV NEXT_PUBLIC_AXEPTIO_ID=$AXEPTIO_ID
ENV NEXT_PUBLIC_CRISP_WEBSITE_ID=$CRISP_WEBSITE_ID
ENV NEXT_TELEMETRY_DISABLED=1
ENV PUBLIC_PATH="/app/packages/panier/public"
ENV PORT=80
Expand Down
1 change: 1 addition & 0 deletions packages/panier/.env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NEXT_PUBLIC_SUPABASE_URL=http://localhost:8000
NEXT_PUBLIC_SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY}
NEXT_PUBLIC_CRISP_WEBSITE_ID=""
13 changes: 13 additions & 0 deletions packages/panier/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './global.css';
import Footer from '@tet/panier/components/Layout/Footer';
import Header from '@tet/panier/components/Layout/Header';
import { StoreProvider } from '../providers';
import Script from 'next/script';

export const metadata = {
title: 'Territoires en Transitions',
Expand Down Expand Up @@ -45,6 +46,18 @@ export default function RootLayout({
<Footer />
</body>
</StoreProvider>
{/* crisp widget */}
<Script id="crisp" type="text/javascript">{`
window.$crisp = [];
window.CRISP_WEBSITE_ID = '${process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID}';
(function () {
d = document;
s = d.createElement('script');
s.src = 'https://client.crisp.chat/l.js';
s.async = 1;
d.getElementsByTagName('head')[0].appendChild(s);
})();
`}</Script>
</html>
);
}
11 changes: 7 additions & 4 deletions packages/panier/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ export function middleware(request: NextRequest) {
// options de la politique de sécurité
const cspHeader = `
default-src 'self';
script-src ${scriptSrc} *.axept.io *.posthog.com;
style-src ${styleSrc};
img-src 'self' blob: data: axeptio.imgix.net;
font-src 'self';
script-src ${scriptSrc} *.axept.io *.posthog.com client.crisp.chat;
style-src ${styleSrc} client.crisp.chat;
img-src 'self' blob: data: axeptio.imgix.net image.crisp.chat client.crisp.chat;
font-src 'self' client.crisp.chat;
object-src 'none';
connect-src 'self'
${process.env.NEXT_PUBLIC_SUPABASE_URL!}
${process.env.NEXT_PUBLIC_SUPABASE_URL!.replace('http', 'ws')}
ws://${request.nextUrl.host}
ws://127.0.0.1:54321
client.crisp.chat
wss://client.relay.crisp.chat
wss://stream.relay.crisp.chat
*.posthog.com
*.axept.io;
base-uri 'self';
Expand Down

0 comments on commit 7b26686

Please sign in to comment.