2025-10-08 10:33:33 +09:00
|
|
|
/**
|
|
|
|
|
* Customer Domain
|
2025-12-23 17:53:08 +09:00
|
|
|
*
|
2025-10-08 16:31:42 +09:00
|
|
|
* Main exports:
|
|
|
|
|
* - User: API response type
|
|
|
|
|
* - UserAuth: Portal DB auth state
|
|
|
|
|
* - Address: Address structure (follows billing/subscriptions pattern)
|
2025-12-23 17:53:08 +09:00
|
|
|
*
|
2025-10-08 16:31:42 +09:00
|
|
|
* Pattern matches billing and subscriptions domains.
|
2025-12-23 17:53:08 +09:00
|
|
|
*
|
2025-10-08 10:33:33 +09:00
|
|
|
* Types are derived from Zod schemas (Schema-First Approach)
|
|
|
|
|
*/
|
|
|
|
|
|
2025-10-08 16:31:42 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
// Constants
|
|
|
|
|
// ============================================================================
|
2025-10-08 10:33:33 +09:00
|
|
|
|
2026-02-24 11:57:43 +09:00
|
|
|
export {
|
|
|
|
|
USER_ROLE,
|
|
|
|
|
type UserRoleValue,
|
|
|
|
|
type SalesforceAccountFieldMap,
|
|
|
|
|
type SalesforceAccountRecord,
|
|
|
|
|
type SalesforceContactRecord,
|
|
|
|
|
} from "./contract.js";
|
2025-10-08 10:33:33 +09:00
|
|
|
|
2025-10-08 16:31:42 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
// Domain Types (Clean Names - Public API)
|
|
|
|
|
// ============================================================================
|
2025-10-08 10:33:33 +09:00
|
|
|
|
|
|
|
|
export type {
|
2025-12-23 17:53:08 +09:00
|
|
|
User, // API response type (normalized camelCase)
|
|
|
|
|
UserAuth, // Portal DB auth state
|
|
|
|
|
UserRole, // "USER" | "ADMIN"
|
|
|
|
|
Address, // Address structure (not "CustomerAddress")
|
2025-10-08 16:31:42 +09:00
|
|
|
AddressFormData, // Address form validation
|
2025-10-09 10:49:03 +09:00
|
|
|
ProfileEditFormData, // Profile edit form data
|
2025-12-23 17:53:08 +09:00
|
|
|
ResidenceCardVerificationStatus,
|
|
|
|
|
ResidenceCardVerification,
|
|
|
|
|
UserProfile, // Alias for User
|
2025-10-09 10:49:03 +09:00
|
|
|
AuthenticatedUser, // Alias for authenticated user
|
2025-12-23 17:53:08 +09:00
|
|
|
WhmcsClient, // Provider-normalized WHMCS client shape
|
2025-12-10 15:22:10 +09:00
|
|
|
} from "./schema.js";
|
2025-10-08 16:31:42 +09:00
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
// Schemas
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
export {
|
|
|
|
|
userSchema,
|
|
|
|
|
userAuthSchema,
|
|
|
|
|
addressSchema,
|
|
|
|
|
addressFormSchema,
|
2025-10-09 10:49:03 +09:00
|
|
|
profileEditFormSchema,
|
2025-12-23 17:53:08 +09:00
|
|
|
residenceCardVerificationStatusSchema,
|
|
|
|
|
residenceCardVerificationSchema,
|
|
|
|
|
|
2025-10-08 16:31:42 +09:00
|
|
|
// Helper functions
|
2025-12-23 17:53:08 +09:00
|
|
|
combineToUser, // Domain helper: UserAuth + WhmcsClient → User
|
2025-10-08 16:31:42 +09:00
|
|
|
addressFormToRequest,
|
2025-10-09 10:49:03 +09:00
|
|
|
profileFormToRequest,
|
2025-12-10 15:22:10 +09:00
|
|
|
} from "./schema.js";
|
2025-10-08 16:31:42 +09:00
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
// Provider Namespace
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Providers namespace contains provider-specific implementations
|
2025-12-23 17:53:08 +09:00
|
|
|
*
|
2025-10-08 16:31:42 +09:00
|
|
|
* Access as:
|
|
|
|
|
* - Providers.Whmcs.Client (full WHMCS type)
|
|
|
|
|
* - Providers.Whmcs.transformWhmcsClientResponse()
|
|
|
|
|
* - Providers.Portal.mapPrismaUserToUserAuth()
|
|
|
|
|
*/
|
2025-12-26 14:53:03 +09:00
|
|
|
// NOTE: Provider adapters and provider-specific types are intentionally not exported
|
|
|
|
|
// from the module root. Import BFF-only provider APIs from:
|
|
|
|
|
// @customer-portal/domain/customer/providers
|