From bc601efb95c5f14dafe5f29bc187c82fa3858147 Mon Sep 17 00:00:00 2001 From: Hugo Montenegro Date: Wed, 5 Nov 2025 10:44:57 -0300 Subject: [PATCH 1/4] fix: attempted fix at iOS bug --- src/app/(mobile-ui)/support/page.tsx | 48 ++++++---- src/app/crisp-proxy/page.tsx | 87 ++++++++++--------- src/components/Global/SupportDrawer/index.tsx | 58 +++++++------ src/hooks/useCrispIframeReady.ts | 76 ++++++++++++++++ 4 files changed, 185 insertions(+), 84 deletions(-) create mode 100644 src/hooks/useCrispIframeReady.ts diff --git a/src/app/(mobile-ui)/support/page.tsx b/src/app/(mobile-ui)/support/page.tsx index 2a0072c82..d98d54c90 100644 --- a/src/app/(mobile-ui)/support/page.tsx +++ b/src/app/(mobile-ui)/support/page.tsx @@ -1,37 +1,51 @@ 'use client' -import { useState, useEffect } from 'react' import { useCrispUserData } from '@/hooks/useCrispUserData' import { useCrispProxyUrl } from '@/hooks/useCrispProxyUrl' +import { useCrispIframeReady } from '@/hooks/useCrispIframeReady' import PeanutLoading from '@/components/Global/PeanutLoading' +import { Button } from '@/components/0_Bruddle' const SupportPage = () => { const userData = useCrispUserData() const crispProxyUrl = useCrispProxyUrl(userData) - const [isLoading, setIsLoading] = useState(true) - useEffect(() => { - // Listen for ready message from proxy iframe - const handleMessage = (event: MessageEvent) => { - if (event.origin !== window.location.origin) return - - if (event.data.type === 'CRISP_READY') { - setIsLoading(false) - } - } - - window.addEventListener('message', handleMessage) - return () => window.removeEventListener('message', handleMessage) - }, []) + // Use shared hook with device-specific timeouts (3s desktop, 8s iOS) + const { isReady, hasError, retry } = useCrispIframeReady() return (
- {isLoading && ( + {!isReady && (
)} -