- Implement AddressReconcileQueueService to handle address reconciliation jobs between WHMCS and Salesforce. - Define job data structure and queue configuration for retries and error handling. - Add methods for enqueueing reconciliation jobs and retrieving queue health metrics. feat: create loading components for various services in the portal - Add loading skeletons for Internet, SIM, VPN, and public services configuration. - Implement loading states for account-related views including account details, services, and verification settings. - Introduce loading states for support case details and subscription actions. feat: implement OTP input component for user verification - Create OtpInput component to handle 6-digit OTP input with auto-focus and navigation. - Add LoginOtpStep component for OTP verification during login, including countdown timer and error handling. feat: define address domain constants for validation - Establish constants for address field length limits to ensure compliance with WHMCS API constraints. - Include maximum lengths for address fields and user input fields to maintain data integrity.
114 lines
3.2 KiB
TypeScript
114 lines
3.2 KiB
TypeScript
/**
|
|
* Auth Domain - Contract
|
|
*
|
|
* Constants and types for the authentication domain.
|
|
* All validated types are derived from schemas (see schema.ts).
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Authentication Error Codes
|
|
// ============================================================================
|
|
|
|
export const AUTH_ERROR_CODE = {
|
|
INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
|
|
EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED",
|
|
ACCOUNT_LOCKED: "ACCOUNT_LOCKED",
|
|
MFA_REQUIRED: "MFA_REQUIRED",
|
|
INVALID_TOKEN: "INVALID_TOKEN",
|
|
TOKEN_EXPIRED: "TOKEN_EXPIRED",
|
|
PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
|
|
EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS",
|
|
WHMCS_ACCOUNT_NOT_FOUND: "WHMCS_ACCOUNT_NOT_FOUND",
|
|
SALESFORCE_ACCOUNT_NOT_FOUND: "SALESFORCE_ACCOUNT_NOT_FOUND",
|
|
LINKING_FAILED: "LINKING_FAILED",
|
|
} as const;
|
|
|
|
export type AuthErrorCode = (typeof AUTH_ERROR_CODE)[keyof typeof AUTH_ERROR_CODE];
|
|
|
|
// ============================================================================
|
|
// Token Type Constants
|
|
// ============================================================================
|
|
|
|
export const TOKEN_TYPE = {
|
|
BEARER: "Bearer",
|
|
} as const;
|
|
|
|
export type TokenTypeValue = (typeof TOKEN_TYPE)[keyof typeof TOKEN_TYPE];
|
|
|
|
// ============================================================================
|
|
// Gender Constants
|
|
// ============================================================================
|
|
|
|
export const GENDER = {
|
|
MALE: "male",
|
|
FEMALE: "female",
|
|
OTHER: "other",
|
|
} as const;
|
|
|
|
export type GenderValue = (typeof GENDER)[keyof typeof GENDER];
|
|
|
|
// ============================================================================
|
|
// Security Configuration Constants
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Password reset token configuration
|
|
* Single-use tokens tracked in Redis
|
|
*/
|
|
export const PASSWORD_RESET_CONFIG = {
|
|
/** Time-to-live in seconds (15 minutes) */
|
|
TTL_SECONDS: 900,
|
|
/** Tokens can only be used once */
|
|
SINGLE_USE: true,
|
|
} as const;
|
|
|
|
/**
|
|
* OTP (One-Time Password) configuration
|
|
* Used for email verification in get-started flow
|
|
*/
|
|
export const OTP_CONFIG = {
|
|
/** Time-to-live in seconds (10 minutes) */
|
|
TTL_SECONDS: 600,
|
|
/** Maximum verification attempts before invalidation */
|
|
MAX_ATTEMPTS: 3,
|
|
/** Length of generated code */
|
|
CODE_LENGTH: 6,
|
|
} as const;
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
// Request types
|
|
LoginRequest,
|
|
SignupRequest,
|
|
PasswordResetRequest,
|
|
ResetPasswordRequest,
|
|
SetPasswordRequest,
|
|
ChangePasswordRequest,
|
|
LinkWhmcsRequest,
|
|
ValidateSignupRequest,
|
|
UpdateCustomerProfileRequest,
|
|
AccountStatusRequest,
|
|
SsoLinkRequest,
|
|
CheckPasswordNeededRequest,
|
|
RefreshTokenRequest,
|
|
LoginVerifyOtpRequest,
|
|
// Token types
|
|
AuthTokens,
|
|
AuthSession,
|
|
PasswordResetTokenPayload,
|
|
// Response types
|
|
AuthResponse,
|
|
SignupResult,
|
|
PasswordChangeResult,
|
|
SsoLinkResponse,
|
|
CheckPasswordNeededResponse,
|
|
LinkWhmcsResponse,
|
|
LoginOtpRequiredResponse,
|
|
LoginResponse,
|
|
// Error types
|
|
AuthError,
|
|
} from "./schema.js";
|