2025-12-22 18:59:38 +09:00
|
|
|
/**
|
|
|
|
|
* 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,
|
2026-01-05 16:32:45 +09:00
|
|
|
// Internet Cancellation notice constants
|
2025-12-22 18:59:38 +09:00
|
|
|
CANCELLATION_NOTICE,
|
|
|
|
|
type CancellationNoticeValue,
|
2026-01-05 16:32:45 +09:00
|
|
|
// Line return status constants (Internet)
|
2025-12-22 18:59:38 +09:00
|
|
|
LINE_RETURN_STATUS,
|
|
|
|
|
type LineReturnStatusValue,
|
2026-01-05 16:32:45 +09:00
|
|
|
// SIM Cancellation notice constants
|
|
|
|
|
SIM_CANCELLATION_NOTICE,
|
|
|
|
|
type SimCancellationNoticeValue,
|
2025-12-22 18:59:38 +09:00
|
|
|
// 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,
|
2025-12-23 16:44:45 +09:00
|
|
|
OPPORTUNITY_MATCH_STAGES_INTERNET_ELIGIBILITY,
|
|
|
|
|
OPPORTUNITY_MATCH_STAGES_ORDER_PLACEMENT,
|
2025-12-22 18:59:38 +09:00
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
// ============================================================================
|
2026-01-15 16:31:15 +09:00
|
|
|
// Contract Types (business types from contract.ts)
|
2025-12-22 18:59:38 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
export type {
|
2026-01-05 16:32:45 +09:00
|
|
|
InternetCancellationOpportunityData,
|
|
|
|
|
SimCancellationOpportunityData,
|
2025-12-22 18:59:38 +09:00
|
|
|
} 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";
|