Skip to content

feat: Migrate backend-ai-email-verification-view to React #5367

@inureyes

Description

@inureyes

⚠️ Before implementing, read and follow the Implementation Rules in the epic issue #5364. These rules cover mandatory patterns for React component structure, BAI component usage, reactToWebComponent bridge, state management, i18n, error handling, styling, and code quality. The reference implementation is react/src/components/SignupModal.tsx.

Goal: Complete Lit file removal. Each migration must fully replace the Lit source file with React — not just the dialog parts. The migrated Lit .ts file and its type declarations must be deleted. This epic is a critical step toward removing all Lit/MWC/Vaadin dependencies from the codebase.

Description

Migrate backend-ai-email-verification-view.ts (Lit-Element) to a React component. This component handles email verification after user signup, with success and failure dialog states.

Part of epic #5364 — Phase 1 (Simple standalone views)

Current Implementation

File: src/components/backend-ai-email-verification-view.ts

Dialogs (2):

  1. #verification-success-dialog — Shows verification success message + login button
  2. #verification-fail-dialog — Shows error + email input for resending verification

MWC Components Used:

  • mwc-textfield (email input in fail dialog)
  • mwc-button (Login button, Send Email button)

State:

  • client: BackendAIClient
  • clientConfig: ClientConfig
  • notification

Flow:

  1. Extract verification_code from URL query params
  2. Call client.cloud.verify_email(token)
  3. On success → show #verification-success-dialog
  4. On error → show #verification-fail-dialog with resend option
  5. Both dialogs redirect to login page on close (didHide event)

Resend Flow:

  1. Validate email format
  2. POST to /auth/send_verification_email
  3. Show notification on success/error

Migration Plan

  1. Create react/src/components/EmailVerificationView.tsx
  2. Use BAIModal for both success and fail states (single modal, conditional content)
  3. Use Ant Design Input + Form for email validation
  4. Use BAIButton with action prop for async resend
  5. Use useNavigate or window.location.href for redirect
  6. Register as web component via reactToWebComponent

Component Mapping

Current (Lit) Target (React)
backend-ai-dialog x2 BAIModal with conditional content
mwc-textfield Ant Design Input with Form validation
mwc-button BAIButton
addEventListener('didHide') afterClose callback
Direct fetch useTanMutation or custom hook

Acceptance Criteria

  • EmailVerificationView.tsx created
  • Email verification flow works (success + failure paths)
  • Email resend functionality works
  • Redirect to login after dialog close
  • Form validation on email input
  • i18n translations preserved
  • Registered as web component for backward compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uxUI / UX issue.effort:easyNeed to understand only a specific region of codes (good first issue, easy).platform:webWeb-specific issuetype:enhanceAdd new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions