mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 05:58:18 +00:00
- FaydaVerifyPanel + /callback popup flow for owner and poa - general manager is a plain typed role again, offers "same as verified owner" copy instead of being fayda-verified itself - company step gates on owner verification (ethiopian) or typed passport number (foreign); poa step gates on poa verification - settings tabs (company profile, general manager, poa) updated to match Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { useEffect, useState } from "react";
|
|
import { Center, Loader, Stack, Text } from "@mantine/core";
|
|
|
|
import type { FaydaCallbackMessage } from "@/services/verifayda.service";
|
|
|
|
/**
|
|
* Landing page for the portal's eSignet redirect_uri
|
|
* (FAYDA_PORTAL_REDIRECT_URI → http://localhost:5173/callback). Runs inside the
|
|
* verification popup: relays ?code&state (or ?error) to the window that opened
|
|
* it via postMessage, then closes itself. The opener performs the completion
|
|
* call so the single-use session is only consumed once, in one place.
|
|
*/
|
|
export default function FaydaCallbackPage() {
|
|
const [standalone, setStandalone] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const params = new URLSearchParams(window.location.search);
|
|
const message: FaydaCallbackMessage = {
|
|
type: "fayda-callback",
|
|
code: params.get("code") ?? undefined,
|
|
state: params.get("state") ?? undefined,
|
|
error: params.get("error") ?? undefined,
|
|
errorDescription: params.get("error_description") ?? undefined,
|
|
};
|
|
|
|
if (window.opener && window.opener !== window) {
|
|
(window.opener as Window).postMessage(message, window.location.origin);
|
|
window.close();
|
|
} else {
|
|
// Opened as a full-page redirect instead of a popup — nothing to relay to.
|
|
setStandalone(true);
|
|
}
|
|
}, []);
|
|
|
|
return (
|
|
<Center h="100vh">
|
|
<Stack align="center" gap="sm">
|
|
{standalone ? (
|
|
<>
|
|
<Text fw={600}>Verification window lost its parent page</Text>
|
|
<Text size="sm" c="dimmed">
|
|
Close this tab and start the verification again from the form.
|
|
</Text>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Loader size="sm" color="edr-green" />
|
|
<Text size="sm" c="dimmed">
|
|
Completing Fayda verification…
|
|
</Text>
|
|
</>
|
|
)}
|
|
</Stack>
|
|
</Center>
|
|
);
|
|
}
|