feat: move crisp out of common (#3287)

* feat: move crisp out of common

* fix: update static spotlight searcher

* chore: fix typo
This commit is contained in:
Andrew Bastin
2023-08-26 03:00:58 +05:30
committed by GitHub
parent d4d7a20fbd
commit a7566dfd86
17 changed files with 325 additions and 319 deletions

View File

@@ -1,32 +0,0 @@
import { HoppModule } from "."
export const showChat = () => {
;(window as any).$crisp.push([
"do",
"chat:show",
(window as any).$crisp.push(["do", "chat:open"]),
])
}
export default <HoppModule>{
onVueAppInit() {
// TODO: Env variable this ?
;(window as any).$crisp = []
;(window as any).CRISP_WEBSITE_ID = "3ad30257-c192-4773-955d-fb05a4b41af3"
const d = document
const s = d.createElement("script")
s.src = "https://client.crisp.chat/l.js"
s.async = true
d.getElementsByTagName("head")[0].appendChild(s)
;(window as any).$crisp.push(["do", "chat:hide"])
;(window as any).$crisp.push([
"on",
"chat:closed",
() => {
;(window as any).$crisp.push(["do", "chat:hide"])
},
])
},
}

View File

@@ -53,6 +53,9 @@ export default <HoppModule>{
HOPP_MODULES.forEach((mod) => {
mod.onBeforeRouteChange?.(to, from, router)
})
platform.addedHoppModules?.forEach((mod) => {
mod.onBeforeRouteChange?.(to, from, router)
})
})
// Instead of this a better architecture is for the router
@@ -66,10 +69,14 @@ export default <HoppModule>{
HOPP_MODULES.forEach((mod) => {
mod.onAfterRouteChange?.(to, router)
})
platform.addedHoppModules?.forEach((mod) => {
mod.onAfterRouteChange?.(to, router)
})
})
app.use(router)
HOPP_MODULES.forEach((mod) => mod.onRouterInit?.(app, router))
platform.addedHoppModules?.forEach((mod) => mod.onRouterInit?.(app, router))
},
}