e2365e29fe
- Prayer times page: arc progress ring, next-prayer countdown, clean prayer list - Dhikr counter: SVG ring with glow, 3-phase sequence (SubhanAllah/Alhamdulillah/AllahuAkbar), streak tracking - Daily Quran reading tracker API routes (GET/POST) - Bottom nav updated: Prayer + Dhikr tabs, Repeat2 icon for dhikr, Moon for prayer - Home page redirects to /prayer as primary entry point - Dockerfile: openssl added to builder stage, explicit prisma schema path fixes build - Schema: dhikrStreak, quranStreak on User; DhikrSession and QuranReading models - Stub wallet top-up checkout to fix TypeScript build error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
'use client'
|
|
|
|
/**
|
|
* Halal Monitor Bridge
|
|
* Passes auth credentials from FalahMobile to the World Monitor iframe
|
|
* via localStorage and postMessage.
|
|
*/
|
|
|
|
const WORLD_MONITOR_URL = process.env.NEXT_PUBLIC_WORLD_MONITOR_URL || 'https://halal.worldmonitor.app'
|
|
|
|
export function getWorldMonitorUrl(): string {
|
|
return WORLD_MONITOR_URL
|
|
}
|
|
|
|
export function getWorldMonitorIframeUrl(path?: string): string {
|
|
const base = WORLD_MONITOR_URL
|
|
const variant = 'halal'
|
|
return path ? `${base}/${path}?variant=${variant}` : `${base}/?variant=${variant}`
|
|
}
|
|
|
|
export interface HalalAuthPayload {
|
|
type: 'flh-auth'
|
|
token: string
|
|
user: {
|
|
id: string
|
|
name: string
|
|
email: string
|
|
isPremium: boolean
|
|
}
|
|
}
|
|
|
|
export function broadcastAuthToIframe(iframe: HTMLIFrameElement | null, auth: {
|
|
token: string
|
|
user: { id: string; name: string; email: string; isPremium: boolean }
|
|
}) {
|
|
if (!iframe?.contentWindow) return
|
|
const payload: HalalAuthPayload = { type: 'flh-auth', ...auth }
|
|
iframe.contentWindow.postMessage(payload, WORLD_MONITOR_URL)
|
|
}
|