File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,13 +302,24 @@ const config: Config = {
302302 ] ,
303303
304304 scripts : [
305- '/js/crisp-chat.js' ,
306305 {
307306 src : '//js-eu1.hs-scripts.com/143451822.js' ,
308307 async : true ,
309308 defer : true ,
310309 id : 'hs-script-loader' ,
311310 } ,
311+ {
312+ src : "https://widget.kapa.ai/kapa-widget.bundle.js" ,
313+ "data-website-id" : "bbb5a478-1363-4c1e-84b5-cdba2c58e5ad" ,
314+ "data-project-name" : "Flagsmith" ,
315+ "data-project-color" : "#6633FF" ,
316+ "data-project-logo" : "http://docs.flagsmith.com/img/logo.svg" ,
317+ "data-answer-cta-button-enabled" : "true" ,
318+ "data-answer-cta-button-link" : "/support/" ,
319+ "data-answer-cta-button-text" : "Still need help? Reach out to our support team" ,
320+ "data-modal-disclaimer" : "Results are AI generated from our product documentation. [Contact Support to speak to a human](/support)." ,
321+ async : true ,
322+ } ,
312323 ] ,
313324
314325 clientModules : [
Original file line number Diff line number Diff line change 99.hidden {
1010 display : none !important ;
1111}
12-
12+ /*Prevents kapa from immediately showing before crisp on support pages*/
13+ # kapa-widget-container {
14+ display : none;
15+ }
1316@font-face {
1417 font-family : 'Open Sans Regular' ;
1518 src : url ('/static/fonts/open-sans-regular.woff' ) format ('woff' );
Original file line number Diff line number Diff line change 1+ // src/crisp.js
2+ import { useEffect } from 'react' ;
3+ import { useLocation } from '@docusaurus/router' ;
4+
5+ export default function CrispLoader ( ) {
6+ const location = useLocation ( ) ;
7+
8+ useEffect ( ( ) => {
9+ if ( typeof window === 'undefined' ) {
10+ return ;
11+ }
12+
13+ window . $crisp = window . $crisp || [ ] ;
14+ window . CRISP_WEBSITE_ID = '8857f89e-0eb5-4263-ab49-a293872b6c19' ;
15+
16+ if ( ! document . getElementById ( 'crisp-chat-script' ) ) {
17+ const d = document ;
18+ const s = d . createElement ( 'script' ) ;
19+ s . id = 'crisp-chat-script' ;
20+ s . src = 'https://client.crisp.chat/l.js' ;
21+ s . async = 1 ;
22+ d . head . appendChild ( s ) ;
23+ }
24+
25+ const kapaEl = document . getElementById ( 'kapa-widget-container' ) ;
26+
27+ if ( location . pathname . replace ( / \/ / g, '' ) === 'support' ) {
28+ window . $crisp . push ( [ 'do' , 'chat:show' ] ) ;
29+ window . $crisp . push ( [ 'do' , 'chat:open' ] ) ;
30+ window . __isCrispVisible = true ;
31+ if ( kapaEl ) kapaEl . style . display = 'none' ;
32+ } else {
33+ window . $crisp . push ( [ 'do' , 'chat:hide' ] ) ;
34+ window . __isCrispVisible = false ;
35+ if ( kapaEl ) kapaEl . style . display = 'block' ;
36+ }
37+ } , [ location . pathname ] ) ;
38+
39+ return null ;
40+ }
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import OriginalLayout from '@theme-original/Layout' ;
3+ import CrispLoader from './crisp' ;
4+
5+ export default function Layout ( props ) {
6+ return (
7+ < >
8+ < CrispLoader />
9+ < OriginalLayout { ...props } />
10+ </ >
11+ ) ;
12+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments