- Introduced ServicesCdcSubscriber for handling Salesforce Change Data Capture events, enabling real-time updates for product and account eligibility changes. - Developed utility functions for building SOQL queries related to services, enhancing data retrieval capabilities. - Created base service classes for internet, SIM, and VPN offerings, improving code organization and maintainability. - Implemented ServicesCacheService for efficient caching and invalidation of service data, leveraging CDC for real-time updates. - Enhanced existing service components to utilize new caching mechanisms and ensure data consistency across the application.
97 lines
2.4 KiB
TypeScript
97 lines
2.4 KiB
TypeScript
/**
|
|
* Services Domain - Contract
|
|
*
|
|
* Constants and types for the services domain.
|
|
* Most types are derived from schemas (see schema.ts).
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Salesforce Field Mapping (Provider-Specific, Not Validated)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Salesforce Product2 field mapping
|
|
* This is provider-specific and not validated at runtime
|
|
*/
|
|
export interface SalesforceProductFieldMap {
|
|
sku: string;
|
|
portalCategory: string;
|
|
portalCatalog: string;
|
|
portalAccessible: string;
|
|
itemClass: string;
|
|
billingCycle: string;
|
|
whmcsProductId: string;
|
|
whmcsProductName: string;
|
|
internetPlanTier: string;
|
|
internetOfferingType: string;
|
|
displayOrder: string;
|
|
bundledAddon: string;
|
|
isBundledAddon: string;
|
|
simDataSize: string;
|
|
simPlanType: string;
|
|
simHasFamilyDiscount: string;
|
|
vpnRegion: string;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Pricing and Filter Types
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Pricing tier for display purposes
|
|
*/
|
|
export interface PricingTier {
|
|
name: string;
|
|
price: number;
|
|
billingCycle: "Monthly" | "Onetime" | "Annual";
|
|
description?: string;
|
|
features?: string[];
|
|
isRecommended?: boolean;
|
|
originalPrice?: number;
|
|
}
|
|
|
|
/**
|
|
* Standardized pricing display info
|
|
* Used for consistent price rendering across Frontend and BFF
|
|
*/
|
|
export interface CatalogPriceInfo {
|
|
display: string;
|
|
monthly: number | null;
|
|
oneTime: number | null;
|
|
currency: string;
|
|
}
|
|
|
|
/**
|
|
* Catalog filtering options
|
|
*/
|
|
export interface CatalogFilter {
|
|
category?: string;
|
|
priceMin?: number;
|
|
priceMax?: number;
|
|
search?: string;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
CatalogProductBase,
|
|
CatalogPricebookEntry,
|
|
// Internet products
|
|
InternetCatalogProduct,
|
|
InternetPlanTemplate,
|
|
InternetPlanCatalogItem,
|
|
InternetInstallationCatalogItem,
|
|
InternetAddonCatalogItem,
|
|
InternetEligibilityStatus,
|
|
InternetEligibilityDetails,
|
|
// SIM products
|
|
SimCatalogProduct,
|
|
SimActivationFeeCatalogItem,
|
|
// VPN products
|
|
VpnCatalogProduct,
|
|
// Union type
|
|
CatalogProduct,
|
|
} from "./schema.js";
|