<!-- source-hash: 76fefb8d1dd3113ac55a32017a2a8fe1 -->
React hook that manages contact form submission state, API communication, toast notifications, and post-submission routing for the `/api/contact` endpoint.

## Key Components

### `ContactSubmissionOptions`
Configuration interface for hook behavior:
- `userId` — optional authenticated user identifier appended to the payload
- `successRedirectUrl` — destination after successful submission (supports absolute URLs and internal paths)
- `successToastMessage` — appends custom text to the default success toast
- `onSuccess` — optional callback fired after successful submission

### `ContactFormData`
Mirrors the `ContactBaseSchema` Zod contract on the server. Required fields are `name`, `email`, `helpCategory`, and `message`. Includes an index signature (`[key: string]: unknown`) so tracking metadata (`utm_*`, `rdt_cid`, `referrer_url`) and A/B variant fields pass through unchanged.

### `useContactSubmission(options)`
The exported hook. Pulls `contactUrl` from `useRequiredEndpointsRuntime` (throws if no provider is mounted), then returns:

| Return Value | Type | Description |
|---|---|---|
| `submit` | `(formData: ContactFormData) => Promise<void>` | Sends POST request; shows toast on success or error |
| `isSubmitting` | `boolean` | True while the fetch is in-flight |
| `isSuccess` | `boolean` | True after a successful response |
| `setIsSuccess` | `Dispatch<SetStateAction<boolean>>` | Allows caller to manually reset success state |

Redirect logic waits 1500ms after `isSuccess` before navigating — using `window.location.href` for absolute URLs and `router.push` for relative paths.

## Usage Example

```typescript
import { useContactSubmission } from './use-contact-submission';

function ContactForm() {
  const { submit, isSubmitting, isSuccess } = useContactSubmission({
    userId: currentUser?.id,
    successRedirectUrl: '/thank-you',
    successToastMessage: 'Our team will respond within 24 hours.',
    onSuccess: () => analytics.track('contact_submitted'),
  });

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault();
    await submit({
      name: 'Jane Smith',
      email: 'jane@acme.com',
      helpCategory: 'billing',
      message: 'I have a question about my invoice.',
      // Tracking fields forwarded transparently
      utm_source: 'homepage',
      rdt_cid: 'abc123',
    });
  };

  return (
    <form onSubmit={handleSubmit}>
      {/* form fields */}
      <button type="submit" disabled={isSubmitting}>
        {isSubmitting ? 'Sending...' : 'Send Message'}
      </button>
    </form>
  );
}
```

> **Note:** This hook requires `EndpointsRuntimeProvider` to be mounted in the component tree. The hub supplies the default contact endpoint; embedded apps provide a proxied path via the same context.