529 Commits

Author SHA1 Message Date
barsa
1156398caa refactor: improve WHMCS account discovery error handling
- Simplify error handling in WhmcsAccountDiscoveryService by logging warnings for user sub-account lookup failures instead of throwing errors.
- Ensure that the primary client lookup remains the authoritative source while allowing supplementary checks for user accounts.
- Enhance code clarity and maintainability by removing unnecessary error checks.
2026-02-24 14:48:03 +09:00
barsa
9941250cb5 refactor: streamline authentication workflows and remove legacy services
- Replace SignupWorkflowService and GetStartedWorkflowService with new coordinator services for improved modularity and clarity.
- Update auth controller to utilize the new GetStartedCoordinator.
- Refactor account status handling in the GetStartedForm component to leverage XState for state management.
- Introduce new hooks for managing the get-started flow, enhancing the overall user experience.
- Remove deprecated services and clean up related imports to maintain code hygiene.
2026-02-24 14:37:23 +09:00
barsa
912582caf7 docs: add get-started flow refactoring design
Covers splitting the god class into per-path workflow services,
compensating transactions via DistributedTransactionService,
error classification, XState frontend state machine, and
legacy signup flow removal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:57:43 +09:00
barsa
5c329bbe96 refactor: update WHMCS mappers and schemas to use numberLike for type safety
- Refactor various mappers in billing, payments, services, and subscriptions to ensure IDs are consistently converted to numbers.
- Update raw types schemas to utilize whmcsNumberLike and whmcsString for improved validation and type safety.
- Enhance the whmcs-utils to include schema exports for better modularity.
2026-02-24 13:56:02 +09:00
barsa
7bc4c14b4c refactor: consolidate error handling to safeOperation 2026-02-24 13:15:45 +09:00
barsa
9736e96cb3 refactor: consolidate error handling to safeOperation
- Enhance safeOperation with rethrow and fallbackMessage options for CRITICAL operations
- Migrate all 19 withErrorHandling calls across 5 services to safeOperation
- Remove safeAsync from error.util.ts
- Delete error-handler.util.ts (withErrorHandling, withErrorSuppression, withErrorLogging)
- Update barrel exports in core/utils/index.ts
2026-02-24 13:15:35 +09:00
narantuya
a94e59fe06 Merge pull request 'Add Japanese translations of documentation' (#1) from feature/japanese-translations into main 2026-02-24 03:11:54 +00:00
d7efc99fdc Add Japanese translations of UAT and how-it-works documentation
Translated all UAT test guides and how-it-works documentation to Japanese.
Files are organized under docs/ja/uat/ and docs/ja/how-it-works/.
2026-02-24 12:11:14 +09:00
barsa
058ed4765f refactor: infrastructure consolidation 2026-02-24 11:58:21 +09:00
barsa
13f1bdc658 refactor: module reorganization 2026-02-24 11:58:17 +09:00
barsa
536bdb6c87 refactor: Salesforce throttle base guard and RealtimeModule rename 2026-02-24 11:58:13 +09:00
barsa
d32a703fd3 refactor: core layer quick wins 2026-02-24 11:58:09 +09:00
barsa
34abe1981f refactor: infrastructure consolidation
- Create RollbackCoordinator shared by TransactionService and DistributedTransactionService
- Remove unused executeSimpleTransaction()
- Split AuditService into AuditLogService (writes) and AuditQueryService (reads)
- Create CacheStrategyBase with request coalescing, metrics, and getOrSet pattern
- Refactor orders and support cache services to extend CacheStrategyBase
2026-02-24 11:58:02 +09:00
barsa
1e2ff96313 refactor: module reorganization
- Move sim-orders.controller.ts into sim-orders/ sub-directory with barrel file
- Extract checkout session business logic from orders controller into checkout-session.service.ts
2026-02-24 11:58:00 +09:00
barsa
b00e7aac95 refactor: extract Salesforce throttle base guard and rename RealtimeModule
- Create SalesforceThrottleBaseGuard abstract base class (read/write guards are thin subclasses)
- Rename infra RealtimeModule to RealtimePubSubModule to distinguish from RealtimeApiModule
2026-02-24 11:57:59 +09:00
barsa
1ac5e95e08 refactor: core layer quick wins
- Rename getRequestFingerprint to getRateLimitFingerprint in rate-limit.util.ts
- Delete empty CoreConfigModule wrapper (importers use @nestjs/config directly)
- Replace inline admin role check in csrf.controller.ts with @UseGuards(AdminGuard)
- Move hashEmailForLogs() from support.logging.ts to core/logging/redaction.util.ts
2026-02-24 11:57:58 +09:00
barsa
0c63bc5c33 refactor: domain package cleanup
- Remove validation wrapper functions from common/validation.ts (use Zod schemas directly)
- Delete duplicate CheckoutItem/CheckoutTotals/CheckoutCart/OrderCreateResponse from orders/contract.ts
- Delete empty orders/checkout.ts
- Remove unused MIGRATION_STEPS/MIGRATION_TRANSFER_ITEMS UI constants from auth/forms.ts
- Standardize checkout/contract.ts to not re-export schema types
- Fix customer/providers/index.ts to not re-export contract types through providers barrel
2026-02-24 11:57:43 +09:00
barsa
6e51012d21 UAT docs and bug fixes 2026-02-24 11:09:35 +09:00
Temuulen Ankhbayar
5e5bff12da fix: comprehensive SIM audit fixes and MNP debug logging
Address critical, high, and medium issues found during SIM management audit:

Critical: fix eSIM plan code mapping (SKU→PASI), PA05-41 endpoint typo,
PA05-05 gender mapping (F→W) and katakana field names.

High: fix double authKey injection, add MNP/porting fields to SF getOrder
SOQL, add reissue params to eSIM addAcnt, remove console.error debug stmt.

Medium: fix KB/MB conversion (1000→1024), birthday UTC timezone bug, plan
code regex matching "5G" as 5GB, case-insensitive isMnp flag, domain schema
enums (addKind +M, simkind E0/E2/E3), move identity into mnp Level 2.

Frontend: fix SVG donut radius mismatch (r=88→96), fix FreebitError typo.

Add comprehensive MNP debug logging across the entire data flow pipeline:
SF order extraction, config mapping, MNP field parsing, API payload assembly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:48:50 +09:00
Temuulen Ankhbayar
be09c78491 docs: add Freebit API specification docs (PA05-05/06/18/19/20/33/38/41)
Translated Freebit API specs for voice options, semi-black registration,
state changes, OTA activation, contract changes, and eSIM activation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:06:10 +09:00
Temuulen Ankhbayar
891d3aa099 feat: add MNP support for Physical SIM (PA05-19) and fix eSIM MNP bugs (PA05-41)
Physical SIM: route MNP orders through PA05-19 (semi-black registration)
instead of PA02-01. eSIM: fix PA05-41 payload — move identity fields into
mnp object (Level 2 nesting per spec), set addKind="M" and aladinOperated="20"
for MNP, map Salesforce gender "F" to Freebit "W", and pass simKind="E0".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:04:13 +09:00
Temuulen Ankhbayar
df017d520f fix: resolve SIM management modal, plan change, and voice feature issues
- Fix Tailwind v4 modal stacking bug by adding relative z-10 to modal
  content divs (CancellationFlow, ChangePlanModal, TopUpModal, SimActions)
- Add test mode for immediate plan changes (SIM_BILLING_TEST_MODE) instead
  of scheduling for 1st of next month
- Bypass rate limiter spacing/cancellation checks in test mode
- Hide voice feature toggles for data-only SIMs using hasVoice flag
- Guard BFF voice feature updates to reject early for data-only SIMs
- Fix Freebit retry logic to not retry business errors (e.g. resultCode 260)
- Add user-friendly error message for resultCode 260 (voice not active)
- Update plan change page text to reflect test mode behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 14:53:07 +09:00
Temuuleenn
191a377657 fix: enhance Order Activation Flow and improve WHMCS integration
- Refactor executeSfActivatedUpdate to only set Activation_Status__c, deferring Status change.
- Update WHMCS custom fields with new SIM Number, Serial Number, and EID after order acceptance.
- Modify Opportunity WH_Registeration__c field for better WHMCS linking.
- Populate new SIM Inventory assignment fields: Assigned_Account__c, Assigned_Order__c, SIM_Type__c.
- Remove support for PA05-18 Semi-Black SIM registration, switching to PA02-01 call.
- Adjust me-status check to verify Status: Processed instead of Activated.
2026-02-05 16:26:46 +09:00
Temuulen Ankhbayar
5c67fc34ea fix: resolve Order Activation Flow issues
- Fix SF Order locking by deferring Status change to final step
  - executeSfActivatedUpdate now only sets Activation_Status__c
  - executeSfRegistrationComplete sets Status: Processed atomically with WHMCS info

- Add WHMCS custom fields update step (whmcs_custom_fields)
  - AddOrder API expects field IDs, UpdateClientProduct accepts field names
  - New step updates SIM Number, Serial Number, EID after order acceptance

- Add Opportunity WH_Registeration__c field update
  - Sets productselect={serviceId} for WHMCS linking

- Add SIM Inventory assignment fields
  - Assigned_Account__c, Assigned_Order__c, SIM_Type__c now populated

- Remove PA05-18 Semi-Black SIM registration (only Black SIMs used)
  - Changed to direct PA02-01 call with createType=new

- Fix me-status to check for Status: Processed instead of Activated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 15:38:59 +09:00
Temuuleenn
df742e50bc fix: resolve BFF TypeScript errors and improve mobile UX
BFF fixes:
- Fix pino-http type import by using Params from nestjs-pino
- Use Prisma-generated AuditAction enum instead of local duplicate
- Add null check for sfAccountId in mapping mapper

Portal mobile UX improvements:
- DataTable: Add responsive card view for mobile with stacked layout
- Header: Increase touch targets to 44px minimum, better spacing
- PageLayout: Optimize padding and make breadcrumbs scrollable
- PublicShell: Add iOS safe area support, slide animation, language
  switcher and sign-in button visible in mobile header

Also removes "Trusted by Leading Companies" section from AboutUsView.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:29:55 +09:00
barsa
4c724da7ae feat: implement trusted device functionality for enhanced login experience 2026-02-03 19:21:48 +09:00
barsa
60849b59a8 chore: update dependencies and fix lint errors
- Update pnpm 10.25.0 → 10.28.2
- Update all packages to latest versions (Next.js, React, NestJS, Prisma, etc.)
- Fix 36 nested ternary lint errors (unicorn/no-nested-ternary)
- Add security overrides for lodash and hono transitive deps
- Change pinned versions to use caret (^) for auto-updates
- Update catalog versions (@types/node, typescript, zod)
- Resolve all 12 security vulnerabilities
2026-02-03 18:46:51 +09:00
barsa
70f65cedaa chore: remove IDE artifacts and update gitignore
- Remove .cursor/ folder from tracking (plans, worktrees, rules)
- Remove sim-api-test-log.csv from tracking
- Add .cursor/ and *.csv to gitignore
2026-02-03 18:35:15 +09:00
barsa
b957877c6f chore: ignore all csv files 2026-02-03 18:32:16 +09:00
barsa
7659f0d3ac chore: add test artifact csv to gitignore 2026-02-03 18:30:15 +09:00
barsa
7abd433d95 Refactor conditional rendering and improve code readability across multiple components
- Simplified conditional rendering in OrderSummary, ProductCard, InstallationOptions, InternetOfferingCard, DeviceCompatibility, SimPlansContent, and other components by removing unnecessary parentheses.
- Enhanced clarity in the use of ternary operators for better maintainability.
- Updated documentation to reflect changes in development setup for skipping OTP verification during login.
- Removed outdated orchestrator refactoring plan document.
- Added new environment variable for skipping OTP verification in development.
- Minor adjustments in domain contracts and mappers for consistency in conditional checks.
2026-02-03 18:28:38 +09:00
barsa
2dec0af63b fix: resolve nested ternary lint errors across codebase 2026-02-03 18:11:51 +09:00
barsa
44aa90061e refactor: remove unused metadata and sitemap configurations for cleaner code 2026-02-03 17:59:44 +09:00
barsa
9e442a51f8 feat: add API Property Name Guessing Audit and Orchestrator Refactoring Plan documentation 2026-02-03 17:37:42 +09:00
barsa
4cb393bdb8 refactor: simplify order fulfillment and remove unused public pages
- Extract fulfillment step executors and factory from orchestrator
- Remove unused signup, migrate, and internet configure pages
- Simplify PublicShell and landing page components
- Standardize conditional expressions across codebase
2026-02-03 17:35:47 +09:00
barsa
ff9ee10860 Merge main into alt-design
Resolved merge conflicts between main and alt-design branches.

Key decisions:
- BFF: Adopted SIM-first workflow from main (PA05-18 → PA02-01 → PA05-05 → WHMCS)
- BFF: Kept FreebitFacade pattern, added new services (AccountRegistration, VoiceOptions, SemiBlack)
- BFF: Fixed freebit-usage.service.ts bug (quotaKb → quotaMb)
- BFF: Merged rate limiting + HTTP status parsing in WHMCS error handler
- Portal: Took main's UI implementations
- Deleted: TV page, SignupForm, ServicesGrid (as per main)
- Added whmcsRegistrationUrl to field-maps.ts (was missing after file consolidation)

TODO post-merge:
- Refactor order-fulfillment-orchestrator.service.ts to use buildTransactionSteps abstraction
- Fix ESLint errors from main's code (skipped pre-commit for merge)
2026-02-03 16:12:05 +09:00
Temuuleenn
35619f24d1 Simplify physical SIM activation and enhance order fulfillment
- Remove PA05-18 semi-black step from physical SIM flow, use PA02-01 directly
- Add WHMCS client ID fallback from Salesforce WH_Account__c field
- Return service IDs from WHMCS AcceptOrder for proper linking
- Add phone number to WHMCS domain field and WHMCS admin URL to Salesforce
- Change SIM Inventory status from "In Use" to "Assigned"
- Fix SIM services query case sensitivity ("SIM" → "Sim")
- Add bash 3.2 compatibility to dev-watch.sh
- Add "Most Popular Services" section to landing page
- Add "Trusted By" company carousel to About page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:41:32 +09:00
barsa
61d2236b68 refactor: standardize conditional expressions for improved readability 2026-02-03 15:21:45 +09:00
barsa
f257ffe35a Refactor SupportCaseDetailView for improved state management and component structure
- Extracted case detail logic into a custom hook `useCaseDetailState` for better separation of concerns.
- Created sub-components: `CaseNotFoundView`, `CaseHeaderCard`, `CaseMetaInfoRow`, `CaseConversationSection`, `ReplyForm`, and `ClosedCaseNotice` to enhance readability and maintainability.
- Updated message bubble rendering to use `MessageBubbleHeader` and `MessageBubbleStatus` for clearer status indication.
- Improved loading and error handling in `ResidenceCardVerificationSettingsView` by creating dedicated content components for different states.
- Refactored `transformWhmcsSubscriptionListResponse` to enhance readability and maintainability.
- Minor code style adjustments for consistency and clarity across various files.
2026-02-03 13:12:08 +09:00
barsa
d5e22f14f5 feat: add address reconciliation queue service for Salesforce integration
- Implement AddressReconcileQueueService to handle address reconciliation jobs between WHMCS and Salesforce.
- Define job data structure and queue configuration for retries and error handling.
- Add methods for enqueueing reconciliation jobs and retrieving queue health metrics.

feat: create loading components for various services in the portal

- Add loading skeletons for Internet, SIM, VPN, and public services configuration.
- Implement loading states for account-related views including account details, services, and verification settings.
- Introduce loading states for support case details and subscription actions.

feat: implement OTP input component for user verification

- Create OtpInput component to handle 6-digit OTP input with auto-focus and navigation.
- Add LoginOtpStep component for OTP verification during login, including countdown timer and error handling.

feat: define address domain constants for validation

- Establish constants for address field length limits to ensure compliance with WHMCS API constraints.
- Include maximum lengths for address fields and user input fields to maintain data integrity.
2026-02-03 11:48:49 +09:00
Temuulen Ankhbayar
9fbb6ed61e Add PA05-18 semi-black registration before PA02-01 for physical SIM activation
Physical SIM activation was failing with error 210 "アカウント不在エラー"
(Account not found) because PA02-01 requires the SIM to be pre-registered
in Freebit's system. This adds PA05-18 (Semi-Black Account Registration)
as the first step before PA02-01.

New flow: PA05-18 → PA02-01 → PA05-05

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:02:15 +09:00
tema
b400b982f3 Improve section transitions with gradient bleed effect
- Replace animated blob hero background with dot grid pattern
- Add gradient bleed transitions between all landing page sections
- Apply same gradient bleed technique to About page sections
- Remove unused blob-float animations from globals.css
- Make Trust and Values sections full-width for visual consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:05:54 +09:00
tema
1283880f7d Revamp Physical SIM activation to use PA02-01 + PA05-05
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>
2026-01-30 18:22:00 +09:00
tema
56189a9fe8 Enhance Portal Functionality and UI Components
- Added new animation styles to globals.css for improved visual effects in the portal.
- Updated PublicShell component to include mobile menu functionality and touch device detection, enhancing user experience on mobile devices.
- Refactored PublicLandingView to incorporate a custom hook for scroll-triggered animations and improved form validation for user inquiries.
- Enhanced AboutUsView layout for better readability and accessibility, including corporate data presentation.
- Streamlined PublicInternetPlans component by removing unnecessary CTA elements, focusing on setup fee details for clarity.
- Adjusted PublicContactView styling for improved layout consistency across the portal.
2026-01-29 17:42:57 +09:00
tema
c9d568d22f Enhance Homepage UX with Mobile Navigation and Form Improvements
- Add mobile hamburger menu with full navigation
- Fix touch support for Services dropdown
- Add form validation and accessibility labels to contact form
- Add carousel position indicators and swipe support
- Add scroll-triggered animations with useInView hook
- Add sticky mobile CTA bar
- Improve Remote Support section mobile layout
- Add animated background blobs
- Add language selector (EN indicator)
- Optimize hero image with priority flag

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:42:19 +09:00
barsa
b5a1091d41 feat(sim-plans): update layout for SimPlansContent component with responsive design 2026-01-20 19:44:12 +09:00
barsa
7dff7dc728 refactor(auth): remove SignupForm and related steps, migrate to new account creation flow
- Deleted SignupForm component and its associated steps (AccountStep, AddressStep, PasswordStep, ReviewStep).
- Removed references to SignupForm in index files and views.
- Updated MigrateAccountView to redirect to the new get-started flow.
- Adjusted PublicInternetConfigureView to use InlineGetStartedSection instead of InlineAuthSection.
- Cleaned up unused hooks and store methods related to WHMCS linking.
2026-01-20 19:40:55 +09:00
barsa
0ee1f00bf8 feat(migrate-account): implement MigrateAccountStep for passwordless WHMCS account migration 2026-01-20 19:00:20 +09:00
barsa
464f98284a feat(eligibility): add address key field for Salesforce Flow duplicate detection
Add Eligibility_Address_Key__c field (postcode:streetAddress format) to Case records
for eligibility check requests. Salesforce Flow will use this field to detect duplicate
requests for the same address within a time period.

Changes:
- Add eligibilityAddressKey to CreateCaseParams and CASE_FIELDS mapping
- Add streetAddress param to EligibilityCheckCaseParams for passing from callers
- Add createAddressKey() helper in WorkflowCaseManager to generate the key
- Update raw.types.ts schema with new field
- Note in internet-eligibility.service.ts that basic flow skips duplicate detection
2026-01-20 19:00:09 +09:00
tema
ff870c9f4f Update Service Pages Metadata and Content for Enhanced User Engagement
- Revised metadata titles and descriptions across various service pages to better reflect offerings and improve SEO.
- Updated content in the About Us, Contact, and Support pages to emphasize English support and services for expats in Japan.
- Removed TV Services references from the portal, streamlining service offerings and focusing on core services.
- Enhanced service descriptions to clarify benefits and features, ensuring users understand the value of each service.
2026-01-20 17:19:00 +09:00