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

78 lines
2.4 KiB
TypeScript

/**
* Customer Domain
*
* Main exports:
* - User: API response type
* - UserAuth: Portal DB auth state
* - Address: Address structure (follows billing/subscriptions pattern)
*
* Pattern matches billing and subscriptions domains.
*
* Types are derived from Zod schemas (Schema-First Approach)
*/
// ============================================================================
// Constants
// ============================================================================
export {
USER_ROLE,
type UserRoleValue,
type SalesforceAccountFieldMap,
type SalesforceAccountRecord,
type SalesforceContactRecord,
} from "./contract.js";
// ============================================================================
// Domain Types (Clean Names - Public API)
// ============================================================================
export type {
User, // API response type (normalized camelCase)
UserAuth, // Portal DB auth state
UserRole, // "USER" | "ADMIN"
Address, // Address structure (not "CustomerAddress")
AddressFormData, // Address form validation
ProfileEditFormData, // Profile edit form data
ResidenceCardVerificationStatus,
ResidenceCardVerification,
UserProfile, // Alias for User
AuthenticatedUser, // Alias for authenticated user
WhmcsClient, // Provider-normalized WHMCS client shape
} from "./schema.js";
// ============================================================================
// Schemas
// ============================================================================
export {
userSchema,
userAuthSchema,
addressSchema,
addressFormSchema,
profileEditFormSchema,
residenceCardVerificationStatusSchema,
residenceCardVerificationSchema,
// Helper functions
combineToUser, // Domain helper: UserAuth + WhmcsClient → User
addressFormToRequest,
profileFormToRequest,
} from "./schema.js";
// ============================================================================
// Provider Namespace
// ============================================================================
/**
* Providers namespace contains provider-specific implementations
*
* Access as:
* - Providers.Whmcs.Client (full WHMCS type)
* - Providers.Whmcs.transformWhmcsClientResponse()
* - Providers.Portal.mapPrismaUserToUserAuth()
*/
// 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