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