mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-27 09:40:45 +00:00
intercom update
This commit is contained in:
@ -50,18 +50,16 @@ export const load = () => {
|
||||
}
|
||||
}
|
||||
})();
|
||||
console.log("loaded", APP_ID);
|
||||
}
|
||||
|
||||
// Initializes Intercom
|
||||
export const boot = (options = {}) => {
|
||||
console.log("boot", options)
|
||||
window &&
|
||||
window.Intercom &&
|
||||
window.Intercom("boot", { app_id: APP_ID, ...options });
|
||||
console.log("booted");
|
||||
};
|
||||
|
||||
export const update = () => {
|
||||
window && window.Intercom && window.Intercom("update");
|
||||
console.log("updated");
|
||||
};
|
@ -1,6 +1,8 @@
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
import { useUser } from "@app/context";
|
||||
|
||||
import {
|
||||
boot as bootIntercom,
|
||||
load as loadIntercom,
|
||||
@ -9,12 +11,13 @@ import {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const IntercomProvider = ({ children }: { children: any }) => {
|
||||
const { user } = useUser();
|
||||
const router = useRouter();
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
console.log("window is defined");
|
||||
loadIntercom();
|
||||
bootIntercom();
|
||||
bootIntercom({name: `${user.firstName} ${user.lastName}`, email: user.email});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
Reference in New Issue
Block a user