'use client';
/**
 * VendorRegisterIsland — single Astro boundary for the /vendor/register page.
 *
 * Why this wrapper exists:
 *   Astro's Cloudflare adapter SSR-renders React children passed to a
 *   `client:only` component even though the parent is skipped. Radix UI
 *   Checkbox (used inside VendorUpgradeFormShell) calls useState via
 *   CheckboxProvider during that server-side pass; React's dispatcher is null
 *   in workerd's split-vite SSR context, aborting the stream before <body> is
 *   emitted.
 *
 *   Fix: colocate HydratedIsland + the actual page component inside ONE React
 *   module so the single Astro boundary (`client:only="react"`) covers
 *   everything — children never cross the Astro ↔ React framework gap.
 */
import { HydratedIsland } from '@/components/HydratedIsland';
import { VendorUpgradeFormShell } from './VendorUpgradeFormShell';

export interface VendorRegisterIslandProps {
  /** True when no session exists (guest visitor). Uses firebase-verify OTP endpoint. */
  isGuest: boolean;
  /** Pre-filled from decrypted user.email. Empty string for guests. */
  prefillEmail: string;
  /** Whether the authenticated user already has a verified phone on file. Always false for guests. */
  hasPhone: boolean;
  /** Platform commission percentage for disclosure near ToS. */
  platformFeePct: number;
}

export function VendorRegisterIsland({
  isGuest,
  prefillEmail,
  hasPhone,
  platformFeePct,
}: VendorRegisterIslandProps) {
  return (
    <HydratedIsland>
      <VendorUpgradeFormShell
        isGuest={isGuest}
        prefillEmail={prefillEmail}
        hasPhone={hasPhone}
        platformFeePct={platformFeePct}
      />
    </HydratedIsland>
  );
}
