325 Commits

Author SHA1 Message Date
barsa
d3b94b1ed3 feat(auth): implement permission-based access control and centralized error handling
- Introduced PermissionsGuard to enforce permission checks on routes.
- Added RequirePermissions decorator for specifying required permissions on handlers.
- Created AUTH_ERRORS constants for consistent error messages across the auth module.
- Updated CsrfService to reduce CSRF token expiry time for enhanced security.
- Refactored auth cookie handling into utility functions for better maintainability.
- Enhanced TokenBlacklistService to default to fail-closed in production environments.
- Updated various DTOs and schemas for consistency and clarity.
- Removed legacy code and types related to SIM requests.
- Improved logging and error handling in GlobalAuthGuard.
- Added middleware for public path checks and optimistic authentication.
2026-01-19 10:40:50 +09:00
barsa
b52b2874d6 feat: add public VPN configuration page and view for unauthenticated users 2026-01-19 10:13:55 +09:00
barsa
f4099ac81f feat(eslint): enforce BFF architecture rules for controllers and aggregators 2026-01-16 17:11:49 +09:00
barsa
a23a5593f7 refactor(bff): restructure service architecture with clearer naming conventions
- Rename integration orchestrators to facades:
  - WhmcsConnectionOrchestratorService → WhmcsConnectionFacade
  - FreebitOperationsService → FreebitFacade
  - SalesforceService → SalesforceFacade

- Rename module orchestrator:
  - SimOrchestratorService → SimOrchestrator

- Rename aggregators for clarity:
  - MeStatusService → MeStatusAggregator
  - UserProfileService → UserProfileAggregator

- Move integration facades to dedicated facades/ folders:
  - whmcs/facades/whmcs.facade.ts
  - salesforce/facades/salesforce.facade.ts
  - freebit/facades/freebit.facade.ts

This establishes clearer architectural boundaries between:
- Facades: unified entry points for integration subsystems
- Orchestrators: coordinate workflows across multiple services
- Aggregators: read-only data composition from multiple sources

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 18:50:52 +09:00
barsa
18360416a3 feat(workflow): introduce Workflow Module and Case Manager for internal case handling
- Added WorkflowModule to manage internal workflow operations.
- Implemented WorkflowCaseManager for creating various types of internal cases (e.g., order placements, cancellations, ID verifications).
- Integrated WorkflowCaseManager into existing services for handling internet and SIM cancellations, eligibility checks, and ID verification submissions.
- Enhanced error handling and logging for case creation processes.
- Introduced CacheCoordinatorService for coordinating multiple cache invalidation operations with error aggregation.
- Updated relevant modules to include WorkflowModule and refactored services to utilize the new WorkflowCaseManager.
- Improved UI components in the eligibility check process for better user experience.
2026-01-15 18:15:51 +09:00
barsa
1294375205 feat: implement InlineGetStartedSection for email-first registration flow on service pages 2026-01-15 17:33:23 +09:00
barsa
7bcd7fa10d refactor: remove unused DTOs and guards from auth and billing controllers 2026-01-15 16:41:58 +09:00
barsa
37ef51cc82 chore: update repository structure documentation for clarity and organization 2026-01-15 16:31:15 +09:00
barsa
aa77f23d85 Refactor conditional rendering and improve code readability across multiple components
- Updated conditional rendering syntax in CheckoutStatusBanners, IdentityVerificationSection, and other components for consistency.
- Removed unused quick eligibility and maybe later API functions from get-started API.
- Enhanced error handling messages in various subscription views.
- Updated documentation to reflect changes in eligibility check flow.
- Cleaned up unused fields in Salesforce mapping and raw types.
2026-01-15 16:11:11 +09:00
barsa
a01361bb89 Enhance JapanAddressForm with 2026-01-15 14:38:25 +09:00
barsa
c4abd41ec6 2026-01-15 12:38:16 +09:00
barsa
0f6bae840f feat: add eligibility check flow with form, OTP, and success steps
- Implemented FormStep component for user input (name, email, address).
- Created OtpStep component for OTP verification.
- Developed SuccessStep component to display success messages based on account creation.
- Introduced eligibility-check.store for managing state throughout the eligibility check process.
- Added commitlint configuration for standardized commit messages.
- Configured knip for workspace management and project structure.
2026-01-15 11:28:25 +09:00
barsa
1d1602f5e7 feat: Implement unified eligibility check flow with inline OTP verification
- Refactor PublicLandingView to enhance service section animations.
- Update SimPlansContent and PublicEligibilityCheck to streamline service highlights.
- Revise PublicEligibilityCheck to support new flow: "Send Request Only" and "Continue to Create Account".
- Introduce guest eligibility check API with handoff token for account creation.
- Modify success step to provide clear options for account creation and navigation.
- Enhance form handling and error management in PublicEligibilityCheckView.
- Update domain schemas to accommodate guest eligibility requests and responses.
- Document new eligibility check flows and testing procedures.
2026-01-14 17:14:07 +09:00
barsa
bb4be98444 feat: Enhance About Us page with animations and updated styles
- Updated typography for headings and paragraphs in AboutUsView.
- Added animation effects for header and sections to improve user experience.
- Refactored section headers to use new display styles.

feat: Implement bilingual address handling in AddressConfirmation

- Integrated JapanAddressForm for ZIP code lookup and bilingual address input.
- Updated state management to handle bilingual addresses and validation.
- Enhanced save functionality to support dual-write to WHMCS and Salesforce.

fix: Adjust Japan Post address mapping to handle nullish values

- Updated address mapping to use nullish coalescing for optional fields.
- Ensured compatibility with API responses that may return null for certain fields.

feat: Add ServiceCard component for displaying services

- Created a flexible ServiceCard component with multiple variants (default, featured, minimal, bento).
- Implemented accent color options and responsive design for better UI.
- Added detailed props documentation and usage examples.

chore: Clean up development scripts

- Removed unnecessary build steps for validation package in manage.sh.
2026-01-14 16:25:06 +09:00
barsa
7624684e6b feat: enhance development experience by improving watch options for domain package and refining error logging in Japan Post Address Service 2026-01-14 14:00:37 +09:00
barsa
971cde9d05 feat(auth): add Password Reset Token Service and update token infrastructure 2026-01-14 13:58:24 +09:00
barsa
fd15324ef0 feat(address): integrate AddressModule and optimize Japan address form handling 2026-01-14 13:54:01 +09:00
barsa
78689da8fb feat(address): implement Japan address form with ZIP code lookup
- Add JapanAddressForm component for complete Japanese address input.
- Integrate ZipCodeInput for automatic address population via Japan Post API.
- Create hooks for ZIP code lookup and address service status.
- Define address-related types and constants in the domain package.
- Document the feature, including environment variables and API endpoints.
- Implement mapping functions for WHMCS and Salesforce address formats.
2026-01-13 18:41:17 +09:00
barsa
dc32e7aa07 feat: Enhance Public VPN Plans view with marketing content and new components
- Added detailed service highlights, how it works steps, and FAQs to the Public VPN Plans view.
- Introduced new components: CtaButton, FeaturedServiceCard, ProcessStep, ServiceCard, ServiceShowcaseCard, TrustBadge, TrustIndicators, HowItWorks, ServiceCTA, and ServiceFAQ for improved layout and functionality.
- Implemented a new design for the landing page with enhanced visuals and user engagement elements.
- Updated the VPN plans section to include a more informative and visually appealing layout.
2026-01-13 18:19:58 +09:00
barsa
bde9f706ce feat: add VPN services and call history management features
- Implemented VpnServicesService for managing VPN plans and activation fees.
- Created SimCallHistoryFormatterService for formatting call history data.
- Developed SimCallHistoryParserService to parse call history CSV files.
- Added AnimatedContainer and AnimatedBackground components for UI animations.
- Introduced BentoServiceCard, FloatingGlassCard, GlowButton, and ValuePropCard components for landing page.
- Implemented useCountUp hook for animated number counting.
- Added cancellation months utility functions for subscription management.
2026-01-13 16:19:39 +09:00
barsa
b49c94994d Decompose large services and components for improved maintainability
Phase 5: BFF Service Decomposition
- Split SalesforceOpportunityService (1055 lines) into focused services:
  - OpportunityQueryService: find/get operations
  - OpportunityCancellationService: cancellation workflows
  - OpportunityMutationService: create/update/link operations
  - SalesforceOpportunityService: thin facade (227 lines)

Phase 6: Portal Component Decomposition
- Refactor AccountCheckoutContainer (798 → 357 lines, 55% reduction)
- Extract reusable checkout section components:
  - ResidenceCardUploadInput: eliminates 3x duplicated upload UI
  - PaymentMethodSection: payment method handling
  - IdentityVerificationSection: identity verification states
  - OrderSubmitSection: order summary and submission

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:38:27 +09:00
barsa
f447ba1800 Refactor codebase: eliminate duplication, standardize patterns, resolve circular deps
Phase 1: Portal Duplication Cleanup
- Delete apps/portal/src/lib/ directory (12 duplicate files)
- Update imports to use canonical locations (core/, shared/)

Phase 2: Domain Package Standardization
- Add contract.ts to notifications and checkout modules
- Update billing schema to derive enums from contract

Phase 3: BFF Error Handling
- Remove hardcoded test SIM number from SimValidationService
- Use ConfigService for TEST_SIM_ACCOUNT env variable

Phase 4: Circular Dependency Resolution
- Create VoiceOptionsModule to break FreebitModule <-> SimManagementModule cycle
- Remove forwardRef usage between these modules
- Move SimVoiceOptionsService to new voice-options module

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:25:14 +09:00
barsa
90958d5e1d Update SalesforceAccountService to Handle Person Accounts and Update Contacts
- Modified SalesforceAccountService to support Person Accounts by adding required fields for account creation and updating associated contacts.
- Enhanced the createContact method to retrieve and update the PersonContactId instead of creating a new contact, ensuring compliance with Salesforce's Person Account structure.
- Improved logging for better traceability during account and contact updates, enhancing overall integration reliability.
2026-01-07 17:13:27 +09:00
barsa
3fb1de27d5 Add RecordTypeId for Person Accounts in Salesforce Account Service
- Updated SalesforceAccountService to include RecordTypeId for Person Accounts, ensuring proper handling of account types during creation.
- This addition enhances the integration with Salesforce by specifying the required record type for accounts, improving data accuracy and compliance with Salesforce requirements.
2026-01-06 17:03:27 +09:00
barsa
a8580b0d61 Enhance Salesforce Account and Contact Creation in Signup Workflow
- Updated SalesforceAccountService to map gender values to Salesforce picklist values and added date of birth handling for contact creation.
- Modified SignupWorkflowService to require gender and date of birth during account creation, ensuring complete data submission.
- Adjusted SignupAccountResolverService to include gender and date of birth in account creation logic, improving data integrity.
- Introduced SalesforceContactRecord interface in domain to standardize contact data structure, enhancing type safety and validation.
2026-01-06 16:52:02 +09:00
barsa
1a3032bbd3 Refactor Address Handling in Signup and Profile Components
- Updated address handling in Salesforce account and contact services to remove unnecessary address fields during signup, improving data management.
- Refactored address input fields in the SignupForm and AddressForm components to ensure proper labeling and validation for Japanese address formats.
- Enhanced address display logic in ProfileContainer and AddressConfirmation components for better user experience.
- Standardized address field names and improved placeholder texts for clarity and consistency across the application.
2026-01-06 16:13:59 +09:00
barsa
655d26da4f Refactor Subscription Module and Enhance Subscription Detail View
- Updated the subscriptions module to register CancellationController alongside SimController, ensuring more specific route matching for cancellation actions.
- Enhanced SubscriptionDetail component by adding a header action button for canceling Internet services, improving user experience and navigation.
- Removed deprecated Internet service actions from the SubscriptionDetail view, streamlining the component and promoting cleaner code.
2026-01-05 18:35:05 +09:00
barsa
b19c213931 Implement Unified Cancellation Features for SIM and Internet Services
- Added new methods in SalesforceOpportunityService to retrieve cancellation statuses for both Internet and SIM services by Opportunity ID, enhancing cancellation handling.
- Updated BFF module to include a new CancellationModule, improving service organization and modularity.
- Refactored portal routes and components to unify cancellation navigation, streamlining user experience.
- Introduced new domain schemas for unified cancellation previews, ensuring consistent data structure and validation across services.
- Removed deprecated cancellation components from the portal, promoting cleaner code and improved maintainability.
2026-01-05 17:09:10 +09:00
barsa
6096c15659 Refactor Salesforce Opportunity Integration for SIM and Internet Cancellations
- Updated opportunity field mappings to replace deprecated fields with new ones for SIM and Internet cancellations, enhancing clarity and consistency.
- Introduced separate data structures for Internet and SIM cancellation data, improving type safety and validation.
- Refactored SalesforceOpportunityService to handle updates for both Internet and SIM cancellations, ensuring accurate data handling.
- Enhanced cancellation query fields to support new SIM cancellation requirements, improving the overall cancellation process.
- Cleaned up the portal integration to reflect changes in opportunity source fields, promoting better data integrity and tracking.
2026-01-05 17:08:33 +09:00
tema
2b001809c3 Merge branch 'main' of https://github.com/NTumurbars/customer-portal 2026-01-05 15:59:09 +09:00
tema
4712463919 Adjust sim management layout and clean billing hook 2026-01-05 15:57:50 +09:00
barsa
a41f2bf47e Enhance BFF Modules and Update Domain Schemas
- Added new modules for SIM management, internet management, and call history to the BFF, improving service organization and modularity.
- Updated environment validation schema to reflect changes in Salesforce event channels, ensuring accurate configuration.
- Refactored router configuration to include new subscription-related modules, enhancing API routing clarity.
- Cleaned up Salesforce integration by removing unused service files and optimizing event handling logic.
- Improved support service by adding cache invalidation logic for case comments, ensuring real-time updates for users.
- Updated domain schemas to remove deprecated fields and enhance validation for residence card verification, promoting data integrity.
- Enhanced utility functions in the portal for better address formatting and confirmation prompts, improving user experience.
2026-01-05 15:11:56 +09:00
barsa
fd5336f499 Implement Case Messaging and Commenting Features in Salesforce Integration
- Added methods in `SalesforceCaseService` to fetch and add case messages, unifying email messages and case comments into a chronological conversation thread.
- Enhanced `SupportService` and `SupportController` to handle case message retrieval and comment addition, integrating new DTOs for request and response validation.
- Updated `SupportCaseDetailView` in the Portal to display conversation messages and allow users to add comments, improving user interaction with support cases.
- Introduced new schemas in the domain for case messages and comments, ensuring robust validation and type safety.
- Refactored Salesforce mappers to transform email messages and case comments into a unified format for display in the portal.
2025-12-29 18:39:13 +09:00
barsa
74d469ce22 Refactor API Client Error Handling and Update Date Formatting
- Enhanced error handling in various API client services by integrating `redactForLogs` for sensitive data protection in logs.
- Updated date formatting across multiple components and services to utilize `formatIsoDate` and `formatIsoRelative`, improving consistency and readability.
- Removed unused imports and optimized code structure for better maintainability.
- Streamlined retry logic in the Freebit and WHMCS services to improve resilience and error management during API requests.
2025-12-29 17:17:36 +09:00
barsa
a938c605c7 Enhance Salesforce Case Integration and Update Eligibility Logic
- Added new fields for notes and case ID in the ServicesCdcSubscriber to improve eligibility detail tracking.
- Refactored the SalesforceCaseService to unify case creation for various case types, including customer support and internal workflow cases.
- Updated InternetServicesService to create internal workflow cases for eligibility checks, enhancing tracking and management.
- Improved error handling and logging consistency across services when creating cases.
- Cleaned up unused imports and optimized code structure for better maintainability.
2025-12-29 16:53:32 +09:00
barsa
a55967a31f Refactor Error Handling and Improve Service Consistency
- Introduced `mapHttpStatusToErrorCode` function in the domain to standardize error code mapping from HTTP status codes, enhancing error handling across the application.
- Updated various services and controllers to utilize the new error mapping function, ensuring consistent error responses and improved clarity in logging.
- Refactored error handling in the BillingController and other modules to align with the updated practices, promoting maintainability and clarity in API responses.
- Cleaned up unused imports and optimized code structure for better maintainability across the BFF modules.
2025-12-29 15:44:01 +09:00
barsa
03eccd1db2 Enhance Error Handling and Logging Consistency Across Services
- Replaced instances of `getErrorMessage` with `extractErrorMessage` in various services to ensure consistent error handling and improve clarity in logging.
- Updated error logging in the Whmcs, Salesforce, and subscription services to utilize the new error extraction method, enhancing maintainability and debugging capabilities.
- Adjusted ESLint configuration to prevent the use of `console.log` in production code, promoting the use of a centralized logging solution.
- Refactored error handling in the Agentforce widget and other components to align with the updated logging practices, ensuring a consistent approach to error management across the application.
- Cleaned up unused imports and optimized code structure for better maintainability.
2025-12-29 15:07:11 +09:00
barsa
cdcdb4c172 Enhance User ID Handling and Validation Across Services
- Added optional userId parameter to payment capture methods in WhmcsService and WhmcsInvoiceService to improve tracking and management of user-related transactions.
- Updated invoice retrieval and user profile services to utilize parseUuidOrThrow for user ID validation, ensuring consistent error messaging for invalid formats.
- Refactored SIM billing and activation services to include userId in one-time charge creation, enhancing billing traceability.
- Adjusted validation logic in various services to improve clarity and maintainability, ensuring robust handling of user IDs throughout the application.
2025-12-29 14:21:55 +09:00
barsa
ed5c2ead63 Refactor Salesforce Integration and Update Billing Logic
- 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.
2025-12-29 14:09:33 +09:00
barsa
ea188f098b Refactor Residence Card Verification Logic and Enhance Error Handling
- Updated the MeStatusService to include a safe method for fetching residence card verification, improving error handling and providing a fallback response in case of failures.
- Refactored the ResidenceCardService to utilize a normalization utility for date handling and improved payload validation, ensuring consistent and safe responses from Salesforce.
- Enhanced logging for error scenarios to aid in debugging and maintainability.
- Updated the Next.js configuration to allow direct API calls, providing a solution to bypass Next's internal dev proxy and avoid deprecation warnings.
- Expanded documentation to guide users on configuring the environment for development.
2025-12-29 12:59:36 +09:00
barsa
88aebdc75c Remove Agent Logging from Bootstrap and CSRF Controller
- Eliminated agent logging fetch calls from the bootstrap process and CSRF token endpoint to streamline the code and reduce unnecessary network requests.
- Improved code clarity and maintainability by removing commented-out logging sections that were not contributing to functionality.
- Ensured that error handling remains intact while focusing on essential application logic.
2025-12-29 11:39:15 +09:00
barsa
2a1b4d93ed Refactor API Response Handling and Update Service Implementations
- Removed the TransformInterceptor to streamline response handling, ensuring that all responses are returned directly without a success envelope.
- Updated various controllers and services to utilize new action response schemas, enhancing clarity and consistency in API responses.
- Refactored error handling in the CsrfController and CheckoutController to improve logging and error management.
- Cleaned up unused imports and optimized code structure for better maintainability and clarity across the application.
2025-12-29 11:12:20 +09:00
barsa
fb682c4c44 Refactor Error Handling Utilities and Update Service Implementations
- Renamed `getErrorMessage` to `extractErrorMessage` for clarity and to avoid confusion with the domain's `getMessageForErrorCode`.
- Introduced a deprecation notice for `getErrorMessage` to maintain backward compatibility.
- Updated various services and controllers to utilize the new `extractErrorMessage` function, ensuring consistent error handling across the application.
- Enhanced error handling in the `BillingController`, `SubscriptionsService`, and other modules to improve maintainability and clarity in API responses.
2025-12-26 18:17:37 +09:00
barsa
934a87330d Refactor Billing Controller to Improve Error Handling
- Replaced inline error throwing with NotFoundException in the BillingController to enhance error handling and provide clearer responses for missing WHMCS client mappings.
- Updated multiple methods to ensure consistent error management across the controller, improving maintainability and clarity in API responses.
2025-12-26 17:36:06 +09:00
barsa
465a62a3e8 Refactor Domain Mappings and Update Import Paths
- 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.
2025-12-26 17:27:22 +09:00
barsa
a3dbd07183 Enhance ESLint Rules and Refactor Domain Imports
- Updated ESLint configuration to enforce stricter import rules for the @customer-portal/domain package, promoting better import hygiene and preventing deep imports.
- Refactored various files across the BFF and portal applications to comply with the new import rules, ensuring that only the appropriate modules are imported from the domain.
- Cleaned up unused imports and optimized code structure for improved maintainability and clarity.
- Updated documentation to reflect changes in import practices and domain structure.
2025-12-26 14:53:03 +09:00
barsa
fcc9bc247e Refactor Controllers to Utilize Zod DTOs for Parameter Validation
- Updated InvoicesController, NotificationsController, OrdersController, and SubscriptionsController to replace inline parameter validation with Zod DTOs, enhancing code maintainability and clarity.
- Introduced new DTOs for invoice and notification ID parameters, ensuring consistent validation across endpoints.
- Refactored service method calls to utilize the new DTOs, improving type safety and reducing potential errors.
- Cleaned up unused imports and optimized code structure for better readability.
2025-12-26 13:40:10 +09:00
barsa
a1be0ea527 Refactor Notification Handling and Update API Response Structure
- Improved notification handling in the NotificationsController to ensure consistent response formats across different endpoints.
- Updated response types to utilize ApiErrorResponse for error scenarios, enhancing clarity in API responses.
- Refactored service methods to streamline notification processing and improve maintainability.
- Cleaned up unused imports and optimized code structure for better readability.
2025-12-26 13:04:47 +09:00
barsa
10c8461661 Implement Zod DTOs for Request Validation and Enhance ESLint Rules
- Introduced Zod DTOs for request validation across multiple controllers, replacing inline validation with structured classes for improved maintainability and clarity.
- Updated ESLint configuration to enforce a rule against importing Zod directly in BFF controllers, promoting the use of shared domain schemas for request validation.
- Removed the SecureErrorMapperService to streamline the security module, as its functionality was deemed unnecessary.
- Enhanced various controllers to utilize the new DTOs, ensuring consistent validation and response handling across the application.
2025-12-26 13:04:15 +09:00
barsa
851207b401 Refactor WHMCS HTTP Client Error Handling and Update API Response Types
- Modified error handling in WhmcsHttpClientService to avoid exposing sensitive response bodies in error messages, logging snippets only in development mode.
- Updated NotificationsController and SubscriptionsController to use ApiSuccessAckResponse for success responses, enhancing type safety and consistency.
- Refactored various service methods to return more specific response types, including ApiSuccessResponse for subscription-related actions and improved SIM management services.
- Cleaned up unused interfaces and types in the SIM management services, streamlining the codebase and improving maintainability.
2025-12-26 10:30:09 +09:00