Update documentation and remove unused files for codebase clarity
- 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.
This commit is contained in:
parent
31bd4ba8c6
commit
d04b256885
@ -1,186 +1,18 @@
|
||||
# Codebase Analysis: Remaining Errors & Redundancies
|
||||
# Codebase Analysis (October 2025)
|
||||
|
||||
## 🔴 **Critical Type Errors**
|
||||
## ✅ Recent Cleanup
|
||||
- **Checkout contracts unified**: `checkoutBuildCartRequestSchema` and the wrapped response now live in `@customer-portal/domain/orders`. Both the NestJS controller and service import the shared types, eliminating local Zod definitions and ad-hoc request shapes.
|
||||
- **SIM configuration aligned**: The catalog store and `useSimConfigure` hook persist state that maps directly to `simConfigureFormSchema`. Validation now delegates to the domain schema, and UI state uses the shared field names (`selectedAddons`, `scheduledActivationDate`, etc.).
|
||||
- **Dashboard metadata centralized**: Invoice/service activity metadata schemas moved into `@customer-portal/domain/dashboard`, and the portal utilities reuse them rather than maintaining local copies.
|
||||
- **UI totals reuse domain types**: `EnhancedOrderSummary` now aliases `CheckoutTotals`, keeping the presentation layer in lockstep with the API contract.
|
||||
- **Build artefacts removed**: Legacy `dist/` folders under `apps/bff` and `packages/*` were deleted and remain ignored so future builds stay out of version control.
|
||||
|
||||
### 1. **Portal API Client Method Case Issue**
|
||||
**Location**: `apps/portal/src/features/checkout/services/checkout.service.ts`
|
||||
```typescript
|
||||
// ❌ ERROR: Property 'post' does not exist on type 'ApiClient'. Did you mean 'POST'?
|
||||
return apiClient.post("/checkout/cart", { ... });
|
||||
await apiClient.post("/checkout/validate", cart);
|
||||
```
|
||||
## 🔍 Follow-Up Opportunities
|
||||
- **Auth workflow audit**: Re-run a focused review of the WHMCS link workflow and mapping services to confirm no lingering loose types (the earlier report flagged placeholder values—verify after the latest merges).
|
||||
- **Portal checkout transforms**: Consider using `simConfigureFormToRequest` when serialising SIM selections into cart params so the client sends the same payload shape the BFF expects.
|
||||
- **End-to-end validation run**: Execute `pnpm lint && pnpm type-check` once the workspace stabilises to catch any regressions introduced outside the touched files.
|
||||
|
||||
**Fix**: Use uppercase method names
|
||||
```typescript
|
||||
return apiClient.POST("/checkout/cart", { ... });
|
||||
await apiClient.POST("/checkout/validate", cart);
|
||||
```
|
||||
|
||||
### 2. **PricingTier Export Issue**
|
||||
**Location**: `apps/portal/src/features/catalog/components/index.ts:29`
|
||||
```typescript
|
||||
// ❌ ERROR: Module declares 'PricingTier' locally, but it is not exported
|
||||
export type { PricingDisplayProps, PricingTier } from "./base/PricingDisplay";
|
||||
```
|
||||
|
||||
**Fix**: Remove PricingTier from local export since it's now imported from domain
|
||||
```typescript
|
||||
export type { PricingDisplayProps } from "./base/PricingDisplay";
|
||||
```
|
||||
|
||||
### 3. **Checkout Hook Type Issue**
|
||||
**Location**: `apps/portal/src/features/checkout/hooks/useCheckout.ts:115`
|
||||
```typescript
|
||||
// ❌ ERROR: Type 'null' is not assignable to parameter type 'OrderConfigurations | undefined'
|
||||
const cart = await checkoutService.buildCart(orderType, selections, simConfig);
|
||||
```
|
||||
|
||||
**Fix**: Handle null case
|
||||
```typescript
|
||||
const cart = await checkoutService.buildCart(orderType, selections, simConfig || undefined);
|
||||
```
|
||||
|
||||
### 4. **Response Helper Type Issue**
|
||||
**Location**: `apps/portal/src/lib/api/response-helpers.ts:91`
|
||||
```typescript
|
||||
// ❌ ERROR: Property 'data' is missing in type
|
||||
```
|
||||
|
||||
**Fix**: Ensure response structure matches expected type
|
||||
|
||||
---
|
||||
|
||||
## 🟠 **High Priority Redundancies**
|
||||
|
||||
### 1. **SIM Action Request Types Duplication**
|
||||
**Location**: `apps/portal/src/features/subscriptions/services/sim-actions.service.ts`
|
||||
|
||||
**Problem**: Portal defines its own request types instead of using domain types
|
||||
```typescript
|
||||
// ❌ Portal defines locally
|
||||
export interface TopUpRequest {
|
||||
quotaMb: number;
|
||||
}
|
||||
|
||||
export interface ChangePlanRequest {
|
||||
newPlanCode: string;
|
||||
assignGlobalIp: boolean;
|
||||
scheduledAt?: string;
|
||||
}
|
||||
```
|
||||
|
||||
**Domain already has** (`packages/domain/sim/schema.ts`):
|
||||
```typescript
|
||||
// ✅ Domain has validated types
|
||||
export type SimTopUpRequest = z.infer<typeof simTopUpRequestSchema>;
|
||||
export type SimPlanChangeRequest = z.infer<typeof simPlanChangeRequestSchema>;
|
||||
export type SimCancelRequest = z.infer<typeof simCancelRequestSchema>;
|
||||
```
|
||||
|
||||
**Impact**:
|
||||
- Portal types lack validation (no min/max for quotaMb, no format validation for scheduledAt)
|
||||
- Types could diverge over time
|
||||
- No runtime type checking before API calls
|
||||
|
||||
### 2. **SIM Configuration Schema Missing**
|
||||
**Location**: `apps/portal/src/features/catalog/hooks/useSimConfigure.ts`
|
||||
|
||||
**Problem**: Broken imports from wrong domain
|
||||
```typescript
|
||||
// ❌ Wrong imports
|
||||
import {
|
||||
simConfigureFormSchema, // Does not exist
|
||||
simConfigureFormToRequest, // Does not exist
|
||||
type SimConfigureFormData, // Does not exist
|
||||
type SimType, // Exists in domain/sim
|
||||
type ActivationType, // Does not exist in billing
|
||||
type MnpData, // Does not exist in billing
|
||||
} from "@customer-portal/domain/billing"; // Wrong domain
|
||||
```
|
||||
|
||||
**Fix**: Create proper schemas in domain/sim or domain/orders
|
||||
|
||||
---
|
||||
|
||||
## 🟡 **Medium Priority Issues**
|
||||
|
||||
### 3. **BFF Auth Workflow Type Issues**
|
||||
**Location**: `apps/bff/src/modules/auth/infra/workflows/workflows/whmcs-link-workflow.service.ts`
|
||||
|
||||
**Problem**: Type '{}' is not assignable to type 'string'
|
||||
```typescript
|
||||
// Lines 144-147: Empty object assignments to string fields
|
||||
```
|
||||
|
||||
**Fix**: Ensure proper string values or handle empty cases
|
||||
|
||||
### 4. **Prisma Type Issue**
|
||||
**Location**: `apps/bff/src/modules/id-mappings/mappings.service.ts:71`
|
||||
|
||||
**Problem**: `Prisma.IdMapping` does not exist
|
||||
```typescript
|
||||
// ❌ ERROR: Namespace has no exported member 'IdMapping'
|
||||
```
|
||||
|
||||
**Fix**: Check Prisma schema or use correct type name
|
||||
|
||||
### 5. **Users Service Type Issue**
|
||||
**Location**: `apps/bff/src/modules/users/users.service.ts:535`
|
||||
|
||||
**Problem**: Type '{}' is not assignable to type 'string'
|
||||
```typescript
|
||||
// Line 535: Empty object assignment to string field
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🟢 **Low Priority Cleanup Opportunities**
|
||||
|
||||
### 6. **Validation Schema Organization**
|
||||
**Current State**: Good separation between `common/validation.ts` and `toolkit/validation/`
|
||||
**Recommendation**: Keep current structure, toolkit is for utilities, common is for validation
|
||||
|
||||
### 7. **Domain Package Structure**
|
||||
**Current State**: Well-organized with clear separation
|
||||
**Recommendation**: No changes needed, follows good DDD principles
|
||||
|
||||
### 8. **BFF Service Architecture**
|
||||
**Current State**: Good separation of concerns
|
||||
**Recommendation**: Consider extracting shared validation logic to domain layer
|
||||
|
||||
---
|
||||
|
||||
## 📋 **Implementation Priority**
|
||||
|
||||
### **Phase 1: Fix Critical Type Errors** (30 minutes)
|
||||
1. Fix API client method case (`post` → `POST`)
|
||||
2. Remove PricingTier from local export
|
||||
3. Handle null simConfig in checkout hook
|
||||
4. Fix response helper type issue
|
||||
|
||||
### **Phase 2: Remove Type Duplications** (1 hour)
|
||||
1. Replace Portal SIM request types with domain types
|
||||
2. Create missing SIM configuration schemas
|
||||
3. Update imports to use correct domain
|
||||
|
||||
### **Phase 3: Fix BFF Type Issues** (30 minutes)
|
||||
1. Fix auth workflow string assignments
|
||||
2. Fix Prisma type reference
|
||||
3. Fix users service string assignment
|
||||
|
||||
### **Phase 4: Cleanup & Documentation** (30 minutes)
|
||||
1. Update any remaining documentation
|
||||
2. Run full type check
|
||||
3. Verify all functionality works
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **Success Criteria**
|
||||
|
||||
- ✅ All TypeScript errors resolved
|
||||
- ✅ No duplicate type definitions between Portal and Domain
|
||||
- ✅ All validation schemas centralized in Domain
|
||||
- ✅ Portal uses Domain types exclusively
|
||||
- ✅ BFF uses Domain types exclusively
|
||||
- ✅ All tests passing
|
||||
- ✅ Type checking passes across all workspaces
|
||||
## 🎯 Next Recommended Steps
|
||||
1. **Type-check sweep** – run the workspace type checker and fix residual errors, paying special attention to auth and user modules.
|
||||
2. **Checkout flow trace** – ensure the BFF and portal both serialise/deserialise SIM selections via the shared helpers (avoids stale query-param parsing edge cases).
|
||||
3. **Documentation refresh** – propagate the new ownership model (domain-first schemas) into any onboarding or architecture docs so future engineers default to the shared packages.
|
||||
|
||||
@ -1,521 +0,0 @@
|
||||
# Validation Duplication Report: BFF vs Portal
|
||||
|
||||
**Date**: October 8, 2025
|
||||
**Scope**: Cross-layer validation type duplication analysis
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
After fixing frontend form duplication with domain schemas, I found **additional type duplication** between the portal and domain layers. The portal is defining its own request types instead of importing validated types from the domain layer.
|
||||
|
||||
**Status**: 🔴 Duplication Found
|
||||
**Impact**: Medium - Types work but lack validation, could diverge over time
|
||||
**Effort to Fix**: Low (1-2 hours)
|
||||
|
||||
---
|
||||
|
||||
## Duplication Found
|
||||
|
||||
### Issue #1: SIM Action Request Types Duplicated
|
||||
|
||||
**Location**: `apps/portal/src/features/subscriptions/services/sim-actions.service.ts`
|
||||
|
||||
**Portal defines** (lines 3-15):
|
||||
```typescript
|
||||
export interface TopUpRequest {
|
||||
quotaMb: number;
|
||||
}
|
||||
|
||||
export interface ChangePlanRequest {
|
||||
newPlanCode: string;
|
||||
assignGlobalIp: boolean;
|
||||
scheduledAt?: string;
|
||||
}
|
||||
|
||||
export interface CancelRequest {
|
||||
scheduledAt: string;
|
||||
}
|
||||
```
|
||||
|
||||
**Domain already has** (`packages/domain/sim/schema.ts`):
|
||||
```typescript
|
||||
export const simTopUpRequestSchema = z.object({
|
||||
quotaMb: z
|
||||
.number()
|
||||
.int()
|
||||
.min(100, "Quota must be at least 100MB")
|
||||
.max(51200, "Quota must be 50GB or less"),
|
||||
});
|
||||
|
||||
export const simPlanChangeRequestSchema = z.object({
|
||||
newPlanCode: z.string().min(1, "New plan code is required"),
|
||||
assignGlobalIp: z.boolean().optional(),
|
||||
scheduledAt: z
|
||||
.string()
|
||||
.regex(/^\d{8}$/, "Scheduled date must be in YYYYMMDD format")
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const simCancelRequestSchema = z.object({
|
||||
scheduledAt: z
|
||||
.string()
|
||||
.regex(/^\d{8}$/, "Scheduled date must be in YYYYMMDD format")
|
||||
.optional(),
|
||||
});
|
||||
|
||||
// Exported types
|
||||
export type SimTopUpRequest = z.infer<typeof simTopUpRequestSchema>;
|
||||
export type SimPlanChangeRequest = z.infer<typeof simPlanChangeRequestSchema>;
|
||||
export type SimCancelRequest = z.infer<typeof simCancelRequestSchema>;
|
||||
```
|
||||
|
||||
**Problems**:
|
||||
1. ❌ Portal types lack validation (no min/max for quotaMb, no format validation for scheduledAt)
|
||||
2. ❌ Portal types use different names (TopUpRequest vs SimTopUpRequest)
|
||||
3. ❌ Field types differ (assignGlobalIp is required in portal but optional in domain)
|
||||
4. ❌ No single source of truth - types could diverge over time
|
||||
5. ❌ Portal doesn't benefit from Zod validation rules
|
||||
|
||||
**Impact**:
|
||||
- Medium priority - The portal service works, but requests aren't validated client-side
|
||||
- Data could be sent in wrong format (e.g., scheduledAt as "2024-10-08" instead of "20241008")
|
||||
- No runtime type checking before API calls
|
||||
|
||||
---
|
||||
|
||||
### Issue #2: SIM Configuration Schema Missing
|
||||
|
||||
**Location**: `apps/portal/src/features/catalog/hooks/useSimConfigure.ts` (lines 7-14)
|
||||
|
||||
**Portal attempts to import**:
|
||||
```typescript
|
||||
import {
|
||||
simConfigureFormSchema, // ❌ Does not exist
|
||||
simConfigureFormToRequest, // ❌ Does not exist
|
||||
type SimConfigureFormData, // ❌ Does not exist
|
||||
type SimType, // ✅ Exists in domain/sim
|
||||
type ActivationType, // ❌ Does not exist in billing
|
||||
type MnpData, // ❌ Does not exist in billing
|
||||
} from "@customer-portal/domain/billing"; // ❌ Wrong domain
|
||||
```
|
||||
|
||||
**Problems**:
|
||||
1. ❌ Imports from wrong domain (billing instead of sim/orders)
|
||||
2. ❌ Schemas don't exist yet in any domain
|
||||
3. ❌ This is likely causing TypeScript errors
|
||||
|
||||
**Impact**:
|
||||
- High priority - Broken imports
|
||||
- SIM configuration flow may not be working correctly
|
||||
- Need to create proper schemas in domain layer
|
||||
|
||||
---
|
||||
|
||||
## BFF Layer Analysis
|
||||
|
||||
### ✅ BFF Correctly Uses Domain Schemas
|
||||
|
||||
The BFF layer is **following the correct pattern**:
|
||||
|
||||
**Example 1: Auth Controller**
|
||||
```typescript
|
||||
// apps/bff/src/modules/auth/presentation/http/auth.controller.ts
|
||||
import {
|
||||
signupRequestSchema,
|
||||
passwordResetRequestSchema,
|
||||
passwordResetSchema,
|
||||
setPasswordRequestSchema,
|
||||
linkWhmcsRequestSchema,
|
||||
// ... all from domain
|
||||
} from "@customer-portal/domain/auth";
|
||||
|
||||
@UsePipes(new ZodValidationPipe(signupRequestSchema))
|
||||
async signup(@Body() body: SignupRequest) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
**Example 2: Orders Controller**
|
||||
```typescript
|
||||
// apps/bff/src/modules/orders/orders.controller.ts
|
||||
import {
|
||||
createOrderRequestSchema,
|
||||
type CreateOrderRequest,
|
||||
} from "@customer-portal/domain/orders";
|
||||
|
||||
@UsePipes(new ZodValidationPipe(createOrderRequestSchema))
|
||||
async create(@Body() body: CreateOrderRequest) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
**Example 3: Subscriptions Controller**
|
||||
```typescript
|
||||
// apps/bff/src/modules/subscriptions/subscriptions.controller.ts
|
||||
import {
|
||||
simTopupRequestSchema,
|
||||
simChangePlanRequestSchema,
|
||||
simCancelRequestSchema,
|
||||
simFeaturesRequestSchema,
|
||||
type SimTopupRequest,
|
||||
type SimChangePlanRequest,
|
||||
type SimCancelRequest,
|
||||
type SimFeaturesRequest,
|
||||
} from "@customer-portal/domain/sim";
|
||||
|
||||
@UsePipes(new ZodValidationPipe(simTopupRequestSchema))
|
||||
async topUp(@Body() body: SimTopupRequest) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
**Why BFF is correct**:
|
||||
- ✅ Imports validation schemas from domain
|
||||
- ✅ Uses ZodValidationPipe for runtime validation
|
||||
- ✅ Uses domain types for type safety
|
||||
- ✅ No duplicate type definitions
|
||||
- ✅ Single source of truth
|
||||
|
||||
---
|
||||
|
||||
## Portal Layer Issues
|
||||
|
||||
### ❌ Portal Sometimes Bypasses Domain Types
|
||||
|
||||
The portal defines its own types for API calls instead of importing from domain:
|
||||
|
||||
**Problem Pattern**:
|
||||
```typescript
|
||||
// Portal defines its own simple types
|
||||
export interface TopUpRequest {
|
||||
quotaMb: number;
|
||||
}
|
||||
|
||||
// But domain has validated types
|
||||
export type SimTopUpRequest = z.infer<typeof simTopUpRequestSchema>;
|
||||
|
||||
// Portal should be using domain types
|
||||
import type { SimTopUpRequest } from "@customer-portal/domain/sim";
|
||||
```
|
||||
|
||||
**Why this is problematic**:
|
||||
1. No client-side validation before API calls
|
||||
2. Types could diverge from backend expectations
|
||||
3. Harder to maintain consistency
|
||||
4. Duplicates type definitions
|
||||
5. Loses validation rules (min/max, regex patterns, etc.)
|
||||
|
||||
---
|
||||
|
||||
## Comparison: What's Working vs. What's Not
|
||||
|
||||
### ✅ Good Examples (Portal correctly uses domain)
|
||||
|
||||
```typescript
|
||||
// apps/portal/src/features/orders/services/orders.service.ts
|
||||
import type { CreateOrderRequest } from "@customer-portal/domain/orders";
|
||||
|
||||
async function createOrder(payload: CreateOrderRequest) {
|
||||
// Uses domain type directly
|
||||
}
|
||||
```
|
||||
|
||||
```typescript
|
||||
// apps/portal/src/features/auth/stores/auth.store.ts
|
||||
import type {
|
||||
LoginRequest,
|
||||
SignupRequest,
|
||||
LinkWhmcsRequest
|
||||
} from "@customer-portal/domain/auth";
|
||||
|
||||
// Uses domain types for all auth operations
|
||||
```
|
||||
|
||||
### ❌ Bad Examples (Portal defines own types)
|
||||
|
||||
```typescript
|
||||
// apps/portal/src/features/subscriptions/services/sim-actions.service.ts
|
||||
|
||||
// ❌ BAD - Duplicates domain types
|
||||
export interface TopUpRequest {
|
||||
quotaMb: number;
|
||||
}
|
||||
|
||||
// ✅ GOOD - Should be:
|
||||
import type { SimTopUpRequest } from "@customer-portal/domain/sim";
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Recommended Fixes
|
||||
|
||||
### Fix #1: Replace Portal SIM Types with Domain Types
|
||||
|
||||
**File**: `apps/portal/src/features/subscriptions/services/sim-actions.service.ts`
|
||||
|
||||
**Current** (lines 1-16):
|
||||
```typescript
|
||||
import { apiClient, getDataOrDefault } from "@/lib/api";
|
||||
|
||||
export interface TopUpRequest {
|
||||
quotaMb: number;
|
||||
}
|
||||
|
||||
export interface ChangePlanRequest {
|
||||
newPlanCode: string;
|
||||
assignGlobalIp: boolean;
|
||||
scheduledAt?: string;
|
||||
}
|
||||
|
||||
export interface CancelRequest {
|
||||
scheduledAt: string;
|
||||
}
|
||||
```
|
||||
|
||||
**Should be**:
|
||||
```typescript
|
||||
import { apiClient, getDataOrDefault } from "@/lib/api";
|
||||
import type {
|
||||
SimTopUpRequest,
|
||||
SimPlanChangeRequest,
|
||||
SimCancelRequest
|
||||
} from "@customer-portal/domain/sim";
|
||||
|
||||
// Remove duplicate type definitions
|
||||
// Types are now imported from domain
|
||||
```
|
||||
|
||||
**Update service methods**:
|
||||
```typescript
|
||||
export const simActionsService = {
|
||||
async topUp(subscriptionId: string, request: SimTopUpRequest): Promise<void> {
|
||||
await apiClient.POST("/api/subscriptions/{subscriptionId}/sim/top-up", {
|
||||
params: { path: { subscriptionId } },
|
||||
body: request,
|
||||
});
|
||||
},
|
||||
|
||||
async changePlan(subscriptionId: string, request: SimPlanChangeRequest): Promise<void> {
|
||||
await apiClient.POST("/api/subscriptions/{subscriptionId}/sim/change-plan", {
|
||||
params: { path: { subscriptionId } },
|
||||
body: request,
|
||||
});
|
||||
},
|
||||
|
||||
async cancel(subscriptionId: string, request: SimCancelRequest): Promise<void> {
|
||||
await apiClient.POST("/api/subscriptions/{subscriptionId}/sim/cancel", {
|
||||
params: { path: { subscriptionId } },
|
||||
body: request,
|
||||
});
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
**Benefits**:
|
||||
- ✅ Single source of truth
|
||||
- ✅ Types match backend exactly
|
||||
- ✅ Can add client-side validation using domain schemas
|
||||
- ✅ Less code to maintain
|
||||
|
||||
---
|
||||
|
||||
### Fix #2: Create Missing SIM Configuration Schemas
|
||||
|
||||
**Files to create/update**:
|
||||
1. `packages/domain/sim/schema.ts` - Add configuration schemas
|
||||
2. `apps/portal/src/features/catalog/hooks/useSimConfigure.ts` - Fix imports
|
||||
|
||||
**Add to domain** (`packages/domain/sim/schema.ts`):
|
||||
```typescript
|
||||
// SIM Configuration Form Schema (for frontend)
|
||||
export const simConfigureFormSchema = z.object({
|
||||
simType: z.enum(["eSIM", "Physical SIM"]),
|
||||
eid: z.string().min(15).optional(),
|
||||
selectedAddons: z.array(z.string()),
|
||||
activationType: z.enum(["Immediate", "Scheduled"]),
|
||||
scheduledActivationDate: z.string().regex(/^\d{8}$/).optional(),
|
||||
wantsMnp: z.boolean(),
|
||||
mnpData: z.object({
|
||||
reservationNumber: z.string(),
|
||||
expiryDate: z.string().regex(/^\d{8}$/),
|
||||
phoneNumber: z.string(),
|
||||
mvnoAccountNumber: z.string().optional(),
|
||||
portingLastName: z.string().optional(),
|
||||
portingFirstName: z.string().optional(),
|
||||
portingLastNameKatakana: z.string().optional(),
|
||||
portingFirstNameKatakana: z.string().optional(),
|
||||
portingGender: z.string().optional(),
|
||||
portingDateOfBirth: z.string().regex(/^\d{8}$/).optional(),
|
||||
}).optional(),
|
||||
});
|
||||
|
||||
export type SimConfigureFormData = z.infer<typeof simConfigureFormSchema>;
|
||||
export type ActivationType = "Immediate" | "Scheduled";
|
||||
export type MnpData = z.infer<typeof simConfigureFormSchema>["mnpData"];
|
||||
|
||||
// Transform function to convert form data to API request
|
||||
export function simConfigureFormToRequest(
|
||||
formData: SimConfigureFormData
|
||||
): SimOrderActivationRequest {
|
||||
// Transform logic here
|
||||
return {
|
||||
// ...
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**Update portal hook** (`apps/portal/src/features/catalog/hooks/useSimConfigure.ts`):
|
||||
```typescript
|
||||
import {
|
||||
simConfigureFormSchema,
|
||||
simConfigureFormToRequest,
|
||||
type SimConfigureFormData,
|
||||
type ActivationType,
|
||||
type MnpData,
|
||||
} from "@customer-portal/domain/sim"; // ✅ Correct domain
|
||||
|
||||
import type { SimType } from "@customer-portal/domain/sim"; // ✅ Already exists
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Fix Portal SIM Action Types (30 minutes)
|
||||
|
||||
**Priority**: Medium
|
||||
**Impact**: Improves type safety, enables client validation
|
||||
|
||||
Tasks:
|
||||
- [ ] Update `apps/portal/src/features/subscriptions/services/sim-actions.service.ts`
|
||||
- [ ] Remove duplicate type definitions
|
||||
- [ ] Import types from `@customer-portal/domain/sim`
|
||||
- [ ] Update all usages in components
|
||||
- [ ] Verify TypeScript compilation
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Create SIM Configuration Schemas (1-2 hours)
|
||||
|
||||
**Priority**: High (fixes broken imports)
|
||||
**Impact**: Enables SIM configuration flow
|
||||
|
||||
Tasks:
|
||||
- [ ] Create `simConfigureFormSchema` in `packages/domain/sim/schema.ts`
|
||||
- [ ] Export types: `SimConfigureFormData`, `ActivationType`, `MnpData`
|
||||
- [ ] Create `simConfigureFormToRequest()` transform function
|
||||
- [ ] Update exports in `packages/domain/sim/index.ts`
|
||||
- [ ] Fix imports in `apps/portal/src/features/catalog/hooks/useSimConfigure.ts`
|
||||
- [ ] Test SIM configuration flow
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Add Client-Side Validation (Optional, 1 hour)
|
||||
|
||||
**Priority**: Low
|
||||
**Impact**: Better UX with early validation
|
||||
|
||||
Tasks:
|
||||
- [ ] Add Zod validation in portal services before API calls
|
||||
- [ ] Show validation errors to users before submitting
|
||||
- [ ] Use same validation rules as backend
|
||||
|
||||
Example:
|
||||
```typescript
|
||||
async topUp(subscriptionId: string, request: SimTopUpRequest) {
|
||||
// Validate before API call
|
||||
const validated = simTopUpRequestSchema.parse(request);
|
||||
|
||||
await apiClient.POST("/api/subscriptions/{subscriptionId}/sim/top-up", {
|
||||
params: { path: { subscriptionId } },
|
||||
body: validated,
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### After Fix #1 (Portal SIM Types)
|
||||
1. Import and use domain types in portal service
|
||||
2. Verify TypeScript compilation succeeds
|
||||
3. Test SIM top-up, plan change, and cancel flows
|
||||
4. Verify API receives correctly formatted data
|
||||
|
||||
### After Fix #2 (SIM Configuration)
|
||||
1. Verify all imports resolve correctly
|
||||
2. Test SIM configuration form
|
||||
3. Verify form validation works
|
||||
4. Test API submission with form data
|
||||
|
||||
---
|
||||
|
||||
## Benefits of Fixes
|
||||
|
||||
### Current State Issues
|
||||
- ❌ Duplicate type definitions
|
||||
- ❌ No client-side validation
|
||||
- ❌ Types could diverge from backend
|
||||
- ❌ Broken imports in SIM configuration
|
||||
- ❌ No validation for date formats, min/max values
|
||||
|
||||
### After Fixes
|
||||
- ✅ Single source of truth for all types
|
||||
- ✅ Type safety across layers
|
||||
- ✅ Option to add client-side validation
|
||||
- ✅ All imports working correctly
|
||||
- ✅ Validation rules enforced (formats, ranges, etc.)
|
||||
- ✅ Less code to maintain
|
||||
- ✅ Consistency guaranteed
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
### Current Architecture
|
||||
|
||||
```
|
||||
Domain Layer (packages/domain/sim)
|
||||
├── Schemas with validation ✅
|
||||
├── Types inferred from schemas ✅
|
||||
└── Exported for reuse ✅
|
||||
|
||||
BFF Layer (apps/bff)
|
||||
├── Imports domain schemas ✅
|
||||
├── Uses ZodValidationPipe ✅
|
||||
└── No duplication ✅
|
||||
|
||||
Portal Layer (apps/portal)
|
||||
├── Sometimes imports domain types ⚠️
|
||||
├── Sometimes defines own types ❌
|
||||
└── Missing schemas (SIM config) ❌
|
||||
```
|
||||
|
||||
### Target Architecture
|
||||
|
||||
```
|
||||
Domain Layer
|
||||
└── Single source of truth for all schemas and types
|
||||
|
||||
BFF Layer
|
||||
└── Uses domain schemas via ZodValidationPipe
|
||||
|
||||
Portal Layer
|
||||
└── Uses domain types for all API calls
|
||||
└── Optional: Add client validation using domain schemas
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Related Documents
|
||||
|
||||
- [Frontend Validation Patterns](./docs/validation/FRONTEND_VALIDATION_PATTERNS.md)
|
||||
- [Validation Audit Summary](./VALIDATION_AUDIT_SUMMARY.md)
|
||||
- [Validation Patterns Guide](./docs/validation/VALIDATION_PATTERNS.md)
|
||||
|
||||
---
|
||||
|
||||
**Next Steps**: Review and approve fixes, then implement in priority order.
|
||||
|
||||
@ -5,20 +5,14 @@ import { CheckoutService } from "../services/checkout.service";
|
||||
import {
|
||||
CheckoutCart,
|
||||
checkoutCartSchema,
|
||||
OrderConfigurations,
|
||||
checkoutBuildCartRequestSchema,
|
||||
checkoutBuildCartResponseSchema,
|
||||
type CheckoutBuildCartRequest,
|
||||
} from "@customer-portal/domain/orders";
|
||||
import { apiSuccessResponseSchema } from "@customer-portal/domain/common";
|
||||
import { z } from "zod";
|
||||
import type { RequestWithUser } from "@bff/modules/auth/auth.types";
|
||||
|
||||
// Request schemas for checkout endpoints
|
||||
const buildCartRequestSchema = z.object({
|
||||
orderType: z.string(),
|
||||
selections: z.record(z.string(), z.string()),
|
||||
configuration: z.any().optional(),
|
||||
});
|
||||
|
||||
const buildCartResponseSchema = apiSuccessResponseSchema(checkoutCartSchema);
|
||||
const validateCartResponseSchema = apiSuccessResponseSchema(z.object({ valid: z.boolean() }));
|
||||
|
||||
@Controller("checkout")
|
||||
@ -29,10 +23,10 @@ export class CheckoutController {
|
||||
) {}
|
||||
|
||||
@Post("cart")
|
||||
@UsePipes(new ZodValidationPipe(buildCartRequestSchema))
|
||||
@UsePipes(new ZodValidationPipe(checkoutBuildCartRequestSchema))
|
||||
async buildCart(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: z.infer<typeof buildCartRequestSchema>
|
||||
@Body() body: CheckoutBuildCartRequest
|
||||
) {
|
||||
this.logger.log("Building checkout cart", {
|
||||
userId: req.user?.id,
|
||||
@ -43,10 +37,10 @@ export class CheckoutController {
|
||||
const cart = await this.checkoutService.buildCart(
|
||||
body.orderType,
|
||||
body.selections,
|
||||
body.configuration as OrderConfigurations
|
||||
body.configuration
|
||||
);
|
||||
|
||||
return buildCartResponseSchema.parse({
|
||||
return checkoutBuildCartResponseSchema.parse({
|
||||
success: true,
|
||||
data: cart,
|
||||
});
|
||||
|
||||
@ -7,6 +7,9 @@ import {
|
||||
checkoutCartSchema,
|
||||
OrderConfigurations,
|
||||
ORDER_TYPE,
|
||||
type OrderTypeValue,
|
||||
type OrderSelections,
|
||||
buildOrderConfigurations,
|
||||
} from "@customer-portal/domain/orders";
|
||||
import type {
|
||||
InternetPlanCatalogItem,
|
||||
@ -34,8 +37,8 @@ export class CheckoutService {
|
||||
* Build checkout cart from order type and selections
|
||||
*/
|
||||
async buildCart(
|
||||
orderType: string,
|
||||
selections: Record<string, string>,
|
||||
orderType: OrderTypeValue,
|
||||
selections: OrderSelections,
|
||||
configuration?: OrderConfigurations
|
||||
): Promise<CheckoutCart> {
|
||||
this.logger.log("Building checkout cart", { orderType, selections });
|
||||
@ -60,10 +63,13 @@ export class CheckoutService {
|
||||
throw new BadRequestException(`Unsupported order type: ${orderType}`);
|
||||
}
|
||||
|
||||
const configurationPayload: OrderConfigurations =
|
||||
configuration ?? buildOrderConfigurations(selections);
|
||||
|
||||
const cart: CheckoutCart = {
|
||||
items,
|
||||
totals,
|
||||
configuration: configuration || ({} as OrderConfigurations),
|
||||
configuration: configurationPayload,
|
||||
};
|
||||
|
||||
// Validate the cart using domain schema
|
||||
@ -136,9 +142,7 @@ export class CheckoutService {
|
||||
/**
|
||||
* Build Internet order cart
|
||||
*/
|
||||
private async buildInternetCart(
|
||||
selections: Record<string, string>
|
||||
): Promise<{ items: CheckoutItem[] }> {
|
||||
private async buildInternetCart(selections: OrderSelections): Promise<{ items: CheckoutItem[] }> {
|
||||
const items: CheckoutItem[] = [];
|
||||
const plans: InternetPlanCatalogItem[] = await this.internetCatalogService.getPlans();
|
||||
const addons: InternetAddonCatalogItem[] = await this.internetCatalogService.getAddons();
|
||||
@ -209,9 +213,7 @@ export class CheckoutService {
|
||||
/**
|
||||
* Build SIM order cart
|
||||
*/
|
||||
private async buildSimCart(
|
||||
selections: Record<string, string>
|
||||
): Promise<{ items: CheckoutItem[] }> {
|
||||
private async buildSimCart(selections: OrderSelections): Promise<{ items: CheckoutItem[] }> {
|
||||
const items: CheckoutItem[] = [];
|
||||
const plans: SimCatalogProduct[] = await this.simCatalogService.getPlans();
|
||||
const activationFees: SimActivationFeeCatalogItem[] =
|
||||
@ -286,9 +288,7 @@ export class CheckoutService {
|
||||
/**
|
||||
* Build VPN order cart
|
||||
*/
|
||||
private async buildVpnCart(
|
||||
selections: Record<string, string>
|
||||
): Promise<{ items: CheckoutItem[] }> {
|
||||
private async buildVpnCart(selections: OrderSelections): Promise<{ items: CheckoutItem[] }> {
|
||||
const items: CheckoutItem[] = [];
|
||||
const plans: VpnCatalogProduct[] = await this.vpnCatalogService.getPlans();
|
||||
const activationFees: VpnCatalogProduct[] = await this.vpnCatalogService.getActivationFees();
|
||||
@ -339,7 +339,7 @@ export class CheckoutService {
|
||||
/**
|
||||
* Collect addon references from selections
|
||||
*/
|
||||
private collectAddonRefs(selections: Record<string, string>): string[] {
|
||||
private collectAddonRefs(selections: OrderSelections): string[] {
|
||||
const refs = new Set<string>();
|
||||
|
||||
// Handle various addon selection formats
|
||||
|
||||
@ -11,6 +11,7 @@ import { useRouter } from "next/navigation";
|
||||
|
||||
// Align with shared catalog contracts
|
||||
import type { CatalogProductBase } from "@customer-portal/domain/catalog";
|
||||
import type { CheckoutTotals } from "@customer-portal/domain/orders";
|
||||
|
||||
// Enhanced order item representation for UI summary
|
||||
export type OrderItem = CatalogProductBase & {
|
||||
@ -27,13 +28,11 @@ export interface OrderConfiguration {
|
||||
}
|
||||
|
||||
// Totals summary for UI; base fields mirror API aggregates
|
||||
export interface OrderTotals {
|
||||
monthlyTotal: number;
|
||||
oneTimeTotal: number;
|
||||
export type OrderTotals = CheckoutTotals & {
|
||||
annualTotal?: number;
|
||||
discountAmount?: number;
|
||||
taxAmount?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface EnhancedOrderSummaryProps {
|
||||
// Core order data
|
||||
|
||||
@ -175,8 +175,8 @@ function PlanHeader({
|
||||
|
||||
<h1 className="text-3xl font-bold text-gray-900 mb-4">Configure {plan.name}</h1>
|
||||
|
||||
<div className="inline-flex items-center gap-3 bg-gray-50 px-6 py-3 rounded-2xl border border-gray-200">
|
||||
{plan.internetPlanTier && (
|
||||
<div className="inline-flex flex-wrap items-center justify-center gap-3 bg-gray-50 px-6 py-3 rounded-2xl border border-gray-200 text-sm md:text-base">
|
||||
{plan.internetPlanTier ? (
|
||||
<>
|
||||
<CardBadge
|
||||
text={plan.internetPlanTier}
|
||||
@ -185,16 +185,16 @@ function PlanHeader({
|
||||
/>
|
||||
<span className="text-gray-500">•</span>
|
||||
</>
|
||||
)}
|
||||
) : null}
|
||||
<span className="font-medium text-gray-900">{plan.name}</span>
|
||||
{plan.monthlyPrice && plan.monthlyPrice > 0 && (
|
||||
{plan.monthlyPrice && plan.monthlyPrice > 0 ? (
|
||||
<>
|
||||
<span className="text-gray-500">•</span>
|
||||
<span className="font-semibold text-gray-900">
|
||||
¥{plan.monthlyPrice.toLocaleString()}/month
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -4,10 +4,12 @@ import { useEffect, useCallback } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useSimCatalog, useSimPlan } from ".";
|
||||
import { useCatalogStore } from "../services/catalog.store";
|
||||
import type {
|
||||
SimCardType,
|
||||
ActivationType,
|
||||
MnpData,
|
||||
import {
|
||||
simConfigureFormSchema,
|
||||
type SimConfigureFormData,
|
||||
type SimCardType,
|
||||
type ActivationType,
|
||||
type MnpData,
|
||||
} from "@customer-portal/domain/sim";
|
||||
import type {
|
||||
SimCatalogProduct,
|
||||
@ -98,7 +100,7 @@ export function useSimConfigure(planId?: string): UseSimConfigureResult {
|
||||
}, [setConfig]);
|
||||
|
||||
const setSelectedAddons = useCallback((value: string[]) => {
|
||||
setConfig({ addonSkus: value });
|
||||
setConfig({ selectedAddons: value });
|
||||
}, [setConfig]);
|
||||
|
||||
const setActivationType = useCallback((value: ActivationType) => {
|
||||
@ -106,7 +108,7 @@ export function useSimConfigure(planId?: string): UseSimConfigureResult {
|
||||
}, [setConfig]);
|
||||
|
||||
const setScheduledActivationDate = useCallback((value: string) => {
|
||||
setConfig({ scheduledDate: value });
|
||||
setConfig({ scheduledActivationDate: value });
|
||||
}, [setConfig]);
|
||||
|
||||
const setWantsMnp = useCallback((value: boolean) => {
|
||||
@ -123,27 +125,52 @@ export function useSimConfigure(planId?: string): UseSimConfigureResult {
|
||||
|
||||
// Basic validation
|
||||
const validate = useCallback((): boolean => {
|
||||
if (!configState.planSku) return false;
|
||||
|
||||
// eSIM requires EID
|
||||
if (configState.simType === "eSIM" && !configState.eid.trim()) {
|
||||
if (!configState.planSku) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Scheduled activation requires date
|
||||
if (configState.activationType === "Scheduled" && !configState.scheduledDate) {
|
||||
return false;
|
||||
const trimOptional = (value?: string | null) => {
|
||||
if (typeof value !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
const trimmed = value.trim();
|
||||
return trimmed.length > 0 ? trimmed : undefined;
|
||||
};
|
||||
|
||||
// MNP requires basic fields
|
||||
if (configState.wantsMnp) {
|
||||
const { reservationNumber, expiryDate, phoneNumber } = configState.mnpData;
|
||||
if (!reservationNumber || !expiryDate || !phoneNumber) {
|
||||
return false;
|
||||
}
|
||||
const formData: SimConfigureFormData = {
|
||||
simType: configState.simType,
|
||||
eid: trimOptional(configState.eid),
|
||||
selectedAddons: configState.selectedAddons,
|
||||
activationType: configState.activationType,
|
||||
scheduledActivationDate:
|
||||
configState.activationType === "Scheduled"
|
||||
? trimOptional(configState.scheduledActivationDate)
|
||||
: undefined,
|
||||
wantsMnp: configState.wantsMnp,
|
||||
mnpData: configState.wantsMnp
|
||||
? {
|
||||
reservationNumber: configState.mnpData.reservationNumber.trim(),
|
||||
expiryDate: configState.mnpData.expiryDate.trim(),
|
||||
phoneNumber: configState.mnpData.phoneNumber.trim(),
|
||||
mvnoAccountNumber: trimOptional(configState.mnpData.mvnoAccountNumber),
|
||||
portingLastName: trimOptional(configState.mnpData.portingLastName),
|
||||
portingFirstName: trimOptional(configState.mnpData.portingFirstName),
|
||||
portingLastNameKatakana: trimOptional(configState.mnpData.portingLastNameKatakana),
|
||||
portingFirstNameKatakana: trimOptional(
|
||||
configState.mnpData.portingFirstNameKatakana
|
||||
),
|
||||
portingGender: trimOptional(configState.mnpData.portingGender),
|
||||
portingDateOfBirth: trimOptional(configState.mnpData.portingDateOfBirth),
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
|
||||
try {
|
||||
simConfigureFormSchema.parse(formData);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}, [configState]);
|
||||
|
||||
return {
|
||||
@ -155,11 +182,11 @@ export function useSimConfigure(planId?: string): UseSimConfigureResult {
|
||||
setSimType,
|
||||
eid: configState.eid,
|
||||
setEid,
|
||||
selectedAddons: configState.addonSkus,
|
||||
selectedAddons: configState.selectedAddons,
|
||||
setSelectedAddons,
|
||||
activationType: configState.activationType,
|
||||
setActivationType,
|
||||
scheduledActivationDate: configState.scheduledDate,
|
||||
scheduledActivationDate: configState.scheduledActivationDate,
|
||||
setScheduledActivationDate,
|
||||
wantsMnp: configState.wantsMnp,
|
||||
setWantsMnp,
|
||||
|
||||
@ -8,13 +8,24 @@
|
||||
|
||||
import { create } from "zustand";
|
||||
import { persist, createJSONStorage } from "zustand/middleware";
|
||||
import type { SimCardType, ActivationType, MnpData } from "@customer-portal/domain/sim";
|
||||
import {
|
||||
simConfigureFormSchema,
|
||||
type SimCardType,
|
||||
type ActivationType,
|
||||
type MnpData,
|
||||
} from "@customer-portal/domain/sim";
|
||||
import {
|
||||
buildSimOrderConfigurations,
|
||||
normalizeOrderSelections,
|
||||
type OrderConfigurations,
|
||||
type OrderSelections,
|
||||
} from "@customer-portal/domain/orders";
|
||||
|
||||
// ============================================================================
|
||||
// Types
|
||||
// ============================================================================
|
||||
|
||||
export type InternetAccessMode = "IPoE-BYOR" | "PPPoE";
|
||||
export type InternetAccessMode = "IPoE-BYOR" | "IPoE-HGW" | "PPPoE";
|
||||
|
||||
export interface InternetConfigState {
|
||||
planSku: string | null;
|
||||
@ -28,9 +39,9 @@ export interface SimConfigState {
|
||||
planSku: string | null;
|
||||
simType: SimCardType;
|
||||
eid: string;
|
||||
addonSkus: string[];
|
||||
selectedAddons: string[];
|
||||
activationType: ActivationType;
|
||||
scheduledDate: string;
|
||||
scheduledActivationDate: string;
|
||||
wantsMnp: boolean;
|
||||
mnpData: MnpData;
|
||||
currentStep: number;
|
||||
@ -50,6 +61,7 @@ interface CatalogStore {
|
||||
// Checkout transition helpers
|
||||
buildInternetCheckoutParams: () => URLSearchParams | null;
|
||||
buildSimCheckoutParams: () => URLSearchParams | null;
|
||||
buildServiceOrderConfigurations: () => OrderConfigurations | undefined;
|
||||
restoreInternetFromParams: (params: URLSearchParams) => void;
|
||||
restoreSimFromParams: (params: URLSearchParams) => void;
|
||||
}
|
||||
@ -70,9 +82,9 @@ const initialSimState: SimConfigState = {
|
||||
planSku: null,
|
||||
simType: "eSIM",
|
||||
eid: "",
|
||||
addonSkus: [],
|
||||
selectedAddons: [],
|
||||
activationType: "Immediate",
|
||||
scheduledDate: "",
|
||||
scheduledActivationDate: "",
|
||||
wantsMnp: false,
|
||||
mnpData: {
|
||||
reservationNumber: "",
|
||||
@ -89,6 +101,58 @@ const initialSimState: SimConfigState = {
|
||||
currentStep: 1,
|
||||
};
|
||||
|
||||
const trimToUndefined = (value: string | null | undefined): string | undefined => {
|
||||
if (typeof value !== "string") return undefined;
|
||||
const trimmed = value.trim();
|
||||
return trimmed.length > 0 ? trimmed : undefined;
|
||||
};
|
||||
|
||||
const selectionsToSearchParams = (selections: OrderSelections): URLSearchParams => {
|
||||
const params = new URLSearchParams();
|
||||
Object.entries(selections).forEach(([key, value]) => {
|
||||
if (typeof value === "string") {
|
||||
params.set(key, value);
|
||||
}
|
||||
});
|
||||
return params;
|
||||
};
|
||||
|
||||
const normalizeSelectionsFromParams = (params: URLSearchParams): OrderSelections => {
|
||||
const raw: Record<string, string> = {};
|
||||
params.forEach((value, key) => {
|
||||
if (key !== "type") {
|
||||
raw[key] = value;
|
||||
}
|
||||
});
|
||||
return normalizeOrderSelections(raw);
|
||||
};
|
||||
|
||||
const parseAddonList = (value?: string | null): string[] =>
|
||||
value
|
||||
? value
|
||||
.split(",")
|
||||
.map(entry => entry.trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
|
||||
const coalescePlanSku = (selections: OrderSelections): string | null => {
|
||||
const candidates = [
|
||||
selections.planSku,
|
||||
selections.plan,
|
||||
selections.planIdSku,
|
||||
selections.planId,
|
||||
].filter((candidate): candidate is string => typeof candidate === "string");
|
||||
|
||||
for (const candidate of candidates) {
|
||||
const trimmed = candidate.trim();
|
||||
if (trimmed.length > 0) {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Store
|
||||
// ============================================================================
|
||||
@ -137,18 +201,19 @@ export const useCatalogStore = create<CatalogStore>()(
|
||||
return null;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams({
|
||||
type: "internet",
|
||||
const rawSelections: Record<string, string> = {
|
||||
plan: internet.planSku,
|
||||
accessMode: internet.accessMode,
|
||||
installationSku: internet.installationSku,
|
||||
});
|
||||
};
|
||||
|
||||
// Addon format: comma-separated string for BFF
|
||||
if (internet.addonSkus.length > 0) {
|
||||
params.set("addons", internet.addonSkus.join(","));
|
||||
rawSelections.addons = internet.addonSkus.join(",");
|
||||
}
|
||||
|
||||
const selections = normalizeOrderSelections(rawSelections);
|
||||
const params = selectionsToSearchParams(selections);
|
||||
params.set("type", "internet");
|
||||
return params;
|
||||
},
|
||||
|
||||
@ -159,51 +224,89 @@ export const useCatalogStore = create<CatalogStore>()(
|
||||
return null;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams({
|
||||
type: "sim",
|
||||
const rawSelections: Record<string, string> = {
|
||||
plan: sim.planSku,
|
||||
simType: sim.simType,
|
||||
activationType: sim.activationType,
|
||||
});
|
||||
};
|
||||
|
||||
// eSIM requires EID
|
||||
if (sim.simType === "eSIM" && sim.eid) {
|
||||
params.set("eid", sim.eid);
|
||||
const eid = trimToUndefined(sim.eid);
|
||||
if (sim.simType === "eSIM" && eid) {
|
||||
rawSelections.eid = eid;
|
||||
}
|
||||
|
||||
// Scheduled activation
|
||||
if (sim.activationType === "Scheduled" && sim.scheduledDate) {
|
||||
params.set("scheduledAt", sim.scheduledDate);
|
||||
const scheduledAt = trimToUndefined(sim.scheduledActivationDate);
|
||||
if (sim.activationType === "Scheduled" && scheduledAt) {
|
||||
rawSelections.scheduledAt = scheduledAt;
|
||||
}
|
||||
|
||||
// Addons
|
||||
if (sim.addonSkus.length > 0) {
|
||||
params.set("addons", sim.addonSkus.join(","));
|
||||
if (sim.selectedAddons.length > 0) {
|
||||
rawSelections.addons = sim.selectedAddons.join(",");
|
||||
}
|
||||
|
||||
// MNP configuration (serialize as JSON for checkout)
|
||||
if (sim.wantsMnp) {
|
||||
params.set("isMnp", "true");
|
||||
// Serialize MNP data to pass to checkout
|
||||
params.set("mnpData", JSON.stringify(sim.mnpData));
|
||||
rawSelections.isMnp = "true";
|
||||
const mnp = sim.mnpData;
|
||||
if (mnp.reservationNumber) rawSelections.mnpNumber = mnp.reservationNumber.trim();
|
||||
if (mnp.expiryDate) rawSelections.mnpExpiry = mnp.expiryDate.trim();
|
||||
if (mnp.phoneNumber) rawSelections.mnpPhone = mnp.phoneNumber.trim();
|
||||
if (mnp.mvnoAccountNumber) rawSelections.mvnoAccountNumber = mnp.mvnoAccountNumber.trim();
|
||||
if (mnp.portingLastName) rawSelections.portingLastName = mnp.portingLastName.trim();
|
||||
if (mnp.portingFirstName) rawSelections.portingFirstName = mnp.portingFirstName.trim();
|
||||
if (mnp.portingLastNameKatakana)
|
||||
rawSelections.portingLastNameKatakana = mnp.portingLastNameKatakana.trim();
|
||||
if (mnp.portingFirstNameKatakana)
|
||||
rawSelections.portingFirstNameKatakana = mnp.portingFirstNameKatakana.trim();
|
||||
if (mnp.portingGender) rawSelections.portingGender = mnp.portingGender;
|
||||
if (mnp.portingDateOfBirth)
|
||||
rawSelections.portingDateOfBirth = mnp.portingDateOfBirth.trim();
|
||||
}
|
||||
|
||||
const selections = normalizeOrderSelections(rawSelections);
|
||||
const params = selectionsToSearchParams(selections);
|
||||
params.set("type", "sim");
|
||||
return params;
|
||||
},
|
||||
|
||||
restoreInternetFromParams: (params: URLSearchParams) => {
|
||||
const planSku = params.get("plan");
|
||||
const accessMode = params.get("accessMode") as InternetAccessMode | null;
|
||||
const installationSku = params.get("installationSku");
|
||||
buildServiceOrderConfigurations: () => {
|
||||
const { sim } = get();
|
||||
try {
|
||||
const formData = simConfigureFormSchema.parse({
|
||||
simType: sim.simType,
|
||||
eid: trimToUndefined(sim.eid),
|
||||
selectedAddons: sim.selectedAddons,
|
||||
activationType: sim.activationType,
|
||||
scheduledActivationDate: trimToUndefined(sim.scheduledActivationDate),
|
||||
wantsMnp: sim.wantsMnp,
|
||||
mnpData: sim.wantsMnp
|
||||
? {
|
||||
reservationNumber: trimToUndefined(sim.mnpData.reservationNumber) ?? "",
|
||||
expiryDate: trimToUndefined(sim.mnpData.expiryDate) ?? "",
|
||||
phoneNumber: trimToUndefined(sim.mnpData.phoneNumber) ?? "",
|
||||
mvnoAccountNumber: trimToUndefined(sim.mnpData.mvnoAccountNumber),
|
||||
portingLastName: trimToUndefined(sim.mnpData.portingLastName),
|
||||
portingFirstName: trimToUndefined(sim.mnpData.portingFirstName),
|
||||
portingLastNameKatakana: trimToUndefined(sim.mnpData.portingLastNameKatakana),
|
||||
portingFirstNameKatakana: trimToUndefined(sim.mnpData.portingFirstNameKatakana),
|
||||
portingGender: trimToUndefined(sim.mnpData.portingGender),
|
||||
portingDateOfBirth: trimToUndefined(sim.mnpData.portingDateOfBirth),
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
|
||||
// Parse addons (support both comma-separated and multiple params for backward compat)
|
||||
const addonsParam = params.get("addons");
|
||||
const addonSkuParams = params.getAll("addonSku");
|
||||
const addonSkus = addonsParam
|
||||
? addonsParam.split(",").map(s => s.trim()).filter(Boolean)
|
||||
: addonSkuParams.length > 0
|
||||
? addonSkuParams
|
||||
: [];
|
||||
return buildSimOrderConfigurations(formData);
|
||||
} catch (error) {
|
||||
console.warn("Failed to build SIM order configurations from store state", error);
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
|
||||
restoreInternetFromParams: (params: URLSearchParams) => {
|
||||
const selections = normalizeSelectionsFromParams(params);
|
||||
const planSku = coalescePlanSku(selections);
|
||||
const accessMode = selections.accessMode as InternetAccessMode | undefined;
|
||||
const installationSku = trimToUndefined(selections.installationSku) ?? null;
|
||||
const selectedAddons = parseAddonList(selections.addons);
|
||||
|
||||
set(state => ({
|
||||
internet: {
|
||||
@ -211,50 +314,54 @@ export const useCatalogStore = create<CatalogStore>()(
|
||||
...(planSku && { planSku }),
|
||||
...(accessMode && { accessMode }),
|
||||
...(installationSku && { installationSku }),
|
||||
addonSkus,
|
||||
addonSkus: selectedAddons,
|
||||
},
|
||||
}));
|
||||
},
|
||||
|
||||
restoreSimFromParams: (params: URLSearchParams) => {
|
||||
const planSku = params.get("plan");
|
||||
const simType = params.get("simType") as SimCardType | null;
|
||||
const eid = params.get("eid");
|
||||
const activationType = params.get("activationType") as ActivationType | null;
|
||||
const scheduledAt = params.get("scheduledAt");
|
||||
const isMnp = params.get("isMnp") === "true";
|
||||
const selections = normalizeSelectionsFromParams(params);
|
||||
const planSku = coalescePlanSku(selections);
|
||||
const simType = selections.simType as SimCardType | undefined;
|
||||
const activationType = selections.activationType as ActivationType | undefined;
|
||||
const eid = trimToUndefined(selections.eid) ?? "";
|
||||
const scheduledActivationDate = trimToUndefined(selections.scheduledAt) ?? "";
|
||||
const wantsMnp = selections.isMnp === "true";
|
||||
const selectedAddons = parseAddonList(selections.addons);
|
||||
|
||||
// Parse addons
|
||||
const addonsParam = params.get("addons");
|
||||
const addonSkuParams = params.getAll("addonSku");
|
||||
const addonSkus = addonsParam
|
||||
? addonsParam.split(",").map(s => s.trim()).filter(Boolean)
|
||||
: addonSkuParams.length > 0
|
||||
? addonSkuParams
|
||||
: [];
|
||||
|
||||
// Parse MNP data
|
||||
let mnpData = initialSimState.mnpData;
|
||||
const mnpDataParam = params.get("mnpData");
|
||||
if (mnpDataParam) {
|
||||
try {
|
||||
mnpData = JSON.parse(mnpDataParam);
|
||||
} catch (e) {
|
||||
console.warn("Failed to parse MNP data from params", e);
|
||||
}
|
||||
const mnpData = wantsMnp
|
||||
? {
|
||||
...initialSimState.mnpData,
|
||||
reservationNumber: trimToUndefined(selections.mnpNumber) ?? "",
|
||||
expiryDate: trimToUndefined(selections.mnpExpiry) ?? "",
|
||||
phoneNumber: trimToUndefined(selections.mnpPhone) ?? "",
|
||||
mvnoAccountNumber: trimToUndefined(selections.mvnoAccountNumber) ?? "",
|
||||
portingLastName: trimToUndefined(selections.portingLastName) ?? "",
|
||||
portingFirstName: trimToUndefined(selections.portingFirstName) ?? "",
|
||||
portingLastNameKatakana: trimToUndefined(selections.portingLastNameKatakana) ?? "",
|
||||
portingFirstNameKatakana:
|
||||
trimToUndefined(selections.portingFirstNameKatakana) ?? "",
|
||||
portingGender:
|
||||
selections.portingGender === "Male" ||
|
||||
selections.portingGender === "Female" ||
|
||||
selections.portingGender === "Corporate/Other"
|
||||
? selections.portingGender
|
||||
: "",
|
||||
portingDateOfBirth: trimToUndefined(selections.portingDateOfBirth) ?? "",
|
||||
}
|
||||
: { ...initialSimState.mnpData };
|
||||
|
||||
set(state => ({
|
||||
sim: {
|
||||
...state.sim,
|
||||
...(planSku && { planSku }),
|
||||
...(simType && { simType }),
|
||||
...(eid && { eid }),
|
||||
...(activationType && { activationType }),
|
||||
...(scheduledAt && { scheduledDate: scheduledAt }),
|
||||
wantsMnp: isMnp,
|
||||
eid,
|
||||
scheduledActivationDate,
|
||||
wantsMnp,
|
||||
mnpData,
|
||||
addonSkus,
|
||||
selectedAddons,
|
||||
},
|
||||
}));
|
||||
},
|
||||
@ -293,5 +400,3 @@ export const clearCatalogStore = () => {
|
||||
localStorage.removeItem('catalog-config-store');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -15,7 +15,10 @@ import type { AsyncState } from "@customer-portal/domain/toolkit";
|
||||
import { useActiveSubscriptions } from "@/features/subscriptions/hooks/useSubscriptions";
|
||||
import {
|
||||
ORDER_TYPE,
|
||||
orderConfigurationsSchema,
|
||||
buildOrderConfigurations,
|
||||
normalizeOrderSelections,
|
||||
type OrderSelections,
|
||||
type OrderConfigurations,
|
||||
type OrderTypeValue,
|
||||
type CheckoutCart,
|
||||
} from "@customer-portal/domain/orders";
|
||||
@ -83,32 +86,36 @@ export function useCheckout() {
|
||||
}
|
||||
}, [params]);
|
||||
|
||||
const selections = useMemo(() => {
|
||||
const obj: Record<string, string> = {};
|
||||
params.forEach((v, k) => {
|
||||
if (k !== "type") obj[k] = v;
|
||||
const { selections, configurations } = useMemo(() => {
|
||||
const rawSelections: Record<string, string> = {};
|
||||
params.forEach((value, key) => {
|
||||
if (key !== "type") {
|
||||
rawSelections[key] = value;
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
}, [params]);
|
||||
|
||||
const simConfig = useMemo(() => {
|
||||
if (orderType !== ORDER_TYPE.SIM) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const rawConfig = params.get("simConfig");
|
||||
if (!rawConfig) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(rawConfig) as unknown;
|
||||
return orderConfigurationsSchema.parse(parsed);
|
||||
const normalizedSelections = normalizeOrderSelections(rawSelections);
|
||||
let configuration: OrderConfigurations | undefined;
|
||||
|
||||
try {
|
||||
configuration = buildOrderConfigurations(normalizedSelections);
|
||||
} catch (error) {
|
||||
console.warn("Failed to parse SIM order configuration from query params", error);
|
||||
return null;
|
||||
console.warn("Failed to derive order configurations from selections", error);
|
||||
}
|
||||
}, [orderType, params]);
|
||||
|
||||
return {
|
||||
selections: normalizedSelections,
|
||||
configurations: configuration,
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn("Failed to normalize checkout selections", error);
|
||||
return {
|
||||
selections: rawSelections as unknown as OrderSelections,
|
||||
configurations: undefined,
|
||||
};
|
||||
}
|
||||
}, [params]);
|
||||
|
||||
useEffect(() => {
|
||||
if (orderType !== ORDER_TYPE.INTERNET || !hasActiveInternetSubscription) {
|
||||
@ -146,7 +153,7 @@ export function useCheckout() {
|
||||
}
|
||||
|
||||
// Build cart using BFF service
|
||||
const cart = await checkoutService.buildCart(orderType, selections, simConfig || undefined);
|
||||
const cart = await checkoutService.buildCart(orderType, selections, configurations);
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
@ -162,7 +169,7 @@ export function useCheckout() {
|
||||
return () => {
|
||||
mounted = false;
|
||||
};
|
||||
}, [isAuthenticated, orderType, params, selections, simConfig]);
|
||||
}, [isAuthenticated, orderType, params, selections, configurations]);
|
||||
|
||||
const handleSubmitOrder = useCallback(async () => {
|
||||
try {
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
import { apiClient, getDataOrThrow } from "@/lib/api";
|
||||
import type { CheckoutCart, OrderConfigurations } from "@customer-portal/domain/orders";
|
||||
import type {
|
||||
CheckoutCart,
|
||||
OrderConfigurations,
|
||||
OrderSelections,
|
||||
OrderTypeValue,
|
||||
} from "@customer-portal/domain/orders";
|
||||
import type { ApiSuccessResponse } from "@customer-portal/domain/common";
|
||||
|
||||
export const checkoutService = {
|
||||
@ -7,8 +12,8 @@ export const checkoutService = {
|
||||
* Build checkout cart from order type and selections
|
||||
*/
|
||||
async buildCart(
|
||||
orderType: string,
|
||||
selections: Record<string, string>,
|
||||
orderType: OrderTypeValue,
|
||||
selections: OrderSelections,
|
||||
configuration?: OrderConfigurations
|
||||
): Promise<CheckoutCart> {
|
||||
const response = await apiClient.POST<ApiSuccessResponse<CheckoutCart>>("/api/checkout/cart", {
|
||||
|
||||
@ -3,8 +3,9 @@
|
||||
* Helper functions for dashboard data processing and formatting
|
||||
*/
|
||||
|
||||
import { z } from "zod";
|
||||
import type {
|
||||
import {
|
||||
invoiceActivityMetadataSchema,
|
||||
serviceActivityMetadataSchema,
|
||||
Activity,
|
||||
ActivityFilter,
|
||||
ActivityFilterConfig,
|
||||
@ -123,28 +124,6 @@ export function getActivityIconGradient(activityType: Activity["type"]): string
|
||||
return gradientMap[activityType] || "from-gray-500 to-slate-500";
|
||||
}
|
||||
|
||||
const invoiceActivityMetadataSchema = z
|
||||
.object({
|
||||
amount: z.number(),
|
||||
currency: z.string().optional(),
|
||||
dueDate: z.string().optional(),
|
||||
invoiceNumber: z.string().optional(),
|
||||
status: z.string().optional(),
|
||||
})
|
||||
.partial()
|
||||
.refine(data => typeof data.amount === "number", {
|
||||
message: "amount is required",
|
||||
path: ["amount"],
|
||||
});
|
||||
|
||||
const serviceActivityMetadataSchema = z
|
||||
.object({
|
||||
productName: z.string().optional(),
|
||||
registrationDate: z.string().optional(),
|
||||
status: z.string().optional(),
|
||||
})
|
||||
.partial();
|
||||
|
||||
const currencyFormatterCache = new Map<string, Intl.NumberFormat>();
|
||||
|
||||
const formatCurrency = (amount: number, currency?: string) => {
|
||||
|
||||
25
packages/domain/auth/contract.d.ts
vendored
25
packages/domain/auth/contract.d.ts
vendored
@ -1,25 +0,0 @@
|
||||
export declare const AUTH_ERROR_CODE: {
|
||||
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
||||
readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED";
|
||||
readonly ACCOUNT_LOCKED: "ACCOUNT_LOCKED";
|
||||
readonly MFA_REQUIRED: "MFA_REQUIRED";
|
||||
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
||||
readonly TOKEN_EXPIRED: "TOKEN_EXPIRED";
|
||||
readonly PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK";
|
||||
readonly EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS";
|
||||
readonly WHMCS_ACCOUNT_NOT_FOUND: "WHMCS_ACCOUNT_NOT_FOUND";
|
||||
readonly SALESFORCE_ACCOUNT_NOT_FOUND: "SALESFORCE_ACCOUNT_NOT_FOUND";
|
||||
readonly LINKING_FAILED: "LINKING_FAILED";
|
||||
};
|
||||
export type AuthErrorCode = (typeof AUTH_ERROR_CODE)[keyof typeof AUTH_ERROR_CODE];
|
||||
export declare const TOKEN_TYPE: {
|
||||
readonly BEARER: "Bearer";
|
||||
};
|
||||
export type TokenTypeValue = (typeof TOKEN_TYPE)[keyof typeof TOKEN_TYPE];
|
||||
export declare const GENDER: {
|
||||
readonly MALE: "male";
|
||||
readonly FEMALE: "female";
|
||||
readonly OTHER: "other";
|
||||
};
|
||||
export type GenderValue = (typeof GENDER)[keyof typeof GENDER];
|
||||
export type { LoginRequest, SignupRequest, PasswordResetRequest, ResetPasswordRequest, SetPasswordRequest, ChangePasswordRequest, LinkWhmcsRequest, ValidateSignupRequest, UpdateCustomerProfileRequest, AccountStatusRequest, SsoLinkRequest, CheckPasswordNeededRequest, RefreshTokenRequest, AuthTokens, AuthResponse, SignupResult, PasswordChangeResult, SsoLinkResponse, CheckPasswordNeededResponse, AuthError, } from './schema';
|
||||
@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GENDER = exports.TOKEN_TYPE = exports.AUTH_ERROR_CODE = void 0;
|
||||
exports.AUTH_ERROR_CODE = {
|
||||
INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
|
||||
EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED",
|
||||
ACCOUNT_LOCKED: "ACCOUNT_LOCKED",
|
||||
MFA_REQUIRED: "MFA_REQUIRED",
|
||||
INVALID_TOKEN: "INVALID_TOKEN",
|
||||
TOKEN_EXPIRED: "TOKEN_EXPIRED",
|
||||
PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
|
||||
EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS",
|
||||
WHMCS_ACCOUNT_NOT_FOUND: "WHMCS_ACCOUNT_NOT_FOUND",
|
||||
SALESFORCE_ACCOUNT_NOT_FOUND: "SALESFORCE_ACCOUNT_NOT_FOUND",
|
||||
LINKING_FAILED: "LINKING_FAILED",
|
||||
};
|
||||
exports.TOKEN_TYPE = {
|
||||
BEARER: "Bearer",
|
||||
};
|
||||
exports.GENDER = {
|
||||
MALE: "male",
|
||||
FEMALE: "female",
|
||||
OTHER: "other",
|
||||
};
|
||||
//# sourceMappingURL=contract.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"contract.js","sourceRoot":"","sources":["contract.ts"],"names":[],"mappings":";;;AAWa,QAAA,eAAe,GAAG;IAC7B,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;IAClD,4BAA4B,EAAE,8BAA8B;IAC5D,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAQE,QAAA,UAAU,GAAG;IACxB,MAAM,EAAE,QAAQ;CACR,CAAC;AAQE,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC"}
|
||||
3
packages/domain/auth/index.d.ts
vendored
3
packages/domain/auth/index.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
export { AUTH_ERROR_CODE, TOKEN_TYPE, GENDER, type AuthErrorCode, type TokenTypeValue, type GenderValue, } from "./contract";
|
||||
export type { LoginRequest, SignupRequest, PasswordResetRequest, ResetPasswordRequest, SetPasswordRequest, ChangePasswordRequest, LinkWhmcsRequest, ValidateSignupRequest, UpdateCustomerProfileRequest, AccountStatusRequest, SsoLinkRequest, CheckPasswordNeededRequest, RefreshTokenRequest, AuthTokens, AuthResponse, SignupResult, PasswordChangeResult, SsoLinkResponse, CheckPasswordNeededResponse, AuthError, } from "./contract";
|
||||
export { loginRequestSchema, signupInputSchema, signupRequestSchema, passwordResetRequestSchema, passwordResetSchema, setPasswordRequestSchema, changePasswordRequestSchema, linkWhmcsRequestSchema, validateSignupRequestSchema, updateCustomerProfileRequestSchema, updateProfileRequestSchema, updateAddressRequestSchema, accountStatusRequestSchema, ssoLinkRequestSchema, checkPasswordNeededRequestSchema, refreshTokenRequestSchema, authTokensSchema, authResponseSchema, signupResultSchema, passwordChangeResultSchema, ssoLinkResponseSchema, checkPasswordNeededResponseSchema, } from "./schema";
|
||||
@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkPasswordNeededResponseSchema = exports.ssoLinkResponseSchema = exports.passwordChangeResultSchema = exports.signupResultSchema = exports.authResponseSchema = exports.authTokensSchema = exports.refreshTokenRequestSchema = exports.checkPasswordNeededRequestSchema = exports.ssoLinkRequestSchema = exports.accountStatusRequestSchema = exports.updateAddressRequestSchema = exports.updateProfileRequestSchema = exports.updateCustomerProfileRequestSchema = exports.validateSignupRequestSchema = exports.linkWhmcsRequestSchema = exports.changePasswordRequestSchema = exports.setPasswordRequestSchema = exports.passwordResetSchema = exports.passwordResetRequestSchema = exports.signupRequestSchema = exports.signupInputSchema = exports.loginRequestSchema = exports.GENDER = exports.TOKEN_TYPE = exports.AUTH_ERROR_CODE = void 0;
|
||||
var contract_1 = require("./contract");
|
||||
Object.defineProperty(exports, "AUTH_ERROR_CODE", { enumerable: true, get: function () { return contract_1.AUTH_ERROR_CODE; } });
|
||||
Object.defineProperty(exports, "TOKEN_TYPE", { enumerable: true, get: function () { return contract_1.TOKEN_TYPE; } });
|
||||
Object.defineProperty(exports, "GENDER", { enumerable: true, get: function () { return contract_1.GENDER; } });
|
||||
var schema_1 = require("./schema");
|
||||
Object.defineProperty(exports, "loginRequestSchema", { enumerable: true, get: function () { return schema_1.loginRequestSchema; } });
|
||||
Object.defineProperty(exports, "signupInputSchema", { enumerable: true, get: function () { return schema_1.signupInputSchema; } });
|
||||
Object.defineProperty(exports, "signupRequestSchema", { enumerable: true, get: function () { return schema_1.signupRequestSchema; } });
|
||||
Object.defineProperty(exports, "passwordResetRequestSchema", { enumerable: true, get: function () { return schema_1.passwordResetRequestSchema; } });
|
||||
Object.defineProperty(exports, "passwordResetSchema", { enumerable: true, get: function () { return schema_1.passwordResetSchema; } });
|
||||
Object.defineProperty(exports, "setPasswordRequestSchema", { enumerable: true, get: function () { return schema_1.setPasswordRequestSchema; } });
|
||||
Object.defineProperty(exports, "changePasswordRequestSchema", { enumerable: true, get: function () { return schema_1.changePasswordRequestSchema; } });
|
||||
Object.defineProperty(exports, "linkWhmcsRequestSchema", { enumerable: true, get: function () { return schema_1.linkWhmcsRequestSchema; } });
|
||||
Object.defineProperty(exports, "validateSignupRequestSchema", { enumerable: true, get: function () { return schema_1.validateSignupRequestSchema; } });
|
||||
Object.defineProperty(exports, "updateCustomerProfileRequestSchema", { enumerable: true, get: function () { return schema_1.updateCustomerProfileRequestSchema; } });
|
||||
Object.defineProperty(exports, "updateProfileRequestSchema", { enumerable: true, get: function () { return schema_1.updateProfileRequestSchema; } });
|
||||
Object.defineProperty(exports, "updateAddressRequestSchema", { enumerable: true, get: function () { return schema_1.updateAddressRequestSchema; } });
|
||||
Object.defineProperty(exports, "accountStatusRequestSchema", { enumerable: true, get: function () { return schema_1.accountStatusRequestSchema; } });
|
||||
Object.defineProperty(exports, "ssoLinkRequestSchema", { enumerable: true, get: function () { return schema_1.ssoLinkRequestSchema; } });
|
||||
Object.defineProperty(exports, "checkPasswordNeededRequestSchema", { enumerable: true, get: function () { return schema_1.checkPasswordNeededRequestSchema; } });
|
||||
Object.defineProperty(exports, "refreshTokenRequestSchema", { enumerable: true, get: function () { return schema_1.refreshTokenRequestSchema; } });
|
||||
Object.defineProperty(exports, "authTokensSchema", { enumerable: true, get: function () { return schema_1.authTokensSchema; } });
|
||||
Object.defineProperty(exports, "authResponseSchema", { enumerable: true, get: function () { return schema_1.authResponseSchema; } });
|
||||
Object.defineProperty(exports, "signupResultSchema", { enumerable: true, get: function () { return schema_1.signupResultSchema; } });
|
||||
Object.defineProperty(exports, "passwordChangeResultSchema", { enumerable: true, get: function () { return schema_1.passwordChangeResultSchema; } });
|
||||
Object.defineProperty(exports, "ssoLinkResponseSchema", { enumerable: true, get: function () { return schema_1.ssoLinkResponseSchema; } });
|
||||
Object.defineProperty(exports, "checkPasswordNeededResponseSchema", { enumerable: true, get: function () { return schema_1.checkPasswordNeededResponseSchema; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAeA,uCAOoB;AANlB,2GAAA,eAAe,OAAA;AACf,sGAAA,UAAU,OAAA;AACV,kGAAA,MAAM,OAAA;AAqCR,mCA4BkB;AA1BhB,4GAAA,kBAAkB,OAAA;AAClB,2GAAA,iBAAiB,OAAA;AACjB,6GAAA,mBAAmB,OAAA;AACnB,oHAAA,0BAA0B,OAAA;AAC1B,6GAAA,mBAAmB,OAAA;AACnB,kHAAA,wBAAwB,OAAA;AACxB,qHAAA,2BAA2B,OAAA;AAC3B,gHAAA,sBAAsB,OAAA;AACtB,qHAAA,2BAA2B,OAAA;AAC3B,4HAAA,kCAAkC,OAAA;AAClC,oHAAA,0BAA0B,OAAA;AAC1B,oHAAA,0BAA0B,OAAA;AAC1B,oHAAA,0BAA0B,OAAA;AAC1B,8GAAA,oBAAoB,OAAA;AACpB,0HAAA,gCAAgC,OAAA;AAChC,mHAAA,yBAAyB,OAAA;AAGzB,0GAAA,gBAAgB,OAAA;AAGhB,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAClB,oHAAA,0BAA0B,OAAA;AAC1B,+GAAA,qBAAqB,OAAA;AACrB,2HAAA,iCAAiC,OAAA"}
|
||||
349
packages/domain/auth/schema.d.ts
vendored
349
packages/domain/auth/schema.d.ts
vendored
@ -1,349 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const loginRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
password: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const signupInputSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
password: z.ZodString;
|
||||
firstName: z.ZodString;
|
||||
lastName: z.ZodString;
|
||||
company: z.ZodOptional<z.ZodString>;
|
||||
phone: z.ZodString;
|
||||
sfNumber: z.ZodString;
|
||||
address: z.ZodOptional<z.ZodObject<{
|
||||
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
}, z.core.$strip>>;
|
||||
nationality: z.ZodOptional<z.ZodString>;
|
||||
dateOfBirth: z.ZodOptional<z.ZodString>;
|
||||
gender: z.ZodOptional<z.ZodEnum<{
|
||||
male: "male";
|
||||
female: "female";
|
||||
other: "other";
|
||||
}>>;
|
||||
acceptTerms: z.ZodBoolean;
|
||||
marketingConsent: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
export declare const signupRequestSchema: z.ZodPipe<z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
password: z.ZodString;
|
||||
firstName: z.ZodString;
|
||||
lastName: z.ZodString;
|
||||
company: z.ZodOptional<z.ZodString>;
|
||||
phone: z.ZodString;
|
||||
sfNumber: z.ZodString;
|
||||
address: z.ZodOptional<z.ZodObject<{
|
||||
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
}, z.core.$strip>>;
|
||||
nationality: z.ZodOptional<z.ZodString>;
|
||||
dateOfBirth: z.ZodOptional<z.ZodString>;
|
||||
gender: z.ZodOptional<z.ZodEnum<{
|
||||
male: "male";
|
||||
female: "female";
|
||||
other: "other";
|
||||
}>>;
|
||||
acceptTerms: z.ZodBoolean;
|
||||
marketingConsent: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>, z.ZodTransform<{
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
companyname: string | undefined;
|
||||
phonenumber: string;
|
||||
email: string;
|
||||
password: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
phone: string;
|
||||
sfNumber: string;
|
||||
acceptTerms: boolean;
|
||||
company?: string | undefined;
|
||||
address?: {
|
||||
address1?: string | null | undefined;
|
||||
address2?: string | null | undefined;
|
||||
city?: string | null | undefined;
|
||||
state?: string | null | undefined;
|
||||
postcode?: string | null | undefined;
|
||||
country?: string | null | undefined;
|
||||
countryCode?: string | null | undefined;
|
||||
phoneNumber?: string | null | undefined;
|
||||
phoneCountryCode?: string | null | undefined;
|
||||
} | undefined;
|
||||
nationality?: string | undefined;
|
||||
dateOfBirth?: string | undefined;
|
||||
gender?: "male" | "female" | "other" | undefined;
|
||||
marketingConsent?: boolean | undefined;
|
||||
}, {
|
||||
email: string;
|
||||
password: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
phone: string;
|
||||
sfNumber: string;
|
||||
acceptTerms: boolean;
|
||||
company?: string | undefined;
|
||||
address?: {
|
||||
address1?: string | null | undefined;
|
||||
address2?: string | null | undefined;
|
||||
city?: string | null | undefined;
|
||||
state?: string | null | undefined;
|
||||
postcode?: string | null | undefined;
|
||||
country?: string | null | undefined;
|
||||
countryCode?: string | null | undefined;
|
||||
phoneNumber?: string | null | undefined;
|
||||
phoneCountryCode?: string | null | undefined;
|
||||
} | undefined;
|
||||
nationality?: string | undefined;
|
||||
dateOfBirth?: string | undefined;
|
||||
gender?: "male" | "female" | "other" | undefined;
|
||||
marketingConsent?: boolean | undefined;
|
||||
}>>;
|
||||
export declare const passwordResetRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const passwordResetSchema: z.ZodObject<{
|
||||
token: z.ZodString;
|
||||
password: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const setPasswordRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
password: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const changePasswordRequestSchema: z.ZodObject<{
|
||||
currentPassword: z.ZodString;
|
||||
newPassword: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const linkWhmcsRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
password: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const validateSignupRequestSchema: z.ZodObject<{
|
||||
sfNumber: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const updateCustomerProfileRequestSchema: z.ZodObject<{
|
||||
firstname: z.ZodOptional<z.ZodString>;
|
||||
lastname: z.ZodOptional<z.ZodString>;
|
||||
companyname: z.ZodOptional<z.ZodString>;
|
||||
phonenumber: z.ZodOptional<z.ZodString>;
|
||||
address1: z.ZodOptional<z.ZodString>;
|
||||
address2: z.ZodOptional<z.ZodString>;
|
||||
city: z.ZodOptional<z.ZodString>;
|
||||
state: z.ZodOptional<z.ZodString>;
|
||||
postcode: z.ZodOptional<z.ZodString>;
|
||||
country: z.ZodOptional<z.ZodString>;
|
||||
language: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const updateProfileRequestSchema: z.ZodObject<{
|
||||
firstname: z.ZodOptional<z.ZodString>;
|
||||
lastname: z.ZodOptional<z.ZodString>;
|
||||
companyname: z.ZodOptional<z.ZodString>;
|
||||
phonenumber: z.ZodOptional<z.ZodString>;
|
||||
address1: z.ZodOptional<z.ZodString>;
|
||||
address2: z.ZodOptional<z.ZodString>;
|
||||
city: z.ZodOptional<z.ZodString>;
|
||||
state: z.ZodOptional<z.ZodString>;
|
||||
postcode: z.ZodOptional<z.ZodString>;
|
||||
country: z.ZodOptional<z.ZodString>;
|
||||
language: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const updateAddressRequestSchema: z.ZodObject<{
|
||||
firstname: z.ZodOptional<z.ZodString>;
|
||||
lastname: z.ZodOptional<z.ZodString>;
|
||||
companyname: z.ZodOptional<z.ZodString>;
|
||||
phonenumber: z.ZodOptional<z.ZodString>;
|
||||
address1: z.ZodOptional<z.ZodString>;
|
||||
address2: z.ZodOptional<z.ZodString>;
|
||||
city: z.ZodOptional<z.ZodString>;
|
||||
state: z.ZodOptional<z.ZodString>;
|
||||
postcode: z.ZodOptional<z.ZodString>;
|
||||
country: z.ZodOptional<z.ZodString>;
|
||||
language: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const accountStatusRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const ssoLinkRequestSchema: z.ZodObject<{
|
||||
destination: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const checkPasswordNeededRequestSchema: z.ZodObject<{
|
||||
email: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const refreshTokenRequestSchema: z.ZodObject<{
|
||||
refreshToken: z.ZodOptional<z.ZodString>;
|
||||
deviceId: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const authTokensSchema: z.ZodObject<{
|
||||
accessToken: z.ZodString;
|
||||
refreshToken: z.ZodString;
|
||||
expiresAt: z.ZodString;
|
||||
refreshExpiresAt: z.ZodString;
|
||||
tokenType: z.ZodLiteral<"Bearer">;
|
||||
}, z.core.$strip>;
|
||||
export declare const authResponseSchema: z.ZodObject<{
|
||||
user: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
email: z.ZodString;
|
||||
role: z.ZodEnum<{
|
||||
USER: "USER";
|
||||
ADMIN: "ADMIN";
|
||||
}>;
|
||||
emailVerified: z.ZodBoolean;
|
||||
mfaEnabled: z.ZodBoolean;
|
||||
lastLoginAt: z.ZodOptional<z.ZodString>;
|
||||
createdAt: z.ZodString;
|
||||
updatedAt: z.ZodString;
|
||||
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
fullname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
companyname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
phonenumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
address: z.ZodOptional<z.ZodObject<{
|
||||
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
tokens: z.ZodObject<{
|
||||
accessToken: z.ZodString;
|
||||
refreshToken: z.ZodString;
|
||||
expiresAt: z.ZodString;
|
||||
refreshExpiresAt: z.ZodString;
|
||||
tokenType: z.ZodLiteral<"Bearer">;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const signupResultSchema: z.ZodObject<{
|
||||
user: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
email: z.ZodString;
|
||||
role: z.ZodEnum<{
|
||||
USER: "USER";
|
||||
ADMIN: "ADMIN";
|
||||
}>;
|
||||
emailVerified: z.ZodBoolean;
|
||||
mfaEnabled: z.ZodBoolean;
|
||||
lastLoginAt: z.ZodOptional<z.ZodString>;
|
||||
createdAt: z.ZodString;
|
||||
updatedAt: z.ZodString;
|
||||
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
fullname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
companyname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
phonenumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
address: z.ZodOptional<z.ZodObject<{
|
||||
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
tokens: z.ZodObject<{
|
||||
accessToken: z.ZodString;
|
||||
refreshToken: z.ZodString;
|
||||
expiresAt: z.ZodString;
|
||||
refreshExpiresAt: z.ZodString;
|
||||
tokenType: z.ZodLiteral<"Bearer">;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const passwordChangeResultSchema: z.ZodObject<{
|
||||
user: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
email: z.ZodString;
|
||||
role: z.ZodEnum<{
|
||||
USER: "USER";
|
||||
ADMIN: "ADMIN";
|
||||
}>;
|
||||
emailVerified: z.ZodBoolean;
|
||||
mfaEnabled: z.ZodBoolean;
|
||||
lastLoginAt: z.ZodOptional<z.ZodString>;
|
||||
createdAt: z.ZodString;
|
||||
updatedAt: z.ZodString;
|
||||
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
fullname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
companyname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
phonenumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
address: z.ZodOptional<z.ZodObject<{
|
||||
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
tokens: z.ZodObject<{
|
||||
accessToken: z.ZodString;
|
||||
refreshToken: z.ZodString;
|
||||
expiresAt: z.ZodString;
|
||||
refreshExpiresAt: z.ZodString;
|
||||
tokenType: z.ZodLiteral<"Bearer">;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const ssoLinkResponseSchema: z.ZodObject<{
|
||||
url: z.ZodURL;
|
||||
expiresAt: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const checkPasswordNeededResponseSchema: z.ZodObject<{
|
||||
needsPasswordSet: z.ZodBoolean;
|
||||
userExists: z.ZodBoolean;
|
||||
email: z.ZodOptional<z.ZodEmail>;
|
||||
}, z.core.$strip>;
|
||||
export type LoginRequest = z.infer<typeof loginRequestSchema>;
|
||||
export type SignupRequest = z.infer<typeof signupRequestSchema>;
|
||||
export type PasswordResetRequest = z.infer<typeof passwordResetRequestSchema>;
|
||||
export type ResetPasswordRequest = z.infer<typeof passwordResetSchema>;
|
||||
export type SetPasswordRequest = z.infer<typeof setPasswordRequestSchema>;
|
||||
export type ChangePasswordRequest = z.infer<typeof changePasswordRequestSchema>;
|
||||
export type LinkWhmcsRequest = z.infer<typeof linkWhmcsRequestSchema>;
|
||||
export type ValidateSignupRequest = z.infer<typeof validateSignupRequestSchema>;
|
||||
export type UpdateCustomerProfileRequest = z.infer<typeof updateCustomerProfileRequestSchema>;
|
||||
export type AccountStatusRequest = z.infer<typeof accountStatusRequestSchema>;
|
||||
export type SsoLinkRequest = z.infer<typeof ssoLinkRequestSchema>;
|
||||
export type CheckPasswordNeededRequest = z.infer<typeof checkPasswordNeededRequestSchema>;
|
||||
export type RefreshTokenRequest = z.infer<typeof refreshTokenRequestSchema>;
|
||||
export type AuthTokens = z.infer<typeof authTokensSchema>;
|
||||
export type AuthResponse = z.infer<typeof authResponseSchema>;
|
||||
export type SignupResult = z.infer<typeof signupResultSchema>;
|
||||
export type PasswordChangeResult = z.infer<typeof passwordChangeResultSchema>;
|
||||
export type SsoLinkResponse = z.infer<typeof ssoLinkResponseSchema>;
|
||||
export type CheckPasswordNeededResponse = z.infer<typeof checkPasswordNeededResponseSchema>;
|
||||
export interface AuthError {
|
||||
code: "INVALID_CREDENTIALS" | "EMAIL_NOT_VERIFIED" | "ACCOUNT_LOCKED" | "MFA_REQUIRED" | "INVALID_TOKEN" | "TOKEN_EXPIRED" | "PASSWORD_TOO_WEAK" | "EMAIL_ALREADY_EXISTS" | "WHMCS_ACCOUNT_NOT_FOUND" | "SALESFORCE_ACCOUNT_NOT_FOUND" | "LINKING_FAILED";
|
||||
message: string;
|
||||
details?: unknown;
|
||||
}
|
||||
@ -1,110 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkPasswordNeededResponseSchema = exports.ssoLinkResponseSchema = exports.passwordChangeResultSchema = exports.signupResultSchema = exports.authResponseSchema = exports.authTokensSchema = exports.refreshTokenRequestSchema = exports.checkPasswordNeededRequestSchema = exports.ssoLinkRequestSchema = exports.accountStatusRequestSchema = exports.updateAddressRequestSchema = exports.updateProfileRequestSchema = exports.updateCustomerProfileRequestSchema = exports.validateSignupRequestSchema = exports.linkWhmcsRequestSchema = exports.changePasswordRequestSchema = exports.setPasswordRequestSchema = exports.passwordResetSchema = exports.passwordResetRequestSchema = exports.signupRequestSchema = exports.signupInputSchema = exports.loginRequestSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
const schema_1 = require("../common/schema");
|
||||
const schema_2 = require("../customer/schema");
|
||||
const genderEnum = zod_1.z.enum(["male", "female", "other"]);
|
||||
exports.loginRequestSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
password: zod_1.z.string().min(1, "Password is required"),
|
||||
});
|
||||
exports.signupInputSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
password: schema_1.passwordSchema,
|
||||
firstName: schema_1.nameSchema,
|
||||
lastName: schema_1.nameSchema,
|
||||
company: zod_1.z.string().optional(),
|
||||
phone: schema_1.phoneSchema,
|
||||
sfNumber: zod_1.z.string().min(6, "Customer number must be at least 6 characters"),
|
||||
address: schema_2.addressSchema.optional(),
|
||||
nationality: zod_1.z.string().optional(),
|
||||
dateOfBirth: zod_1.z.string().optional(),
|
||||
gender: genderEnum.optional(),
|
||||
acceptTerms: zod_1.z.boolean(),
|
||||
marketingConsent: zod_1.z.boolean().optional(),
|
||||
});
|
||||
exports.signupRequestSchema = exports.signupInputSchema.transform(data => ({
|
||||
...data,
|
||||
firstname: data.firstName,
|
||||
lastname: data.lastName,
|
||||
companyname: data.company,
|
||||
phonenumber: data.phone,
|
||||
}));
|
||||
exports.passwordResetRequestSchema = zod_1.z.object({ email: schema_1.emailSchema });
|
||||
exports.passwordResetSchema = zod_1.z.object({
|
||||
token: zod_1.z.string().min(1, "Reset token is required"),
|
||||
password: schema_1.passwordSchema,
|
||||
});
|
||||
exports.setPasswordRequestSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
password: schema_1.passwordSchema,
|
||||
});
|
||||
exports.changePasswordRequestSchema = zod_1.z.object({
|
||||
currentPassword: zod_1.z.string().min(1, "Current password is required"),
|
||||
newPassword: schema_1.passwordSchema,
|
||||
});
|
||||
exports.linkWhmcsRequestSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
password: zod_1.z.string().min(1, "Password is required"),
|
||||
});
|
||||
exports.validateSignupRequestSchema = zod_1.z.object({
|
||||
sfNumber: zod_1.z.string().min(1, "Customer number is required"),
|
||||
});
|
||||
exports.updateCustomerProfileRequestSchema = zod_1.z.object({
|
||||
firstname: schema_1.nameSchema.optional(),
|
||||
lastname: schema_1.nameSchema.optional(),
|
||||
companyname: zod_1.z.string().max(100).optional(),
|
||||
phonenumber: schema_1.phoneSchema.optional(),
|
||||
address1: zod_1.z.string().max(200).optional(),
|
||||
address2: zod_1.z.string().max(200).optional(),
|
||||
city: zod_1.z.string().max(100).optional(),
|
||||
state: zod_1.z.string().max(100).optional(),
|
||||
postcode: zod_1.z.string().max(20).optional(),
|
||||
country: zod_1.z.string().length(2).optional(),
|
||||
language: zod_1.z.string().max(10).optional(),
|
||||
});
|
||||
exports.updateProfileRequestSchema = exports.updateCustomerProfileRequestSchema;
|
||||
exports.updateAddressRequestSchema = exports.updateCustomerProfileRequestSchema;
|
||||
exports.accountStatusRequestSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
});
|
||||
exports.ssoLinkRequestSchema = zod_1.z.object({
|
||||
destination: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.checkPasswordNeededRequestSchema = zod_1.z.object({
|
||||
email: schema_1.emailSchema,
|
||||
});
|
||||
exports.refreshTokenRequestSchema = zod_1.z.object({
|
||||
refreshToken: zod_1.z.string().min(1, "Refresh token is required").optional(),
|
||||
deviceId: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.authTokensSchema = zod_1.z.object({
|
||||
accessToken: zod_1.z.string().min(1, "Access token is required"),
|
||||
refreshToken: zod_1.z.string().min(1, "Refresh token is required"),
|
||||
expiresAt: zod_1.z.string().min(1, "Access token expiry required"),
|
||||
refreshExpiresAt: zod_1.z.string().min(1, "Refresh token expiry required"),
|
||||
tokenType: zod_1.z.literal("Bearer"),
|
||||
});
|
||||
exports.authResponseSchema = zod_1.z.object({
|
||||
user: schema_2.userSchema,
|
||||
tokens: exports.authTokensSchema,
|
||||
});
|
||||
exports.signupResultSchema = zod_1.z.object({
|
||||
user: schema_2.userSchema,
|
||||
tokens: exports.authTokensSchema,
|
||||
});
|
||||
exports.passwordChangeResultSchema = zod_1.z.object({
|
||||
user: schema_2.userSchema,
|
||||
tokens: exports.authTokensSchema,
|
||||
});
|
||||
exports.ssoLinkResponseSchema = zod_1.z.object({
|
||||
url: zod_1.z.url(),
|
||||
expiresAt: zod_1.z.string(),
|
||||
});
|
||||
exports.checkPasswordNeededResponseSchema = zod_1.z.object({
|
||||
needsPasswordSet: zod_1.z.boolean(),
|
||||
userExists: zod_1.z.boolean(),
|
||||
email: zod_1.z.email().optional(),
|
||||
});
|
||||
//# sourceMappingURL=schema.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";;;AAYA,6BAAwB;AAExB,6CAAwF;AACxF,+CAA+D;AAM/D,MAAM,UAAU,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAE1C,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,oBAAW;IAClB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;CACpD,CAAC,CAAC;AAMU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,oBAAW;IAClB,QAAQ,EAAE,uBAAc;IACxB,SAAS,EAAE,mBAAU;IACrB,QAAQ,EAAE,mBAAU;IACpB,OAAO,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,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC/B,CAAC,CAAC;AASU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,mBAAU;IAChB,MAAM,EAAE,wBAAgB;CACzB,CAAC,CAAC;AAKU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,mBAAU;IAChB,MAAM,EAAE,wBAAgB;CACzB,CAAC,CAAC;AAKU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,mBAAU;IAChB,MAAM,EAAE,wBAAgB;CACzB,CAAC,CAAC;AAKU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE;IACZ,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAKU,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,gBAAgB,EAAE,OAAC,CAAC,OAAO,EAAE;IAC7B,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE;IACvB,KAAK,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC"}
|
||||
14
packages/domain/billing/constants.d.ts
vendored
14
packages/domain/billing/constants.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
export declare const INVOICE_PAGINATION: {
|
||||
readonly MIN_LIMIT: 1;
|
||||
readonly MAX_LIMIT: 100;
|
||||
readonly DEFAULT_LIMIT: 10;
|
||||
readonly DEFAULT_PAGE: 1;
|
||||
};
|
||||
export declare const VALID_INVOICE_STATUSES: readonly ["Paid", "Unpaid", "Cancelled", "Overdue", "Collections"];
|
||||
export declare const VALID_INVOICE_LIST_STATUSES: readonly ["Paid", "Unpaid", "Cancelled", "Overdue", "Collections"];
|
||||
export declare function isValidInvoiceStatus(status: string): boolean;
|
||||
export declare function isValidPaginationLimit(limit: number): boolean;
|
||||
export declare function sanitizePaginationLimit(limit: number): number;
|
||||
export declare function sanitizePaginationPage(page: number): number;
|
||||
export type ValidInvoiceStatus = (typeof VALID_INVOICE_STATUSES)[number];
|
||||
export type ValidInvoiceListStatus = (typeof VALID_INVOICE_LIST_STATUSES)[number];
|
||||
@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VALID_INVOICE_LIST_STATUSES = exports.VALID_INVOICE_STATUSES = exports.INVOICE_PAGINATION = void 0;
|
||||
exports.isValidInvoiceStatus = isValidInvoiceStatus;
|
||||
exports.isValidPaginationLimit = isValidPaginationLimit;
|
||||
exports.sanitizePaginationLimit = sanitizePaginationLimit;
|
||||
exports.sanitizePaginationPage = sanitizePaginationPage;
|
||||
exports.INVOICE_PAGINATION = {
|
||||
MIN_LIMIT: 1,
|
||||
MAX_LIMIT: 100,
|
||||
DEFAULT_LIMIT: 10,
|
||||
DEFAULT_PAGE: 1,
|
||||
};
|
||||
exports.VALID_INVOICE_STATUSES = [
|
||||
"Paid",
|
||||
"Unpaid",
|
||||
"Cancelled",
|
||||
"Overdue",
|
||||
"Collections",
|
||||
];
|
||||
exports.VALID_INVOICE_LIST_STATUSES = [
|
||||
"Paid",
|
||||
"Unpaid",
|
||||
"Cancelled",
|
||||
"Overdue",
|
||||
"Collections",
|
||||
];
|
||||
function isValidInvoiceStatus(status) {
|
||||
return exports.VALID_INVOICE_STATUSES.includes(status);
|
||||
}
|
||||
function isValidPaginationLimit(limit) {
|
||||
return limit >= exports.INVOICE_PAGINATION.MIN_LIMIT && limit <= exports.INVOICE_PAGINATION.MAX_LIMIT;
|
||||
}
|
||||
function sanitizePaginationLimit(limit) {
|
||||
return Math.max(exports.INVOICE_PAGINATION.MIN_LIMIT, Math.min(exports.INVOICE_PAGINATION.MAX_LIMIT, Math.floor(limit)));
|
||||
}
|
||||
function sanitizePaginationPage(page) {
|
||||
return Math.max(exports.INVOICE_PAGINATION.DEFAULT_PAGE, Math.floor(page));
|
||||
}
|
||||
//# sourceMappingURL=constants.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":";;;AAkDA,oDAEC;AAKD,wDAEC;AAKD,0DAKC;AAKD,wDAEC;AA/DY,QAAA,kBAAkB,GAAG;IAChC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,GAAG;IACd,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,CAAC;CACP,CAAC;AAME,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,QAAQ;IACR,WAAW;IACX,SAAS;IACT,aAAa;CACL,CAAC;AAKE,QAAA,2BAA2B,GAAG;IACzC,MAAM;IACN,QAAQ;IACR,WAAW;IACX,SAAS;IACT,aAAa;CACL,CAAC;AASX,SAAgB,oBAAoB,CAAC,MAAc;IACjD,OAAO,8BAAsB,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC;AACxD,CAAC;AAKD,SAAgB,sBAAsB,CAAC,KAAa;IAClD,OAAO,KAAK,IAAI,0BAAkB,CAAC,SAAS,IAAI,KAAK,IAAI,0BAAkB,CAAC,SAAS,CAAC;AACxF,CAAC;AAKD,SAAgB,uBAAuB,CAAC,KAAa;IACnD,OAAO,IAAI,CAAC,GAAG,CACb,0BAAkB,CAAC,SAAS,EAC5B,IAAI,CAAC,GAAG,CAAC,0BAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;AACJ,CAAC;AAKD,SAAgB,sBAAsB,CAAC,IAAY;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,0BAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
||||
11
packages/domain/billing/contract.d.ts
vendored
11
packages/domain/billing/contract.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
export declare const INVOICE_STATUS: {
|
||||
readonly DRAFT: "Draft";
|
||||
readonly PENDING: "Pending";
|
||||
readonly PAID: "Paid";
|
||||
readonly UNPAID: "Unpaid";
|
||||
readonly OVERDUE: "Overdue";
|
||||
readonly CANCELLED: "Cancelled";
|
||||
readonly REFUNDED: "Refunded";
|
||||
readonly COLLECTIONS: "Collections";
|
||||
};
|
||||
export type { InvoiceStatus, InvoiceItem, Invoice, InvoicePagination, InvoiceList, InvoiceSsoLink, PaymentInvoiceRequest, BillingSummary, InvoiceQueryParams, InvoiceListQuery, } from './schema';
|
||||
@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.INVOICE_STATUS = void 0;
|
||||
exports.INVOICE_STATUS = {
|
||||
DRAFT: "Draft",
|
||||
PENDING: "Pending",
|
||||
PAID: "Paid",
|
||||
UNPAID: "Unpaid",
|
||||
OVERDUE: "Overdue",
|
||||
CANCELLED: "Cancelled",
|
||||
REFUNDED: "Refunded",
|
||||
COLLECTIONS: "Collections",
|
||||
};
|
||||
//# sourceMappingURL=contract.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"contract.js","sourceRoot":"","sources":["contract.ts"],"names":[],"mappings":";;;AAWa,QAAA,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;CAClB,CAAC"}
|
||||
6
packages/domain/billing/index.d.ts
vendored
6
packages/domain/billing/index.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export { INVOICE_STATUS } from "./contract";
|
||||
export * from "./constants";
|
||||
export * from "./schema";
|
||||
export type { InvoiceStatus, InvoiceItem, Invoice, InvoicePagination, InvoiceList, InvoiceSsoLink, PaymentInvoiceRequest, BillingSummary, InvoiceQueryParams, InvoiceListQuery, } from './schema';
|
||||
export * as Providers from "./providers/index";
|
||||
export type { WhmcsGetInvoicesParams, WhmcsCreateInvoiceParams, WhmcsUpdateInvoiceParams, WhmcsCapturePaymentParams, WhmcsInvoiceListResponse, WhmcsInvoiceResponse, WhmcsCreateInvoiceResponse, WhmcsUpdateInvoiceResponse, WhmcsCapturePaymentResponse, WhmcsCurrency, WhmcsCurrenciesResponse, } from "./providers/whmcs/raw.types";
|
||||
@ -1,45 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Providers = exports.INVOICE_STATUS = void 0;
|
||||
var contract_1 = require("./contract");
|
||||
Object.defineProperty(exports, "INVOICE_STATUS", { enumerable: true, get: function () { return contract_1.INVOICE_STATUS; } });
|
||||
__exportStar(require("./constants"), exports);
|
||||
__exportStar(require("./schema"), exports);
|
||||
exports.Providers = __importStar(require("./providers/index"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,8CAA4B;AAG5B,2CAAyB;AAiBzB,+DAA+C"}
|
||||
11
packages/domain/billing/providers/index.d.ts
vendored
11
packages/domain/billing/providers/index.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
import * as WhmcsMapper from "./whmcs/mapper";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
export declare const Whmcs: {
|
||||
mapper: typeof WhmcsMapper;
|
||||
raw: typeof WhmcsRaw;
|
||||
transformWhmcsInvoice(rawInvoice: unknown, options?: WhmcsMapper.TransformInvoiceOptions): import("..").Invoice;
|
||||
transformWhmcsInvoices(rawInvoices: unknown[], options?: WhmcsMapper.TransformInvoiceOptions): import("..").Invoice[];
|
||||
};
|
||||
export { WhmcsMapper, WhmcsRaw };
|
||||
export * from "./whmcs/mapper";
|
||||
export * from "./whmcs/raw.types";
|
||||
@ -1,51 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WhmcsRaw = exports.WhmcsMapper = exports.Whmcs = void 0;
|
||||
const WhmcsMapper = __importStar(require("./whmcs/mapper"));
|
||||
exports.WhmcsMapper = WhmcsMapper;
|
||||
const WhmcsRaw = __importStar(require("./whmcs/raw.types"));
|
||||
exports.WhmcsRaw = WhmcsRaw;
|
||||
exports.Whmcs = {
|
||||
...WhmcsMapper,
|
||||
mapper: WhmcsMapper,
|
||||
raw: WhmcsRaw,
|
||||
};
|
||||
__exportStar(require("./whmcs/mapper"), exports);
|
||||
__exportStar(require("./whmcs/raw.types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,4DAA8C;AASrC,kCAAW;AARpB,4DAA8C;AAQxB,4BAAQ;AANjB,QAAA,KAAK,GAAG;IACnB,GAAG,WAAW;IACd,MAAM,EAAE,WAAW;IACnB,GAAG,EAAE,QAAQ;CACd,CAAC;AAGF,iDAA+B;AAC/B,oDAAkC"}
|
||||
@ -1,7 +0,0 @@
|
||||
import type { Invoice } from "../../contract";
|
||||
export interface TransformInvoiceOptions {
|
||||
defaultCurrencyCode?: string;
|
||||
defaultCurrencySymbol?: string;
|
||||
}
|
||||
export declare function transformWhmcsInvoice(rawInvoice: unknown, options?: TransformInvoiceOptions): Invoice;
|
||||
export declare function transformWhmcsInvoices(rawInvoices: unknown[], options?: TransformInvoiceOptions): Invoice[];
|
||||
@ -1,91 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.transformWhmcsInvoice = transformWhmcsInvoice;
|
||||
exports.transformWhmcsInvoices = transformWhmcsInvoices;
|
||||
const schema_1 = require("../../schema");
|
||||
const raw_types_1 = require("./raw.types");
|
||||
const STATUS_MAP = {
|
||||
draft: "Draft",
|
||||
pending: "Pending",
|
||||
"payment pending": "Pending",
|
||||
paid: "Paid",
|
||||
unpaid: "Unpaid",
|
||||
cancelled: "Cancelled",
|
||||
canceled: "Cancelled",
|
||||
overdue: "Overdue",
|
||||
refunded: "Refunded",
|
||||
collections: "Collections",
|
||||
};
|
||||
function mapStatus(status) {
|
||||
const normalized = status?.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
throw new Error("Invoice status missing");
|
||||
}
|
||||
const mapped = STATUS_MAP[normalized];
|
||||
if (!mapped) {
|
||||
throw new Error(`Unsupported WHMCS invoice status: ${status}`);
|
||||
}
|
||||
return mapped;
|
||||
}
|
||||
function parseAmount(amount) {
|
||||
if (typeof amount === "number") {
|
||||
return amount;
|
||||
}
|
||||
if (!amount) {
|
||||
return 0;
|
||||
}
|
||||
const cleaned = String(amount).replace(/[^\d.-]/g, "");
|
||||
const parsed = Number.parseFloat(cleaned);
|
||||
return Number.isNaN(parsed) ? 0 : parsed;
|
||||
}
|
||||
function formatDate(input) {
|
||||
if (!input) {
|
||||
return undefined;
|
||||
}
|
||||
const date = new Date(input);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return undefined;
|
||||
}
|
||||
return date.toISOString();
|
||||
}
|
||||
function mapItems(rawItems) {
|
||||
if (!rawItems)
|
||||
return [];
|
||||
const parsed = raw_types_1.whmcsInvoiceItemsRawSchema.parse(rawItems);
|
||||
const itemArray = Array.isArray(parsed.item) ? parsed.item : [parsed.item];
|
||||
return itemArray.map(item => ({
|
||||
id: item.id,
|
||||
description: item.description,
|
||||
amount: parseAmount(item.amount),
|
||||
quantity: 1,
|
||||
type: item.type,
|
||||
serviceId: typeof item.relid === "number" && item.relid > 0 ? item.relid : undefined,
|
||||
}));
|
||||
}
|
||||
function transformWhmcsInvoice(rawInvoice, options = {}) {
|
||||
const whmcsInvoice = raw_types_1.whmcsInvoiceRawSchema.parse(rawInvoice);
|
||||
const currency = whmcsInvoice.currencycode || options.defaultCurrencyCode || "JPY";
|
||||
const currencySymbol = whmcsInvoice.currencyprefix ||
|
||||
whmcsInvoice.currencysuffix ||
|
||||
options.defaultCurrencySymbol;
|
||||
const invoice = {
|
||||
id: whmcsInvoice.invoiceid ?? whmcsInvoice.id ?? 0,
|
||||
number: whmcsInvoice.invoicenum || `INV-${whmcsInvoice.invoiceid}`,
|
||||
status: mapStatus(whmcsInvoice.status),
|
||||
currency,
|
||||
currencySymbol,
|
||||
total: parseAmount(whmcsInvoice.total),
|
||||
subtotal: parseAmount(whmcsInvoice.subtotal),
|
||||
tax: parseAmount(whmcsInvoice.tax) + parseAmount(whmcsInvoice.tax2),
|
||||
issuedAt: formatDate(whmcsInvoice.date || whmcsInvoice.datecreated),
|
||||
dueDate: formatDate(whmcsInvoice.duedate),
|
||||
paidDate: formatDate(whmcsInvoice.datepaid),
|
||||
description: whmcsInvoice.notes || undefined,
|
||||
items: mapItems(whmcsInvoice.items),
|
||||
};
|
||||
return schema_1.invoiceSchema.parse(invoice);
|
||||
}
|
||||
function transformWhmcsInvoices(rawInvoices, options = {}) {
|
||||
return rawInvoices.map(raw => transformWhmcsInvoice(raw, options));
|
||||
}
|
||||
//# sourceMappingURL=mapper.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"mapper.js","sourceRoot":"","sources":["mapper.ts"],"names":[],"mappings":";;AA4FA,sDAgCC;AAKD,wDAKC;AA/HD,yCAA6C;AAC7C,2CAKqB;AAQrB,MAAM,UAAU,GAAsC;IACpD,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,SAAS;IAC5B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;CAC3B,CAAC;AAEF,SAAS,SAAS,CAAC,MAAc;IAC/B,MAAM,UAAU,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,WAAW,CAAC,MAAmC;IACtD,IAAI,OAAO,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C,WAAW,EAAE,YAAY,CAAC,KAAK,IAAI,SAAS;QAC5C,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;KACpC,CAAC;IAGF,OAAO,sBAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAKD,SAAgB,sBAAsB,CACpC,WAAsB,EACtB,UAAmC,EAAE;IAErC,OAAO,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
||||
@ -1,287 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export interface WhmcsGetInvoicesParams {
|
||||
userid?: number;
|
||||
status?: "Paid" | "Unpaid" | "Cancelled" | "Overdue" | "Collections";
|
||||
limitstart?: number;
|
||||
limitnum?: number;
|
||||
orderby?: "id" | "invoicenum" | "date" | "duedate" | "total" | "status";
|
||||
order?: "ASC" | "DESC";
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export interface WhmcsCreateInvoiceParams {
|
||||
userid: number;
|
||||
status?: "Draft" | "Paid" | "Unpaid" | "Cancelled" | "Refunded" | "Collections" | "Overdue" | "Payment Pending";
|
||||
sendnotification?: boolean;
|
||||
paymentmethod?: string;
|
||||
taxrate?: number;
|
||||
taxrate2?: number;
|
||||
date?: string;
|
||||
duedate?: string;
|
||||
notes?: string;
|
||||
itemdescription1?: string;
|
||||
itemamount1?: number;
|
||||
itemtaxed1?: boolean;
|
||||
itemdescription2?: string;
|
||||
itemamount2?: number;
|
||||
itemtaxed2?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export interface WhmcsUpdateInvoiceParams {
|
||||
invoiceid: number;
|
||||
status?: "Draft" | "Paid" | "Unpaid" | "Cancelled" | "Refunded" | "Collections" | "Overdue";
|
||||
duedate?: string;
|
||||
notes?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export interface WhmcsCapturePaymentParams {
|
||||
invoiceid: number;
|
||||
cvv?: string;
|
||||
cardnum?: string;
|
||||
cccvv?: string;
|
||||
cardtype?: string;
|
||||
cardexp?: string;
|
||||
paymentmethodid?: number;
|
||||
transid?: string;
|
||||
gateway?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export declare const whmcsInvoiceItemRawSchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsInvoiceItemRaw = z.infer<typeof whmcsInvoiceItemRawSchema>;
|
||||
export declare const whmcsInvoiceItemsRawSchema: z.ZodObject<{
|
||||
item: z.ZodUnion<readonly [z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>]>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsInvoiceItemsRaw = z.infer<typeof whmcsInvoiceItemsRawSchema>;
|
||||
export declare const whmcsInvoiceRawSchema: z.ZodObject<{
|
||||
invoiceid: z.ZodNumber;
|
||||
invoicenum: z.ZodString;
|
||||
userid: z.ZodNumber;
|
||||
date: z.ZodString;
|
||||
duedate: z.ZodString;
|
||||
subtotal: z.ZodString;
|
||||
credit: z.ZodString;
|
||||
tax: z.ZodString;
|
||||
tax2: z.ZodString;
|
||||
total: z.ZodString;
|
||||
balance: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodString;
|
||||
paymentmethod: z.ZodString;
|
||||
notes: z.ZodOptional<z.ZodString>;
|
||||
ccgateway: z.ZodOptional<z.ZodBoolean>;
|
||||
items: z.ZodOptional<z.ZodObject<{
|
||||
item: z.ZodUnion<readonly [z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>]>;
|
||||
}, z.core.$strip>>;
|
||||
transactions: z.ZodOptional<z.ZodUnknown>;
|
||||
id: z.ZodOptional<z.ZodNumber>;
|
||||
clientid: z.ZodOptional<z.ZodNumber>;
|
||||
datecreated: z.ZodOptional<z.ZodString>;
|
||||
paymentmethodname: z.ZodOptional<z.ZodString>;
|
||||
currencycode: z.ZodOptional<z.ZodString>;
|
||||
currencyprefix: z.ZodOptional<z.ZodString>;
|
||||
currencysuffix: z.ZodOptional<z.ZodString>;
|
||||
lastcaptureattempt: z.ZodOptional<z.ZodString>;
|
||||
taxrate: z.ZodOptional<z.ZodString>;
|
||||
taxrate2: z.ZodOptional<z.ZodString>;
|
||||
datepaid: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsInvoiceRaw = z.infer<typeof whmcsInvoiceRawSchema>;
|
||||
export declare const whmcsInvoiceListResponseSchema: z.ZodObject<{
|
||||
invoices: z.ZodObject<{
|
||||
invoice: z.ZodArray<z.ZodObject<{
|
||||
invoiceid: z.ZodNumber;
|
||||
invoicenum: z.ZodString;
|
||||
userid: z.ZodNumber;
|
||||
date: z.ZodString;
|
||||
duedate: z.ZodString;
|
||||
subtotal: z.ZodString;
|
||||
credit: z.ZodString;
|
||||
tax: z.ZodString;
|
||||
tax2: z.ZodString;
|
||||
total: z.ZodString;
|
||||
balance: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodString;
|
||||
paymentmethod: z.ZodString;
|
||||
notes: z.ZodOptional<z.ZodString>;
|
||||
ccgateway: z.ZodOptional<z.ZodBoolean>;
|
||||
items: z.ZodOptional<z.ZodObject<{
|
||||
item: z.ZodUnion<readonly [z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>]>;
|
||||
}, z.core.$strip>>;
|
||||
transactions: z.ZodOptional<z.ZodUnknown>;
|
||||
id: z.ZodOptional<z.ZodNumber>;
|
||||
clientid: z.ZodOptional<z.ZodNumber>;
|
||||
datecreated: z.ZodOptional<z.ZodString>;
|
||||
paymentmethodname: z.ZodOptional<z.ZodString>;
|
||||
currencycode: z.ZodOptional<z.ZodString>;
|
||||
currencyprefix: z.ZodOptional<z.ZodString>;
|
||||
currencysuffix: z.ZodOptional<z.ZodString>;
|
||||
lastcaptureattempt: z.ZodOptional<z.ZodString>;
|
||||
taxrate: z.ZodOptional<z.ZodString>;
|
||||
taxrate2: z.ZodOptional<z.ZodString>;
|
||||
datepaid: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
totalresults: z.ZodNumber;
|
||||
numreturned: z.ZodNumber;
|
||||
startnumber: z.ZodNumber;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsInvoiceListResponse = z.infer<typeof whmcsInvoiceListResponseSchema>;
|
||||
export declare const whmcsInvoiceResponseSchema: z.ZodObject<{
|
||||
invoiceid: z.ZodNumber;
|
||||
invoicenum: z.ZodString;
|
||||
userid: z.ZodNumber;
|
||||
date: z.ZodString;
|
||||
duedate: z.ZodString;
|
||||
subtotal: z.ZodString;
|
||||
credit: z.ZodString;
|
||||
tax: z.ZodString;
|
||||
tax2: z.ZodString;
|
||||
total: z.ZodString;
|
||||
balance: z.ZodOptional<z.ZodString>;
|
||||
status: z.ZodString;
|
||||
paymentmethod: z.ZodString;
|
||||
notes: z.ZodOptional<z.ZodString>;
|
||||
ccgateway: z.ZodOptional<z.ZodBoolean>;
|
||||
items: z.ZodOptional<z.ZodObject<{
|
||||
item: z.ZodUnion<readonly [z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
type: z.ZodString;
|
||||
relid: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
||||
taxed: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>]>;
|
||||
}, z.core.$strip>>;
|
||||
id: z.ZodOptional<z.ZodNumber>;
|
||||
clientid: z.ZodOptional<z.ZodNumber>;
|
||||
datecreated: z.ZodOptional<z.ZodString>;
|
||||
paymentmethodname: z.ZodOptional<z.ZodString>;
|
||||
currencycode: z.ZodOptional<z.ZodString>;
|
||||
currencyprefix: z.ZodOptional<z.ZodString>;
|
||||
currencysuffix: z.ZodOptional<z.ZodString>;
|
||||
lastcaptureattempt: z.ZodOptional<z.ZodString>;
|
||||
taxrate: z.ZodOptional<z.ZodString>;
|
||||
taxrate2: z.ZodOptional<z.ZodString>;
|
||||
datepaid: z.ZodOptional<z.ZodString>;
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
transactions: z.ZodOptional<z.ZodUnknown>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsInvoiceResponse = z.infer<typeof whmcsInvoiceResponseSchema>;
|
||||
export declare const whmcsCreateInvoiceResponseSchema: z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
invoiceid: z.ZodNumber;
|
||||
status: z.ZodString;
|
||||
message: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCreateInvoiceResponse = z.infer<typeof whmcsCreateInvoiceResponseSchema>;
|
||||
export declare const whmcsUpdateInvoiceResponseSchema: z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
invoiceid: z.ZodNumber;
|
||||
status: z.ZodString;
|
||||
message: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsUpdateInvoiceResponse = z.infer<typeof whmcsUpdateInvoiceResponseSchema>;
|
||||
export declare const whmcsCapturePaymentResponseSchema: z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
invoiceid: z.ZodNumber;
|
||||
status: z.ZodString;
|
||||
transactionid: z.ZodOptional<z.ZodString>;
|
||||
amount: z.ZodOptional<z.ZodNumber>;
|
||||
fees: z.ZodOptional<z.ZodNumber>;
|
||||
message: z.ZodOptional<z.ZodString>;
|
||||
error: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCapturePaymentResponse = z.infer<typeof whmcsCapturePaymentResponseSchema>;
|
||||
export declare const whmcsCurrencySchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
code: z.ZodString;
|
||||
prefix: z.ZodString;
|
||||
suffix: z.ZodString;
|
||||
format: z.ZodString;
|
||||
rate: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCurrency = z.infer<typeof whmcsCurrencySchema>;
|
||||
export declare const whmcsCurrenciesResponseSchema: z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
totalresults: z.ZodNumber;
|
||||
currencies: z.ZodObject<{
|
||||
currency: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
code: z.ZodString;
|
||||
prefix: z.ZodString;
|
||||
suffix: z.ZodString;
|
||||
format: z.ZodString;
|
||||
rate: z.ZodString;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCurrenciesResponse = z.infer<typeof whmcsCurrenciesResponseSchema>;
|
||||
@ -1,95 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.whmcsCurrenciesResponseSchema = exports.whmcsCurrencySchema = exports.whmcsCapturePaymentResponseSchema = exports.whmcsUpdateInvoiceResponseSchema = exports.whmcsCreateInvoiceResponseSchema = exports.whmcsInvoiceResponseSchema = exports.whmcsInvoiceListResponseSchema = exports.whmcsInvoiceRawSchema = exports.whmcsInvoiceItemsRawSchema = exports.whmcsInvoiceItemRawSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
exports.whmcsInvoiceItemRawSchema = zod_1.z.object({
|
||||
id: zod_1.z.number(),
|
||||
type: zod_1.z.string(),
|
||||
relid: zod_1.z.number(),
|
||||
description: zod_1.z.string(),
|
||||
amount: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
|
||||
taxed: zod_1.z.number().optional(),
|
||||
});
|
||||
exports.whmcsInvoiceItemsRawSchema = zod_1.z.object({
|
||||
item: zod_1.z.union([exports.whmcsInvoiceItemRawSchema, zod_1.z.array(exports.whmcsInvoiceItemRawSchema)]),
|
||||
});
|
||||
exports.whmcsInvoiceRawSchema = zod_1.z.object({
|
||||
invoiceid: zod_1.z.number(),
|
||||
invoicenum: zod_1.z.string(),
|
||||
userid: zod_1.z.number(),
|
||||
date: zod_1.z.string(),
|
||||
duedate: zod_1.z.string(),
|
||||
subtotal: zod_1.z.string(),
|
||||
credit: zod_1.z.string(),
|
||||
tax: zod_1.z.string(),
|
||||
tax2: zod_1.z.string(),
|
||||
total: zod_1.z.string(),
|
||||
balance: zod_1.z.string().optional(),
|
||||
status: zod_1.z.string(),
|
||||
paymentmethod: zod_1.z.string(),
|
||||
notes: zod_1.z.string().optional(),
|
||||
ccgateway: zod_1.z.boolean().optional(),
|
||||
items: exports.whmcsInvoiceItemsRawSchema.optional(),
|
||||
transactions: zod_1.z.unknown().optional(),
|
||||
id: zod_1.z.number().optional(),
|
||||
clientid: zod_1.z.number().optional(),
|
||||
datecreated: zod_1.z.string().optional(),
|
||||
paymentmethodname: zod_1.z.string().optional(),
|
||||
currencycode: zod_1.z.string().optional(),
|
||||
currencyprefix: zod_1.z.string().optional(),
|
||||
currencysuffix: zod_1.z.string().optional(),
|
||||
lastcaptureattempt: zod_1.z.string().optional(),
|
||||
taxrate: zod_1.z.string().optional(),
|
||||
taxrate2: zod_1.z.string().optional(),
|
||||
datepaid: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.whmcsInvoiceListResponseSchema = zod_1.z.object({
|
||||
invoices: zod_1.z.object({
|
||||
invoice: zod_1.z.array(exports.whmcsInvoiceRawSchema),
|
||||
}),
|
||||
totalresults: zod_1.z.number(),
|
||||
numreturned: zod_1.z.number(),
|
||||
startnumber: zod_1.z.number(),
|
||||
});
|
||||
exports.whmcsInvoiceResponseSchema = exports.whmcsInvoiceRawSchema.extend({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
transactions: zod_1.z.unknown().optional(),
|
||||
});
|
||||
exports.whmcsCreateInvoiceResponseSchema = zod_1.z.object({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
invoiceid: zod_1.z.number(),
|
||||
status: zod_1.z.string(),
|
||||
message: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.whmcsUpdateInvoiceResponseSchema = zod_1.z.object({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
invoiceid: zod_1.z.number(),
|
||||
status: zod_1.z.string(),
|
||||
message: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.whmcsCapturePaymentResponseSchema = zod_1.z.object({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
invoiceid: zod_1.z.number(),
|
||||
status: zod_1.z.string(),
|
||||
transactionid: zod_1.z.string().optional(),
|
||||
amount: zod_1.z.number().optional(),
|
||||
fees: zod_1.z.number().optional(),
|
||||
message: zod_1.z.string().optional(),
|
||||
error: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.whmcsCurrencySchema = zod_1.z.object({
|
||||
id: zod_1.z.number(),
|
||||
code: zod_1.z.string(),
|
||||
prefix: zod_1.z.string(),
|
||||
suffix: zod_1.z.string(),
|
||||
format: zod_1.z.string(),
|
||||
rate: zod_1.z.string(),
|
||||
});
|
||||
exports.whmcsCurrenciesResponseSchema = zod_1.z.object({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
totalresults: zod_1.z.number(),
|
||||
currencies: zod_1.z.object({
|
||||
currency: zod_1.z.array(exports.whmcsCurrencySchema),
|
||||
}),
|
||||
});
|
||||
//# sourceMappingURL=raw.types.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"raw.types.js","sourceRoot":"","sources":["raw.types.ts"],"names":[],"mappings":";;;AAUA,6BAAwB;AAoFX,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CA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AAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAWU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAOU,QAAA,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,2BAAmB,CAAC;KACvC,CAAC;CACH,CAAC,CAAC"}
|
||||
161
packages/domain/billing/schema.d.ts
vendored
161
packages/domain/billing/schema.d.ts
vendored
@ -1,161 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const invoiceStatusSchema: z.ZodEnum<{
|
||||
Pending: "Pending";
|
||||
Cancelled: "Cancelled";
|
||||
Draft: "Draft";
|
||||
Paid: "Paid";
|
||||
Unpaid: "Unpaid";
|
||||
Overdue: "Overdue";
|
||||
Refunded: "Refunded";
|
||||
Collections: "Collections";
|
||||
}>;
|
||||
export declare const invoiceItemSchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodNumber;
|
||||
quantity: z.ZodOptional<z.ZodNumber>;
|
||||
type: z.ZodString;
|
||||
serviceId: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>;
|
||||
export declare const invoiceSchema: z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
number: z.ZodString;
|
||||
status: z.ZodEnum<{
|
||||
Pending: "Pending";
|
||||
Cancelled: "Cancelled";
|
||||
Draft: "Draft";
|
||||
Paid: "Paid";
|
||||
Unpaid: "Unpaid";
|
||||
Overdue: "Overdue";
|
||||
Refunded: "Refunded";
|
||||
Collections: "Collections";
|
||||
}>;
|
||||
currency: z.ZodString;
|
||||
currencySymbol: z.ZodOptional<z.ZodString>;
|
||||
total: z.ZodNumber;
|
||||
subtotal: z.ZodNumber;
|
||||
tax: z.ZodNumber;
|
||||
issuedAt: z.ZodOptional<z.ZodString>;
|
||||
dueDate: z.ZodOptional<z.ZodString>;
|
||||
paidDate: z.ZodOptional<z.ZodString>;
|
||||
pdfUrl: z.ZodOptional<z.ZodString>;
|
||||
paymentUrl: z.ZodOptional<z.ZodString>;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodNumber;
|
||||
quantity: z.ZodOptional<z.ZodNumber>;
|
||||
type: z.ZodString;
|
||||
serviceId: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>>;
|
||||
daysOverdue: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>;
|
||||
export declare const invoicePaginationSchema: z.ZodObject<{
|
||||
page: z.ZodNumber;
|
||||
totalPages: z.ZodNumber;
|
||||
totalItems: z.ZodNumber;
|
||||
nextCursor: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const invoiceListSchema: z.ZodObject<{
|
||||
invoices: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
number: z.ZodString;
|
||||
status: z.ZodEnum<{
|
||||
Pending: "Pending";
|
||||
Cancelled: "Cancelled";
|
||||
Draft: "Draft";
|
||||
Paid: "Paid";
|
||||
Unpaid: "Unpaid";
|
||||
Overdue: "Overdue";
|
||||
Refunded: "Refunded";
|
||||
Collections: "Collections";
|
||||
}>;
|
||||
currency: z.ZodString;
|
||||
currencySymbol: z.ZodOptional<z.ZodString>;
|
||||
total: z.ZodNumber;
|
||||
subtotal: z.ZodNumber;
|
||||
tax: z.ZodNumber;
|
||||
issuedAt: z.ZodOptional<z.ZodString>;
|
||||
dueDate: z.ZodOptional<z.ZodString>;
|
||||
paidDate: z.ZodOptional<z.ZodString>;
|
||||
pdfUrl: z.ZodOptional<z.ZodString>;
|
||||
paymentUrl: z.ZodOptional<z.ZodString>;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodNumber;
|
||||
description: z.ZodString;
|
||||
amount: z.ZodNumber;
|
||||
quantity: z.ZodOptional<z.ZodNumber>;
|
||||
type: z.ZodString;
|
||||
serviceId: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>>;
|
||||
daysOverdue: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>>;
|
||||
pagination: z.ZodObject<{
|
||||
page: z.ZodNumber;
|
||||
totalPages: z.ZodNumber;
|
||||
totalItems: z.ZodNumber;
|
||||
nextCursor: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const invoiceSsoLinkSchema: z.ZodObject<{
|
||||
url: z.ZodString;
|
||||
expiresAt: z.ZodString;
|
||||
}, z.core.$strip>;
|
||||
export declare const paymentInvoiceRequestSchema: z.ZodObject<{
|
||||
invoiceId: z.ZodNumber;
|
||||
paymentMethodId: z.ZodOptional<z.ZodNumber>;
|
||||
gatewayName: z.ZodOptional<z.ZodString>;
|
||||
amount: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>;
|
||||
export declare const billingSummarySchema: z.ZodObject<{
|
||||
totalOutstanding: z.ZodNumber;
|
||||
totalOverdue: z.ZodNumber;
|
||||
totalPaid: z.ZodNumber;
|
||||
currency: z.ZodString;
|
||||
currencySymbol: z.ZodOptional<z.ZodString>;
|
||||
invoiceCount: z.ZodObject<{
|
||||
total: z.ZodNumber;
|
||||
unpaid: z.ZodNumber;
|
||||
overdue: z.ZodNumber;
|
||||
paid: z.ZodNumber;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const invoiceQueryParamsSchema: z.ZodObject<{
|
||||
page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
status: z.ZodOptional<z.ZodEnum<{
|
||||
Pending: "Pending";
|
||||
Cancelled: "Cancelled";
|
||||
Draft: "Draft";
|
||||
Paid: "Paid";
|
||||
Unpaid: "Unpaid";
|
||||
Overdue: "Overdue";
|
||||
Refunded: "Refunded";
|
||||
Collections: "Collections";
|
||||
}>>;
|
||||
dateFrom: z.ZodOptional<z.ZodString>;
|
||||
dateTo: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type InvoiceQueryParams = z.infer<typeof invoiceQueryParamsSchema>;
|
||||
export declare const invoiceListQuerySchema: z.ZodObject<{
|
||||
page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
status: z.ZodOptional<z.ZodEnum<{
|
||||
Cancelled: "Cancelled";
|
||||
Paid: "Paid";
|
||||
Unpaid: "Unpaid";
|
||||
Overdue: "Overdue";
|
||||
Collections: "Collections";
|
||||
}>>;
|
||||
}, z.core.$strip>;
|
||||
export type InvoiceListQuery = z.infer<typeof invoiceListQuerySchema>;
|
||||
export type InvoiceStatus = z.infer<typeof invoiceStatusSchema>;
|
||||
export type InvoiceItem = z.infer<typeof invoiceItemSchema>;
|
||||
export type Invoice = z.infer<typeof invoiceSchema>;
|
||||
export type InvoicePagination = z.infer<typeof invoicePaginationSchema>;
|
||||
export type InvoiceList = z.infer<typeof invoiceListSchema>;
|
||||
export type InvoiceSsoLink = z.infer<typeof invoiceSsoLinkSchema>;
|
||||
export type PaymentInvoiceRequest = z.infer<typeof paymentInvoiceRequestSchema>;
|
||||
export type BillingSummary = z.infer<typeof billingSummarySchema>;
|
||||
@ -1,87 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.invoiceListQuerySchema = exports.invoiceQueryParamsSchema = exports.billingSummarySchema = exports.paymentInvoiceRequestSchema = exports.invoiceSsoLinkSchema = exports.invoiceListSchema = exports.invoicePaginationSchema = exports.invoiceSchema = exports.invoiceItemSchema = exports.invoiceStatusSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
exports.invoiceStatusSchema = zod_1.z.enum([
|
||||
"Draft",
|
||||
"Pending",
|
||||
"Paid",
|
||||
"Unpaid",
|
||||
"Overdue",
|
||||
"Cancelled",
|
||||
"Refunded",
|
||||
"Collections",
|
||||
]);
|
||||
exports.invoiceItemSchema = zod_1.z.object({
|
||||
id: zod_1.z.number().int().positive("Invoice item id must be positive"),
|
||||
description: zod_1.z.string().min(1, "Description is required"),
|
||||
amount: zod_1.z.number(),
|
||||
quantity: zod_1.z.number().int().positive("Quantity must be positive").optional(),
|
||||
type: zod_1.z.string().min(1, "Item type is required"),
|
||||
serviceId: zod_1.z.number().int().positive().optional(),
|
||||
});
|
||||
exports.invoiceSchema = zod_1.z.object({
|
||||
id: zod_1.z.number().int().positive("Invoice id must be positive"),
|
||||
number: zod_1.z.string().min(1, "Invoice number is required"),
|
||||
status: exports.invoiceStatusSchema,
|
||||
currency: zod_1.z.string().min(1, "Currency is required"),
|
||||
currencySymbol: zod_1.z.string().min(1, "Currency symbol is required").optional(),
|
||||
total: zod_1.z.number(),
|
||||
subtotal: zod_1.z.number(),
|
||||
tax: zod_1.z.number(),
|
||||
issuedAt: zod_1.z.string().optional(),
|
||||
dueDate: zod_1.z.string().optional(),
|
||||
paidDate: zod_1.z.string().optional(),
|
||||
pdfUrl: zod_1.z.string().optional(),
|
||||
paymentUrl: zod_1.z.string().optional(),
|
||||
description: zod_1.z.string().optional(),
|
||||
items: zod_1.z.array(exports.invoiceItemSchema).optional(),
|
||||
daysOverdue: zod_1.z.number().int().nonnegative().optional(),
|
||||
});
|
||||
exports.invoicePaginationSchema = zod_1.z.object({
|
||||
page: zod_1.z.number().int().nonnegative(),
|
||||
totalPages: zod_1.z.number().int().nonnegative(),
|
||||
totalItems: zod_1.z.number().int().nonnegative(),
|
||||
nextCursor: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.invoiceListSchema = zod_1.z.object({
|
||||
invoices: zod_1.z.array(exports.invoiceSchema),
|
||||
pagination: exports.invoicePaginationSchema,
|
||||
});
|
||||
exports.invoiceSsoLinkSchema = zod_1.z.object({
|
||||
url: zod_1.z.string().url(),
|
||||
expiresAt: zod_1.z.string(),
|
||||
});
|
||||
exports.paymentInvoiceRequestSchema = zod_1.z.object({
|
||||
invoiceId: zod_1.z.number().int().positive(),
|
||||
paymentMethodId: zod_1.z.number().int().positive().optional(),
|
||||
gatewayName: zod_1.z.string().optional(),
|
||||
amount: zod_1.z.number().positive().optional(),
|
||||
});
|
||||
exports.billingSummarySchema = zod_1.z.object({
|
||||
totalOutstanding: zod_1.z.number(),
|
||||
totalOverdue: zod_1.z.number(),
|
||||
totalPaid: zod_1.z.number(),
|
||||
currency: zod_1.z.string(),
|
||||
currencySymbol: zod_1.z.string().optional(),
|
||||
invoiceCount: zod_1.z.object({
|
||||
total: zod_1.z.number().int().min(0),
|
||||
unpaid: zod_1.z.number().int().min(0),
|
||||
overdue: zod_1.z.number().int().min(0),
|
||||
paid: zod_1.z.number().int().min(0),
|
||||
}),
|
||||
});
|
||||
exports.invoiceQueryParamsSchema = zod_1.z.object({
|
||||
page: zod_1.z.coerce.number().int().positive().optional(),
|
||||
limit: zod_1.z.coerce.number().int().positive().max(100).optional(),
|
||||
status: exports.invoiceStatusSchema.optional(),
|
||||
dateFrom: zod_1.z.string().datetime().optional(),
|
||||
dateTo: zod_1.z.string().datetime().optional(),
|
||||
});
|
||||
const invoiceListStatusSchema = zod_1.z.enum(["Paid", "Unpaid", "Cancelled", "Overdue", "Collections"]);
|
||||
exports.invoiceListQuerySchema = zod_1.z.object({
|
||||
page: zod_1.z.coerce.number().int().positive().optional(),
|
||||
limit: zod_1.z.coerce.number().int().positive().max(100).optional(),
|
||||
status: invoiceListStatusSchema.optional(),
|
||||
});
|
||||
//# sourceMappingURL=schema.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";;;AAOA,6BAAwB;AAGX,QAAA,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC;IACxC,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,aAAa;CACd,CAAC,CAAC;AAGU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IACjE,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;IACzD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE;IAC3E,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IAChD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAGU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC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AAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC7D,MAAM,EAAE,uBAAuB,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
||||
20
packages/domain/catalog/contract.d.ts
vendored
20
packages/domain/catalog/contract.d.ts
vendored
@ -1,20 +0,0 @@
|
||||
export interface SalesforceProductFieldMap {
|
||||
sku: string;
|
||||
portalCategory: string;
|
||||
portalCatalog: string;
|
||||
portalAccessible: string;
|
||||
itemClass: string;
|
||||
billingCycle: string;
|
||||
whmcsProductId: string;
|
||||
whmcsProductName: string;
|
||||
internetPlanTier: string;
|
||||
internetOfferingType: string;
|
||||
displayOrder: string;
|
||||
bundledAddon: string;
|
||||
isBundledAddon: string;
|
||||
simDataSize: string;
|
||||
simPlanType: string;
|
||||
simHasFamilyDiscount: string;
|
||||
vpnRegion: string;
|
||||
}
|
||||
export type { CatalogProductBase, CatalogPricebookEntry, InternetCatalogProduct, InternetPlanTemplate, InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct, CatalogProduct, } from './schema';
|
||||
@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=contract.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"contract.js","sourceRoot":"","sources":["contract.ts"],"names":[],"mappings":""}
|
||||
6
packages/domain/catalog/index.d.ts
vendored
6
packages/domain/catalog/index.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export { type SalesforceProductFieldMap } from "./contract";
|
||||
export * from "./schema";
|
||||
export type { CatalogProductBase, CatalogPricebookEntry, InternetCatalogProduct, InternetPlanTemplate, InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct, CatalogProduct, } from './schema';
|
||||
export * as Providers from "./providers/index";
|
||||
export * from "./providers/salesforce/raw.types";
|
||||
export type { WhmcsCatalogProduct, WhmcsCatalogProductListResponse, } from "./providers/whmcs/raw.types";
|
||||
@ -1,43 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Providers = void 0;
|
||||
__exportStar(require("./schema"), exports);
|
||||
exports.Providers = __importStar(require("./providers/index"));
|
||||
__exportStar(require("./providers/salesforce/raw.types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,2CAAyB;AAsBzB,+DAA+C;AAG/C,mEAAiD"}
|
||||
21
packages/domain/catalog/providers/index.d.ts
vendored
21
packages/domain/catalog/providers/index.d.ts
vendored
@ -1,21 +0,0 @@
|
||||
import * as SalesforceMapper from "./salesforce/mapper";
|
||||
import * as SalesforceRaw from "./salesforce/raw.types";
|
||||
import * as WhmcsRaw from "./whmcs/raw.types";
|
||||
export declare const Salesforce: {
|
||||
mapper: typeof SalesforceMapper;
|
||||
raw: typeof SalesforceRaw;
|
||||
mapInternetPlan(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").InternetPlanCatalogItem;
|
||||
mapInternetInstallation(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").InternetInstallationCatalogItem;
|
||||
mapInternetAddon(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").InternetAddonCatalogItem;
|
||||
mapSimProduct(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").SimCatalogProduct;
|
||||
mapSimActivationFee(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").SimActivationFeeCatalogItem;
|
||||
mapVpnProduct(product: SalesforceRaw.SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforceRaw.SalesforcePricebookEntryRecord): import("..").VpnCatalogProduct;
|
||||
extractPricebookEntry(record: SalesforceRaw.SalesforceProduct2WithPricebookEntries): SalesforceRaw.SalesforcePricebookEntryRecord | undefined;
|
||||
};
|
||||
export declare const Whmcs: {
|
||||
raw: typeof WhmcsRaw;
|
||||
};
|
||||
export { SalesforceMapper, SalesforceRaw, WhmcsRaw };
|
||||
export * from "./salesforce/mapper";
|
||||
export * from "./salesforce/raw.types";
|
||||
export * from "./whmcs/raw.types";
|
||||
@ -1,57 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WhmcsRaw = exports.SalesforceRaw = exports.SalesforceMapper = exports.Whmcs = exports.Salesforce = void 0;
|
||||
const SalesforceMapper = __importStar(require("./salesforce/mapper"));
|
||||
exports.SalesforceMapper = SalesforceMapper;
|
||||
const SalesforceRaw = __importStar(require("./salesforce/raw.types"));
|
||||
exports.SalesforceRaw = SalesforceRaw;
|
||||
const WhmcsRaw = __importStar(require("./whmcs/raw.types"));
|
||||
exports.WhmcsRaw = WhmcsRaw;
|
||||
exports.Salesforce = {
|
||||
...SalesforceMapper,
|
||||
mapper: SalesforceMapper,
|
||||
raw: SalesforceRaw,
|
||||
};
|
||||
exports.Whmcs = {
|
||||
raw: WhmcsRaw,
|
||||
};
|
||||
__exportStar(require("./salesforce/mapper"), exports);
|
||||
__exportStar(require("./salesforce/raw.types"), exports);
|
||||
__exportStar(require("./whmcs/raw.types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,sEAAwD;AAc/C,4CAAgB;AAbzB,sEAAwD;AAa7B,sCAAa;AAZxC,4DAA8C;AAYJ,4BAAQ;AAVrC,QAAA,UAAU,GAAG;IACxB,GAAG,gBAAgB;IACnB,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,aAAa;CACnB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,GAAG,EAAE,QAAQ;CACd,CAAC;AAGF,sDAAoC;AACpC,yDAAuC;AACvC,oDAAkC"}
|
||||
@ -1,9 +0,0 @@
|
||||
import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct } from "../../contract";
|
||||
import type { SalesforceProduct2WithPricebookEntries, SalesforcePricebookEntryRecord } from "./raw.types";
|
||||
export declare function mapInternetPlan(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): InternetPlanCatalogItem;
|
||||
export declare function mapInternetInstallation(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): InternetInstallationCatalogItem;
|
||||
export declare function mapInternetAddon(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): InternetAddonCatalogItem;
|
||||
export declare function mapSimProduct(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): SimCatalogProduct;
|
||||
export declare function mapSimActivationFee(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): SimActivationFeeCatalogItem;
|
||||
export declare function mapVpnProduct(product: SalesforceProduct2WithPricebookEntries, pricebookEntry?: SalesforcePricebookEntryRecord): VpnCatalogProduct;
|
||||
export declare function extractPricebookEntry(record: SalesforceProduct2WithPricebookEntries): SalesforcePricebookEntryRecord | undefined;
|
||||
@ -1,186 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mapInternetPlan = mapInternetPlan;
|
||||
exports.mapInternetInstallation = mapInternetInstallation;
|
||||
exports.mapInternetAddon = mapInternetAddon;
|
||||
exports.mapSimProduct = mapSimProduct;
|
||||
exports.mapSimActivationFee = mapSimActivationFee;
|
||||
exports.mapVpnProduct = mapVpnProduct;
|
||||
exports.extractPricebookEntry = extractPricebookEntry;
|
||||
const DEFAULT_PLAN_TEMPLATE = {
|
||||
tierDescription: "Standard plan",
|
||||
description: undefined,
|
||||
features: undefined,
|
||||
};
|
||||
function getTierTemplate(tier) {
|
||||
if (!tier) {
|
||||
return DEFAULT_PLAN_TEMPLATE;
|
||||
}
|
||||
const normalized = tier.toLowerCase();
|
||||
switch (normalized) {
|
||||
case "silver":
|
||||
return {
|
||||
tierDescription: "Simple package with broadband-modem and ISP only",
|
||||
description: "Simple package with broadband-modem and ISP only",
|
||||
features: [
|
||||
"NTT modem + ISP connection",
|
||||
"Two ISP connection protocols: IPoE (recommended) or PPPoE",
|
||||
"Self-configuration of router (you provide your own)",
|
||||
"Monthly: ¥6,000 | One-time: ¥22,800",
|
||||
],
|
||||
};
|
||||
case "gold":
|
||||
return {
|
||||
tierDescription: "Standard all-inclusive package with basic Wi-Fi",
|
||||
description: "Standard all-inclusive package with basic Wi-Fi",
|
||||
features: [
|
||||
"NTT modem + wireless router (rental)",
|
||||
"ISP (IPoE) configured automatically within 24 hours",
|
||||
"Basic wireless router included",
|
||||
"Optional: TP-LINK RE650 range extender (¥500/month)",
|
||||
"Monthly: ¥6,500 | One-time: ¥22,800",
|
||||
],
|
||||
};
|
||||
case "platinum":
|
||||
return {
|
||||
tierDescription: "Tailored set up with premier Wi-Fi management support",
|
||||
description: "Tailored set up with premier Wi-Fi management support - Recommended for homes & apartments larger than 50m²",
|
||||
features: [
|
||||
"NTT modem + Netgear INSIGHT Wi-Fi routers",
|
||||
"Cloud management support for remote router management",
|
||||
"Automatic updates and quicker support",
|
||||
"Seamless wireless network setup",
|
||||
"Monthly: ¥6,500 | One-time: ¥22,800",
|
||||
"Cloud management: ¥500/month per router",
|
||||
],
|
||||
};
|
||||
default:
|
||||
return {
|
||||
tierDescription: `${tier} plan`,
|
||||
description: undefined,
|
||||
features: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
function coerceNumber(value) {
|
||||
if (typeof value === "number")
|
||||
return value;
|
||||
if (typeof value === "string") {
|
||||
const parsed = Number.parseFloat(value);
|
||||
return Number.isFinite(parsed) ? parsed : undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function inferInstallationTypeFromSku(sku) {
|
||||
const normalized = sku.toLowerCase();
|
||||
if (normalized.includes("24"))
|
||||
return "24-Month";
|
||||
if (normalized.includes("12"))
|
||||
return "12-Month";
|
||||
return "One-time";
|
||||
}
|
||||
function baseProduct(product, pricebookEntry) {
|
||||
const sku = product.StockKeepingUnit ?? "";
|
||||
const base = {
|
||||
id: product.Id,
|
||||
sku,
|
||||
name: product.Name ?? sku,
|
||||
};
|
||||
if (product.Description)
|
||||
base.description = product.Description;
|
||||
if (product.Billing_Cycle__c)
|
||||
base.billingCycle = product.Billing_Cycle__c;
|
||||
if (typeof product.Catalog_Order__c === "number")
|
||||
base.displayOrder = product.Catalog_Order__c;
|
||||
const billingCycle = product.Billing_Cycle__c?.toLowerCase();
|
||||
const unitPrice = coerceNumber(pricebookEntry?.UnitPrice);
|
||||
if (unitPrice !== undefined) {
|
||||
base.unitPrice = unitPrice;
|
||||
if (billingCycle === "monthly") {
|
||||
base.monthlyPrice = unitPrice;
|
||||
}
|
||||
else if (billingCycle) {
|
||||
base.oneTimePrice = unitPrice;
|
||||
}
|
||||
}
|
||||
return base;
|
||||
}
|
||||
function mapInternetPlan(product, pricebookEntry) {
|
||||
const base = baseProduct(product, pricebookEntry);
|
||||
const tier = product.Internet_Plan_Tier__c ?? undefined;
|
||||
const offeringType = product.Internet_Offering_Type__c ?? undefined;
|
||||
const tierData = getTierTemplate(tier);
|
||||
return {
|
||||
...base,
|
||||
internetPlanTier: tier,
|
||||
internetOfferingType: offeringType,
|
||||
features: tierData.features,
|
||||
catalogMetadata: {
|
||||
tierDescription: tierData.tierDescription,
|
||||
features: tierData.features,
|
||||
isRecommended: tier === "Gold",
|
||||
},
|
||||
description: base.description ?? tierData.description,
|
||||
};
|
||||
}
|
||||
function mapInternetInstallation(product, pricebookEntry) {
|
||||
const base = baseProduct(product, pricebookEntry);
|
||||
return {
|
||||
...base,
|
||||
catalogMetadata: {
|
||||
installationTerm: inferInstallationTypeFromSku(base.sku),
|
||||
},
|
||||
};
|
||||
}
|
||||
function mapInternetAddon(product, pricebookEntry) {
|
||||
const base = baseProduct(product, pricebookEntry);
|
||||
const bundledAddonId = product.Bundled_Addon__c ?? undefined;
|
||||
const isBundledAddon = product.Is_Bundled_Addon__c ?? false;
|
||||
return {
|
||||
...base,
|
||||
bundledAddonId,
|
||||
isBundledAddon,
|
||||
};
|
||||
}
|
||||
function mapSimProduct(product, pricebookEntry) {
|
||||
const base = baseProduct(product, pricebookEntry);
|
||||
const dataSize = product.SIM_Data_Size__c ?? undefined;
|
||||
const planType = product.SIM_Plan_Type__c ?? undefined;
|
||||
const hasFamilyDiscount = product.SIM_Has_Family_Discount__c ?? false;
|
||||
const bundledAddonId = product.Bundled_Addon__c ?? undefined;
|
||||
const isBundledAddon = product.Is_Bundled_Addon__c ?? false;
|
||||
return {
|
||||
...base,
|
||||
simDataSize: dataSize,
|
||||
simPlanType: planType,
|
||||
simHasFamilyDiscount: hasFamilyDiscount,
|
||||
bundledAddonId,
|
||||
isBundledAddon,
|
||||
};
|
||||
}
|
||||
function mapSimActivationFee(product, pricebookEntry) {
|
||||
const simProduct = mapSimProduct(product, pricebookEntry);
|
||||
return {
|
||||
...simProduct,
|
||||
catalogMetadata: {
|
||||
isDefault: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
function mapVpnProduct(product, pricebookEntry) {
|
||||
const base = baseProduct(product, pricebookEntry);
|
||||
const vpnRegion = product.VPN_Region__c ?? undefined;
|
||||
return {
|
||||
...base,
|
||||
vpnRegion,
|
||||
};
|
||||
}
|
||||
function extractPricebookEntry(record) {
|
||||
const entries = record.PricebookEntries?.records;
|
||||
if (!Array.isArray(entries) || entries.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const activeEntry = entries.find(e => e.IsActive === true);
|
||||
return activeEntry ?? entries[0];
|
||||
}
|
||||
//# sourceMappingURL=mapper.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"mapper.js","sourceRoot":"","sources":["mapper.ts"],"names":[],"mappings":";;AA+IA,0CAqBC;AAED,0DAYC;AAED,4CAaC;AAMD,sCAmBC;AAED,kDAYC;AAMD,sCAWC;AAMD,sDAWC;AAjPD,MAAM,qB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MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IAGD,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;IAC3D,OAAO,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
||||
@ -1,138 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const salesforceProduct2RecordSchema: z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
StockKeepingUnit: z.ZodOptional<z.ZodString>;
|
||||
Description: z.ZodOptional<z.ZodString>;
|
||||
Product2Categories1__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Portal_Catalog__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Portal_Accessible__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Item_Class__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Billing_Cycle__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Catalog_Order__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Is_Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Internet_Plan_Tier__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Internet_Offering_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Feature_List__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Data_Size__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Plan_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Has_Family_Discount__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
VPN_Region__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
WH_Product_ID__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
WH_Product_Name__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Monthly_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
One_Time_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type SalesforceProduct2Record = z.infer<typeof salesforceProduct2RecordSchema>;
|
||||
export declare const salesforcePricebookEntryRecordSchema: z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
UnitPrice: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
|
||||
Pricebook2Id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Product2Id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
IsActive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Product2: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
StockKeepingUnit: z.ZodOptional<z.ZodString>;
|
||||
Description: z.ZodOptional<z.ZodString>;
|
||||
Product2Categories1__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Portal_Catalog__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Portal_Accessible__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Item_Class__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Billing_Cycle__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Catalog_Order__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Is_Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Internet_Plan_Tier__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Internet_Offering_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Feature_List__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Data_Size__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Plan_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Has_Family_Discount__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
VPN_Region__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
WH_Product_ID__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
WH_Product_Name__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Monthly_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
One_Time_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type SalesforcePricebookEntryRecord = z.infer<typeof salesforcePricebookEntryRecordSchema>;
|
||||
export declare const salesforceProduct2WithPricebookEntriesSchema: z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
StockKeepingUnit: z.ZodOptional<z.ZodString>;
|
||||
Description: z.ZodOptional<z.ZodString>;
|
||||
Product2Categories1__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Portal_Catalog__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Portal_Accessible__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Item_Class__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Billing_Cycle__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Catalog_Order__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Is_Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Internet_Plan_Tier__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Internet_Offering_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Feature_List__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Data_Size__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Plan_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Has_Family_Discount__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
VPN_Region__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
WH_Product_ID__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
WH_Product_Name__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Monthly_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
One_Time_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
PricebookEntries: z.ZodOptional<z.ZodObject<{
|
||||
records: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
UnitPrice: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
|
||||
Pricebook2Id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Product2Id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
IsActive: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Product2: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
||||
Id: z.ZodString;
|
||||
Name: z.ZodOptional<z.ZodString>;
|
||||
StockKeepingUnit: z.ZodOptional<z.ZodString>;
|
||||
Description: z.ZodOptional<z.ZodString>;
|
||||
Product2Categories1__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Portal_Catalog__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Portal_Accessible__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Item_Class__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Billing_Cycle__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Catalog_Order__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Is_Bundled_Addon__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
Internet_Plan_Tier__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Internet_Offering_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Feature_List__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Data_Size__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Plan_Type__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
SIM_Has_Family_Discount__c: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
||||
VPN_Region__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
WH_Product_ID__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
WH_Product_Name__c: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
||||
Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
Monthly_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
One_Time_Price__c: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>>>;
|
||||
CreatedDate: z.ZodOptional<z.ZodString>;
|
||||
LastModifiedDate: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>>>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export type SalesforceProduct2WithPricebookEntries = z.infer<typeof salesforceProduct2WithPricebookEntriesSchema>;
|
||||
@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.salesforceProduct2WithPricebookEntriesSchema = exports.salesforcePricebookEntryRecordSchema = exports.salesforceProduct2RecordSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
exports.salesforceProduct2RecordSchema = zod_1.z.object({
|
||||
Id: zod_1.z.string(),
|
||||
Name: zod_1.z.string().optional(),
|
||||
StockKeepingUnit: zod_1.z.string().optional(),
|
||||
Description: zod_1.z.string().optional(),
|
||||
Product2Categories1__c: zod_1.z.string().nullable().optional(),
|
||||
Portal_Catalog__c: zod_1.z.boolean().nullable().optional(),
|
||||
Portal_Accessible__c: zod_1.z.boolean().nullable().optional(),
|
||||
Item_Class__c: zod_1.z.string().nullable().optional(),
|
||||
Billing_Cycle__c: zod_1.z.string().nullable().optional(),
|
||||
Catalog_Order__c: zod_1.z.number().nullable().optional(),
|
||||
Bundled_Addon__c: zod_1.z.string().nullable().optional(),
|
||||
Is_Bundled_Addon__c: zod_1.z.boolean().nullable().optional(),
|
||||
Internet_Plan_Tier__c: zod_1.z.string().nullable().optional(),
|
||||
Internet_Offering_Type__c: zod_1.z.string().nullable().optional(),
|
||||
Feature_List__c: zod_1.z.string().nullable().optional(),
|
||||
SIM_Data_Size__c: zod_1.z.string().nullable().optional(),
|
||||
SIM_Plan_Type__c: zod_1.z.string().nullable().optional(),
|
||||
SIM_Has_Family_Discount__c: zod_1.z.boolean().nullable().optional(),
|
||||
VPN_Region__c: zod_1.z.string().nullable().optional(),
|
||||
WH_Product_ID__c: zod_1.z.number().nullable().optional(),
|
||||
WH_Product_Name__c: zod_1.z.string().nullable().optional(),
|
||||
Price__c: zod_1.z.number().nullable().optional(),
|
||||
Monthly_Price__c: zod_1.z.number().nullable().optional(),
|
||||
One_Time_Price__c: zod_1.z.number().nullable().optional(),
|
||||
CreatedDate: zod_1.z.string().optional(),
|
||||
LastModifiedDate: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.salesforcePricebookEntryRecordSchema = zod_1.z.object({
|
||||
Id: zod_1.z.string(),
|
||||
Name: zod_1.z.string().optional(),
|
||||
UnitPrice: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).nullable().optional(),
|
||||
Pricebook2Id: zod_1.z.string().nullable().optional(),
|
||||
Product2Id: zod_1.z.string().nullable().optional(),
|
||||
IsActive: zod_1.z.boolean().nullable().optional(),
|
||||
Product2: exports.salesforceProduct2RecordSchema.nullable().optional(),
|
||||
CreatedDate: zod_1.z.string().optional(),
|
||||
LastModifiedDate: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.salesforceProduct2WithPricebookEntriesSchema = exports.salesforceProduct2RecordSchema.extend({
|
||||
PricebookEntries: zod_1.z.object({
|
||||
records: zod_1.z.array(exports.salesforcePricebookEntryRecordSchema).optional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AAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAClE,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC3C,QAAQ,EAAE,sCAA8B,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9D,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAQU,QAAA,4CAA4C,GAAG,sCAA8B,CAAC,MAAM,CAAC;IAChG,gBAAgB,EAAE,OAAC,CAAC,MAAM,CAAC;QACzB,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,4CAAoC,CAAC,CAAC,QAAQ,EAAE;KAClE,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC"}
|
||||
@ -1,57 +0,0 @@
|
||||
import { z } from "zod";
|
||||
declare const whmcsCatalogProductSchema: z.ZodObject<{
|
||||
pid: z.ZodNumber;
|
||||
gid: z.ZodNumber;
|
||||
name: z.ZodString;
|
||||
description: z.ZodString;
|
||||
module: z.ZodString;
|
||||
paytype: z.ZodString;
|
||||
pricing: z.ZodRecord<z.ZodString, z.ZodObject<{
|
||||
prefix: z.ZodString;
|
||||
suffix: z.ZodString;
|
||||
msetupfee: z.ZodString;
|
||||
qsetupfee: z.ZodString;
|
||||
ssetupfee: z.ZodString;
|
||||
asetupfee: z.ZodString;
|
||||
bsetupfee: z.ZodString;
|
||||
tsetupfee: z.ZodString;
|
||||
monthly: z.ZodString;
|
||||
quarterly: z.ZodString;
|
||||
semiannually: z.ZodString;
|
||||
annually: z.ZodString;
|
||||
biennially: z.ZodString;
|
||||
triennially: z.ZodString;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCatalogProduct = z.infer<typeof whmcsCatalogProductSchema>;
|
||||
export declare const whmcsCatalogProductListResponseSchema: z.ZodObject<{
|
||||
products: z.ZodObject<{
|
||||
product: z.ZodArray<z.ZodObject<{
|
||||
pid: z.ZodNumber;
|
||||
gid: z.ZodNumber;
|
||||
name: z.ZodString;
|
||||
description: z.ZodString;
|
||||
module: z.ZodString;
|
||||
paytype: z.ZodString;
|
||||
pricing: z.ZodRecord<z.ZodString, z.ZodObject<{
|
||||
prefix: z.ZodString;
|
||||
suffix: z.ZodString;
|
||||
msetupfee: z.ZodString;
|
||||
qsetupfee: z.ZodString;
|
||||
ssetupfee: z.ZodString;
|
||||
asetupfee: z.ZodString;
|
||||
bsetupfee: z.ZodString;
|
||||
tsetupfee: z.ZodString;
|
||||
monthly: z.ZodString;
|
||||
quarterly: z.ZodString;
|
||||
semiannually: z.ZodString;
|
||||
annually: z.ZodString;
|
||||
biennially: z.ZodString;
|
||||
triennially: z.ZodString;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
totalresults: z.ZodNumber;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsCatalogProductListResponse = z.infer<typeof whmcsCatalogProductListResponseSchema>;
|
||||
export {};
|
||||
@ -1,36 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.whmcsCatalogProductListResponseSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
const whmcsCatalogProductPricingCycleSchema = zod_1.z.object({
|
||||
prefix: zod_1.z.string(),
|
||||
suffix: zod_1.z.string(),
|
||||
msetupfee: zod_1.z.string(),
|
||||
qsetupfee: zod_1.z.string(),
|
||||
ssetupfee: zod_1.z.string(),
|
||||
asetupfee: zod_1.z.string(),
|
||||
bsetupfee: zod_1.z.string(),
|
||||
tsetupfee: zod_1.z.string(),
|
||||
monthly: zod_1.z.string(),
|
||||
quarterly: zod_1.z.string(),
|
||||
semiannually: zod_1.z.string(),
|
||||
annually: zod_1.z.string(),
|
||||
biennially: zod_1.z.string(),
|
||||
triennially: zod_1.z.string(),
|
||||
});
|
||||
const whmcsCatalogProductSchema = zod_1.z.object({
|
||||
pid: zod_1.z.number(),
|
||||
gid: zod_1.z.number(),
|
||||
name: zod_1.z.string(),
|
||||
description: zod_1.z.string(),
|
||||
module: zod_1.z.string(),
|
||||
paytype: zod_1.z.string(),
|
||||
pricing: zod_1.z.record(zod_1.z.string(), whmcsCatalogProductPricingCycleSchema),
|
||||
});
|
||||
exports.whmcsCatalogProductListResponseSchema = zod_1.z.object({
|
||||
products: zod_1.z.object({
|
||||
product: zod_1.z.array(whmcsCatalogProductSchema),
|
||||
}),
|
||||
totalresults: zod_1.z.number(),
|
||||
});
|
||||
//# sourceMappingURL=raw.types.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"raw.types.js","sourceRoot":"","sources":["raw.types.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AAMxB,MAAM,qCAAqC,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAMH,MAAM,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,qCAAqC,CAAC;CACrE,CAAC,CAAC;AAWU,QAAA,qCAAqC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5D,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;QACjB,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC;KAC5C,CAAC;IACF,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC"}
|
||||
153
packages/domain/catalog/schema.d.ts
vendored
153
packages/domain/catalog/schema.d.ts
vendored
@ -1,153 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const catalogProductBaseSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
}, z.core.$strip>;
|
||||
export declare const catalogPricebookEntrySchema: z.ZodObject<{
|
||||
id: z.ZodOptional<z.ZodString>;
|
||||
name: z.ZodOptional<z.ZodString>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
pricebook2Id: z.ZodOptional<z.ZodString>;
|
||||
product2Id: z.ZodOptional<z.ZodString>;
|
||||
isActive: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>;
|
||||
export declare const internetCatalogProductSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
internetPlanTier: z.ZodOptional<z.ZodString>;
|
||||
internetOfferingType: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const internetPlanTemplateSchema: z.ZodObject<{
|
||||
tierDescription: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const internetPlanCatalogItemSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
internetPlanTier: z.ZodOptional<z.ZodString>;
|
||||
internetOfferingType: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
catalogMetadata: z.ZodOptional<z.ZodObject<{
|
||||
tierDescription: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
isRecommended: z.ZodOptional<z.ZodBoolean>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const internetInstallationCatalogItemSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
internetPlanTier: z.ZodOptional<z.ZodString>;
|
||||
internetOfferingType: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
catalogMetadata: z.ZodOptional<z.ZodObject<{
|
||||
installationTerm: z.ZodEnum<{
|
||||
"One-time": "One-time";
|
||||
"12-Month": "12-Month";
|
||||
"24-Month": "24-Month";
|
||||
}>;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const internetAddonCatalogItemSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
internetPlanTier: z.ZodOptional<z.ZodString>;
|
||||
internetOfferingType: z.ZodOptional<z.ZodString>;
|
||||
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
||||
isBundledAddon: z.ZodOptional<z.ZodBoolean>;
|
||||
bundledAddonId: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const simCatalogProductSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
simDataSize: z.ZodOptional<z.ZodString>;
|
||||
simPlanType: z.ZodOptional<z.ZodString>;
|
||||
simHasFamilyDiscount: z.ZodOptional<z.ZodBoolean>;
|
||||
isBundledAddon: z.ZodOptional<z.ZodBoolean>;
|
||||
bundledAddonId: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export declare const simActivationFeeCatalogItemSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
simDataSize: z.ZodOptional<z.ZodString>;
|
||||
simPlanType: z.ZodOptional<z.ZodString>;
|
||||
simHasFamilyDiscount: z.ZodOptional<z.ZodBoolean>;
|
||||
isBundledAddon: z.ZodOptional<z.ZodBoolean>;
|
||||
bundledAddonId: z.ZodOptional<z.ZodString>;
|
||||
catalogMetadata: z.ZodOptional<z.ZodObject<{
|
||||
isDefault: z.ZodBoolean;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const vpnCatalogProductSchema: z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
sku: z.ZodString;
|
||||
name: z.ZodString;
|
||||
description: z.ZodOptional<z.ZodString>;
|
||||
displayOrder: z.ZodOptional<z.ZodNumber>;
|
||||
billingCycle: z.ZodOptional<z.ZodString>;
|
||||
monthlyPrice: z.ZodOptional<z.ZodNumber>;
|
||||
oneTimePrice: z.ZodOptional<z.ZodNumber>;
|
||||
unitPrice: z.ZodOptional<z.ZodNumber>;
|
||||
vpnRegion: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type CatalogProductBase = z.infer<typeof catalogProductBaseSchema>;
|
||||
export type CatalogPricebookEntry = z.infer<typeof catalogPricebookEntrySchema>;
|
||||
export type InternetCatalogProduct = z.infer<typeof internetCatalogProductSchema>;
|
||||
export type InternetPlanTemplate = z.infer<typeof internetPlanTemplateSchema>;
|
||||
export type InternetPlanCatalogItem = z.infer<typeof internetPlanCatalogItemSchema>;
|
||||
export type InternetInstallationCatalogItem = z.infer<typeof internetInstallationCatalogItemSchema>;
|
||||
export type InternetAddonCatalogItem = z.infer<typeof internetAddonCatalogItemSchema>;
|
||||
export type SimCatalogProduct = z.infer<typeof simCatalogProductSchema>;
|
||||
export type SimActivationFeeCatalogItem = z.infer<typeof simActivationFeeCatalogItemSchema>;
|
||||
export type VpnCatalogProduct = z.infer<typeof vpnCatalogProductSchema>;
|
||||
export type CatalogProduct = InternetPlanCatalogItem | InternetInstallationCatalogItem | InternetAddonCatalogItem | SimCatalogProduct | SimActivationFeeCatalogItem | VpnCatalogProduct | CatalogProductBase;
|
||||
@ -1,65 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.vpnCatalogProductSchema = exports.simActivationFeeCatalogItemSchema = exports.simCatalogProductSchema = exports.internetAddonCatalogItemSchema = exports.internetInstallationCatalogItemSchema = exports.internetPlanCatalogItemSchema = exports.internetPlanTemplateSchema = exports.internetCatalogProductSchema = exports.catalogPricebookEntrySchema = exports.catalogProductBaseSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
exports.catalogProductBaseSchema = zod_1.z.object({
|
||||
id: zod_1.z.string(),
|
||||
sku: zod_1.z.string(),
|
||||
name: zod_1.z.string(),
|
||||
description: zod_1.z.string().optional(),
|
||||
displayOrder: zod_1.z.number().optional(),
|
||||
billingCycle: zod_1.z.string().optional(),
|
||||
monthlyPrice: zod_1.z.number().optional(),
|
||||
oneTimePrice: zod_1.z.number().optional(),
|
||||
unitPrice: zod_1.z.number().optional(),
|
||||
});
|
||||
exports.catalogPricebookEntrySchema = zod_1.z.object({
|
||||
id: zod_1.z.string().optional(),
|
||||
name: zod_1.z.string().optional(),
|
||||
unitPrice: zod_1.z.number().optional(),
|
||||
pricebook2Id: zod_1.z.string().optional(),
|
||||
product2Id: zod_1.z.string().optional(),
|
||||
isActive: zod_1.z.boolean().optional(),
|
||||
});
|
||||
exports.internetCatalogProductSchema = exports.catalogProductBaseSchema.extend({
|
||||
internetPlanTier: zod_1.z.string().optional(),
|
||||
internetOfferingType: zod_1.z.string().optional(),
|
||||
features: zod_1.z.array(zod_1.z.string()).optional(),
|
||||
});
|
||||
exports.internetPlanTemplateSchema = zod_1.z.object({
|
||||
tierDescription: zod_1.z.string(),
|
||||
description: zod_1.z.string().optional(),
|
||||
features: zod_1.z.array(zod_1.z.string()).optional(),
|
||||
});
|
||||
exports.internetPlanCatalogItemSchema = exports.internetCatalogProductSchema.extend({
|
||||
catalogMetadata: zod_1.z.object({
|
||||
tierDescription: zod_1.z.string().optional(),
|
||||
features: zod_1.z.array(zod_1.z.string()).optional(),
|
||||
isRecommended: zod_1.z.boolean().optional(),
|
||||
}).optional(),
|
||||
});
|
||||
exports.internetInstallationCatalogItemSchema = exports.internetCatalogProductSchema.extend({
|
||||
catalogMetadata: zod_1.z.object({
|
||||
installationTerm: zod_1.z.enum(["One-time", "12-Month", "24-Month"]),
|
||||
}).optional(),
|
||||
});
|
||||
exports.internetAddonCatalogItemSchema = exports.internetCatalogProductSchema.extend({
|
||||
isBundledAddon: zod_1.z.boolean().optional(),
|
||||
bundledAddonId: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.simCatalogProductSchema = exports.catalogProductBaseSchema.extend({
|
||||
simDataSize: zod_1.z.string().optional(),
|
||||
simPlanType: zod_1.z.string().optional(),
|
||||
simHasFamilyDiscount: zod_1.z.boolean().optional(),
|
||||
isBundledAddon: zod_1.z.boolean().optional(),
|
||||
bundledAddonId: zod_1.z.string().optional(),
|
||||
});
|
||||
exports.simActivationFeeCatalogItemSchema = exports.simCatalogProductSchema.extend({
|
||||
catalogMetadata: zod_1.z.object({
|
||||
isDefault: zod_1.z.boolean(),
|
||||
}).optional(),
|
||||
});
|
||||
exports.vpnCatalogProductSchema = exports.catalogProductBaseSchema.extend({
|
||||
vpnRegion: zod_1.z.string().optional(),
|
||||
});
|
||||
//# sourceMappingURL=schema.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AAMX,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,OAAC,CAAC,M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C;AAMU,QAAA,uBAAuB,GAAG,gCAAwB,CAAC,MAAM,CAAC;IACrE,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
|
||||
6
packages/domain/common/index.d.ts
vendored
6
packages/domain/common/index.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export * from "./types";
|
||||
export * from "./schema";
|
||||
export * from "./validation";
|
||||
export * as CommonProviders from "./providers/index";
|
||||
export type { WhmcsResponse, WhmcsErrorResponse } from "./providers/whmcs";
|
||||
export type { SalesforceResponse } from "./providers/salesforce";
|
||||
@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommonProviders = void 0;
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./schema"), exports);
|
||||
__exportStar(require("./validation"), exports);
|
||||
exports.CommonProviders = __importStar(require("./providers/index"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAG7B,qEAAqD"}
|
||||
2
packages/domain/common/providers/index.d.ts
vendored
2
packages/domain/common/providers/index.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
export * as Whmcs from "./whmcs";
|
||||
export * as Salesforce from "./salesforce/index";
|
||||
@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Salesforce = exports.Whmcs = void 0;
|
||||
exports.Whmcs = __importStar(require("./whmcs"));
|
||||
exports.Salesforce = __importStar(require("./salesforce/index"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,iDAAiC;AACjC,iEAAiD"}
|
||||
16
packages/domain/common/providers/salesforce.d.ts
vendored
16
packages/domain/common/providers/salesforce.d.ts
vendored
@ -1,16 +0,0 @@
|
||||
import { z } from "zod";
|
||||
declare const salesforceResponseBaseSchema: z.ZodObject<{
|
||||
totalSize: z.ZodNumber;
|
||||
done: z.ZodBoolean;
|
||||
records: z.ZodArray<z.ZodUnknown>;
|
||||
}, z.core.$strip>;
|
||||
type SalesforceResponseBase = z.infer<typeof salesforceResponseBaseSchema>;
|
||||
export type SalesforceResponse<TRecord> = Omit<SalesforceResponseBase, 'records'> & {
|
||||
records: TRecord[];
|
||||
};
|
||||
export declare const salesforceResponseSchema: <TRecord extends z.ZodTypeAny>(recordSchema: TRecord) => z.ZodObject<{
|
||||
totalSize: z.ZodNumber;
|
||||
done: z.ZodBoolean;
|
||||
records: z.ZodArray<TRecord>;
|
||||
}, z.core.$strip>;
|
||||
export {};
|
||||
@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.salesforceResponseSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
const salesforceResponseBaseSchema = zod_1.z.object({
|
||||
totalSize: zod_1.z.number(),
|
||||
done: zod_1.z.boolean(),
|
||||
records: zod_1.z.array(zod_1.z.unknown()),
|
||||
});
|
||||
const salesforceResponseSchema = (recordSchema) => salesforceResponseBaseSchema.extend({
|
||||
records: zod_1.z.array(recordSchema),
|
||||
});
|
||||
exports.salesforceResponseSchema = salesforceResponseSchema;
|
||||
//# sourceMappingURL=salesforce.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"salesforce.js","sourceRoot":"","sources":["salesforce.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AASxB,MAAM,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE;IACjB,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC;CAC9B,CAAC,CAAC;AAkBI,MAAM,wBAAwB,GAAG,CAA+B,YAAqB,EAAE,EAAE,CAC9F,4BAA4B,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,YAAY,CAAC;CAC/B,CAAC,CAAC;AAHQ,QAAA,wBAAwB,4BAGhC"}
|
||||
@ -1 +0,0 @@
|
||||
export * from "./raw.types";
|
||||
@ -1,18 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./raw.types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
||||
@ -1,11 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const salesforceQueryResultSchema: <TRecord extends z.ZodTypeAny>(recordSchema: TRecord) => z.ZodObject<{
|
||||
totalSize: z.ZodNumber;
|
||||
done: z.ZodBoolean;
|
||||
records: z.ZodArray<TRecord>;
|
||||
}, z.core.$strip>;
|
||||
export interface SalesforceQueryResult<TRecord = unknown> {
|
||||
totalSize: number;
|
||||
done: boolean;
|
||||
records: TRecord[];
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.salesforceQueryResultSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
const salesforceQueryResultSchema = (recordSchema) => zod_1.z.object({
|
||||
totalSize: zod_1.z.number(),
|
||||
done: zod_1.z.boolean(),
|
||||
records: zod_1.z.array(recordSchema),
|
||||
});
|
||||
exports.salesforceQueryResultSchema = salesforceQueryResultSchema;
|
||||
//# sourceMappingURL=raw.types.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"raw.types.js","sourceRoot":"","sources":["raw.types.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AAUjB,MAAM,2BAA2B,GAAG,CAA+B,YAAqB,EAAE,EAAE,CACjG,OAAC,CAAC,MAAM,CAAC;IACP,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE;IACjB,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,YAAY,CAAC;CAC/B,CAAC,CAAC;AALQ,QAAA,2BAA2B,+BAKnC"}
|
||||
27
packages/domain/common/providers/whmcs.d.ts
vendored
27
packages/domain/common/providers/whmcs.d.ts
vendored
@ -1,27 +0,0 @@
|
||||
import { z } from "zod";
|
||||
declare const whmcsResponseBaseSchema: z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
message: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
type WhmcsResponseBase = z.infer<typeof whmcsResponseBaseSchema>;
|
||||
export type WhmcsResponse<T> = WhmcsResponseBase & {
|
||||
data?: T;
|
||||
};
|
||||
export declare const whmcsResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
||||
result: z.ZodEnum<{
|
||||
error: "error";
|
||||
success: "success";
|
||||
}>;
|
||||
message: z.ZodOptional<z.ZodString>;
|
||||
data: z.ZodOptional<T>;
|
||||
}, z.core.$strip>;
|
||||
export declare const whmcsErrorResponseSchema: z.ZodObject<{
|
||||
result: z.ZodLiteral<"error">;
|
||||
message: z.ZodString;
|
||||
errorcode: z.ZodOptional<z.ZodString>;
|
||||
}, z.core.$strip>;
|
||||
export type WhmcsErrorResponse = z.infer<typeof whmcsErrorResponseSchema>;
|
||||
export {};
|
||||
@ -1,18 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.whmcsErrorResponseSchema = exports.whmcsResponseSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
const whmcsResponseBaseSchema = zod_1.z.object({
|
||||
result: zod_1.z.enum(["success", "error"]),
|
||||
message: zod_1.z.string().optional(),
|
||||
});
|
||||
const whmcsResponseSchema = (dataSchema) => whmcsResponseBaseSchema.extend({
|
||||
data: dataSchema.optional(),
|
||||
});
|
||||
exports.whmcsResponseSchema = whmcsResponseSchema;
|
||||
exports.whmcsErrorResponseSchema = zod_1.z.object({
|
||||
result: zod_1.z.literal("error"),
|
||||
message: zod_1.z.string(),
|
||||
errorcode: zod_1.z.string().optional(),
|
||||
});
|
||||
//# sourceMappingURL=whmcs.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"whmcs.js","sourceRoot":"","sources":["whmcs.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AASxB,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAkBI,MAAM,mBAAmB,GAAG,CAAyB,UAAa,EAAE,EAAE,CAC3E,uBAAuB,CAAC,MAAM,CAAC;IAC7B,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAHQ,QAAA,mBAAmB,uBAG3B;AASQ,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
|
||||
105
packages/domain/common/schema.d.ts
vendored
105
packages/domain/common/schema.d.ts
vendored
@ -1,105 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const emailSchema: z.ZodString;
|
||||
export declare const passwordSchema: z.ZodString;
|
||||
export declare const nameSchema: z.ZodString;
|
||||
export declare const phoneSchema: z.ZodString;
|
||||
export declare const countryCodeSchema: z.ZodString;
|
||||
export declare const currencyCodeSchema: z.ZodString;
|
||||
export declare const timestampSchema: z.ZodString;
|
||||
export declare const dateSchema: z.ZodString;
|
||||
export declare const moneyAmountSchema: z.ZodNumber;
|
||||
export declare const percentageSchema: z.ZodNumber;
|
||||
export declare const genderEnum: z.ZodEnum<{
|
||||
male: "male";
|
||||
female: "female";
|
||||
other: "other";
|
||||
}>;
|
||||
export declare const statusEnum: z.ZodEnum<{
|
||||
active: "active";
|
||||
inactive: "inactive";
|
||||
pending: "pending";
|
||||
suspended: "suspended";
|
||||
}>;
|
||||
export declare const priorityEnum: z.ZodEnum<{
|
||||
low: "low";
|
||||
medium: "medium";
|
||||
high: "high";
|
||||
urgent: "urgent";
|
||||
}>;
|
||||
export declare const categoryEnum: z.ZodEnum<{
|
||||
technical: "technical";
|
||||
billing: "billing";
|
||||
account: "account";
|
||||
general: "general";
|
||||
}>;
|
||||
export declare const billingCycleEnum: z.ZodEnum<{
|
||||
Monthly: "Monthly";
|
||||
Quarterly: "Quarterly";
|
||||
Annually: "Annually";
|
||||
Onetime: "Onetime";
|
||||
Free: "Free";
|
||||
}>;
|
||||
export declare const subscriptionBillingCycleEnum: z.ZodEnum<{
|
||||
Monthly: "Monthly";
|
||||
Quarterly: "Quarterly";
|
||||
Annually: "Annually";
|
||||
Free: "Free";
|
||||
"Semi-Annually": "Semi-Annually";
|
||||
Biennially: "Biennially";
|
||||
Triennially: "Triennially";
|
||||
"One-time": "One-time";
|
||||
}>;
|
||||
export declare const apiSuccessResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
||||
success: z.ZodLiteral<true>;
|
||||
data: T;
|
||||
}, z.core.$strip>;
|
||||
export declare const apiErrorResponseSchema: z.ZodObject<{
|
||||
success: z.ZodLiteral<false>;
|
||||
error: z.ZodObject<{
|
||||
code: z.ZodString;
|
||||
message: z.ZodString;
|
||||
details: z.ZodOptional<z.ZodUnknown>;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>;
|
||||
export declare const apiResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
success: z.ZodLiteral<true>;
|
||||
data: T;
|
||||
}, z.core.$strip>, z.ZodObject<{
|
||||
success: z.ZodLiteral<false>;
|
||||
error: z.ZodObject<{
|
||||
code: z.ZodString;
|
||||
message: z.ZodString;
|
||||
details: z.ZodOptional<z.ZodUnknown>;
|
||||
}, z.core.$strip>;
|
||||
}, z.core.$strip>], "success">;
|
||||
export declare const paginationParamsSchema: z.ZodObject<{
|
||||
page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
||||
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
||||
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const paginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
|
||||
items: z.ZodArray<T>;
|
||||
total: z.ZodNumber;
|
||||
page: z.ZodNumber;
|
||||
limit: z.ZodNumber;
|
||||
hasMore: z.ZodBoolean;
|
||||
}, z.core.$strip>;
|
||||
export declare const filterParamsSchema: z.ZodObject<{
|
||||
search: z.ZodOptional<z.ZodString>;
|
||||
sortBy: z.ZodOptional<z.ZodString>;
|
||||
sortOrder: z.ZodOptional<z.ZodEnum<{
|
||||
asc: "asc";
|
||||
desc: "desc";
|
||||
}>>;
|
||||
}, z.core.$strip>;
|
||||
export declare const queryParamsSchema: z.ZodObject<{
|
||||
page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
||||
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
||||
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
||||
search: z.ZodOptional<z.ZodString>;
|
||||
sortBy: z.ZodOptional<z.ZodString>;
|
||||
sortOrder: z.ZodOptional<z.ZodEnum<{
|
||||
asc: "asc";
|
||||
desc: "desc";
|
||||
}>>;
|
||||
}, z.core.$strip>;
|
||||
@ -1,80 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.queryParamsSchema = exports.filterParamsSchema = exports.paginatedResponseSchema = exports.paginationParamsSchema = exports.apiResponseSchema = exports.apiErrorResponseSchema = exports.apiSuccessResponseSchema = exports.subscriptionBillingCycleEnum = exports.billingCycleEnum = exports.categoryEnum = exports.priorityEnum = exports.statusEnum = exports.genderEnum = exports.percentageSchema = exports.moneyAmountSchema = exports.dateSchema = exports.timestampSchema = exports.currencyCodeSchema = exports.countryCodeSchema = exports.phoneSchema = exports.nameSchema = exports.passwordSchema = exports.emailSchema = void 0;
|
||||
const zod_1 = require("zod");
|
||||
exports.emailSchema = zod_1.z
|
||||
.string()
|
||||
.email("Please enter a valid email address")
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
exports.passwordSchema = zod_1.z
|
||||
.string()
|
||||
.min(8, "Password must be at least 8 characters")
|
||||
.regex(/[A-Z]/, "Password must contain at least one uppercase letter")
|
||||
.regex(/[a-z]/, "Password must contain at least one lowercase letter")
|
||||
.regex(/[0-9]/, "Password must contain at least one number")
|
||||
.regex(/[^A-Za-z0-9]/, "Password must contain at least one special character");
|
||||
exports.nameSchema = zod_1.z.string().min(1, "Name is required").max(100, "Name must be less than 100 characters").trim();
|
||||
exports.phoneSchema = zod_1.z
|
||||
.string()
|
||||
.regex(/^[+]?[0-9\s\-()]{7,20}$/u, "Please enter a valid phone number")
|
||||
.trim();
|
||||
exports.countryCodeSchema = zod_1.z.string().length(2, "Country code must be 2 characters");
|
||||
exports.currencyCodeSchema = zod_1.z.string().length(3, "Currency code must be 3 characters");
|
||||
exports.timestampSchema = zod_1.z.string().datetime("Invalid timestamp format");
|
||||
exports.dateSchema = zod_1.z.string().date("Invalid date format");
|
||||
exports.moneyAmountSchema = zod_1.z.number().int().nonnegative("Amount must be non-negative");
|
||||
exports.percentageSchema = zod_1.z.number().min(0).max(100, "Percentage must be between 0 and 100");
|
||||
exports.genderEnum = zod_1.z.enum(["male", "female", "other"]);
|
||||
exports.statusEnum = zod_1.z.enum(["active", "inactive", "pending", "suspended"]);
|
||||
exports.priorityEnum = zod_1.z.enum(["low", "medium", "high", "urgent"]);
|
||||
exports.categoryEnum = zod_1.z.enum(["technical", "billing", "account", "general"]);
|
||||
exports.billingCycleEnum = zod_1.z.enum(["Monthly", "Quarterly", "Annually", "Onetime", "Free"]);
|
||||
exports.subscriptionBillingCycleEnum = zod_1.z.enum([
|
||||
"Monthly",
|
||||
"Quarterly",
|
||||
"Semi-Annually",
|
||||
"Annually",
|
||||
"Biennially",
|
||||
"Triennially",
|
||||
"One-time",
|
||||
"Free",
|
||||
]);
|
||||
const apiSuccessResponseSchema = (dataSchema) => zod_1.z.object({
|
||||
success: zod_1.z.literal(true),
|
||||
data: dataSchema,
|
||||
});
|
||||
exports.apiSuccessResponseSchema = apiSuccessResponseSchema;
|
||||
exports.apiErrorResponseSchema = zod_1.z.object({
|
||||
success: zod_1.z.literal(false),
|
||||
error: zod_1.z.object({
|
||||
code: zod_1.z.string(),
|
||||
message: zod_1.z.string(),
|
||||
details: zod_1.z.unknown().optional(),
|
||||
}),
|
||||
});
|
||||
const apiResponseSchema = (dataSchema) => zod_1.z.discriminatedUnion("success", [
|
||||
(0, exports.apiSuccessResponseSchema)(dataSchema),
|
||||
exports.apiErrorResponseSchema,
|
||||
]);
|
||||
exports.apiResponseSchema = apiResponseSchema;
|
||||
exports.paginationParamsSchema = zod_1.z.object({
|
||||
page: zod_1.z.coerce.number().int().positive().optional().default(1),
|
||||
limit: zod_1.z.coerce.number().int().positive().max(100).optional().default(20),
|
||||
offset: zod_1.z.coerce.number().int().nonnegative().optional(),
|
||||
});
|
||||
const paginatedResponseSchema = (itemSchema) => zod_1.z.object({
|
||||
items: zod_1.z.array(itemSchema),
|
||||
total: zod_1.z.number().int().nonnegative(),
|
||||
page: zod_1.z.number().int().positive(),
|
||||
limit: zod_1.z.number().int().positive(),
|
||||
hasMore: zod_1.z.boolean(),
|
||||
});
|
||||
exports.paginatedResponseSchema = paginatedResponseSchema;
|
||||
exports.filterParamsSchema = zod_1.z.object({
|
||||
search: zod_1.z.string().optional(),
|
||||
sortBy: zod_1.z.string().optional(),
|
||||
sortOrder: zod_1.z.enum(["asc", "desc"]).optional(),
|
||||
});
|
||||
exports.queryParamsSchema = exports.paginationParamsSchema.merge(exports.filterParamsSchema);
|
||||
//# sourceMappingURL=schema.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"schema.js","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AAEX,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,EAAE;KACR,KAAK,CAAC,oCAAoC,CAAC;KAC3C,WAAW,EAAE;KACb,IAAI,EAAE,CAAC;AAEG,QAAA,cAAc,GAAG,OAAC;KAC5B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,wCAAwC,CAAC;KAChD,KAAK,CAAC,OAAO,EAAE,qDAAqD,CAAC;KACrE,KAAK,CAAC,OAAO,EAAE,qDAAqD,CAAC;KACrE,KAAK,CAAC,OAAO,EAAE,2CAA2C,CAAC;KAC3D,KAAK,CAAC,cAAc,EAAE,sDAAsD,CAAC,CAAC;AAEpE,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,uCAAuC,CAAC,CAAC,IAAI,EAAE,CAAC;AAE5G,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,EAAE;KACR,KAAK,CAAC,0BAA0B,EAAE,mCAAmC,CAAC;KACtE,IAAI,EAAE,CAAC;AAEG,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,mCAAmC,CAAC,CAAC;AAC9E,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,E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AAa,EAAE,EAAE,CAC/E,OAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAPQ,QAAA,uBAAuB,2BAO/B;AASQ,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,SAAS,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC;AAKU,QAAA,iBAAiB,GAAG,8BAAsB,CAAC,KAAK,CAAC,0BAAkB,CAAC,CAAC"}
|
||||
71
packages/domain/common/types.d.ts
vendored
71
packages/domain/common/types.d.ts
vendored
@ -1,71 +0,0 @@
|
||||
export type IsoDateTimeString = string;
|
||||
export type EmailAddress = string;
|
||||
export type PhoneNumber = string;
|
||||
export type Currency = "JPY" | "USD" | "EUR";
|
||||
export type UserId = string & {
|
||||
readonly __brand: "UserId";
|
||||
};
|
||||
export type AccountId = string & {
|
||||
readonly __brand: "AccountId";
|
||||
};
|
||||
export type OrderId = string & {
|
||||
readonly __brand: "OrderId";
|
||||
};
|
||||
export type InvoiceId = string & {
|
||||
readonly __brand: "InvoiceId";
|
||||
};
|
||||
export type ProductId = string & {
|
||||
readonly __brand: "ProductId";
|
||||
};
|
||||
export type SimId = string & {
|
||||
readonly __brand: "SimId";
|
||||
};
|
||||
export type WhmcsClientId = number & {
|
||||
readonly __brand: "WhmcsClientId";
|
||||
};
|
||||
export type WhmcsInvoiceId = number & {
|
||||
readonly __brand: "WhmcsInvoiceId";
|
||||
};
|
||||
export type WhmcsProductId = number & {
|
||||
readonly __brand: "WhmcsProductId";
|
||||
};
|
||||
export type SalesforceContactId = string & {
|
||||
readonly __brand: "SalesforceContactId";
|
||||
};
|
||||
export type SalesforceAccountId = string & {
|
||||
readonly __brand: "SalesforceAccountId";
|
||||
};
|
||||
export type SalesforceCaseId = string & {
|
||||
readonly __brand: "SalesforceCaseId";
|
||||
};
|
||||
export interface ApiSuccessResponse<T> {
|
||||
success: true;
|
||||
data: T;
|
||||
}
|
||||
export interface ApiErrorResponse {
|
||||
success: false;
|
||||
error: {
|
||||
code: string;
|
||||
message: string;
|
||||
details?: unknown;
|
||||
};
|
||||
}
|
||||
export type ApiResponse<T> = ApiSuccessResponse<T> | ApiErrorResponse;
|
||||
export interface PaginationParams {
|
||||
page?: number;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}
|
||||
export interface PaginatedResponse<T> {
|
||||
items: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
hasMore: boolean;
|
||||
}
|
||||
export interface FilterParams {
|
||||
search?: string;
|
||||
sortBy?: string;
|
||||
sortOrder?: "asc" | "desc";
|
||||
}
|
||||
export type QueryParams = PaginationParams & FilterParams;
|
||||
@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""}
|
||||
16
packages/domain/common/validation.d.ts
vendored
16
packages/domain/common/validation.d.ts
vendored
@ -1,16 +0,0 @@
|
||||
import { z } from "zod";
|
||||
export declare const uuidSchema: z.ZodString;
|
||||
export declare const requiredStringSchema: z.ZodString;
|
||||
export declare const salesforceIdSchema: z.ZodString;
|
||||
export declare const customerNumberSchema: z.ZodString;
|
||||
export declare function normalizeAndValidateEmail(email: string): string;
|
||||
export declare function validateUuidV4OrThrow(id: string): string;
|
||||
export declare function isValidEmail(email: string): boolean;
|
||||
export declare function isValidUuid(id: string): boolean;
|
||||
export declare const urlSchema: z.ZodString;
|
||||
export declare function validateUrlOrThrow(url: string): string;
|
||||
export declare function validateUrl(url: string): {
|
||||
isValid: boolean;
|
||||
errors: string[];
|
||||
};
|
||||
export declare function isValidUrl(url: string): boolean;
|
||||
@ -1,57 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.urlSchema = exports.customerNumberSchema = exports.salesforceIdSchema = exports.requiredStringSchema = exports.uuidSchema = void 0;
|
||||
exports.normalizeAndValidateEmail = normalizeAndValidateEmail;
|
||||
exports.validateUuidV4OrThrow = validateUuidV4OrThrow;
|
||||
exports.isValidEmail = isValidEmail;
|
||||
exports.isValidUuid = isValidUuid;
|
||||
exports.validateUrlOrThrow = validateUrlOrThrow;
|
||||
exports.validateUrl = validateUrl;
|
||||
exports.isValidUrl = isValidUrl;
|
||||
const zod_1 = require("zod");
|
||||
exports.uuidSchema = zod_1.z.string().uuid();
|
||||
exports.requiredStringSchema = zod_1.z.string().min(1, "This field is required").trim();
|
||||
exports.salesforceIdSchema = zod_1.z
|
||||
.string()
|
||||
.length(18, "Salesforce ID must be 18 characters")
|
||||
.regex(/^[A-Za-z0-9]+$/, "Salesforce ID must be alphanumeric")
|
||||
.trim();
|
||||
exports.customerNumberSchema = zod_1.z.string().min(1, "Customer number is required").trim();
|
||||
function normalizeAndValidateEmail(email) {
|
||||
const emailValidationSchema = zod_1.z.string().email().transform(e => e.toLowerCase().trim());
|
||||
return emailValidationSchema.parse(email);
|
||||
}
|
||||
function validateUuidV4OrThrow(id) {
|
||||
try {
|
||||
return exports.uuidSchema.parse(id);
|
||||
}
|
||||
catch {
|
||||
throw new Error("Invalid user ID format");
|
||||
}
|
||||
}
|
||||
function isValidEmail(email) {
|
||||
return zod_1.z.string().email().safeParse(email).success;
|
||||
}
|
||||
function isValidUuid(id) {
|
||||
return exports.uuidSchema.safeParse(id).success;
|
||||
}
|
||||
exports.urlSchema = zod_1.z.string().url();
|
||||
function validateUrlOrThrow(url) {
|
||||
try {
|
||||
return exports.urlSchema.parse(url);
|
||||
}
|
||||
catch {
|
||||
throw new Error("Invalid URL format");
|
||||
}
|
||||
}
|
||||
function validateUrl(url) {
|
||||
const result = exports.urlSchema.safeParse(url);
|
||||
return {
|
||||
isValid: result.success,
|
||||
errors: result.success ? [] : result.error.issues.map(i => i.message),
|
||||
};
|
||||
}
|
||||
function isValidUrl(url) {
|
||||
return exports.urlSchema.safeParse(url).success;
|
||||
}
|
||||
//# sourceMappingURL=validation.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"validation.js","sourceRoot":"","sources":["validation.ts"],"names":[],"mappings":";;;AA4CA,8DAGC;AAUD,sDAMC;AAKD,oCAEC;AAKD,kCAEC;AAeD,gDAMC;AAQD,kCAMC;AAKD,gCAEC;AAhHD,6BAAwB;AAKX,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAM/B,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,IAAI,EAAE,CAAC;AAM1E,QAAA,kBAAkB,GAAG,OAAC;KAChC,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,EAAE,qCAAqC,CAAC;KACjD,KAAK,CAAC,gBAAgB,EAAE,oCAAoC,CAAC;KAC7D,IAAI,EAAE,CAAC;AAMG,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC,CAAC,IAAI,EAAE,CAAC;AAU5F,SAAgB,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MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;KACtE,CAAC;AACJ,CAAC;AAKD,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,iBAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;AAC1C,CAAC"}
|
||||
16
packages/domain/customer/contract.d.ts
vendored
16
packages/domain/customer/contract.d.ts
vendored
@ -1,16 +0,0 @@
|
||||
export declare const USER_ROLE: {
|
||||
readonly USER: "USER";
|
||||
readonly ADMIN: "ADMIN";
|
||||
};
|
||||
export type UserRoleValue = (typeof USER_ROLE)[keyof typeof USER_ROLE];
|
||||
export interface SalesforceAccountFieldMap {
|
||||
internetEligibility: string;
|
||||
customerNumber: string;
|
||||
}
|
||||
export interface SalesforceAccountRecord {
|
||||
Id: string;
|
||||
Name?: string | null;
|
||||
WH_Account__c?: string | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export type { User, UserAuth, UserRole, Address, AddressFormData, } from './schema';
|
||||
@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.USER_ROLE = void 0;
|
||||
exports.USER_ROLE = {
|
||||
USER: "USER",
|
||||
ADMIN: "ADMIN",
|
||||
};
|
||||
//# sourceMappingURL=contract.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"contract.js","sourceRoot":"","sources":["contract.ts"],"names":[],"mappings":";;;AAaa,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACN,CAAC"}
|
||||
6
packages/domain/customer/index.d.ts
vendored
6
packages/domain/customer/index.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export { USER_ROLE, type UserRoleValue } from "./contract";
|
||||
export type { User, UserAuth, UserRole, Address, AddressFormData, } from "./schema";
|
||||
export { userSchema, userAuthSchema, addressSchema, addressFormSchema, combineToUser, addressFormToRequest, } from "./schema";
|
||||
export * as Providers from "./providers/index";
|
||||
export type { WhmcsAddClientParams, WhmcsValidateLoginParams, WhmcsCreateSsoTokenParams, WhmcsClientResponse, WhmcsAddClientResponse, WhmcsValidateLoginResponse, WhmcsSsoResponse, } from "./providers/whmcs/raw.types";
|
||||
export type { SalesforceAccountFieldMap, SalesforceAccountRecord, } from "./contract";
|
||||
@ -1,47 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Providers = exports.addressFormToRequest = exports.combineToUser = exports.addressFormSchema = exports.addressSchema = exports.userAuthSchema = exports.userSchema = exports.USER_ROLE = void 0;
|
||||
var contract_1 = require("./contract");
|
||||
Object.defineProperty(exports, "USER_ROLE", { enumerable: true, get: function () { return contract_1.USER_ROLE; } });
|
||||
var schema_1 = require("./schema");
|
||||
Object.defineProperty(exports, "userSchema", { enumerable: true, get: function () { return schema_1.userSchema; } });
|
||||
Object.defineProperty(exports, "userAuthSchema", { enumerable: true, get: function () { return schema_1.userAuthSchema; } });
|
||||
Object.defineProperty(exports, "addressSchema", { enumerable: true, get: function () { return schema_1.addressSchema; } });
|
||||
Object.defineProperty(exports, "addressFormSchema", { enumerable: true, get: function () { return schema_1.addressFormSchema; } });
|
||||
Object.defineProperty(exports, "combineToUser", { enumerable: true, get: function () { return schema_1.combineToUser; } });
|
||||
Object.defineProperty(exports, "addressFormToRequest", { enumerable: true, get: function () { return schema_1.addressFormToRequest; } });
|
||||
exports.Providers = __importStar(require("./providers/index"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,uCAA2D;AAAlD,qGAAA,SAAS,OAAA;AAkBlB,mCASkB;AARhB,oGAAA,UAAU,OAAA;AACV,wGAAA,cAAc,OAAA;AACd,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AAGjB,uGAAA,aAAa,OAAA;AACb,8GAAA,oBAAoB,OAAA;AAetB,+DAA+C"}
|
||||
@ -1,2 +0,0 @@
|
||||
export * as Portal from "./portal/index";
|
||||
export * as Whmcs from "./whmcs/index";
|
||||
@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Whmcs = exports.Portal = void 0;
|
||||
exports.Portal = __importStar(require("./portal/index"));
|
||||
exports.Whmcs = __importStar(require("./whmcs/index"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,yDAAyC;AACzC,uDAAuC"}
|
||||
@ -1,2 +0,0 @@
|
||||
export * from "./mapper";
|
||||
export * from "./types";
|
||||
@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./mapper"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user