- MNP_Application__c: change Zod type from z.string() to z.coerce.boolean()
to match Salesforce Checkbox field type
- Date fields (mnpExpiry, portingDateOfBirth, scheduledAt): convert
YYYY-MM-DD back to YYYYMMDD when reading from SF for Freebit API
- Gender mapping: handle full SF picklist values (Male/Female/Corporate)
not just legacy M/F codes, for both Freebit activation and PA05-05
- MNP reservation number: add max(10) per SF Text(10) field limit
- Porting name fields: add max(255) to match SF Text(255) limits
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comprehensive refactoring across 70 files (net -298 lines) improving
type safety, error handling, and code organization:
- Replace .passthrough()/.catchall(z.unknown()) with .strip() in all Zod schemas
- Tighten Record<string, unknown> to bounded union types where possible
- Replace throw new Error with domain-specific exceptions (OrderException,
FulfillmentException, WhmcsOperationException, SalesforceOperationException, etc.)
- Split AuthTokenService (625 lines) into TokenGeneratorService and
TokenRefreshService with thin orchestrator
- Deduplicate FreebitClientService with shared makeRequest() method
- Add typed interfaces to WHMCS facade, order service, and fulfillment mapper
- Externalize hardcoded config values to ConfigService with env fallbacks
- Consolidate duplicate billing cycle enums into shared billingCycleSchema
- Standardize logger usage (nestjs-pino @Inject(Logger) everywhere)
- Move shared WHMCS number coercion helpers to whmcs-utils/schema.ts
Replace PA05-33 OTA API with the proper two-step activation flow:
- PA02-01: Account Registration (/master/addAcnt/)
- PA05-05: Voice Options Registration (/mvno/talkoption/addOrder/)
Changes:
- Add FreebitAccountRegistrationService for PA02-01 account registration
- Add FreebitVoiceOptionsService for PA05-05 voice options
- Update SimFulfillmentService to use new APIs instead of PA05-33 OTA
- Add SalesforceSIMInventoryService for fetching SIM inventory data
- Remove deprecated FreebitOtaService (PA05-33 no longer used)
- Remove debug console.log statements
The new flow:
1. Fetch SIM inventory from Salesforce (phone number, PT number)
2. Call PA02-01 to register MVNO account with plan code
3. Call PA05-05 to configure voice options with customer identity
4. Update SIM inventory status to "In Use"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replaced the OrderFieldConfigModule with SalesforceOrderFieldConfigModule in the Salesforce integration module to streamline configuration management.
- Updated SalesforceOrderService to utilize SalesforceOrderFieldMapService, enhancing consistency in order field mapping.
- Refactored multiple controllers to remove inline query parsing, directly using query parameters for improved clarity and maintainability.
- Adjusted the ResidenceCardService to enhance error handling and response consistency when interacting with Salesforce.
- Cleaned up unused imports and optimized code structure for better maintainability across the BFF modules.
- Removed the domain mappings module, consolidating related types and schemas into the id-mappings feature.
- Updated import paths across the BFF to reflect the new structure, ensuring compliance with import hygiene rules.
- Cleaned up unused files and optimized the codebase for better maintainability and clarity.
- Introduced new controllers for internet eligibility and service health checks to enhance backend functionality.
- Created service modules for internet, SIM, and VPN offerings, improving organization and maintainability.
- Developed various components for internet and SIM configuration, including forms and plan cards, to streamline user interactions.
- Implemented hooks for managing service configurations and eligibility checks, enhancing frontend data handling.
- Updated utility functions for pricing and catalog operations to support new service structures and improve performance.
- Refactored the SignupWorkflowService to throw a DomainHttpException for legacy account conflicts, improving error handling.
- Updated the SignupForm component to include initialEmail and showFooterLinks props, enhancing user experience during account creation.
- Improved the AccountStep in the SignupForm to allow users to add optional details, such as date of birth and gender, for a more personalized signup process.
- Enhanced the PasswordStep to include terms acceptance and marketing consent options, ensuring compliance and user engagement.
- Updated various catalog views to improve layout and user guidance, streamlining the onboarding process for new users.
- Changed TypeScript target and library settings in tsconfig files to align with ESNext standards.
- Updated pnpm version in GitHub workflows for better dependency management.
- Modified Dockerfile to reflect the updated pnpm version.
- Adjusted import statements across various domain modules to include file extensions for consistency and compatibility.
- Cleaned up TypeScript configuration files for improved clarity and organization.
- Removed admin authentication methods and related configurations from WhmcsConfigService, simplifying the API integration.
- Updated WHMCS API methods to directly use API key authentication, improving security and reducing complexity.
- Enhanced error logging in WHMCS HTTP client to include full response context for better debugging.
- Adjusted order processing components to reflect changes in authentication handling, ensuring consistent behavior across the application.
- Improved loading states in the portal UI for better user experience during order processing.
- Introduced OrderEventsService to manage order-related events and updates.
- Added SSE endpoint in OrdersController for streaming order updates to clients.
- Enhanced OrderFulfillmentOrchestrator to publish order status updates during fulfillment processes.
- Updated order field mappings to include bundled add-on information for improved order detail handling.
- Refactored OrderCard and OrderDetail components for better display of order information and status updates.
- Replaced UsersService with UsersFacade across various modules for improved abstraction and consistency.
- Updated validation imports to utilize the new @customer-portal/validation package, enhancing modularity.
- Removed deprecated validation files and streamlined user-related logic in controllers and services.
- Enhanced order processing by integrating field mappings for Salesforce orders, improving maintainability.
- Improved error handling and response structures in authentication and user management workflows.
- Updated WHMCS service to utilize addressSchema for client address retrieval, enhancing data validation.
- Cleaned up imports in WHMCS client service for better organization.
- Improved logging format in WHMCS subscription service for clearer output.
- Streamlined address handling in order builder service for consistency.
- Enhanced code readability by formatting JSX elements in ProfileContainer and other components.
- Removed deprecated billing cycle normalization logic and centralized it in the domain helpers for better maintainability.
- Added a new error mapping for "SESSION_EXPIRED" in SecureErrorMapperService to provide user-friendly messages and appropriate logging levels.
- Updated SessionTimeoutWarning component to include a reason for logout when the session expires, improving user feedback.
- Refactored useAuth hook to support enhanced logout functionality with reason options, ensuring better session management.
- Improved auth.store to handle logout reasons and integrate with error handling for session refresh failures.
- Streamlined LoginView to display logout messages based on session expiration, enhancing user experience.
- Refreshed CODEBASE_ANALYSIS.md to reflect the new ownership model and improve onboarding documentation.
- Deleted obsolete VALIDATION_DUPLICATION_REPORT.md to streamline the codebase.
- Made minor adjustments to various components and services for better organization and clarity.
- Added exceptions to .gitignore for the portal public directory to ensure proper asset management.
- Marked CSRF token retrieval and refresh endpoints as public for improved access control.
- Refactored WHMCS invoice service to enhance error logging and processing of invoice records.
- Updated WHMCS raw types to introduce a common schema for invoices, improving data consistency and validation.
- Enhanced Salesforce order item transformation to streamline billing cycle handling.