🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: window not available at build time (#6472)
Marc Klingen8fd6951a1966
diff --git a/web/src/components/nav/support-menu-dropdown.tsx b/web/src/components/nav/support-menu-dropdown.tsxindex 931abf9aba..01b8cdd3d4 100644--- a/web/src/components/nav/support-menu-dropdown.tsx+++ b/web/src/components/nav/support-menu-dropdown.tsx@@ -55,7 +55,7 @@ export const SupportMenuDropdown = () => {icon: LifeBuoy,});} else {- if (chatAvailable) {+ if (chatAvailable()) {items.push({title: "Chat",pathname: "#",diff --git a/web/src/ee/features/billing/components/BillingSettings.tsx b/web/src/ee/features/billing/components/BillingSettings.tsxindex 98e18acec3..f067d8e6f5 100644--- a/web/src/ee/features/billing/components/BillingSettings.tsx+++ b/web/src/ee/features/billing/components/BillingSettings.tsx@@ -189,7 +189,7 @@ const BillingPortalOrPricingPageButton = () => {// Do not show checkout or customer portal if manual plan is set in cloud configif (organization?.cloudConfig?.plan) {- if (chatAvailable)+ if (chatAvailable())return (<Buttonvariant="secondary"diff --git a/web/src/features/notifications/ErrorNotification.tsx b/web/src/features/notifications/ErrorNotification.tsxindex fe580dd5fb..90a548edca 100644--- a/web/src/features/notifications/ErrorNotification.tsx+++ b/web/src/features/notifications/ErrorNotification.tsx@@ -55,7 +55,7 @@ export const ErrorNotification: React.FC<ErrorNotificationProps> = ({</div>)}- {isError && chatAvailable && (+ {isError && chatAvailable() && (<Buttonvariant="errorNotification"size={"sm"}diff --git a/web/src/features/support-chat/PlainChat.tsx b/web/src/features/support-chat/PlainChat.tsxindex 372c363baa..06cf232a59 100644--- a/web/src/features/support-chat/PlainChat.tsx+++ b/web/src/features/support-chat/PlainChat.tsx@@ -75,11 +75,16 @@ const PlainChat = () => {export default PlainChat;-export const chatAvailable =- !!env.NEXT_PUBLIC_PLAIN_APP_ID && window.Plain !== undefined;+export const chatAvailable = () => {+ return (+ !!env.NEXT_PUBLIC_PLAIN_APP_ID &&+ typeof window !== "undefined" &&+ window.Plain !== undefined+ );+};export const showChat = (): void => {- if (chatAvailable) {+ if (chatAvailable()) {window.Plain.update({hideLauncher: false,});@@ -87,7 +92,7 @@ export const showChat = (): void => {};export const hideChat = (): void => {- if (chatAvailable) {+ if (chatAvailable()) {window.Plain.update({hideLauncher: true,});@@ -95,20 +100,20 @@ export const hideChat = (): void => {};export const closeChat = (): void => {- if (chatAvailable) {+ if (chatAvailable()) {window.Plain.close();}};export const openChat = (): void => {- if (chatAvailable) {+ if (chatAvailable()) {showChat();window.Plain.open();}};export const getUnreadMessageCount = (): number | null => {- if (chatAvailable) {+ if (chatAvailable()) {return window.Plain.getUnreadMessageCount();}return null;@@ -120,7 +125,7 @@ export const chatSetCustomer = (customer: {emailHash?: string;chatAvatarUrl?: string;}) => {- if (chatAvailable) {+ if (chatAvailable()) {window.Plain.update({customerDetails: customer,});@@ -128,7 +133,7 @@ export const chatSetCustomer = (customer: {};export const chatSetThreadDetails = (p: { orgId?: string; plan?: Plan }) => {- if (chatAvailable) {+ if (chatAvailable()) {window.Plain.update({threadDetails: {...(p.orgId && {