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:
@@ -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"])
|
||||
},
|
||||
])
|
||||
},
|
||||
}
|
||||
@@ -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))
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user