110 lines
3.5 KiB
TypeScript
Raw Normal View History

/**
* Opportunity Domain
*
* Exports all Opportunity-related contracts, schemas, helpers, and types.
* Used for Salesforce Opportunity lifecycle management including cancellation.
*
* Key features:
* - Service lifecycle tracking (Introduction -> Active -> Cancelling -> Cancelled)
* - Cancellation deadline logic (25th of month rule)
* - Rental equipment return tracking
*
* Types are derived from Zod schemas (Schema-First Approach)
*/
// ============================================================================
// Constants
// ============================================================================
export {
// Stage constants (existing Salesforce picklist values)
OPPORTUNITY_STAGE,
type OpportunityStageValue,
// Application stage constants
APPLICATION_STAGE,
type ApplicationStageValue,
// Internet Cancellation notice constants
CANCELLATION_NOTICE,
type CancellationNoticeValue,
// Line return status constants (Internet)
LINE_RETURN_STATUS,
type LineReturnStatusValue,
// SIM Cancellation notice constants
SIM_CANCELLATION_NOTICE,
type SimCancellationNoticeValue,
// Commodity type constants (existing Salesforce CommodityType field)
COMMODITY_TYPE,
type CommodityTypeValue,
// Product type constants (simplified, derived from CommodityType)
OPPORTUNITY_PRODUCT_TYPE,
type OpportunityProductTypeValue,
// Default commodity types for portal
PORTAL_DEFAULT_COMMODITY_TYPES,
// Commodity type helpers
getCommodityTypeProductType,
getDefaultCommodityType,
// Source constants
OPPORTUNITY_SOURCE,
type OpportunitySourceValue,
// Matching constants
OPEN_OPPORTUNITY_STAGES,
OPPORTUNITY_MATCH_STAGES_INTERNET_ELIGIBILITY,
OPPORTUNITY_MATCH_STAGES_ORDER_PLACEMENT,
CLOSED_OPPORTUNITY_STAGES,
// Deadline constants
CANCELLATION_DEADLINE_DAY,
RENTAL_RETURN_DEADLINE_DAY,
// Customer-facing service display types
type CustomerServicePhase,
type ServiceLinkStatus,
type OrderTrackingInfo,
type WhmcsServiceDetails,
type CancellationDisplayInfo,
type CustomerServiceView,
// Customer-facing helpers
getCustomerPhaseFromStage,
getOrderTrackingSteps,
canServiceBeCancelled,
} from "./contract.js";
// ============================================================================
// Contract Types (business types from contract.ts)
// ============================================================================
export type {
InternetCancellationOpportunityData,
SimCancellationOpportunityData,
} from "./contract.js";
// ============================================================================
// Schemas and Validated Types (preferred)
// ============================================================================
export {
// Schemas
opportunityRecordSchema,
createOpportunityRequestSchema,
updateOpportunityStageRequestSchema,
cancellationFormDataSchema,
cancellationOpportunityDataSchema,
cancellationMonthOptionSchema,
cancellationEligibilitySchema,
cancellationStatusSchema,
opportunityLookupCriteriaSchema,
opportunityMatchResultSchema,
opportunityResponseSchema,
createOpportunityResponseSchema,
cancellationPreviewResponseSchema,
// Derived types (preferred - validated)
type OpportunityRecord,
type CreateOpportunityRequest,
type UpdateOpportunityStageRequest,
type CancellationFormData,
type CancellationOpportunityData,
type CancellationMonthOption,
type CancellationEligibility,
type CancellationStatus,
type OpportunityLookupCriteria,
type OpportunityMatchResult,
} from "./schema.js";