- Updated CacheModule and CacheService with detailed documentation and new methods for better cache management, including pattern deletion and memory usage tracking. - Refactored CatalogCacheService and OrdersCacheService to utilize CDC-driven cache invalidation, improving data freshness and reducing unnecessary API calls. - Introduced SIM plan options and updated related components to leverage new domain utilities for better plan management and user experience. - Enhanced error handling and validation in TopUpModal for improved user feedback during SIM top-up operations. - Removed obsolete plan formatting utilities to streamline codebase and improve maintainability.
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
/**
|
|
* SIM Domain - Contract
|
|
*
|
|
* Constants and types for the SIM domain.
|
|
* All validated types are derived from schemas (see schema.ts).
|
|
*/
|
|
|
|
// ============================================================================
|
|
// SIM Status Constants
|
|
// ============================================================================
|
|
|
|
export const SIM_STATUS = {
|
|
ACTIVE: "active",
|
|
SUSPENDED: "suspended",
|
|
CANCELLED: "cancelled",
|
|
PENDING: "pending",
|
|
} as const;
|
|
|
|
// ============================================================================
|
|
// SIM Type Constants
|
|
// ============================================================================
|
|
|
|
export const SIM_TYPE = {
|
|
STANDARD: "standard",
|
|
NANO: "nano",
|
|
MICRO: "micro",
|
|
ESIM: "esim",
|
|
} as const;
|
|
|
|
// ============================================================================
|
|
// SIM Plan Codes (frontend-safe subset; authoritative list lives in WHMCS)
|
|
// ============================================================================
|
|
|
|
export const SIM_PLAN_CODES = ["PASI_5G", "PASI_10G", "PASI_25G", "PASI_50G"] as const;
|
|
|
|
export type SimPlanCode = (typeof SIM_PLAN_CODES)[number];
|
|
|
|
export const SIM_PLAN_LABELS: Record<SimPlanCode, string> = {
|
|
PASI_5G: "5GB",
|
|
PASI_10G: "10GB",
|
|
PASI_25G: "25GB",
|
|
PASI_50G: "50GB",
|
|
};
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
SimStatus,
|
|
SimType,
|
|
SimDetails,
|
|
RecentDayUsage,
|
|
SimUsage,
|
|
SimTopUpHistoryEntry,
|
|
SimTopUpHistory,
|
|
// Request types
|
|
SimTopUpRequest,
|
|
SimPlanChangeRequest,
|
|
SimCancelRequest,
|
|
SimTopUpHistoryRequest,
|
|
SimFeaturesUpdateRequest,
|
|
// Activation types
|
|
SimOrderActivationRequest,
|
|
SimOrderActivationMnp,
|
|
SimOrderActivationAddons,
|
|
} from './schema';
|