From 12c3dc976ff103a3b660551f2d0d9b56c26fe627 Mon Sep 17 00:00:00 2001 From: barsa Date: Fri, 3 Oct 2025 17:08:42 +0900 Subject: [PATCH] Refactor integration services and update import paths to align with the new domain structure, enhancing type safety and maintainability. Streamline Freebit integration by utilizing updated provider methods and removing deprecated types. Improve organization and consistency in data handling across various modules, including catalog and billing services. --- apps/bff/src/core/config/field-map.ts | 2 +- .../freebit/services/freebit-auth.service.ts | 2 +- .../services/freebit-operations.service.ts | 3 +- .../salesforce/salesforce.service.ts | 2 +- .../services/salesforce-account.service.ts | 2 +- .../src/modules/catalog/catalog.controller.ts | 2 +- .../catalog/services/base-catalog.service.ts | 2 +- .../services/internet-catalog.service.ts | 2 +- .../catalog/services/sim-catalog.service.ts | 2 +- .../catalog/services/vpn-catalog.service.ts | 2 +- .../utils/salesforce-product.mapper.ts | 4 +- .../modules/invoices/invoices.controller.ts | 4 +- .../services/invoice-retrieval.service.ts | 2 +- .../services/invoices-orchestrator.service.ts | 2 +- .../bff/src/modules/users/users.controller.ts | 2 +- .../organisms/AppShell/AppShell.tsx | 2 +- .../organisms/AppShell/navigation.ts | 2 +- .../account/components/AddressCard.tsx | 2 +- .../account/components/PersonalInfoCard.tsx | 2 +- .../features/account/hooks/useAddressEdit.ts | 2 +- .../features/account/hooks/useProfileData.ts | 4 +- .../features/account/hooks/useProfileEdit.ts | 2 +- .../account/services/account.service.ts | 2 +- .../auth/components/LoginForm/LoginForm.tsx | 2 +- .../PasswordResetForm/PasswordResetForm.tsx | 2 +- .../SetPasswordForm/SetPasswordForm.tsx | 2 +- .../BillingStatusBadge/BillingStatusBadge.tsx | 2 +- .../BillingSummary/BillingSummary.tsx | 4 +- .../InvoiceDetail/InvoiceHeader.tsx | 4 +- .../components/InvoiceDetail/InvoiceItems.tsx | 4 +- .../InvoiceDetail/InvoiceSummaryBar.tsx | 4 +- .../InvoiceDetail/InvoiceTotals.tsx | 2 +- .../billing/components/InvoiceItemRow.tsx | 2 +- .../components/InvoiceList/InvoiceList.tsx | 2 +- .../components/InvoiceTable/InvoiceTable.tsx | 4 +- .../billing/components/PaymentMethodCard.tsx | 2 +- .../PaymentMethodCard/PaymentMethodCard.tsx | 2 +- .../src/features/billing/hooks/useBilling.ts | 4 +- .../features/billing/views/InvoiceDetail.tsx | 2 +- .../catalog/components/base/AddonGroup.tsx | 2 +- .../components/base/AddressConfirmation.tsx | 2 +- .../catalog/components/base/AddressForm.tsx | 2 +- .../components/base/EnhancedOrderSummary.tsx | 2 +- .../catalog/components/base/OrderSummary.tsx | 2 +- .../catalog/components/base/PaymentForm.tsx | 2 +- .../internet/InstallationOptions.tsx | 2 +- .../internet/InternetConfigureView.tsx | 2 +- .../components/internet/InternetPlanCard.tsx | 2 +- .../configure/InternetConfigureContainer.tsx | 2 +- .../configure/hooks/useConfigureState.ts | 2 +- .../internet/configure/steps/AddonsStep.tsx | 2 +- .../configure/steps/InstallationStep.tsx | 2 +- .../configure/steps/ReviewOrderStep.tsx | 2 +- .../steps/ServiceConfigurationStep.tsx | 2 +- .../catalog/components/sim/SimPlanCard.tsx | 2 +- .../components/sim/SimPlanTypeSection.tsx | 2 +- .../catalog/components/vpn/VpnPlanCard.tsx | 2 +- .../catalog/hooks/useInternetConfigure.ts | 2 +- .../features/catalog/hooks/useSimConfigure.ts | 4 +- apps/portal/src/features/catalog/index.ts | 2 +- .../catalog/services/catalog.service.ts | 2 +- .../features/catalog/utils/catalog.utils.ts | 4 +- .../src/features/catalog/utils/pricing.ts | 2 +- .../features/catalog/views/InternetPlans.tsx | 2 +- .../src/features/catalog/views/SimPlans.tsx | 2 +- .../features/checkout/hooks/useCheckout.ts | 8 +- .../checkout/views/CheckoutContainer.tsx | 2 +- .../dashboard/components/ActivityFeed.tsx | 4 +- .../components/UpcomingPaymentBanner.tsx | 2 +- .../dashboard/hooks/useDashboardSummary.ts | 2 +- .../dashboard/utils/dashboard.utils.ts | 4 +- .../dashboard/views/DashboardView.tsx | 4 +- .../orders/services/orders.service.ts | 2 +- .../components/SimDetailsCard.tsx | 2 +- .../components/SubscriptionCard.tsx | 4 +- .../components/SubscriptionDetails.tsx | 4 +- .../subscriptions/hooks/useSubscriptions.ts | 2 +- .../views/SubscriptionDetail.tsx | 2 +- .../subscriptions/views/SubscriptionsList.tsx | 4 +- packages/domain/auth/schema.ts | 8 - .../domain/sim/providers/freebit/index.ts | 8 + .../domain/sim/providers/freebit/mapper.ts | 41 +++-- .../domain/sim/providers/freebit/raw.types.ts | 13 +- .../domain/sim/providers/freebit/requests.ts | 56 +++++- packages/domain/src/common.d.ts | 116 ------------ packages/domain/src/common.js | 38 ---- packages/domain/src/common.js.map | 1 - packages/domain/src/common.ts | 135 -------------- packages/domain/src/contracts/api.d.ts | 75 -------- packages/domain/src/contracts/api.js | 3 - packages/domain/src/contracts/api.js.map | 1 - packages/domain/src/contracts/api.ts | 101 ---------- packages/domain/src/contracts/catalog.d.ts | 60 ------ packages/domain/src/contracts/catalog.js | 3 - packages/domain/src/contracts/catalog.js.map | 1 - packages/domain/src/contracts/catalog.ts | 70 ------- packages/domain/src/contracts/common.ts | 0 packages/domain/src/contracts/index.d.ts | 3 - packages/domain/src/contracts/index.js | 20 -- packages/domain/src/contracts/index.js.map | 1 - packages/domain/src/contracts/index.ts | 4 - packages/domain/src/contracts/salesforce.d.ts | 153 ---------------- packages/domain/src/contracts/salesforce.js | 3 - .../domain/src/contracts/salesforce.js.map | 1 - packages/domain/src/contracts/salesforce.ts | 164 ----------------- packages/domain/src/entities/billing.d.ts | 29 --- packages/domain/src/entities/billing.js | 33 ---- packages/domain/src/entities/billing.js.map | 1 - packages/domain/src/entities/billing.ts | 76 -------- packages/domain/src/entities/case.d.ts | 39 ---- packages/domain/src/entities/case.js | 3 - packages/domain/src/entities/case.js.map | 1 - packages/domain/src/entities/case.ts | 45 ----- packages/domain/src/entities/dashboard.d.ts | 31 ---- packages/domain/src/entities/dashboard.js | 3 - packages/domain/src/entities/dashboard.js.map | 1 - packages/domain/src/entities/dashboard.ts | 44 ----- packages/domain/src/entities/index.d.ts | 7 - packages/domain/src/entities/index.js | 24 --- packages/domain/src/entities/index.js.map | 1 - packages/domain/src/entities/index.ts | 8 - packages/domain/src/entities/invoice.d.ts | 12 -- packages/domain/src/entities/invoice.js | 3 - packages/domain/src/entities/invoice.js.map | 1 - packages/domain/src/entities/invoice.ts | 23 --- packages/domain/src/entities/payment.d.ts | 37 ---- packages/domain/src/entities/payment.js | 3 - packages/domain/src/entities/payment.js.map | 1 - packages/domain/src/entities/payment.ts | 55 ------ packages/domain/src/entities/skus.d.ts | 11 -- packages/domain/src/entities/skus.js | 103 ----------- packages/domain/src/entities/skus.js.map | 1 - packages/domain/src/entities/skus.ts | 127 ------------- .../domain/src/entities/subscription.d.ts | 6 - packages/domain/src/entities/subscription.js | 3 - .../domain/src/entities/subscription.js.map | 1 - packages/domain/src/entities/subscription.ts | 14 -- packages/domain/src/entities/user.js | 3 - packages/domain/src/entities/user.js.map | 1 - packages/domain/src/enums/index.d.ts | 1 - packages/domain/src/enums/index.js | 18 -- packages/domain/src/enums/index.js.map | 1 - packages/domain/src/enums/index.ts | 2 - packages/domain/src/enums/status.d.ts | 51 ------ packages/domain/src/enums/status.js | 49 ----- packages/domain/src/enums/status.js.map | 1 - packages/domain/src/enums/status.ts | 60 ------ packages/domain/src/index.d.ts | 10 - packages/domain/src/index.js | 24 --- packages/domain/src/index.js.map | 1 - packages/domain/src/index.ts | 60 ------ packages/domain/src/patterns/async-state.d.ts | 65 ------- packages/domain/src/patterns/async-state.js | 62 ------- .../domain/src/patterns/async-state.js.map | 1 - packages/domain/src/patterns/async-state.ts | 122 ------------- packages/domain/src/patterns/index.d.ts | 4 - packages/domain/src/patterns/index.js | 19 -- packages/domain/src/patterns/index.js.map | 1 - packages/domain/src/patterns/index.ts | 20 -- packages/domain/src/patterns/pagination.d.ts | 23 --- packages/domain/src/patterns/pagination.js | 42 ----- .../domain/src/patterns/pagination.js.map | 1 - packages/domain/src/patterns/pagination.ts | 66 ------- packages/domain/src/utils/array-utils.d.ts | 12 -- packages/domain/src/utils/array-utils.js | 74 -------- packages/domain/src/utils/array-utils.js.map | 1 - packages/domain/src/utils/array-utils.ts | 108 ----------- packages/domain/src/utils/currency.d.ts | 8 - packages/domain/src/utils/currency.js | 26 --- packages/domain/src/utils/currency.js.map | 1 - packages/domain/src/utils/currency.ts | 42 ----- packages/domain/src/utils/filters.d.ts | 45 ----- packages/domain/src/utils/filters.js | 3 - packages/domain/src/utils/filters.js.map | 1 - packages/domain/src/utils/filters.ts | 64 ------- packages/domain/src/utils/index.d.ts | 4 - packages/domain/src/utils/index.js | 21 --- packages/domain/src/utils/index.js.map | 1 - packages/domain/src/utils/index.ts | 5 - packages/domain/src/utils/type-utils.d.ts | 87 --------- packages/domain/src/utils/type-utils.js | 3 - packages/domain/src/utils/type-utils.js.map | 1 - packages/domain/src/utils/type-utils.ts | 172 ------------------ packages/domain/src/utils/validation.d.ts | 17 -- packages/domain/src/utils/validation.js | 69 ------- packages/domain/src/utils/validation.js.map | 1 - packages/domain/src/utils/validation.ts | 118 ------------ .../domain/src/validation/api/requests.js.map | 1 - .../src/validation/api/responses.js.map | 1 - .../domain/src/validation/business/index.d.ts | 1 - .../src/validation/business/index.js.map | 1 - .../src/validation/business/orders.d.ts | 84 --------- .../src/validation/business/orders.js.map | 1 - packages/domain/src/validation/forms/auth.js | 22 --- .../domain/src/validation/forms/auth.js.map | 1 - .../domain/src/validation/forms/profile.d.ts | 21 --- .../domain/src/validation/forms/profile.js | 40 ---- .../src/validation/forms/profile.js.map | 1 - .../domain/src/validation/forms/profile.ts | 80 -------- .../src/validation/forms/sim-configure.d.ts | 88 --------- .../src/validation/forms/sim-configure.js | 97 ---------- .../src/validation/forms/sim-configure.js.map | 1 - .../src/validation/forms/sim-configure.ts | 120 ------------ packages/domain/src/validation/index.js | 92 ---------- packages/domain/src/validation/index.js.map | 1 - .../domain/src/validation/shared/common.d.ts | 142 --------------- .../domain/src/validation/shared/common.js | 92 ---------- .../src/validation/shared/common.js.map | 1 - .../domain/src/validation/shared/common.ts | 154 ---------------- .../src/validation/shared/entities.d.ts | 1 - .../domain/src/validation/shared/entities.js | 3 - .../src/validation/shared/entities.js.map | 1 - .../src/validation/shared/identifiers.d.ts | 27 --- .../src/validation/shared/identifiers.js | 42 ----- .../src/validation/shared/identifiers.js.map | 1 - .../src/validation/shared/identifiers.ts | 78 -------- .../domain/src/validation/shared/index.ts | 80 -------- .../domain/src/validation/shared/order.d.ts | 91 --------- .../domain/src/validation/shared/order.js | 61 ------- .../domain/src/validation/shared/order.js.map | 1 - .../domain/src/validation/shared/order.ts | 69 ------- .../src/validation/shared/primitives.d.ts | 84 --------- .../src/validation/shared/primitives.js | 75 -------- .../src/validation/shared/primitives.js.map | 1 - .../src/validation/shared/primitives.ts | 132 -------------- .../src/validation/shared/utilities.d.ts | 4 - .../domain/src/validation/shared/utilities.js | 14 -- .../src/validation/shared/utilities.js.map | 1 - .../domain/src/validation/shared/utilities.ts | 23 --- .../src/integrations/freebit/quota.schema.ts | 21 --- 230 files changed, 191 insertions(+), 5278 deletions(-) delete mode 100644 packages/domain/src/common.d.ts delete mode 100644 packages/domain/src/common.js delete mode 100644 packages/domain/src/common.js.map delete mode 100644 packages/domain/src/common.ts delete mode 100644 packages/domain/src/contracts/api.d.ts delete mode 100644 packages/domain/src/contracts/api.js delete mode 100644 packages/domain/src/contracts/api.js.map delete mode 100644 packages/domain/src/contracts/api.ts delete mode 100644 packages/domain/src/contracts/catalog.d.ts delete mode 100644 packages/domain/src/contracts/catalog.js delete mode 100644 packages/domain/src/contracts/catalog.js.map delete mode 100644 packages/domain/src/contracts/catalog.ts delete mode 100644 packages/domain/src/contracts/common.ts delete mode 100644 packages/domain/src/contracts/index.d.ts delete mode 100644 packages/domain/src/contracts/index.js delete mode 100644 packages/domain/src/contracts/index.js.map delete mode 100644 packages/domain/src/contracts/index.ts delete mode 100644 packages/domain/src/contracts/salesforce.d.ts delete mode 100644 packages/domain/src/contracts/salesforce.js delete mode 100644 packages/domain/src/contracts/salesforce.js.map delete mode 100644 packages/domain/src/contracts/salesforce.ts delete mode 100644 packages/domain/src/entities/billing.d.ts delete mode 100644 packages/domain/src/entities/billing.js delete mode 100644 packages/domain/src/entities/billing.js.map delete mode 100644 packages/domain/src/entities/billing.ts delete mode 100644 packages/domain/src/entities/case.d.ts delete mode 100644 packages/domain/src/entities/case.js delete mode 100644 packages/domain/src/entities/case.js.map delete mode 100644 packages/domain/src/entities/case.ts delete mode 100644 packages/domain/src/entities/dashboard.d.ts delete mode 100644 packages/domain/src/entities/dashboard.js delete mode 100644 packages/domain/src/entities/dashboard.js.map delete mode 100644 packages/domain/src/entities/dashboard.ts delete mode 100644 packages/domain/src/entities/index.d.ts delete mode 100644 packages/domain/src/entities/index.js delete mode 100644 packages/domain/src/entities/index.js.map delete mode 100644 packages/domain/src/entities/index.ts delete mode 100644 packages/domain/src/entities/invoice.d.ts delete mode 100644 packages/domain/src/entities/invoice.js delete mode 100644 packages/domain/src/entities/invoice.js.map delete mode 100644 packages/domain/src/entities/invoice.ts delete mode 100644 packages/domain/src/entities/payment.d.ts delete mode 100644 packages/domain/src/entities/payment.js delete mode 100644 packages/domain/src/entities/payment.js.map delete mode 100644 packages/domain/src/entities/payment.ts delete mode 100644 packages/domain/src/entities/skus.d.ts delete mode 100644 packages/domain/src/entities/skus.js delete mode 100644 packages/domain/src/entities/skus.js.map delete mode 100644 packages/domain/src/entities/skus.ts delete mode 100644 packages/domain/src/entities/subscription.d.ts delete mode 100644 packages/domain/src/entities/subscription.js delete mode 100644 packages/domain/src/entities/subscription.js.map delete mode 100644 packages/domain/src/entities/subscription.ts delete mode 100644 packages/domain/src/entities/user.js delete mode 100644 packages/domain/src/entities/user.js.map delete mode 100644 packages/domain/src/enums/index.d.ts delete mode 100644 packages/domain/src/enums/index.js delete mode 100644 packages/domain/src/enums/index.js.map delete mode 100644 packages/domain/src/enums/index.ts delete mode 100644 packages/domain/src/enums/status.d.ts delete mode 100644 packages/domain/src/enums/status.js delete mode 100644 packages/domain/src/enums/status.js.map delete mode 100644 packages/domain/src/enums/status.ts delete mode 100644 packages/domain/src/index.d.ts delete mode 100644 packages/domain/src/index.js delete mode 100644 packages/domain/src/index.js.map delete mode 100644 packages/domain/src/index.ts delete mode 100644 packages/domain/src/patterns/async-state.d.ts delete mode 100644 packages/domain/src/patterns/async-state.js delete mode 100644 packages/domain/src/patterns/async-state.js.map delete mode 100644 packages/domain/src/patterns/async-state.ts delete mode 100644 packages/domain/src/patterns/index.d.ts delete mode 100644 packages/domain/src/patterns/index.js delete mode 100644 packages/domain/src/patterns/index.js.map delete mode 100644 packages/domain/src/patterns/index.ts delete mode 100644 packages/domain/src/patterns/pagination.d.ts delete mode 100644 packages/domain/src/patterns/pagination.js delete mode 100644 packages/domain/src/patterns/pagination.js.map delete mode 100644 packages/domain/src/patterns/pagination.ts delete mode 100644 packages/domain/src/utils/array-utils.d.ts delete mode 100644 packages/domain/src/utils/array-utils.js delete mode 100644 packages/domain/src/utils/array-utils.js.map delete mode 100644 packages/domain/src/utils/array-utils.ts delete mode 100644 packages/domain/src/utils/currency.d.ts delete mode 100644 packages/domain/src/utils/currency.js delete mode 100644 packages/domain/src/utils/currency.js.map delete mode 100644 packages/domain/src/utils/currency.ts delete mode 100644 packages/domain/src/utils/filters.d.ts delete mode 100644 packages/domain/src/utils/filters.js delete mode 100644 packages/domain/src/utils/filters.js.map delete mode 100644 packages/domain/src/utils/filters.ts delete mode 100644 packages/domain/src/utils/index.d.ts delete mode 100644 packages/domain/src/utils/index.js delete mode 100644 packages/domain/src/utils/index.js.map delete mode 100644 packages/domain/src/utils/index.ts delete mode 100644 packages/domain/src/utils/type-utils.d.ts delete mode 100644 packages/domain/src/utils/type-utils.js delete mode 100644 packages/domain/src/utils/type-utils.js.map delete mode 100644 packages/domain/src/utils/type-utils.ts delete mode 100644 packages/domain/src/utils/validation.d.ts delete mode 100644 packages/domain/src/utils/validation.js delete mode 100644 packages/domain/src/utils/validation.js.map delete mode 100644 packages/domain/src/utils/validation.ts delete mode 100644 packages/domain/src/validation/api/requests.js.map delete mode 100644 packages/domain/src/validation/api/responses.js.map delete mode 100644 packages/domain/src/validation/business/index.d.ts delete mode 100644 packages/domain/src/validation/business/index.js.map delete mode 100644 packages/domain/src/validation/business/orders.d.ts delete mode 100644 packages/domain/src/validation/business/orders.js.map delete mode 100644 packages/domain/src/validation/forms/auth.js delete mode 100644 packages/domain/src/validation/forms/auth.js.map delete mode 100644 packages/domain/src/validation/forms/profile.d.ts delete mode 100644 packages/domain/src/validation/forms/profile.js delete mode 100644 packages/domain/src/validation/forms/profile.js.map delete mode 100644 packages/domain/src/validation/forms/profile.ts delete mode 100644 packages/domain/src/validation/forms/sim-configure.d.ts delete mode 100644 packages/domain/src/validation/forms/sim-configure.js delete mode 100644 packages/domain/src/validation/forms/sim-configure.js.map delete mode 100644 packages/domain/src/validation/forms/sim-configure.ts delete mode 100644 packages/domain/src/validation/index.js delete mode 100644 packages/domain/src/validation/index.js.map delete mode 100644 packages/domain/src/validation/shared/common.d.ts delete mode 100644 packages/domain/src/validation/shared/common.js delete mode 100644 packages/domain/src/validation/shared/common.js.map delete mode 100644 packages/domain/src/validation/shared/common.ts delete mode 100644 packages/domain/src/validation/shared/entities.d.ts delete mode 100644 packages/domain/src/validation/shared/entities.js delete mode 100644 packages/domain/src/validation/shared/entities.js.map delete mode 100644 packages/domain/src/validation/shared/identifiers.d.ts delete mode 100644 packages/domain/src/validation/shared/identifiers.js delete mode 100644 packages/domain/src/validation/shared/identifiers.js.map delete mode 100644 packages/domain/src/validation/shared/identifiers.ts delete mode 100644 packages/domain/src/validation/shared/index.ts delete mode 100644 packages/domain/src/validation/shared/order.d.ts delete mode 100644 packages/domain/src/validation/shared/order.js delete mode 100644 packages/domain/src/validation/shared/order.js.map delete mode 100644 packages/domain/src/validation/shared/order.ts delete mode 100644 packages/domain/src/validation/shared/primitives.d.ts delete mode 100644 packages/domain/src/validation/shared/primitives.js delete mode 100644 packages/domain/src/validation/shared/primitives.js.map delete mode 100644 packages/domain/src/validation/shared/primitives.ts delete mode 100644 packages/domain/src/validation/shared/utilities.d.ts delete mode 100644 packages/domain/src/validation/shared/utilities.js delete mode 100644 packages/domain/src/validation/shared/utilities.js.map delete mode 100644 packages/domain/src/validation/shared/utilities.ts delete mode 100644 packages/schemas/src/integrations/freebit/quota.schema.ts diff --git a/apps/bff/src/core/config/field-map.ts b/apps/bff/src/core/config/field-map.ts index 73c6069c..97e1000b 100644 --- a/apps/bff/src/core/config/field-map.ts +++ b/apps/bff/src/core/config/field-map.ts @@ -1,4 +1,4 @@ -import type { SalesforceProductFieldMap } from "@customer-portal/domain"; +import type { SalesforceProductFieldMap } from "@customer-portal/domain/billing"; import { Injectable } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; diff --git a/apps/bff/src/integrations/freebit/services/freebit-auth.service.ts b/apps/bff/src/integrations/freebit/services/freebit-auth.service.ts index 1cdd787f..90a0a97a 100644 --- a/apps/bff/src/integrations/freebit/services/freebit-auth.service.ts +++ b/apps/bff/src/integrations/freebit/services/freebit-auth.service.ts @@ -6,7 +6,7 @@ import type { FreebitConfig, FreebitAuthRequest, FreebitAuthResponse, -} from "../interfaces/freebit.types"; +} from "@customer-portal/domain/sim/providers/freebit"; import { FreebitError } from "./freebit-error.service"; @Injectable() diff --git a/apps/bff/src/integrations/freebit/services/freebit-operations.service.ts b/apps/bff/src/integrations/freebit/services/freebit-operations.service.ts index a53fe05e..f3a4760d 100644 --- a/apps/bff/src/integrations/freebit/services/freebit-operations.service.ts +++ b/apps/bff/src/integrations/freebit/services/freebit-operations.service.ts @@ -26,7 +26,6 @@ import type { FreebitAccountDetailsRequest, FreebitTrafficInfoRequest, FreebitQuotaHistoryRequest, - FreebitQuotaHistoryResponse, FreebitEsimAddAccountRequest, } from "@customer-portal/domain/sim/providers/freebit"; import type { SimDetails, SimTopUpHistory, SimUsage } from "@customer-portal/domain/sim"; @@ -200,7 +199,7 @@ export class FreebitOperationsService { const response = await this.client.makeAuthenticatedRequest< FreebitQuotaHistoryResponse, - typeof request + FreebitQuotaHistoryRequest >("/mvno/getQuotaHistory/", request); return this.mapper.mapToSimTopUpHistory(response, account); diff --git a/apps/bff/src/integrations/salesforce/salesforce.service.ts b/apps/bff/src/integrations/salesforce/salesforce.service.ts index 992b4c24..e2eb2385 100644 --- a/apps/bff/src/integrations/salesforce/salesforce.service.ts +++ b/apps/bff/src/integrations/salesforce/salesforce.service.ts @@ -9,7 +9,7 @@ import { type AccountData, type UpsertResult, } from "./services/salesforce-account.service"; -import type { SalesforceAccountRecord, SalesforceOrderRecord } from "@customer-portal/domain"; +import type { SalesforceAccountRecord, SalesforceOrderRecord } from "@customer-portal/domain/billing"; /** * Clean Salesforce Service - Only includes actually used functionality diff --git a/apps/bff/src/integrations/salesforce/services/salesforce-account.service.ts b/apps/bff/src/integrations/salesforce/services/salesforce-account.service.ts index 93cb8cf4..68ecf8fb 100644 --- a/apps/bff/src/integrations/salesforce/services/salesforce-account.service.ts +++ b/apps/bff/src/integrations/salesforce/services/salesforce-account.service.ts @@ -2,7 +2,7 @@ import { Injectable, Inject } from "@nestjs/common"; import { Logger } from "nestjs-pino"; import { getErrorMessage } from "@bff/core/utils/error.util"; import { SalesforceConnection } from "./salesforce-connection.service"; -import type { SalesforceAccountRecord, SalesforceQueryResult } from "@customer-portal/domain"; +import type { SalesforceAccountRecord, SalesforceQueryResult } from "@customer-portal/domain/billing"; export interface AccountData { name: string; diff --git a/apps/bff/src/modules/catalog/catalog.controller.ts b/apps/bff/src/modules/catalog/catalog.controller.ts index 71ea62ee..9a9a78ab 100644 --- a/apps/bff/src/modules/catalog/catalog.controller.ts +++ b/apps/bff/src/modules/catalog/catalog.controller.ts @@ -6,7 +6,7 @@ import type { SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { InternetCatalogService } from "./services/internet-catalog.service"; import { SimCatalogService } from "./services/sim-catalog.service"; import { VpnCatalogService } from "./services/vpn-catalog.service"; diff --git a/apps/bff/src/modules/catalog/services/base-catalog.service.ts b/apps/bff/src/modules/catalog/services/base-catalog.service.ts index 83bb1c4c..689d2b53 100644 --- a/apps/bff/src/modules/catalog/services/base-catalog.service.ts +++ b/apps/bff/src/modules/catalog/services/base-catalog.service.ts @@ -12,7 +12,7 @@ import type { SalesforceProduct2WithPricebookEntries, SalesforcePricebookEntryRecord, SalesforceQueryResult, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; @Injectable() export class BaseCatalogService { diff --git a/apps/bff/src/modules/catalog/services/internet-catalog.service.ts b/apps/bff/src/modules/catalog/services/internet-catalog.service.ts index 090701b6..39fc184b 100644 --- a/apps/bff/src/modules/catalog/services/internet-catalog.service.ts +++ b/apps/bff/src/modules/catalog/services/internet-catalog.service.ts @@ -6,7 +6,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { MappingsService } from "@bff/modules/id-mappings/mappings.service"; import { SalesforceConnection } from "@bff/integrations/salesforce/services/salesforce-connection.service"; import { SalesforceFieldMapService } from "@bff/core/config/field-map"; diff --git a/apps/bff/src/modules/catalog/services/sim-catalog.service.ts b/apps/bff/src/modules/catalog/services/sim-catalog.service.ts index 2aac8cee..51b16c01 100644 --- a/apps/bff/src/modules/catalog/services/sim-catalog.service.ts +++ b/apps/bff/src/modules/catalog/services/sim-catalog.service.ts @@ -6,7 +6,7 @@ import type { SalesforceProduct2WithPricebookEntries, SimCatalogProduct, SimActivationFeeCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { mapSimProduct, mapSimActivationFee, diff --git a/apps/bff/src/modules/catalog/services/vpn-catalog.service.ts b/apps/bff/src/modules/catalog/services/vpn-catalog.service.ts index 6b1e4eee..b23363de 100644 --- a/apps/bff/src/modules/catalog/services/vpn-catalog.service.ts +++ b/apps/bff/src/modules/catalog/services/vpn-catalog.service.ts @@ -7,7 +7,7 @@ import { BaseCatalogService } from "./base-catalog.service"; import type { SalesforceProduct2WithPricebookEntries, VpnCatalogProduct, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { mapVpnProduct } from "@bff/modules/catalog/utils/salesforce-product.mapper"; @Injectable() diff --git a/apps/bff/src/modules/catalog/utils/salesforce-product.mapper.ts b/apps/bff/src/modules/catalog/utils/salesforce-product.mapper.ts index 93a7284f..9b370dfe 100644 --- a/apps/bff/src/modules/catalog/utils/salesforce-product.mapper.ts +++ b/apps/bff/src/modules/catalog/utils/salesforce-product.mapper.ts @@ -7,11 +7,11 @@ import type { SimActivationFeeCatalogItem, SimCatalogProduct, VpnCatalogProduct, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import type { SalesforceProduct2WithPricebookEntries, SalesforcePricebookEntryRecord, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import type { SalesforceFieldMap } from "@bff/core/config/field-map"; export type SalesforceCatalogProductRecord = SalesforceProduct2WithPricebookEntries; diff --git a/apps/bff/src/modules/invoices/invoices.controller.ts b/apps/bff/src/modules/invoices/invoices.controller.ts index 0ef43088..6cdf16f3 100644 --- a/apps/bff/src/modules/invoices/invoices.controller.ts +++ b/apps/bff/src/modules/invoices/invoices.controller.ts @@ -25,8 +25,8 @@ import type { PaymentGatewayList, InvoicePaymentLink, InvoiceListQuery, -} from "@customer-portal/domain"; -import { invoiceListQuerySchema } from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; +import { invoiceListQuerySchema } from "@customer-portal/domain/billing"; interface AuthenticatedRequest { user: { id: string }; diff --git a/apps/bff/src/modules/invoices/services/invoice-retrieval.service.ts b/apps/bff/src/modules/invoices/services/invoice-retrieval.service.ts index 4318b29d..731301f4 100644 --- a/apps/bff/src/modules/invoices/services/invoice-retrieval.service.ts +++ b/apps/bff/src/modules/invoices/services/invoice-retrieval.service.ts @@ -5,7 +5,7 @@ import { Inject, } from "@nestjs/common"; import { Logger } from "nestjs-pino"; -import { Invoice, InvoiceList } from "@customer-portal/domain"; +import { Invoice, InvoiceList } from "@customer-portal/domain/billing"; import { WhmcsService } from "@bff/integrations/whmcs/whmcs.service"; import { MappingsService } from "@bff/modules/id-mappings/mappings.service"; import { getErrorMessage } from "@bff/core/utils/error.util"; diff --git a/apps/bff/src/modules/invoices/services/invoices-orchestrator.service.ts b/apps/bff/src/modules/invoices/services/invoices-orchestrator.service.ts index d3ded4ff..00420f64 100644 --- a/apps/bff/src/modules/invoices/services/invoices-orchestrator.service.ts +++ b/apps/bff/src/modules/invoices/services/invoices-orchestrator.service.ts @@ -1,6 +1,6 @@ import { Injectable, Inject } from "@nestjs/common"; import { Logger } from "nestjs-pino"; -import { Invoice, InvoiceList } from "@customer-portal/domain"; +import { Invoice, InvoiceList } from "@customer-portal/domain/billing"; import { InvoiceRetrievalService } from "./invoice-retrieval.service"; import { InvoiceHealthService } from "./invoice-health.service"; import { InvoiceValidatorService } from "../validators/invoice-validator.service"; diff --git a/apps/bff/src/modules/users/users.controller.ts b/apps/bff/src/modules/users/users.controller.ts index 67772d12..4b42429e 100644 --- a/apps/bff/src/modules/users/users.controller.ts +++ b/apps/bff/src/modules/users/users.controller.ts @@ -15,7 +15,7 @@ import { updateAddressRequestSchema, type UpdateProfileRequest, type UpdateAddressRequest, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import type { RequestWithUser } from "@bff/modules/auth/auth.types"; @Controller("me") diff --git a/apps/portal/src/components/organisms/AppShell/AppShell.tsx b/apps/portal/src/components/organisms/AppShell/AppShell.tsx index 94139dd1..f1452a08 100644 --- a/apps/portal/src/components/organisms/AppShell/AppShell.tsx +++ b/apps/portal/src/components/organisms/AppShell/AppShell.tsx @@ -8,7 +8,7 @@ import { accountService } from "@/features/account/services/account.service"; import { Sidebar } from "./Sidebar"; import { Header } from "./Header"; import { computeNavigation } from "./navigation"; -import type { Subscription } from "@customer-portal/domain"; +import type { Subscription } from "@customer-portal/domain/billing"; interface AppShellProps { children: React.ReactNode; diff --git a/apps/portal/src/components/organisms/AppShell/navigation.ts b/apps/portal/src/components/organisms/AppShell/navigation.ts index 6b18cbb1..ab640569 100644 --- a/apps/portal/src/components/organisms/AppShell/navigation.ts +++ b/apps/portal/src/components/organisms/AppShell/navigation.ts @@ -1,4 +1,4 @@ -import type { Subscription } from "@customer-portal/domain"; +import type { Subscription } from "@customer-portal/domain/billing"; import type { ReactNode } from "react"; import { HomeIcon, diff --git a/apps/portal/src/features/account/components/AddressCard.tsx b/apps/portal/src/features/account/components/AddressCard.tsx index 05ec9fa6..b4eef509 100644 --- a/apps/portal/src/features/account/components/AddressCard.tsx +++ b/apps/portal/src/features/account/components/AddressCard.tsx @@ -3,7 +3,7 @@ import { SubCard } from "@/components/molecules/SubCard/SubCard"; import { MapPinIcon, PencilIcon, CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { AddressForm, type AddressFormProps } from "@/features/catalog/components"; -import type { Address } from "@customer-portal/domain"; +import type { Address } from "@customer-portal/domain/billing"; interface AddressCardProps { address: Address; diff --git a/apps/portal/src/features/account/components/PersonalInfoCard.tsx b/apps/portal/src/features/account/components/PersonalInfoCard.tsx index 2561e5d2..c17154ee 100644 --- a/apps/portal/src/features/account/components/PersonalInfoCard.tsx +++ b/apps/portal/src/features/account/components/PersonalInfoCard.tsx @@ -2,7 +2,7 @@ import { SubCard } from "@/components/molecules/SubCard/SubCard"; import { UserIcon, PencilIcon, CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import type { ProfileDisplayData } from "@customer-portal/domain"; +import type { ProfileDisplayData } from "@customer-portal/domain/billing"; interface PersonalInfoCardProps { data: ProfileDisplayData; diff --git a/apps/portal/src/features/account/hooks/useAddressEdit.ts b/apps/portal/src/features/account/hooks/useAddressEdit.ts index ccd7b46e..0f8b0555 100644 --- a/apps/portal/src/features/account/hooks/useAddressEdit.ts +++ b/apps/portal/src/features/account/hooks/useAddressEdit.ts @@ -6,7 +6,7 @@ import { addressFormSchema, addressFormToRequest, type AddressFormData, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { useZodForm } from "@customer-portal/validation"; export function useAddressEdit(initial: AddressFormData) { diff --git a/apps/portal/src/features/account/hooks/useProfileData.ts b/apps/portal/src/features/account/hooks/useProfileData.ts index f8568a65..c6f395ac 100644 --- a/apps/portal/src/features/account/hooks/useProfileData.ts +++ b/apps/portal/src/features/account/hooks/useProfileData.ts @@ -6,10 +6,10 @@ import { accountService } from "@/features/account/services/account.service"; import { logger } from "@customer-portal/logging"; // Use centralized profile types -import type { ProfileEditFormData } from "@customer-portal/domain"; +import type { ProfileEditFormData } from "@customer-portal/domain/billing"; // Address type moved to domain package -import type { Address } from "@customer-portal/domain"; +import type { Address } from "@customer-portal/domain/billing"; export function useProfileData() { const { user } = useAuthStore(); diff --git a/apps/portal/src/features/account/hooks/useProfileEdit.ts b/apps/portal/src/features/account/hooks/useProfileEdit.ts index 32e9f043..fa477be2 100644 --- a/apps/portal/src/features/account/hooks/useProfileEdit.ts +++ b/apps/portal/src/features/account/hooks/useProfileEdit.ts @@ -7,7 +7,7 @@ import { profileEditFormSchema, profileFormToRequest, type ProfileEditFormData, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { useZodForm } from "@customer-portal/validation"; export function useProfileEdit(initial: ProfileEditFormData) { diff --git a/apps/portal/src/features/account/services/account.service.ts b/apps/portal/src/features/account/services/account.service.ts index 569591a9..be47c913 100644 --- a/apps/portal/src/features/account/services/account.service.ts +++ b/apps/portal/src/features/account/services/account.service.ts @@ -1,5 +1,5 @@ import { apiClient, getDataOrThrow, getNullableData } from "@/lib/api"; -import type { Address, UserProfile } from "@customer-portal/domain"; +import type { Address, UserProfile } from "@customer-portal/domain/billing"; type ProfileUpdateInput = { firstName?: string; diff --git a/apps/portal/src/features/auth/components/LoginForm/LoginForm.tsx b/apps/portal/src/features/auth/components/LoginForm/LoginForm.tsx index 304d081d..a8c93bc8 100644 --- a/apps/portal/src/features/auth/components/LoginForm/LoginForm.tsx +++ b/apps/portal/src/features/auth/components/LoginForm/LoginForm.tsx @@ -10,7 +10,7 @@ import Link from "next/link"; import { Button, Input, ErrorMessage } from "@/components/atoms"; import { FormField } from "@/components/molecules/FormField/FormField"; import { useLogin } from "../../hooks/use-auth"; -import { loginFormSchema, loginFormToRequest } from "@customer-portal/domain"; +import { loginFormSchema, loginFormToRequest } from "@customer-portal/domain/billing"; import { useZodForm } from "@customer-portal/validation"; import { z } from "zod"; diff --git a/apps/portal/src/features/auth/components/PasswordResetForm/PasswordResetForm.tsx b/apps/portal/src/features/auth/components/PasswordResetForm/PasswordResetForm.tsx index a2023469..c1618b57 100644 --- a/apps/portal/src/features/auth/components/PasswordResetForm/PasswordResetForm.tsx +++ b/apps/portal/src/features/auth/components/PasswordResetForm/PasswordResetForm.tsx @@ -16,7 +16,7 @@ import { passwordResetFormSchema, type PasswordResetRequestFormData, type PasswordResetFormData, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { z } from "zod"; interface PasswordResetFormProps { diff --git a/apps/portal/src/features/auth/components/SetPasswordForm/SetPasswordForm.tsx b/apps/portal/src/features/auth/components/SetPasswordForm/SetPasswordForm.tsx index ac5b9e91..9787d96a 100644 --- a/apps/portal/src/features/auth/components/SetPasswordForm/SetPasswordForm.tsx +++ b/apps/portal/src/features/auth/components/SetPasswordForm/SetPasswordForm.tsx @@ -11,7 +11,7 @@ import { Button, Input, ErrorMessage } from "@/components/atoms"; import { FormField } from "@/components/molecules/FormField/FormField"; import { useWhmcsLink } from "../../hooks/use-auth"; import { useZodForm } from "@customer-portal/validation"; -import { setPasswordFormSchema, type SetPasswordFormData } from "@customer-portal/domain"; +import { setPasswordFormSchema, type SetPasswordFormData } from "@customer-portal/domain/billing"; import { z } from "zod"; interface SetPasswordFormProps { diff --git a/apps/portal/src/features/billing/components/BillingStatusBadge/BillingStatusBadge.tsx b/apps/portal/src/features/billing/components/BillingStatusBadge/BillingStatusBadge.tsx index 66cf8ddb..1aa5f41e 100644 --- a/apps/portal/src/features/billing/components/BillingStatusBadge/BillingStatusBadge.tsx +++ b/apps/portal/src/features/billing/components/BillingStatusBadge/BillingStatusBadge.tsx @@ -10,7 +10,7 @@ import { } from "@heroicons/react/24/outline"; import { StatusPill } from "@/components/atoms/status-pill"; import type { StatusPillProps } from "@/components/atoms/status-pill"; -import type { InvoiceStatus } from "@customer-portal/domain"; +import type { InvoiceStatus } from "@customer-portal/domain/billing"; interface BillingStatusBadgeProps extends Omit { status: string; diff --git a/apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx b/apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx index b2cd72c6..f948084c 100644 --- a/apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx +++ b/apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx @@ -10,8 +10,8 @@ import { ArrowRightIcon, } from "@heroicons/react/24/outline"; import { BillingStatusBadge } from "../BillingStatusBadge"; -import type { BillingSummaryData } from "@customer-portal/domain"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; +import type { BillingSummaryData } from "@customer-portal/domain/billing"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; interface BillingSummaryProps extends React.HTMLAttributes { diff --git a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceHeader.tsx b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceHeader.tsx index f357f941..1af35f01 100644 --- a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceHeader.tsx +++ b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceHeader.tsx @@ -8,8 +8,8 @@ import { ServerIcon, } from "@heroicons/react/24/outline"; import { format } from "date-fns"; -import type { Invoice } from "@customer-portal/domain"; -import { formatCurrency } from "@customer-portal/domain"; +import type { Invoice } from "@customer-portal/domain/billing"; +import { formatCurrency } from "@customer-portal/domain/billing"; const formatDate = (dateString?: string) => { if (!dateString || dateString === "0000-00-00" || dateString === "0000-00-00 00:00:00") diff --git a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceItems.tsx b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceItems.tsx index b70e31b6..7ca7116b 100644 --- a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceItems.tsx +++ b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceItems.tsx @@ -2,8 +2,8 @@ import React from "react"; import Link from "next/link"; -import { formatCurrency } from "@customer-portal/domain"; -import type { InvoiceItem } from "@customer-portal/domain"; +import { formatCurrency } from "@customer-portal/domain/billing"; +import type { InvoiceItem } from "@customer-portal/domain/billing"; interface InvoiceItemsProps { items?: InvoiceItem[]; diff --git a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceSummaryBar.tsx b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceSummaryBar.tsx index c2fc79a3..ddf88041 100644 --- a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceSummaryBar.tsx +++ b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceSummaryBar.tsx @@ -1,8 +1,8 @@ import { useMemo } from "react"; import { format, formatDistanceToNowStrict } from "date-fns"; import { ArrowDownTrayIcon, ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; -import type { Invoice } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; +import type { Invoice } from "@customer-portal/domain/billing"; import { Button } from "@/components/atoms/button"; import { StatusPill } from "@/components/atoms/status-pill"; import { cn } from "@/lib/utils"; diff --git a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceTotals.tsx b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceTotals.tsx index 75dcc535..ea705c39 100644 --- a/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceTotals.tsx +++ b/apps/portal/src/features/billing/components/InvoiceDetail/InvoiceTotals.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; -import { formatCurrency } from "@customer-portal/domain"; +import { formatCurrency } from "@customer-portal/domain/billing"; interface InvoiceTotalsProps { subtotal: number; diff --git a/apps/portal/src/features/billing/components/InvoiceItemRow.tsx b/apps/portal/src/features/billing/components/InvoiceItemRow.tsx index def13112..ec37988b 100644 --- a/apps/portal/src/features/billing/components/InvoiceItemRow.tsx +++ b/apps/portal/src/features/billing/components/InvoiceItemRow.tsx @@ -1,5 +1,5 @@ "use client"; -import { formatCurrency } from "@customer-portal/domain"; +import { formatCurrency } from "@customer-portal/domain/billing"; import { useRouter } from "next/navigation"; export function InvoiceItemRow({ diff --git a/apps/portal/src/features/billing/components/InvoiceList/InvoiceList.tsx b/apps/portal/src/features/billing/components/InvoiceList/InvoiceList.tsx index 69139d38..89ac21d7 100644 --- a/apps/portal/src/features/billing/components/InvoiceList/InvoiceList.tsx +++ b/apps/portal/src/features/billing/components/InvoiceList/InvoiceList.tsx @@ -9,7 +9,7 @@ import { PaginationBar } from "@/components/molecules/PaginationBar/PaginationBa import { InvoiceTable } from "@/features/billing/components/InvoiceTable/InvoiceTable"; import { useInvoices } from "@/features/billing/hooks/useBilling"; import { useSubscriptionInvoices } from "@/features/subscriptions/hooks/useSubscriptions"; -import type { Invoice } from "@customer-portal/domain"; +import type { Invoice } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; interface InvoicesListProps { diff --git a/apps/portal/src/features/billing/components/InvoiceTable/InvoiceTable.tsx b/apps/portal/src/features/billing/components/InvoiceTable/InvoiceTable.tsx index 54ed2d63..9294ea5a 100644 --- a/apps/portal/src/features/billing/components/InvoiceTable/InvoiceTable.tsx +++ b/apps/portal/src/features/billing/components/InvoiceTable/InvoiceTable.tsx @@ -16,8 +16,8 @@ import { CheckCircleIcon as CheckCircleIconSolid } from "@heroicons/react/24/sol import { DataTable } from "@/components/molecules/DataTable/DataTable"; import { Button } from "@/components/atoms/button"; import { BillingStatusBadge } from "../BillingStatusBadge"; -import type { Invoice } from "@customer-portal/domain"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; +import type { Invoice } from "@customer-portal/domain/billing"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; import { useCreateInvoiceSsoLink } from "@/features/billing/hooks/useBilling"; import { openSsoLink } from "@/features/billing/utils/sso"; diff --git a/apps/portal/src/features/billing/components/PaymentMethodCard.tsx b/apps/portal/src/features/billing/components/PaymentMethodCard.tsx index 2e4ed9d7..d24d5451 100644 --- a/apps/portal/src/features/billing/components/PaymentMethodCard.tsx +++ b/apps/portal/src/features/billing/components/PaymentMethodCard.tsx @@ -1,7 +1,7 @@ "use client"; import { CreditCardIcon, BanknotesIcon, DevicePhoneMobileIcon, CheckCircleIcon } from "@heroicons/react/24/outline"; -import type { PaymentMethod } from "@customer-portal/domain"; +import type { PaymentMethod } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; import type { ReactNode } from "react"; diff --git a/apps/portal/src/features/billing/components/PaymentMethodCard/PaymentMethodCard.tsx b/apps/portal/src/features/billing/components/PaymentMethodCard/PaymentMethodCard.tsx index 431e79cf..26f1f9dc 100644 --- a/apps/portal/src/features/billing/components/PaymentMethodCard/PaymentMethodCard.tsx +++ b/apps/portal/src/features/billing/components/PaymentMethodCard/PaymentMethodCard.tsx @@ -9,7 +9,7 @@ import { ArrowPathIcon, } from "@heroicons/react/24/outline"; import { Badge } from "@/components/atoms/badge"; -import type { PaymentMethod } from "@customer-portal/domain"; +import type { PaymentMethod } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; interface PaymentMethodCardProps extends React.HTMLAttributes { diff --git a/apps/portal/src/features/billing/hooks/useBilling.ts b/apps/portal/src/features/billing/hooks/useBilling.ts index 1602e3f9..c0b7ee63 100644 --- a/apps/portal/src/features/billing/hooks/useBilling.ts +++ b/apps/portal/src/features/billing/hooks/useBilling.ts @@ -16,12 +16,12 @@ import type { InvoiceList, InvoiceSsoLink, PaymentMethodList, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { invoiceListSchema, invoiceSchema as sharedInvoiceSchema, } from "@customer-portal/domain/validation/shared/entities"; -import { INVOICE_STATUS } from "@customer-portal/domain"; +import { INVOICE_STATUS } from "@customer-portal/domain/billing"; const emptyInvoiceList: InvoiceList = { invoices: [], diff --git a/apps/portal/src/features/billing/views/InvoiceDetail.tsx b/apps/portal/src/features/billing/views/InvoiceDetail.tsx index a6404b3a..39a4eba1 100644 --- a/apps/portal/src/features/billing/views/InvoiceDetail.tsx +++ b/apps/portal/src/features/billing/views/InvoiceDetail.tsx @@ -11,7 +11,7 @@ import { logger } from "@customer-portal/logging"; import { apiClient, getDataOrThrow } from "@/lib/api"; import { openSsoLink } from "@/features/billing/utils/sso"; import { useInvoice, useCreateInvoiceSsoLink } from "@/features/billing/hooks"; -import type { InvoiceSsoLink } from "@customer-portal/domain"; +import type { InvoiceSsoLink } from "@customer-portal/domain/billing"; import { InvoiceItems, InvoiceTotals, diff --git a/apps/portal/src/features/catalog/components/base/AddonGroup.tsx b/apps/portal/src/features/catalog/components/base/AddonGroup.tsx index 487a095f..4499537b 100644 --- a/apps/portal/src/features/catalog/components/base/AddonGroup.tsx +++ b/apps/portal/src/features/catalog/components/base/AddonGroup.tsx @@ -1,7 +1,7 @@ "use client"; import { CheckCircleIcon } from "@heroicons/react/24/solid"; -import type { CatalogProductBase } from "@customer-portal/domain"; +import type { CatalogProductBase } from "@customer-portal/domain/billing"; import { getMonthlyPrice, getOneTimePrice } from "../../utils/pricing"; interface AddonGroupProps { diff --git a/apps/portal/src/features/catalog/components/base/AddressConfirmation.tsx b/apps/portal/src/features/catalog/components/base/AddressConfirmation.tsx index d70244a3..05a8d5f6 100644 --- a/apps/portal/src/features/catalog/components/base/AddressConfirmation.tsx +++ b/apps/portal/src/features/catalog/components/base/AddressConfirmation.tsx @@ -18,7 +18,7 @@ import { } from "@heroicons/react/24/outline"; // Use canonical Address type from domain -import type { Address } from "@customer-portal/domain"; +import type { Address } from "@customer-portal/domain/billing"; interface BillingInfo { company: string | null; diff --git a/apps/portal/src/features/catalog/components/base/AddressForm.tsx b/apps/portal/src/features/catalog/components/base/AddressForm.tsx index c3f42695..249fc2f4 100644 --- a/apps/portal/src/features/catalog/components/base/AddressForm.tsx +++ b/apps/portal/src/features/catalog/components/base/AddressForm.tsx @@ -3,7 +3,7 @@ import { useEffect } from "react"; import { MapPinIcon, ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { useZodForm } from "@customer-portal/validation"; -import { addressFormSchema, type AddressFormData, type Address } from "@customer-portal/domain"; +import { addressFormSchema, type AddressFormData, type Address } from "@customer-portal/domain/billing"; export interface AddressFormProps { // Initial values diff --git a/apps/portal/src/features/catalog/components/base/EnhancedOrderSummary.tsx b/apps/portal/src/features/catalog/components/base/EnhancedOrderSummary.tsx index 09e658ed..43424024 100644 --- a/apps/portal/src/features/catalog/components/base/EnhancedOrderSummary.tsx +++ b/apps/portal/src/features/catalog/components/base/EnhancedOrderSummary.tsx @@ -12,7 +12,7 @@ import { Button } from "@/components/atoms/button"; import { useRouter } from "next/navigation"; // Align with shared catalog contracts -import type { CatalogProductBase } from "@customer-portal/domain"; +import type { CatalogProductBase } from "@customer-portal/domain/billing"; // Enhanced order item representation for UI summary export type OrderItem = CatalogProductBase & { diff --git a/apps/portal/src/features/catalog/components/base/OrderSummary.tsx b/apps/portal/src/features/catalog/components/base/OrderSummary.tsx index 731b8796..14e36ddc 100644 --- a/apps/portal/src/features/catalog/components/base/OrderSummary.tsx +++ b/apps/portal/src/features/catalog/components/base/OrderSummary.tsx @@ -1,5 +1,5 @@ import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; -import type { CatalogProductBase } from "@customer-portal/domain"; +import type { CatalogProductBase } from "@customer-portal/domain/billing"; import { useRouter } from "next/navigation"; import { Button } from "@/components/atoms/button"; import { getMonthlyPrice, getOneTimePrice } from "../../utils/pricing"; diff --git a/apps/portal/src/features/catalog/components/base/PaymentForm.tsx b/apps/portal/src/features/catalog/components/base/PaymentForm.tsx index ee313072..cb011f0a 100644 --- a/apps/portal/src/features/catalog/components/base/PaymentForm.tsx +++ b/apps/portal/src/features/catalog/components/base/PaymentForm.tsx @@ -5,7 +5,7 @@ import { Skeleton } from "@/components/atoms/loading-skeleton"; import { Button } from "@/components/atoms/button"; import { AlertBanner } from "@/components/molecules/AlertBanner/AlertBanner"; import { CreditCardIcon, CheckCircleIcon } from "@heroicons/react/24/outline"; -import type { PaymentMethod } from "@customer-portal/domain"; +import type { PaymentMethod } from "@customer-portal/domain/billing"; export interface PaymentFormProps { existingMethods?: PaymentMethod[]; diff --git a/apps/portal/src/features/catalog/components/internet/InstallationOptions.tsx b/apps/portal/src/features/catalog/components/internet/InstallationOptions.tsx index 664bc8e5..3676e769 100644 --- a/apps/portal/src/features/catalog/components/internet/InstallationOptions.tsx +++ b/apps/portal/src/features/catalog/components/internet/InstallationOptions.tsx @@ -1,6 +1,6 @@ "use client"; -import type { InternetInstallationCatalogItem } from "@customer-portal/domain"; +import type { InternetInstallationCatalogItem } from "@customer-portal/domain/billing"; import { getDisplayPrice } from "../../utils/pricing"; import { inferInstallationTypeFromSku, diff --git a/apps/portal/src/features/catalog/components/internet/InternetConfigureView.tsx b/apps/portal/src/features/catalog/components/internet/InternetConfigureView.tsx index 7b9efde0..26c3f5cb 100644 --- a/apps/portal/src/features/catalog/components/internet/InternetConfigureView.tsx +++ b/apps/portal/src/features/catalog/components/internet/InternetConfigureView.tsx @@ -5,7 +5,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; interface Props { plan: InternetPlanCatalogItem | null; diff --git a/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx b/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx index 97a30166..e8f6bcdd 100644 --- a/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx +++ b/apps/portal/src/features/catalog/components/internet/InternetPlanCard.tsx @@ -6,7 +6,7 @@ import { CurrencyYenIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { useRouter } from "next/navigation"; import { getMonthlyPrice, getOneTimePrice } from "../../utils/pricing"; diff --git a/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx b/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx index bafda7a0..34c43e97 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/InternetConfigureContainer.tsx @@ -7,7 +7,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { ConfigureLoadingSkeleton } from "./components/ConfigureLoadingSkeleton"; import { ServiceConfigurationStep } from "./steps/ServiceConfigurationStep"; import { InstallationStep } from "./steps/InstallationStep"; diff --git a/apps/portal/src/features/catalog/components/internet/configure/hooks/useConfigureState.ts b/apps/portal/src/features/catalog/components/internet/configure/hooks/useConfigureState.ts index b5a70987..0124a941 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/hooks/useConfigureState.ts +++ b/apps/portal/src/features/catalog/components/internet/configure/hooks/useConfigureState.ts @@ -5,7 +5,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import type { AccessMode } from "../../../../hooks/useConfigureParams"; import { getMonthlyPrice, getOneTimePrice } from "../../../../utils/pricing"; diff --git a/apps/portal/src/features/catalog/components/internet/configure/steps/AddonsStep.tsx b/apps/portal/src/features/catalog/components/internet/configure/steps/AddonsStep.tsx index d22ca15d..f931235c 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/steps/AddonsStep.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/steps/AddonsStep.tsx @@ -5,7 +5,7 @@ import { Button } from "@/components/atoms/button"; import { StepHeader } from "@/components/atoms"; import { AddonGroup } from "@/features/catalog/components/base/AddonGroup"; import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; -import type { InternetAddonCatalogItem } from "@customer-portal/domain"; +import type { InternetAddonCatalogItem } from "@customer-portal/domain/billing"; interface Props { addons: InternetAddonCatalogItem[]; diff --git a/apps/portal/src/features/catalog/components/internet/configure/steps/InstallationStep.tsx b/apps/portal/src/features/catalog/components/internet/configure/steps/InstallationStep.tsx index 312ed846..3803964d 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/steps/InstallationStep.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/steps/InstallationStep.tsx @@ -5,7 +5,7 @@ import { Button } from "@/components/atoms/button"; import { StepHeader } from "@/components/atoms"; import { InstallationOptions } from "../../InstallationOptions"; import { ArrowLeftIcon, ArrowRightIcon } from "@heroicons/react/24/outline"; -import type { InternetInstallationCatalogItem } from "@customer-portal/domain"; +import type { InternetInstallationCatalogItem } from "@customer-portal/domain/billing"; interface Props { installations: InternetInstallationCatalogItem[]; diff --git a/apps/portal/src/features/catalog/components/internet/configure/steps/ReviewOrderStep.tsx b/apps/portal/src/features/catalog/components/internet/configure/steps/ReviewOrderStep.tsx index 33b75eb0..1e3b03b1 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/steps/ReviewOrderStep.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/steps/ReviewOrderStep.tsx @@ -8,7 +8,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import type { AccessMode } from "../../../../hooks/useConfigureParams"; import { getMonthlyPrice, getOneTimePrice } from "../../../../utils/pricing"; diff --git a/apps/portal/src/features/catalog/components/internet/configure/steps/ServiceConfigurationStep.tsx b/apps/portal/src/features/catalog/components/internet/configure/steps/ServiceConfigurationStep.tsx index 134e4601..5f39aa62 100644 --- a/apps/portal/src/features/catalog/components/internet/configure/steps/ServiceConfigurationStep.tsx +++ b/apps/portal/src/features/catalog/components/internet/configure/steps/ServiceConfigurationStep.tsx @@ -5,7 +5,7 @@ import { Button } from "@/components/atoms/button"; import { StepHeader } from "@/components/atoms"; import { AlertBanner } from "@/components/molecules/AlertBanner/AlertBanner"; import { ArrowRightIcon } from "@heroicons/react/24/outline"; -import type { InternetPlanCatalogItem } from "@customer-portal/domain"; +import type { InternetPlanCatalogItem } from "@customer-portal/domain/billing"; import type { AccessMode } from "../../../../hooks/useConfigureParams"; interface Props { diff --git a/apps/portal/src/features/catalog/components/sim/SimPlanCard.tsx b/apps/portal/src/features/catalog/components/sim/SimPlanCard.tsx index f0d6f0c7..069f3f0f 100644 --- a/apps/portal/src/features/catalog/components/sim/SimPlanCard.tsx +++ b/apps/portal/src/features/catalog/components/sim/SimPlanCard.tsx @@ -3,7 +3,7 @@ import { DevicePhoneMobileIcon, UsersIcon, CurrencyYenIcon } from "@heroicons/react/24/outline"; import { AnimatedCard } from "@/components/molecules/AnimatedCard/AnimatedCard"; import { Button } from "@/components/atoms/button"; -import type { SimCatalogProduct } from "@customer-portal/domain"; +import type { SimCatalogProduct } from "@customer-portal/domain/billing"; import { getMonthlyPrice } from "../../utils/pricing"; interface SimPlanCardProps { diff --git a/apps/portal/src/features/catalog/components/sim/SimPlanTypeSection.tsx b/apps/portal/src/features/catalog/components/sim/SimPlanTypeSection.tsx index 04348f14..1260707b 100644 --- a/apps/portal/src/features/catalog/components/sim/SimPlanTypeSection.tsx +++ b/apps/portal/src/features/catalog/components/sim/SimPlanTypeSection.tsx @@ -2,7 +2,7 @@ import React from "react"; import { UsersIcon } from "@heroicons/react/24/outline"; -import type { SimCatalogProduct } from "@customer-portal/domain"; +import type { SimCatalogProduct } from "@customer-portal/domain/billing"; import { SimPlanCard } from "./SimPlanCard"; interface SimPlanTypeSectionProps { diff --git a/apps/portal/src/features/catalog/components/vpn/VpnPlanCard.tsx b/apps/portal/src/features/catalog/components/vpn/VpnPlanCard.tsx index 643388a1..21190b7a 100644 --- a/apps/portal/src/features/catalog/components/vpn/VpnPlanCard.tsx +++ b/apps/portal/src/features/catalog/components/vpn/VpnPlanCard.tsx @@ -3,7 +3,7 @@ import { AnimatedCard } from "@/components/molecules"; import { Button } from "@/components/atoms/button"; import { CurrencyYenIcon } from "@heroicons/react/24/outline"; -import type { VpnCatalogProduct } from "@customer-portal/domain"; +import type { VpnCatalogProduct } from "@customer-portal/domain/billing"; interface VpnPlanCardProps { plan: VpnCatalogProduct; diff --git a/apps/portal/src/features/catalog/hooks/useInternetConfigure.ts b/apps/portal/src/features/catalog/hooks/useInternetConfigure.ts index d987f2e3..0f99d8c4 100644 --- a/apps/portal/src/features/catalog/hooks/useInternetConfigure.ts +++ b/apps/portal/src/features/catalog/hooks/useInternetConfigure.ts @@ -7,7 +7,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { inferInstallationTypeFromSku } from "../utils/inferInstallationType"; import { getMonthlyPrice, getOneTimePrice } from "../utils/pricing"; diff --git a/apps/portal/src/features/catalog/hooks/useSimConfigure.ts b/apps/portal/src/features/catalog/hooks/useSimConfigure.ts index 3216c275..19465ba7 100644 --- a/apps/portal/src/features/catalog/hooks/useSimConfigure.ts +++ b/apps/portal/src/features/catalog/hooks/useSimConfigure.ts @@ -11,8 +11,8 @@ import { type SimType, type ActivationType, type MnpData, -} from "@customer-portal/domain"; -import type { SimCatalogProduct, SimActivationFeeCatalogItem } from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; +import type { SimCatalogProduct, SimActivationFeeCatalogItem } from "@customer-portal/domain/billing"; export type UseSimConfigureResult = { // data diff --git a/apps/portal/src/features/catalog/index.ts b/apps/portal/src/features/catalog/index.ts index 46f5d522..21b163f0 100644 --- a/apps/portal/src/features/catalog/index.ts +++ b/apps/portal/src/features/catalog/index.ts @@ -12,7 +12,7 @@ export * from "./hooks"; // Services export * from "./services"; -// Import domain types directly: import type { Address } from "@customer-portal/domain"; +// Import domain types directly: import type { Address } from "@customer-portal/domain/billing"; // Utilities export * from "./utils"; diff --git a/apps/portal/src/features/catalog/services/catalog.service.ts b/apps/portal/src/features/catalog/services/catalog.service.ts index 8f7d34c1..3b803e7b 100644 --- a/apps/portal/src/features/catalog/services/catalog.service.ts +++ b/apps/portal/src/features/catalog/services/catalog.service.ts @@ -6,7 +6,7 @@ import type { SimCatalogProduct, SimActivationFeeCatalogItem, VpnCatalogProduct, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; const emptyInternetPlans: InternetPlanCatalogItem[] = []; const emptyInternetAddons: InternetAddonCatalogItem[] = []; diff --git a/apps/portal/src/features/catalog/utils/catalog.utils.ts b/apps/portal/src/features/catalog/utils/catalog.utils.ts index 5a70ab8f..4cf97c44 100644 --- a/apps/portal/src/features/catalog/utils/catalog.utils.ts +++ b/apps/portal/src/features/catalog/utils/catalog.utils.ts @@ -3,7 +3,7 @@ * Helper functions for catalog operations */ -import { formatCurrency } from "@customer-portal/domain"; +import { formatCurrency } from "@customer-portal/domain/billing"; import type { CatalogFilter, InternetPlanCatalogItem, @@ -11,7 +11,7 @@ import type { InternetInstallationCatalogItem, SimCatalogProduct, VpnCatalogProduct, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; type CatalogProduct = | InternetPlanCatalogItem diff --git a/apps/portal/src/features/catalog/utils/pricing.ts b/apps/portal/src/features/catalog/utils/pricing.ts index c244c279..96663b2f 100644 --- a/apps/portal/src/features/catalog/utils/pricing.ts +++ b/apps/portal/src/features/catalog/utils/pricing.ts @@ -1,4 +1,4 @@ -import type { CatalogProductBase } from "@customer-portal/domain"; +import type { CatalogProductBase } from "@customer-portal/domain/billing"; export function getMonthlyPrice(product?: CatalogProductBase | null): number { if (!product) return 0; diff --git a/apps/portal/src/features/catalog/views/InternetPlans.tsx b/apps/portal/src/features/catalog/views/InternetPlans.tsx index 55671812..514bd29f 100644 --- a/apps/portal/src/features/catalog/views/InternetPlans.tsx +++ b/apps/portal/src/features/catalog/views/InternetPlans.tsx @@ -17,7 +17,7 @@ import type { InternetPlanCatalogItem, InternetInstallationCatalogItem, InternetAddonCatalogItem, -} from "@customer-portal/domain"; +} from "@customer-portal/domain/billing"; import { getMonthlyPrice } from "../utils/pricing"; import { LoadingCard, Skeleton, LoadingTable } from "@/components/atoms/loading-skeleton"; import { AnimatedCard } from "@/components/molecules"; diff --git a/apps/portal/src/features/catalog/views/SimPlans.tsx b/apps/portal/src/features/catalog/views/SimPlans.tsx index f5e5e537..553b128b 100644 --- a/apps/portal/src/features/catalog/views/SimPlans.tsx +++ b/apps/portal/src/features/catalog/views/SimPlans.tsx @@ -15,7 +15,7 @@ import { LoadingCard, Skeleton } from "@/components/atoms/loading-skeleton"; import { Button } from "@/components/atoms/button"; import { AlertBanner } from "@/components/molecules/AlertBanner/AlertBanner"; import { useSimCatalog } from "@/features/catalog/hooks"; -import type { SimCatalogProduct } from "@customer-portal/domain"; +import type { SimCatalogProduct } from "@customer-portal/domain/billing"; import { SimPlanTypeSection } from "@/features/catalog/components/sim/SimPlanTypeSection"; interface PlansByType { diff --git a/apps/portal/src/features/checkout/hooks/useCheckout.ts b/apps/portal/src/features/checkout/hooks/useCheckout.ts index b670a4a5..98946077 100644 --- a/apps/portal/src/features/checkout/hooks/useCheckout.ts +++ b/apps/portal/src/features/checkout/hooks/useCheckout.ts @@ -7,13 +7,13 @@ import { ordersService } from "@/features/orders/services/orders.service"; import { usePaymentMethods } from "@/features/billing/hooks/useBilling"; import { usePaymentRefresh } from "@/features/billing/hooks/usePaymentRefresh"; import { getMonthlyPrice, getOneTimePrice } from "@/features/catalog/utils/pricing"; -import type { CatalogProductBase } from "@customer-portal/domain"; -import { createLoadingState, createSuccessState, createErrorState } from "@customer-portal/domain"; -import type { AsyncState } from "@customer-portal/domain"; +import type { CatalogProductBase } from "@customer-portal/domain/billing"; +import { createLoadingState, createSuccessState, createErrorState } from "@customer-portal/domain/billing"; +import type { AsyncState } from "@customer-portal/domain/billing"; import { useActiveSubscriptions } from "@/features/subscriptions/hooks/useSubscriptions"; // Use domain Address type -import type { Address } from "@customer-portal/domain"; +import type { Address } from "@customer-portal/domain/billing"; type CheckoutItemType = "plan" | "installation" | "addon" | "activation" | "vpn"; diff --git a/apps/portal/src/features/checkout/views/CheckoutContainer.tsx b/apps/portal/src/features/checkout/views/CheckoutContainer.tsx index dc73789e..bb71975f 100644 --- a/apps/portal/src/features/checkout/views/CheckoutContainer.tsx +++ b/apps/portal/src/features/checkout/views/CheckoutContainer.tsx @@ -8,7 +8,7 @@ import { PageAsync } from "@/components/molecules/AsyncBlock/AsyncBlock"; import { InlineToast } from "@/components/atoms/inline-toast"; import { StatusPill } from "@/components/atoms/status-pill"; import { AddressConfirmation } from "@/features/catalog/components/base/AddressConfirmation"; -import { isLoading, isError, isSuccess } from "@customer-portal/domain"; +import { isLoading, isError, isSuccess } from "@customer-portal/domain/billing"; import { ExclamationTriangleIcon, ShieldCheckIcon, diff --git a/apps/portal/src/features/dashboard/components/ActivityFeed.tsx b/apps/portal/src/features/dashboard/components/ActivityFeed.tsx index 9dba0377..4ecf6fdc 100644 --- a/apps/portal/src/features/dashboard/components/ActivityFeed.tsx +++ b/apps/portal/src/features/dashboard/components/ActivityFeed.tsx @@ -10,8 +10,8 @@ import { getActivityNavigationPath, isActivityClickable, } from "../utils/dashboard.utils"; -import type { Activity } from "@customer-portal/domain"; -import type { ActivityFilter } from "@customer-portal/domain"; +import type { Activity } from "@customer-portal/domain/billing"; +import type { ActivityFilter } from "@customer-portal/domain/billing"; export interface ActivityFeedProps { activities: Activity[]; diff --git a/apps/portal/src/features/dashboard/components/UpcomingPaymentBanner.tsx b/apps/portal/src/features/dashboard/components/UpcomingPaymentBanner.tsx index 2c53b91c..ab3f0079 100644 --- a/apps/portal/src/features/dashboard/components/UpcomingPaymentBanner.tsx +++ b/apps/portal/src/features/dashboard/components/UpcomingPaymentBanner.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { CalendarDaysIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; import { format, formatDistanceToNow } from "date-fns"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; interface UpcomingPaymentBannerProps { invoice: { id: number; amount: number; currency?: string; dueDate: string }; diff --git a/apps/portal/src/features/dashboard/hooks/useDashboardSummary.ts b/apps/portal/src/features/dashboard/hooks/useDashboardSummary.ts index fccc0f44..0e01ac78 100644 --- a/apps/portal/src/features/dashboard/hooks/useDashboardSummary.ts +++ b/apps/portal/src/features/dashboard/hooks/useDashboardSummary.ts @@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query"; import { useAuthSession } from "@/features/auth/services/auth.store"; import { apiClient, queryKeys, getDataOrThrow } from "@/lib/api"; -import type { DashboardSummary, DashboardError } from "@customer-portal/domain"; +import type { DashboardSummary, DashboardError } from "@customer-portal/domain/billing"; class DashboardDataError extends Error { constructor( diff --git a/apps/portal/src/features/dashboard/utils/dashboard.utils.ts b/apps/portal/src/features/dashboard/utils/dashboard.utils.ts index f2b83bd7..5f0e0e47 100644 --- a/apps/portal/src/features/dashboard/utils/dashboard.utils.ts +++ b/apps/portal/src/features/dashboard/utils/dashboard.utils.ts @@ -3,8 +3,8 @@ * Helper functions for dashboard data processing and formatting */ -import type { Activity } from "@customer-portal/domain"; -import type { ActivityFilter, ActivityFilterConfig } from "@customer-portal/domain"; +import type { Activity } from "@customer-portal/domain/billing"; +import type { ActivityFilter, ActivityFilterConfig } from "@customer-portal/domain/billing"; /** * Activity filter configurations diff --git a/apps/portal/src/features/dashboard/views/DashboardView.tsx b/apps/portal/src/features/dashboard/views/DashboardView.tsx index 8203c862..0aee83ae 100644 --- a/apps/portal/src/features/dashboard/views/DashboardView.tsx +++ b/apps/portal/src/features/dashboard/views/DashboardView.tsx @@ -3,7 +3,7 @@ import { useState, useEffect } from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; -import type { Activity, DashboardSummary } from "@customer-portal/domain"; +import type { Activity, DashboardSummary } from "@customer-portal/domain/billing"; import { ServerIcon, ChatBubbleLeftRightIcon, @@ -25,7 +25,7 @@ import { useDashboardSummary } from "@/features/dashboard/hooks"; import { StatCard, QuickAction, DashboardActivityItem } from "@/features/dashboard/components"; import { LoadingStats, LoadingTable } from "@/components/atoms"; import { ErrorState } from "@/components/atoms/error-state"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; import { log } from "@customer-portal/logging"; import { useCreateInvoiceSsoLink } from "@/features/billing/hooks/useBilling"; diff --git a/apps/portal/src/features/orders/services/orders.service.ts b/apps/portal/src/features/orders/services/orders.service.ts index 18b0775d..12f76d7d 100644 --- a/apps/portal/src/features/orders/services/orders.service.ts +++ b/apps/portal/src/features/orders/services/orders.service.ts @@ -1,5 +1,5 @@ import { apiClient } from "@/lib/api"; -import type { CreateOrderRequest } from "@customer-portal/domain"; +import type { CreateOrderRequest } from "@customer-portal/domain/billing"; async function createOrder(payload: CreateOrderRequest): Promise { const response = await apiClient.POST("/api/orders", { body: payload }); diff --git a/apps/portal/src/features/sim-management/components/SimDetailsCard.tsx b/apps/portal/src/features/sim-management/components/SimDetailsCard.tsx index c688ddad..64a39bcd 100644 --- a/apps/portal/src/features/sim-management/components/SimDetailsCard.tsx +++ b/apps/portal/src/features/sim-management/components/SimDetailsCard.tsx @@ -11,7 +11,7 @@ import { ExclamationTriangleIcon, XCircleIcon, } from "@heroicons/react/24/outline"; -import type { SimDetails } from "@customer-portal/contracts/sim"; +import type { SimDetails } from "@customer-portal/domain/sim"; interface SimDetailsCardProps { simDetails: SimDetails; diff --git a/apps/portal/src/features/subscriptions/components/SubscriptionCard.tsx b/apps/portal/src/features/subscriptions/components/SubscriptionCard.tsx index 2320525c..4ade0659 100644 --- a/apps/portal/src/features/subscriptions/components/SubscriptionCard.tsx +++ b/apps/portal/src/features/subscriptions/components/SubscriptionCard.tsx @@ -15,8 +15,8 @@ import { import { StatusPill } from "@/components/atoms/status-pill"; import { Button } from "@/components/atoms/button"; import { SubCard } from "@/components/molecules/SubCard/SubCard"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; -import type { Subscription } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; +import type { Subscription } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; interface SubscriptionCardProps { diff --git a/apps/portal/src/features/subscriptions/components/SubscriptionDetails.tsx b/apps/portal/src/features/subscriptions/components/SubscriptionDetails.tsx index a7def57c..7d0de946 100644 --- a/apps/portal/src/features/subscriptions/components/SubscriptionDetails.tsx +++ b/apps/portal/src/features/subscriptions/components/SubscriptionDetails.tsx @@ -15,8 +15,8 @@ import { } from "@heroicons/react/24/outline"; import { StatusPill } from "@/components/atoms/status-pill"; import { SubCard } from "@/components/molecules/SubCard/SubCard"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; -import type { Subscription } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; +import type { Subscription } from "@customer-portal/domain/billing"; import { cn } from "@/lib/utils"; interface SubscriptionDetailsProps { diff --git a/apps/portal/src/features/subscriptions/hooks/useSubscriptions.ts b/apps/portal/src/features/subscriptions/hooks/useSubscriptions.ts index 64c679a8..a5219a23 100644 --- a/apps/portal/src/features/subscriptions/hooks/useSubscriptions.ts +++ b/apps/portal/src/features/subscriptions/hooks/useSubscriptions.ts @@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query"; import { apiClient, queryKeys, getDataOrDefault, getDataOrThrow, getNullableData } from "@/lib/api"; import { useAuthSession } from "@/features/auth/services"; -import type { InvoiceList, Subscription, SubscriptionList } from "@customer-portal/domain"; +import type { InvoiceList, Subscription, SubscriptionList } from "@customer-portal/domain/billing"; interface UseSubscriptionsOptions { status?: string; diff --git a/apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx b/apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx index 6d0c1ce5..b5fa37de 100644 --- a/apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx +++ b/apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx @@ -20,7 +20,7 @@ import { import { format } from "date-fns"; import { useSubscription } from "@/features/subscriptions/hooks"; import { InvoicesList } from "@/features/billing/components/InvoiceList/InvoiceList"; -import { formatCurrency as sharedFormatCurrency, getCurrencyLocale } from "@customer-portal/domain"; +import { formatCurrency as sharedFormatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; import { SimManagementSection } from "@/features/sim-management"; export function SubscriptionDetailContainer() { diff --git a/apps/portal/src/features/subscriptions/views/SubscriptionsList.tsx b/apps/portal/src/features/subscriptions/views/SubscriptionsList.tsx index 533dfb90..73a88608 100644 --- a/apps/portal/src/features/subscriptions/views/SubscriptionsList.tsx +++ b/apps/portal/src/features/subscriptions/views/SubscriptionsList.tsx @@ -23,8 +23,8 @@ import { } from "@heroicons/react/24/outline"; import { format } from "date-fns"; import { useSubscriptions, useSubscriptionStats } from "@/features/subscriptions/hooks"; -import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain"; -import type { Subscription } from "@customer-portal/domain"; +import { formatCurrency, getCurrencyLocale } from "@customer-portal/domain/billing"; +import type { Subscription } from "@customer-portal/domain/billing"; export function SubscriptionsListContainer() { const router = useRouter(); diff --git a/packages/domain/auth/schema.ts b/packages/domain/auth/schema.ts index 47c93cc8..7775a823 100644 --- a/packages/domain/auth/schema.ts +++ b/packages/domain/auth/schema.ts @@ -91,12 +91,4 @@ export const authResponseSchema = z.object({ tokens: authTokensSchema, }); -export const validateSignupRequestSchema = signupRequestSchema.pick({ sfNumber: true }); -export const accountStatusRequestSchema = z.object({ email: emailSchema }); -export const ssoLinkRequestSchema = z.object({ destination: z.string().optional() }); -export const checkPasswordNeededRequestSchema = z.object({ email: emailSchema }); -export const refreshTokenRequestSchema = z.object({ - refreshToken: z.string().min(1, "Refresh token is required").optional(), - deviceId: z.string().optional(), -}); diff --git a/packages/domain/sim/providers/freebit/index.ts b/packages/domain/sim/providers/freebit/index.ts index 191ad6ec..0c17e26b 100644 --- a/packages/domain/sim/providers/freebit/index.ts +++ b/packages/domain/sim/providers/freebit/index.ts @@ -39,6 +39,14 @@ export type CancelPlanRequest = Requests.FreebitCancelPlanRequest; export type CancelPlanApiRequest = Requests.FreebitCancelPlanApiRequest; export type CancelAccountRequest = Requests.FreebitCancelAccountRequest; export type AuthRequest = Requests.FreebitAuthRequest; +export type TopUpResponse = ReturnType; +export type AddSpecResponse = ReturnType; +export type PlanChangeResponse = ReturnType; +export type CancelPlanResponse = ReturnType; +export type CancelAccountResponse = ReturnType; +export type EsimReissueResponse = ReturnType; +export type EsimAddAccountResponse = ReturnType; +export type EsimActivationResponse = ReturnType; export * from "./mapper"; export * from "./raw.types"; diff --git a/packages/domain/sim/providers/freebit/mapper.ts b/packages/domain/sim/providers/freebit/mapper.ts index 7387bb1a..5e14083c 100644 --- a/packages/domain/sim/providers/freebit/mapper.ts +++ b/packages/domain/sim/providers/freebit/mapper.ts @@ -125,16 +125,12 @@ export function transformFreebitTrafficInfo(raw: unknown): SimUsage { const simUsage: SimUsage = { account: asString(response.account), - todayUsageMb: asNumber(response.todayData) / 1024, - todayUsageKb: asNumber(response.todayData), - monthlyUsageMb: response.thisMonthData ? asNumber(response.thisMonthData) / 1024 : undefined, - monthlyUsageKb: response.thisMonthData ? asNumber(response.thisMonthData) : undefined, - recentDaysUsage: (response.daily || []).map(day => ({ - date: day.usageDate || "", - usageKb: asNumber(day.trafficKb), - usageMb: asNumber(day.trafficKb) / 1024, - })), - isBlacklisted: parseBooleanFlag(response.blacklistFlg), + todayUsageMb: response.traffic?.today ? asNumber(response.traffic.today) / 1024 : 0, + todayUsageKb: response.traffic?.today ? asNumber(response.traffic.today) : 0, + monthlyUsageMb: undefined, + monthlyUsageKb: undefined, + recentDaysUsage: [], + isBlacklisted: parseBooleanFlag(response.traffic?.blackList), lastUpdated: new Date().toISOString(), }; @@ -146,9 +142,9 @@ export function transformFreebitQuotaHistory(raw: unknown): SimTopUpHistory { const history: SimTopUpHistory = { account: asString(response.account), - totalAdditions: asNumber(response.totalAddQuotaKb), - additionCount: asNumber(response.addQuotaCount), - history: (response.details || []).map(detail => ({ + totalAdditions: asNumber(response.total), + additionCount: asNumber(response.count), + history: (response.quotaHistory || []).map(detail => ({ quotaKb: asNumber(detail.addQuotaKb), quotaMb: asNumber(detail.addQuotaKb) / 1024, addedDate: detail.addDate || "", @@ -168,27 +164,46 @@ export function transformFreebitTopUpResponse(raw: unknown) { return freebitTopUpRawSchema.parse(raw); } +export type FreebitTopUpResponse = ReturnType; + export function transformFreebitAddSpecResponse(raw: unknown) { return freebitAddSpecRawSchema.parse(raw); } +export type FreebitAddSpecResponse = ReturnType; + export function transformFreebitPlanChangeResponse(raw: unknown) { return freebitPlanChangeRawSchema.parse(raw); } +export type FreebitPlanChangeResponse = ReturnType; + export function transformFreebitCancelPlanResponse(raw: unknown) { return freebitCancelPlanRawSchema.parse(raw); } +export type FreebitCancelPlanResponse = ReturnType; + export function transformFreebitCancelAccountResponse(raw: unknown) { return freebitCancelAccountRawSchema.parse(raw); } +export type FreebitCancelAccountResponse = ReturnType; + export function transformFreebitEsimReissueResponse(raw: unknown) { return freebitEsimReissueRawSchema.parse(raw); } +export type FreebitEsimReissueResponse = ReturnType; + export function transformFreebitEsimAddAccountResponse(raw: unknown) { return freebitEsimAddAccountRawSchema.parse(raw); } +export type FreebitEsimAddAccountResponse = ReturnType; + +export function transformFreebitEsimActivationResponse(raw: unknown) { + return freebitEsimAddAccountRawSchema.parse(raw); +} + + diff --git a/packages/domain/sim/providers/freebit/raw.types.ts b/packages/domain/sim/providers/freebit/raw.types.ts index 44b288dc..af28d5a0 100644 --- a/packages/domain/sim/providers/freebit/raw.types.ts +++ b/packages/domain/sim/providers/freebit/raw.types.ts @@ -145,11 +145,16 @@ export type FreebitTrafficInfoRaw = z.infer; // Freebit Quota History Response export const freebitQuotaHistoryRawSchema = z.object({ resultCode: z.string().optional(), - resultMessage: z.string().optional(), + status: z + .object({ + message: z.string().optional(), + statusCode: z.union([z.string(), z.number()]).optional(), + }) + .optional(), account: z.union([z.string(), z.number()]).optional(), - totalAddQuotaKb: z.union([z.string(), z.number()]).optional(), - addQuotaCount: z.union([z.string(), z.number()]).optional(), - details: z.array( + total: z.union([z.string(), z.number()]).optional(), + count: z.union([z.string(), z.number()]).optional(), + quotaHistory: z.array( z.object({ addQuotaKb: z.union([z.string(), z.number()]).optional(), addDate: z.string().optional(), diff --git a/packages/domain/sim/providers/freebit/requests.ts b/packages/domain/sim/providers/freebit/requests.ts index f2801783..14b66875 100644 --- a/packages/domain/sim/providers/freebit/requests.ts +++ b/packages/domain/sim/providers/freebit/requests.ts @@ -90,6 +90,37 @@ export const freebitCancelPlanApiRequestSchema = z.object({ runTime: z.string().optional(), }); +export const freebitQuotaHistoryRequestSchema = z.object({ + account: z.string().min(1, "Account is required"), + fromDate: z.string().regex(/^\d{8}$/, "From date must be in YYYYMMDD format"), + toDate: z.string().regex(/^\d{8}$/, "To date must be in YYYYMMDD format"), +}); + +export const freebitQuotaHistoryResponseSchema = z.object({ + resultCode: z.string(), + status: z + .object({ + message: z.string(), + statusCode: z.union([z.string(), z.number()]), + }) + .optional(), + total: z.union([z.string(), z.number()]), + count: z.union([z.string(), z.number()]), + quotaHistory: z.array( + z.object({ + addQuotaKb: z.union([z.string(), z.number()]), + addDate: z.string(), + expireDate: z.string(), + campaignCode: z.string().optional(), + }) + ), +}); + +export const freebitEsimMnpSchema = z.object({ + reserveNumber: z.string().min(1, "Reserve number is required"), + reserveExpireDate: z.string().regex(/^\d{8}$/, "Reserve expire date must be in YYYYMMDD format"), +}); + export const freebitEsimReissueRequestSchema = z.object({ account: z.string().min(1, "Account is required"), newEid: z.string().min(1, "New EID is required"), @@ -98,9 +129,21 @@ export const freebitEsimReissueRequestSchema = z.object({ oldProductNumber: z.string().optional(), }); -// ============================================================================ +export const freebitEsimAddAccountRequestSchema = z.object({ + authKey: z.string().min(1).optional(), + aladinOperated: z.enum(["10", "20"]).default("10"), + account: z.string().min(1, "Account is required"), + eid: z.string().min(1, "EID is required"), + addKind: z.enum(["N", "R"]).default("N"), + shipDate: z.string().regex(/^\d{8}$/, "Ship date must be in YYYYMMDD format").optional(), + planCode: z.string().optional(), + contractLine: z.enum(["4G", "5G"]).optional(), + mnp: freebitEsimMnpSchema.optional(), +}); + +// ========================================================================= // SIM Features -// ============================================================================ +// ========================================================================= export const freebitSimFeaturesRequestSchema = z.object({ account: z.string().min(1, "Account is required"), @@ -115,14 +158,9 @@ export const freebitGlobalIpRequestSchema = z.object({ assign: z.boolean(), // true to assign, false to remove }); -// ============================================================================ +// ========================================================================= // eSIM Activation -// ============================================================================ - -export const freebitEsimMnpSchema = z.object({ - reserveNumber: z.string().min(1, "Reserve number is required"), - reserveExpireDate: z.string().regex(/^\d{8}$/, "Reserve expire date must be in YYYYMMDD format"), -}); +// ========================================================================= export const freebitAuthRequestSchema = z.object({ oemId: z.string().min(1), diff --git a/packages/domain/src/common.d.ts b/packages/domain/src/common.d.ts deleted file mode 100644 index 150cd962..00000000 --- a/packages/domain/src/common.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -export type UserId = string & { - readonly __brand: "UserId"; -}; -export type OrderId = string & { - readonly __brand: "OrderId"; -}; -export type InvoiceId = string & { - readonly __brand: "InvoiceId"; -}; -export type SubscriptionId = string & { - readonly __brand: "SubscriptionId"; -}; -export type PaymentId = string & { - readonly __brand: "PaymentId"; -}; -export type CaseId = string & { - readonly __brand: "CaseId"; -}; -export type SessionId = string & { - readonly __brand: "SessionId"; -}; -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 declare const createUserId: (id: string) => UserId; -export declare const createOrderId: (id: string) => OrderId; -export declare const createInvoiceId: (id: string) => InvoiceId; -export declare const createSubscriptionId: (id: string) => SubscriptionId; -export declare const createPaymentId: (id: string) => PaymentId; -export declare const createCaseId: (id: string) => CaseId; -export declare const createSessionId: (id: string) => SessionId; -export declare const createWhmcsClientId: (id: number) => WhmcsClientId; -export declare const createWhmcsInvoiceId: (id: number) => WhmcsInvoiceId; -export declare const createWhmcsProductId: (id: number) => WhmcsProductId; -export declare const createSalesforceContactId: (id: string) => SalesforceContactId; -export declare const createSalesforceAccountId: (id: string) => SalesforceAccountId; -export declare const createSalesforceCaseId: (id: string) => SalesforceCaseId; -export declare const isUserId: (id: string) => id is UserId; -export declare const isOrderId: (id: string) => id is OrderId; -export declare const isInvoiceId: (id: string) => id is InvoiceId; -export declare const isWhmcsClientId: (id: number) => id is WhmcsClientId; -export type IsoDateTimeString = string; -export interface BaseEntity { - id: string; - createdAt: string; - updatedAt: string; -} -export interface WhmcsEntity { - id: number; -} -export interface SalesforceEntity { - id: string; - createdDate: string; - lastModifiedDate: string; -} -export interface Paginated { - items: T[]; - nextCursor: string | null; - totalCount?: number; -} -export interface IdempotencyKey { - key: string; - userId: string; - createdAt: string; -} -export interface UserMapping { - userId: string; - whmcsClientId: number; - sfContactId?: string; - sfAccountId?: string; - createdAt?: Date; - updatedAt?: Date; -} -export interface UserIdMapping extends UserMapping { - createdAt?: Date; - updatedAt?: Date; -} -export interface CreateMappingRequest { - userId: string; - whmcsClientId: number; - sfAccountId?: string; -} -export interface UpdateMappingRequest { - whmcsClientId?: number; - sfAccountId?: string; -} -export interface MappingStats { - totalMappings: number; - whmcsMappings: number; - salesforceMappings: number; - completeMappings: number; - orphanedMappings: number; -} -export interface Address { - street: string | null; - streetLine2: string | null; - city: string | null; - state: string | null; - postalCode: string | null; - country: string | null; -} diff --git a/packages/domain/src/common.js b/packages/domain/src/common.js deleted file mode 100644 index de067238..00000000 --- a/packages/domain/src/common.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isWhmcsClientId = exports.isInvoiceId = exports.isOrderId = exports.isUserId = exports.createSalesforceCaseId = exports.createSalesforceAccountId = exports.createSalesforceContactId = exports.createWhmcsProductId = exports.createWhmcsInvoiceId = exports.createWhmcsClientId = exports.createSessionId = exports.createCaseId = exports.createPaymentId = exports.createSubscriptionId = exports.createInvoiceId = exports.createOrderId = exports.createUserId = void 0; -const createUserId = (id) => id; -exports.createUserId = createUserId; -const createOrderId = (id) => id; -exports.createOrderId = createOrderId; -const createInvoiceId = (id) => id; -exports.createInvoiceId = createInvoiceId; -const createSubscriptionId = (id) => id; -exports.createSubscriptionId = createSubscriptionId; -const createPaymentId = (id) => id; -exports.createPaymentId = createPaymentId; -const createCaseId = (id) => id; -exports.createCaseId = createCaseId; -const createSessionId = (id) => id; -exports.createSessionId = createSessionId; -const createWhmcsClientId = (id) => id; -exports.createWhmcsClientId = createWhmcsClientId; -const createWhmcsInvoiceId = (id) => id; -exports.createWhmcsInvoiceId = createWhmcsInvoiceId; -const createWhmcsProductId = (id) => id; -exports.createWhmcsProductId = createWhmcsProductId; -const createSalesforceContactId = (id) => id; -exports.createSalesforceContactId = createSalesforceContactId; -const createSalesforceAccountId = (id) => id; -exports.createSalesforceAccountId = createSalesforceAccountId; -const createSalesforceCaseId = (id) => id; -exports.createSalesforceCaseId = createSalesforceCaseId; -const isUserId = (id) => typeof id === "string"; -exports.isUserId = isUserId; -const isOrderId = (id) => typeof id === "string"; -exports.isOrderId = isOrderId; -const isInvoiceId = (id) => typeof id === "string"; -exports.isInvoiceId = isInvoiceId; -const isWhmcsClientId = (id) => typeof id === "number"; -exports.isWhmcsClientId = isWhmcsClientId; -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/packages/domain/src/common.js.map b/packages/domain/src/common.js.map deleted file mode 100644 index 569c9529..00000000 --- a/packages/domain/src/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":";;;AA0BO,MAAM,YAAY,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,EAAY,CAAC;AAApD,QAAA,YAAY,gBAAwC;AAC1D,MAAM,aAAa,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,EAAa,CAAC;AAAvD,QAAA,aAAa,iBAA0C;AAC7D,MAAM,eAAe,GAAG,CAAC,EAAU,EAAa,EAAE,CAAC,EAAe,CAAC;AAA7D,QAAA,eAAe,mBAA8C;AACnE,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAkB,EAAE,CAAC,EAAoB,CAAC;AAA5E,QAAA,oBAAoB,wBAAwD;AAClF,MAAM,eAAe,GAAG,CAAC,EAAU,EAAa,EAAE,CAAC,EAAe,CAAC;AAA7D,QAAA,eAAe,mBAA8C;AACnE,MAAM,YAAY,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,EAAY,CAAC;AAApD,QAAA,YAAY,gBAAwC;AAC1D,MAAM,eAAe,GAAG,CAAC,EAAU,EAAa,EAAE,CAAC,EAAe,CAAC;AAA7D,QAAA,eAAe,mBAA8C;AAEnE,MAAM,mBAAmB,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,EAAmB,CAAC;AAAzE,QAAA,mBAAmB,uBAAsD;AAC/E,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAkB,EAAE,CAAC,EAAoB,CAAC;AAA5E,QAAA,oBAAoB,wBAAwD;AAClF,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAkB,EAAE,CAAC,EAAoB,CAAC;AAA5E,QAAA,oBAAoB,wBAAwD;AAElF,MAAM,yBAAyB,GAAG,CAAC,EAAU,EAAuB,EAAE,CAC3E,EAAyB,CAAC;AADf,QAAA,yBAAyB,6BACV;AACrB,MAAM,yBAAyB,GAAG,CAAC,EAAU,EAAuB,EAAE,CAC3E,EAAyB,CAAC;AADf,QAAA,yBAAyB,6BACV;AACrB,MAAM,sBAAsB,GAAG,CAAC,EAAU,EAAoB,EAAE,CAAC,EAAsB,CAAC;AAAlF,QAAA,sBAAsB,0BAA4D;AAGxF,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;AAAhE,QAAA,QAAQ,YAAwD;AACtE,MAAM,SAAS,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;AAAlE,QAAA,SAAS,aAAyD;AACxE,MAAM,WAAW,GAAG,CAAC,EAAU,EAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;AAAtE,QAAA,WAAW,eAA2D;AAC5E,MAAM,eAAe,GAAG,CAAC,EAAU,EAAuB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;AAA9E,QAAA,eAAe,mBAA+D"} \ No newline at end of file diff --git a/packages/domain/src/common.ts b/packages/domain/src/common.ts deleted file mode 100644 index 1fbd2d1c..00000000 --- a/packages/domain/src/common.ts +++ /dev/null @@ -1,135 +0,0 @@ -// Common types used across the application - -// ===================================================== -// BRANDED TYPES FOR TYPE SAFETY -// ===================================================== - -// Branded types for critical identifiers -export type UserId = string & { readonly __brand: "UserId" }; -export type OrderId = string & { readonly __brand: "OrderId" }; -export type InvoiceId = string & { readonly __brand: "InvoiceId" }; -export type SubscriptionId = string & { readonly __brand: "SubscriptionId" }; -export type PaymentId = string & { readonly __brand: "PaymentId" }; -export type CaseId = string & { readonly __brand: "CaseId" }; -export type SessionId = string & { readonly __brand: "SessionId" }; - -// WHMCS-specific branded types -export type WhmcsClientId = number & { readonly __brand: "WhmcsClientId" }; -export type WhmcsInvoiceId = number & { readonly __brand: "WhmcsInvoiceId" }; -export type WhmcsProductId = number & { readonly __brand: "WhmcsProductId" }; - -// Salesforce-specific branded types -export type SalesforceContactId = string & { readonly __brand: "SalesforceContactId" }; -export type SalesforceAccountId = string & { readonly __brand: "SalesforceAccountId" }; -export type SalesforceCaseId = string & { readonly __brand: "SalesforceCaseId" }; - -// Helper functions for creating branded types -export const createUserId = (id: string): UserId => id as UserId; -export const createOrderId = (id: string): OrderId => id as OrderId; -export const createInvoiceId = (id: string): InvoiceId => id as InvoiceId; -export const createSubscriptionId = (id: string): SubscriptionId => id as SubscriptionId; -export const createPaymentId = (id: string): PaymentId => id as PaymentId; -export const createCaseId = (id: string): CaseId => id as CaseId; -export const createSessionId = (id: string): SessionId => id as SessionId; - -export const createWhmcsClientId = (id: number): WhmcsClientId => id as WhmcsClientId; -export const createWhmcsInvoiceId = (id: number): WhmcsInvoiceId => id as WhmcsInvoiceId; -export const createWhmcsProductId = (id: number): WhmcsProductId => id as WhmcsProductId; - -export const createSalesforceContactId = (id: string): SalesforceContactId => - id as SalesforceContactId; -export const createSalesforceAccountId = (id: string): SalesforceAccountId => - id as SalesforceAccountId; -export const createSalesforceCaseId = (id: string): SalesforceCaseId => id as SalesforceCaseId; - -// Type guards for branded types -export const isUserId = (id: string): id is UserId => typeof id === "string"; -export const isOrderId = (id: string): id is OrderId => typeof id === "string"; -export const isInvoiceId = (id: string): id is InvoiceId => typeof id === "string"; -export const isWhmcsClientId = (id: number): id is WhmcsClientId => typeof id === "number"; - -// Shared ISO8601 timestamp string type used for serialized dates -export type IsoDateTimeString = string; - -// ===================================================== -// BASE ENTITY INTERFACES -// ===================================================== - -// Base entity interfaces for different systems - -// Portal entities (User, etc.) -export interface BaseEntity { - id: string; - createdAt: string; - updatedAt: string; -} - -// WHMCS entities (Invoice, Subscription, etc.) -export interface WhmcsEntity { - id: number; -} - -// Salesforce entities (SupportCase, etc.) -export interface SalesforceEntity { - id: string; - createdDate: string; - lastModifiedDate: string; -} - -export interface Paginated { - items: T[]; - nextCursor: string | null; - totalCount?: number; -} - -// API types moved to contracts/api.ts - -export interface IdempotencyKey { - key: string; - userId: string; - createdAt: string; -} - -export interface UserMapping { - userId: string; - whmcsClientId: number; - sfContactId?: string; - sfAccountId?: string; - createdAt?: Date; - updatedAt?: Date; -} - -// Extended mapping interfaces for V2 implementation -export interface UserIdMapping extends UserMapping { - createdAt?: Date; - updatedAt?: Date; -} - -export interface CreateMappingRequest { - userId: string; - whmcsClientId: number; - sfAccountId?: string; -} - -export interface UpdateMappingRequest { - whmcsClientId?: number; - sfAccountId?: string; -} - -export interface MappingStats { - totalMappings: number; - whmcsMappings: number; - salesforceMappings: number; - completeMappings: number; - orphanedMappings: number; -} - -// Shared address type used across BFF and Portal -export interface Address { - street: string | null; - streetLine2: string | null; - city: string | null; - state: string | null; - postalCode: string | null; - country: string | null; -} diff --git a/packages/domain/src/contracts/api.d.ts b/packages/domain/src/contracts/api.d.ts deleted file mode 100644 index e299d5f2..00000000 --- a/packages/domain/src/contracts/api.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -export type ApiResponse = ApiSuccess | ApiFailure; -export interface ApiSuccess { - success: true; - data: T; - meta?: ApiMeta; -} -export interface ApiFailure { - success: false; - error: ApiError; - meta?: ApiMeta; -} -export interface ApiError { - code: string; - message: string; - details?: Record; - statusCode?: number; - timestamp?: string; - path?: string; -} -export interface ApiMeta { - requestId?: string; - timestamp?: string; - version?: string; -} -export interface PaginatedResponse { - data: T[]; - pagination: { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; - }; -} -export interface QueryParams extends Record { - page?: number; - limit?: number; - search?: string; - filter?: Record; - sort?: string; -} -export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; -export interface ApiRequestConfig { - method?: HttpMethod; - headers?: Record; - params?: QueryParams; - data?: unknown; - timeout?: number; - retries?: number; - cache?: boolean; -} -export interface ApiClient { - get(url: string, config?: ApiRequestConfig): Promise>; - post(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - put(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - patch(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - delete(url: string, config?: ApiRequestConfig): Promise>; -} -export interface ApiClientError { - code?: string; - message: string; - details?: Record; - statusCode?: number; - timestamp?: string; -} -export type RequestInterceptor = (config: ApiRequestConfig) => ApiRequestConfig | Promise; -export type ResponseInterceptor = (response: ApiResponse) => ApiResponse | Promise>; -export interface CrudService, UpdateT = Partial> { - getAll(params?: QueryParams): Promise>; - getById(id: string): Promise; - create(data: CreateT): Promise; - update(id: string, data: UpdateT): Promise; - delete(id: string): Promise; -} diff --git a/packages/domain/src/contracts/api.js b/packages/domain/src/contracts/api.js deleted file mode 100644 index 57bf49a1..00000000 --- a/packages/domain/src/contracts/api.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/packages/domain/src/contracts/api.js.map b/packages/domain/src/contracts/api.js.map deleted file mode 100644 index aaabc4be..00000000 --- a/packages/domain/src/contracts/api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/contracts/api.ts b/packages/domain/src/contracts/api.ts deleted file mode 100644 index 458d8529..00000000 --- a/packages/domain/src/contracts/api.ts +++ /dev/null @@ -1,101 +0,0 @@ -// API response envelope types -export type ApiResponse = ApiSuccess | ApiFailure; - -export interface ApiSuccess { - success: true; - data: T; - meta?: ApiMeta; -} - -export interface ApiFailure { - success: false; - error: ApiError; - meta?: ApiMeta; -} - -export interface ApiError { - code: string; - message: string; - details?: Record; - statusCode?: number; - timestamp?: string; - path?: string; -} - -export interface ApiMeta { - requestId?: string; - timestamp?: string; - version?: string; -} - -// Generic pagination interface (business contract) -export interface PaginatedResponse { - data: T[]; - pagination: { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; - }; -} - -// Query parameters for API requests (business contract) -export interface QueryParams extends Record { - page?: number; - limit?: number; - search?: string; - filter?: Record; - sort?: string; -} - -// HTTP methods (technical contract) -export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; - -// API request configuration (technical contract) -export interface ApiRequestConfig { - method?: HttpMethod; - headers?: Record; - params?: QueryParams; - data?: unknown; - timeout?: number; - retries?: number; - cache?: boolean; -} - -// API client interface (technical contract) -export interface ApiClient { - get(url: string, config?: ApiRequestConfig): Promise>; - post(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - put(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - patch(url: string, data?: unknown, config?: ApiRequestConfig): Promise>; - delete(url: string, config?: ApiRequestConfig): Promise>; -} - -// API client error interface (technical contract) -export interface ApiClientError { - code?: string; - message: string; - details?: Record; - statusCode?: number; - timestamp?: string; -} - -// Interceptor types (technical contract) -export type RequestInterceptor = ( - config: ApiRequestConfig -) => ApiRequestConfig | Promise; - -export type ResponseInterceptor = ( - response: ApiResponse -) => ApiResponse | Promise>; - -// Generic CRUD service interface (business contract) -export interface CrudService, UpdateT = Partial> { - getAll(params?: QueryParams): Promise>; - getById(id: string): Promise; - create(data: CreateT): Promise; - update(id: string, data: UpdateT): Promise; - delete(id: string): Promise; -} diff --git a/packages/domain/src/contracts/catalog.d.ts b/packages/domain/src/contracts/catalog.d.ts deleted file mode 100644 index 8ca92f73..00000000 --- a/packages/domain/src/contracts/catalog.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -export interface CatalogProductBase { - id: string; - sku: string; - name: string; - description?: string; - displayOrder?: number; - billingCycle?: string; - monthlyPrice?: number; - oneTimePrice?: number; - unitPrice?: number; -} -export interface InternetCatalogProduct extends CatalogProductBase { - internetPlanTier?: string; - internetOfferingType?: string; - features?: string[]; -} -export interface InternetPlanTemplate { - tierDescription: string; - description?: string; - features?: string[]; -} -export interface InternetPlanCatalogItem extends InternetCatalogProduct { - catalogMetadata?: { - tierDescription?: string; - features?: string[]; - isRecommended?: boolean; - }; -} -export interface InternetInstallationCatalogItem extends InternetCatalogProduct { - catalogMetadata?: { - installationTerm: "One-time" | "12-Month" | "24-Month"; - }; -} -export interface InternetAddonCatalogItem extends InternetCatalogProduct { - isBundledAddon?: boolean; - bundledAddonId?: string; -} -export interface SimCatalogProduct extends CatalogProductBase { - simDataSize?: string; - simPlanType?: string; - simHasFamilyDiscount?: boolean; - isBundledAddon?: boolean; - bundledAddonId?: string; -} -export interface SimActivationFeeCatalogItem extends SimCatalogProduct { - catalogMetadata?: { - isDefault: boolean; - }; -} -export interface VpnCatalogProduct extends CatalogProductBase { - vpnRegion?: string; -} -export interface CatalogPricebookEntry { - id?: string; - name?: string; - unitPrice?: number; - pricebook2Id?: string; - product2Id?: string; - isActive?: boolean; -} diff --git a/packages/domain/src/contracts/catalog.js b/packages/domain/src/contracts/catalog.js deleted file mode 100644 index 11f0692d..00000000 --- a/packages/domain/src/contracts/catalog.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=catalog.js.map \ No newline at end of file diff --git a/packages/domain/src/contracts/catalog.js.map b/packages/domain/src/contracts/catalog.js.map deleted file mode 100644 index 5698e720..00000000 --- a/packages/domain/src/contracts/catalog.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"catalog.js","sourceRoot":"","sources":["catalog.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/contracts/catalog.ts b/packages/domain/src/contracts/catalog.ts deleted file mode 100644 index 8ee758c5..00000000 --- a/packages/domain/src/contracts/catalog.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Shared catalog contracts consumed by both BFF and Portal - -export interface CatalogProductBase { - id: string; - sku: string; - name: string; - description?: string; - displayOrder?: number; - billingCycle?: string; - monthlyPrice?: number; - oneTimePrice?: number; - unitPrice?: number; -} - -export interface InternetCatalogProduct extends CatalogProductBase { - internetPlanTier?: string; - internetOfferingType?: string; - features?: string[]; -} - -export interface InternetPlanTemplate { - tierDescription: string; - description?: string; - features?: string[]; -} - -export interface InternetPlanCatalogItem extends InternetCatalogProduct { - catalogMetadata?: { - tierDescription?: string; - features?: string[]; - isRecommended?: boolean; - }; -} - -export interface InternetInstallationCatalogItem extends InternetCatalogProduct { - catalogMetadata?: { - installationTerm: "One-time" | "12-Month" | "24-Month"; - }; -} - -export interface InternetAddonCatalogItem extends InternetCatalogProduct { - isBundledAddon?: boolean; - bundledAddonId?: string; -} - -export interface SimCatalogProduct extends CatalogProductBase { - simDataSize?: string; - simPlanType?: string; - simHasFamilyDiscount?: boolean; - isBundledAddon?: boolean; - bundledAddonId?: string; -} - -export interface SimActivationFeeCatalogItem extends SimCatalogProduct { - catalogMetadata?: { - isDefault: boolean; - }; -} -export interface VpnCatalogProduct extends CatalogProductBase { - vpnRegion?: string; -} - -export interface CatalogPricebookEntry { - id?: string; - name?: string; - unitPrice?: number; - pricebook2Id?: string; - product2Id?: string; - isActive?: boolean; -} diff --git a/packages/domain/src/contracts/common.ts b/packages/domain/src/contracts/common.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/domain/src/contracts/index.d.ts b/packages/domain/src/contracts/index.d.ts deleted file mode 100644 index 9f0fc011..00000000 --- a/packages/domain/src/contracts/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./api"; -export * from "./catalog"; -export * from "./salesforce"; diff --git a/packages/domain/src/contracts/index.js b/packages/domain/src/contracts/index.js deleted file mode 100644 index 86bcbca7..00000000 --- a/packages/domain/src/contracts/index.js +++ /dev/null @@ -1,20 +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("./api"), exports); -__exportStar(require("./catalog"), exports); -__exportStar(require("./salesforce"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/contracts/index.js.map b/packages/domain/src/contracts/index.js.map deleted file mode 100644 index 78c13bfc..00000000 --- a/packages/domain/src/contracts/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,wCAAsB;AACtB,4CAA0B;AAC1B,+CAA6B"} \ No newline at end of file diff --git a/packages/domain/src/contracts/index.ts b/packages/domain/src/contracts/index.ts deleted file mode 100644 index 5582ed8d..00000000 --- a/packages/domain/src/contracts/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Export all API contracts -export * from "./api"; -export * from "./catalog"; -export * from "./salesforce"; diff --git a/packages/domain/src/contracts/salesforce.d.ts b/packages/domain/src/contracts/salesforce.d.ts deleted file mode 100644 index 68a08c91..00000000 --- a/packages/domain/src/contracts/salesforce.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -import type { IsoDateTimeString } from "../common"; -export interface SalesforceQueryResult { - totalSize: number; - done: boolean; - records: TRecord[]; -} -export interface SalesforceCreateResult { - id: string; - success: boolean; - errors?: string[]; -} -export interface SalesforceSObjectBase { - Id: string; - CreatedDate?: IsoDateTimeString; - LastModifiedDate?: IsoDateTimeString; -} -export type SalesforceOrderStatus = string; -export type SalesforceOrderType = string; -export type SalesforceOrderItemStatus = string; -export interface SalesforceProduct2Record extends SalesforceSObjectBase { - Name?: string; - StockKeepingUnit?: string; - Description?: string; - Product2Categories1__c?: string | null; - Portal_Catalog__c?: boolean | null; - Portal_Accessible__c?: boolean | null; - Item_Class__c?: string | null; - Billing_Cycle__c?: string | null; - Catalog_Order__c?: number | null; - Bundled_Addon__c?: string | null; - Is_Bundled_Addon__c?: boolean | null; - Internet_Plan_Tier__c?: string | null; - Internet_Offering_Type__c?: string | null; - Feature_List__c?: string | null; - SIM_Data_Size__c?: string | null; - SIM_Plan_Type__c?: string | null; - SIM_Has_Family_Discount__c?: boolean | null; - VPN_Region__c?: string | null; - WH_Product_ID__c?: number | null; - WH_Product_Name__c?: string | null; - Price__c?: number | null; - Monthly_Price__c?: number | null; - One_Time_Price__c?: number | null; -} -export interface SalesforcePricebookEntryRecord extends SalesforceSObjectBase { - Name?: string; - UnitPrice?: number | string | null; - Pricebook2Id?: string | null; - Product2Id?: string | null; - IsActive?: boolean | null; - Product2?: SalesforceProduct2Record | null; -} -export interface SalesforceProduct2WithPricebookEntries extends SalesforceProduct2Record { - PricebookEntries?: { - records?: SalesforcePricebookEntryRecord[]; - }; -} -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 interface SalesforceAccountRecord extends SalesforceSObjectBase { - Name?: string; - SF_Account_No__c?: string | null; - WH_Account__c?: string | null; - BillingStreet?: string | null; - BillingCity?: string | null; - BillingState?: string | null; - BillingPostalCode?: string | null; - BillingCountry?: string | null; -} -export interface SalesforceOrderRecord extends SalesforceSObjectBase { - OrderNumber?: string; - Status?: string; - Type?: string; - EffectiveDate?: IsoDateTimeString | null; - TotalAmount?: number | null; - AccountId?: string | null; - Account?: { - Name?: string | null; - } | null; - Pricebook2Id?: string | null; - Activation_Type__c?: string | null; - Activation_Status__c?: string | null; - Activation_Scheduled_At__c?: IsoDateTimeString | null; - Internet_Plan_Tier__c?: string | null; - Installment_Plan__c?: string | null; - Access_Mode__c?: string | null; - Weekend_Install__c?: boolean | null; - Hikari_Denwa__c?: boolean | null; - VPN_Region__c?: string | null; - SIM_Type__c?: string | null; - SIM_Voice_Mail__c?: boolean | null; - SIM_Call_Waiting__c?: boolean | null; - EID__c?: string | null; - WHMCS_Order_ID__c?: string | null; - Activation_Error_Code__c?: string | null; - Activation_Error_Message__c?: string | null; - ActivatedDate?: IsoDateTimeString | null; -} -export interface SalesforceOrderItemSummary { - productName?: string; - sku?: string; - status?: SalesforceOrderItemStatus; - billingCycle?: string; -} -export interface SalesforceOrderSummary { - id: string; - orderNumber: string; - status: SalesforceOrderStatus; - orderType?: SalesforceOrderType; - effectiveDate: IsoDateTimeString; - totalAmount?: number; - createdDate: IsoDateTimeString; - lastModifiedDate: IsoDateTimeString; - whmcsOrderId?: string; - itemsSummary: SalesforceOrderItemSummary[]; -} -export interface SalesforceOrderItemRecord extends SalesforceSObjectBase { - OrderId?: string | null; - Quantity?: number | null; - UnitPrice?: number | null; - TotalPrice?: number | null; - PricebookEntryId?: string | null; - PricebookEntry?: SalesforcePricebookEntryRecord | null; - Billing_Cycle__c?: string | null; - WHMCS_Service_ID__c?: string | null; -} -export interface SalesforceAccountContactRecord extends SalesforceSObjectBase { - AccountId?: string | null; - ContactId?: string | null; -} -export interface SalesforceContactRecord extends SalesforceSObjectBase { - FirstName?: string | null; - LastName?: string | null; - Email?: string | null; - Phone?: string | null; -} diff --git a/packages/domain/src/contracts/salesforce.js b/packages/domain/src/contracts/salesforce.js deleted file mode 100644 index 87e33568..00000000 --- a/packages/domain/src/contracts/salesforce.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=salesforce.js.map \ No newline at end of file diff --git a/packages/domain/src/contracts/salesforce.js.map b/packages/domain/src/contracts/salesforce.js.map deleted file mode 100644 index cd13d709..00000000 --- a/packages/domain/src/contracts/salesforce.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"salesforce.js","sourceRoot":"","sources":["salesforce.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/contracts/salesforce.ts b/packages/domain/src/contracts/salesforce.ts deleted file mode 100644 index 1c1c09d0..00000000 --- a/packages/domain/src/contracts/salesforce.ts +++ /dev/null @@ -1,164 +0,0 @@ -import type { IsoDateTimeString } from "../common"; - -export interface SalesforceQueryResult { - totalSize: number; - done: boolean; - records: TRecord[]; -} - -export interface SalesforceCreateResult { - id: string; - success: boolean; - errors?: string[]; -} - -export interface SalesforceSObjectBase { - Id: string; - CreatedDate?: IsoDateTimeString; - LastModifiedDate?: IsoDateTimeString; -} - -export type SalesforceOrderStatus = string; -export type SalesforceOrderType = string; -export type SalesforceOrderItemStatus = string; - -export interface SalesforceProduct2Record extends SalesforceSObjectBase { - Name?: string; - StockKeepingUnit?: string; - Description?: string; - Product2Categories1__c?: string | null; - Portal_Catalog__c?: boolean | null; - Portal_Accessible__c?: boolean | null; - Item_Class__c?: string | null; - Billing_Cycle__c?: string | null; - Catalog_Order__c?: number | null; - Bundled_Addon__c?: string | null; - Is_Bundled_Addon__c?: boolean | null; - Internet_Plan_Tier__c?: string | null; - Internet_Offering_Type__c?: string | null; - Feature_List__c?: string | null; - SIM_Data_Size__c?: string | null; - SIM_Plan_Type__c?: string | null; - SIM_Has_Family_Discount__c?: boolean | null; - VPN_Region__c?: string | null; - WH_Product_ID__c?: number | null; - WH_Product_Name__c?: string | null; - Price__c?: number | null; - Monthly_Price__c?: number | null; - One_Time_Price__c?: number | null; -} - -export interface SalesforcePricebookEntryRecord extends SalesforceSObjectBase { - Name?: string; - UnitPrice?: number | string | null; - Pricebook2Id?: string | null; - Product2Id?: string | null; - IsActive?: boolean | null; - Product2?: SalesforceProduct2Record | null; -} - -export interface SalesforceProduct2WithPricebookEntries extends SalesforceProduct2Record { - PricebookEntries?: { - records?: SalesforcePricebookEntryRecord[]; - }; -} - -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 interface SalesforceAccountRecord extends SalesforceSObjectBase { - Name?: string; - SF_Account_No__c?: string | null; - WH_Account__c?: string | null; - BillingStreet?: string | null; - BillingCity?: string | null; - BillingState?: string | null; - BillingPostalCode?: string | null; - BillingCountry?: string | null; -} - -export interface SalesforceOrderRecord extends SalesforceSObjectBase { - OrderNumber?: string; - Status?: string; - Type?: string; - EffectiveDate?: IsoDateTimeString | null; - TotalAmount?: number | null; - AccountId?: string | null; - Account?: { Name?: string | null } | null; - Pricebook2Id?: string | null; - Activation_Type__c?: string | null; - Activation_Status__c?: string | null; - Activation_Scheduled_At__c?: IsoDateTimeString | null; - Internet_Plan_Tier__c?: string | null; - Installment_Plan__c?: string | null; - Access_Mode__c?: string | null; - Weekend_Install__c?: boolean | null; - Hikari_Denwa__c?: boolean | null; - VPN_Region__c?: string | null; - SIM_Type__c?: string | null; - SIM_Voice_Mail__c?: boolean | null; - SIM_Call_Waiting__c?: boolean | null; - EID__c?: string | null; - WHMCS_Order_ID__c?: string | null; - Activation_Error_Code__c?: string | null; - Activation_Error_Message__c?: string | null; - ActivatedDate?: IsoDateTimeString | null; -} - -export interface SalesforceOrderItemSummary { - productName?: string; - sku?: string; - status?: SalesforceOrderItemStatus; - billingCycle?: string; -} -export interface SalesforceOrderSummary { - id: string; - orderNumber: string; - status: SalesforceOrderStatus; - orderType?: SalesforceOrderType; - effectiveDate: IsoDateTimeString; - totalAmount?: number; - createdDate: IsoDateTimeString; - lastModifiedDate: IsoDateTimeString; - whmcsOrderId?: string; - itemsSummary: SalesforceOrderItemSummary[]; -} - -export interface SalesforceOrderItemRecord extends SalesforceSObjectBase { - OrderId?: string | null; - Quantity?: number | null; - UnitPrice?: number | null; - TotalPrice?: number | null; - PricebookEntryId?: string | null; - PricebookEntry?: SalesforcePricebookEntryRecord | null; - Billing_Cycle__c?: string | null; - WHMCS_Service_ID__c?: string | null; -} -export interface SalesforceAccountContactRecord extends SalesforceSObjectBase { - AccountId?: string | null; - ContactId?: string | null; -} - -export interface SalesforceContactRecord extends SalesforceSObjectBase { - FirstName?: string | null; - LastName?: string | null; - Email?: string | null; - Phone?: string | null; -} diff --git a/packages/domain/src/entities/billing.d.ts b/packages/domain/src/entities/billing.d.ts deleted file mode 100644 index d7ae98ed..00000000 --- a/packages/domain/src/entities/billing.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export interface BillingSummaryData { - totalOutstanding: number; - totalOverdue: number; - totalPaid: number; - currency: string; - currencySymbol?: string; - invoiceCount: { - total: number; - unpaid: number; - overdue: number; - paid: number; - }; -} -export interface Money { - amount: number; - currency: string; -} -export interface CurrencyFormatOptions { - currency?: string; - locale?: string; - minimumFractionDigits?: number; - maximumFractionDigits?: number; -} -export declare function calculateBillingSummary(invoices: Array<{ - total: number; - status: string; - dueDate?: string; - paidDate?: string; -}>): Omit; diff --git a/packages/domain/src/entities/billing.js b/packages/domain/src/entities/billing.js deleted file mode 100644 index a8fb0b7b..00000000 --- a/packages/domain/src/entities/billing.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.calculateBillingSummary = calculateBillingSummary; -function calculateBillingSummary(invoices) { - const now = new Date(); - return invoices.reduce((summary, invoice) => { - const isOverdue = invoice.dueDate && new Date(invoice.dueDate) < now && !invoice.paidDate; - const isPaid = !!invoice.paidDate; - const isUnpaid = !isPaid; - return { - totalOutstanding: summary.totalOutstanding + (isUnpaid ? invoice.total : 0), - totalOverdue: summary.totalOverdue + (isOverdue ? invoice.total : 0), - totalPaid: summary.totalPaid + (isPaid ? invoice.total : 0), - invoiceCount: { - total: summary.invoiceCount.total + 1, - unpaid: summary.invoiceCount.unpaid + (isUnpaid ? 1 : 0), - overdue: summary.invoiceCount.overdue + (isOverdue ? 1 : 0), - paid: summary.invoiceCount.paid + (isPaid ? 1 : 0), - }, - }; - }, { - totalOutstanding: 0, - totalOverdue: 0, - totalPaid: 0, - invoiceCount: { - total: 0, - unpaid: 0, - overdue: 0, - paid: 0, - }, - }); -} -//# sourceMappingURL=billing.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/billing.js.map b/packages/domain/src/entities/billing.js.map deleted file mode 100644 index 5618c943..00000000 --- a/packages/domain/src/entities/billing.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"billing.js","sourceRoot":"","sources":["billing.ts"],"names":[],"mappings":";;AAmCA,0DAwCC;AAxCD,SAAgB,uBAAuB,CACrC,QAKE;IAEF,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACnB,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC1F,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAClC,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC;QAEzB,OAAO;YACL,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,YAAY,EAAE,OAAO,CAAC,YAAY,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACpE,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3D,YAAY,EAAE;gBACZ,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,CAAC;gBACrC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxD,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3D,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACnD;SACF,CAAC;IACJ,CAAC,EACD;QACE,gBAAgB,EAAE,CAAC;QACnB,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE;YACZ,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,CAAC;SACR;KACF,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/entities/billing.ts b/packages/domain/src/entities/billing.ts deleted file mode 100644 index 31f48a6a..00000000 --- a/packages/domain/src/entities/billing.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Billing Domain Entities - * - * Business entities for billing calculations and summaries - */ - -export interface BillingSummaryData { - totalOutstanding: number; - totalOverdue: number; - totalPaid: number; - currency: string; - currencySymbol?: string; - invoiceCount: { - total: number; - unpaid: number; - overdue: number; - paid: number; - }; -} - -// Money representation (business concept) -export interface Money { - amount: number; - currency: string; -} - -// Currency formatting options (business rules) -export interface CurrencyFormatOptions { - currency?: string; - locale?: string; - minimumFractionDigits?: number; - maximumFractionDigits?: number; -} - -// Business logic for billing calculations -export function calculateBillingSummary( - invoices: Array<{ - total: number; - status: string; - dueDate?: string; - paidDate?: string; - }> -): Omit { - const now = new Date(); - - return invoices.reduce( - (summary, invoice) => { - const isOverdue = invoice.dueDate && new Date(invoice.dueDate) < now && !invoice.paidDate; - const isPaid = !!invoice.paidDate; - const isUnpaid = !isPaid; - - return { - totalOutstanding: summary.totalOutstanding + (isUnpaid ? invoice.total : 0), - totalOverdue: summary.totalOverdue + (isOverdue ? invoice.total : 0), - totalPaid: summary.totalPaid + (isPaid ? invoice.total : 0), - invoiceCount: { - total: summary.invoiceCount.total + 1, - unpaid: summary.invoiceCount.unpaid + (isUnpaid ? 1 : 0), - overdue: summary.invoiceCount.overdue + (isOverdue ? 1 : 0), - paid: summary.invoiceCount.paid + (isPaid ? 1 : 0), - }, - }; - }, - { - totalOutstanding: 0, - totalOverdue: 0, - totalPaid: 0, - invoiceCount: { - total: 0, - unpaid: 0, - overdue: 0, - paid: 0, - }, - } - ); -} diff --git a/packages/domain/src/entities/case.d.ts b/packages/domain/src/entities/case.d.ts deleted file mode 100644 index d104d2aa..00000000 --- a/packages/domain/src/entities/case.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { CaseStatus, CasePriority } from "../enums/status"; -import type { SalesforceEntity } from "../common"; -export type CaseType = "Question" | "Problem" | "Feature Request"; -export interface SupportCase extends SalesforceEntity { - number: string; - subject: string; - description?: string; - status: CaseStatus; - priority: CasePriority; - type: CaseType; - closedDate?: string; - contactId?: string; - accountId?: string; - ownerId?: string; - ownerName?: string; - comments?: CaseComment[]; -} -export interface CaseComment { - id: string; - body: string; - isPublic: boolean; - createdDate: string; - createdBy: { - id: string; - name: string; - type: "user" | "customer"; - }; -} -export interface CreateCaseRequest { - subject: string; - description: string; - type?: string; - priority?: string; -} -export interface CaseList { - cases: SupportCase[]; - totalCount: number; - nextCursor?: string; -} diff --git a/packages/domain/src/entities/case.js b/packages/domain/src/entities/case.js deleted file mode 100644 index 7ac0f895..00000000 --- a/packages/domain/src/entities/case.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=case.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/case.js.map b/packages/domain/src/entities/case.js.map deleted file mode 100644 index 88af2292..00000000 --- a/packages/domain/src/entities/case.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"case.js","sourceRoot":"","sources":["case.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/entities/case.ts b/packages/domain/src/entities/case.ts deleted file mode 100644 index 745707b8..00000000 --- a/packages/domain/src/entities/case.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Support case types from Salesforce -import type { CaseStatus, CasePriority } from "../enums/status"; -import type { SalesforceEntity } from "../common"; - -export type CaseType = "Question" | "Problem" | "Feature Request"; - -export interface SupportCase extends SalesforceEntity { - number: string; - subject: string; - description?: string; - status: CaseStatus; - priority: CasePriority; - type: CaseType; - closedDate?: string; // ISO - contactId?: string; - accountId?: string; - ownerId?: string; - ownerName?: string; - comments?: CaseComment[]; -} - -export interface CaseComment { - id: string; - body: string; - isPublic: boolean; - createdDate: string; // ISO - createdBy: { - id: string; - name: string; - type: "user" | "customer"; - }; -} - -export interface CreateCaseRequest { - subject: string; - description: string; - type?: string; - priority?: string; -} - -export interface CaseList { - cases: SupportCase[]; - totalCount: number; - nextCursor?: string; -} diff --git a/packages/domain/src/entities/dashboard.d.ts b/packages/domain/src/entities/dashboard.d.ts deleted file mode 100644 index b4212872..00000000 --- a/packages/domain/src/entities/dashboard.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { Activity } from "./user"; -export interface DashboardStats { - activeSubscriptions: number; - unpaidInvoices: number; - openCases: number; - recentOrders: number; - totalSpent?: number; - currency: string; -} -export interface NextInvoice { - id: number; - dueDate: string; - amount: number; - currency: string; -} -export interface DashboardSummary { - stats: DashboardStats; - nextInvoice: NextInvoice | null; - recentActivity: Activity[]; -} -export interface DashboardError { - code: string; - message: string; - details?: Record; -} -export type ActivityFilter = "all" | "billing" | "orders" | "support"; -export interface ActivityFilterConfig { - key: ActivityFilter; - label: string; - types?: Activity["type"][]; -} diff --git a/packages/domain/src/entities/dashboard.js b/packages/domain/src/entities/dashboard.js deleted file mode 100644 index 26cb3641..00000000 --- a/packages/domain/src/entities/dashboard.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=dashboard.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/dashboard.js.map b/packages/domain/src/entities/dashboard.js.map deleted file mode 100644 index bbc87dc7..00000000 --- a/packages/domain/src/entities/dashboard.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["dashboard.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/entities/dashboard.ts b/packages/domain/src/entities/dashboard.ts deleted file mode 100644 index 7aa31ec1..00000000 --- a/packages/domain/src/entities/dashboard.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Dashboard Domain Entities - * - * Business entities for dashboard data and statistics - */ - -import type { Activity } from "./user"; - -export interface DashboardStats { - activeSubscriptions: number; - unpaidInvoices: number; - openCases: number; - recentOrders: number; - totalSpent?: number; - currency: string; -} - -export interface NextInvoice { - id: number; - dueDate: string; - amount: number; - currency: string; -} - -export interface DashboardSummary { - stats: DashboardStats; - nextInvoice: NextInvoice | null; - recentActivity: Activity[]; -} - -export interface DashboardError { - code: string; - message: string; - details?: Record; -} - -// Activity filter types (business logic) -export type ActivityFilter = "all" | "billing" | "orders" | "support"; - -export interface ActivityFilterConfig { - key: ActivityFilter; - label: string; - types?: Activity["type"][]; -} diff --git a/packages/domain/src/entities/index.d.ts b/packages/domain/src/entities/index.d.ts deleted file mode 100644 index 7ac6a206..00000000 --- a/packages/domain/src/entities/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./invoice"; -export * from "./subscription"; -export * from "./payment"; -export * from "./case"; -export * from "./dashboard"; -export * from "./billing"; -export * from "./skus"; diff --git a/packages/domain/src/entities/index.js b/packages/domain/src/entities/index.js deleted file mode 100644 index 3454351c..00000000 --- a/packages/domain/src/entities/index.js +++ /dev/null @@ -1,24 +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("./invoice"), exports); -__exportStar(require("./subscription"), exports); -__exportStar(require("./payment"), exports); -__exportStar(require("./case"), exports); -__exportStar(require("./dashboard"), exports); -__exportStar(require("./billing"), exports); -__exportStar(require("./skus"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/index.js.map b/packages/domain/src/entities/index.js.map deleted file mode 100644 index 8f555c79..00000000 --- a/packages/domain/src/entities/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,4CAA0B;AAC1B,iDAA+B;AAC/B,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,yCAAuB"} \ No newline at end of file diff --git a/packages/domain/src/entities/index.ts b/packages/domain/src/entities/index.ts deleted file mode 100644 index 5481daf8..00000000 --- a/packages/domain/src/entities/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Export all entities - resolving conflicts explicitly -export * from "./invoice"; -export * from "./subscription"; -export * from "./payment"; -export * from "./case"; -export * from "./dashboard"; -export * from "./billing"; -export * from "./skus"; diff --git a/packages/domain/src/entities/invoice.d.ts b/packages/domain/src/entities/invoice.d.ts deleted file mode 100644 index c5b57bb4..00000000 --- a/packages/domain/src/entities/invoice.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Invoice as InvoiceContract, InvoiceItem as InvoiceItemContract, InvoiceList as InvoiceListContract } from "@customer-portal/contracts/billing"; -import type { InvoiceSchema as InvoiceSchemaType, InvoiceItemSchema as InvoiceItemSchemaType, InvoiceListSchema as InvoiceListSchemaType } from "@customer-portal/schemas/billing/invoice.schema"; -export type Invoice = InvoiceContract; -export type InvoiceItem = InvoiceItemContract; -export type InvoiceList = InvoiceListContract; -export type InvoiceSchema = InvoiceSchemaType; -export type InvoiceItemSchema = InvoiceItemSchemaType; -export type InvoiceListSchema = InvoiceListSchemaType; -export interface InvoiceSsoLink { - url: string; - expiresAt: string; -} diff --git a/packages/domain/src/entities/invoice.js b/packages/domain/src/entities/invoice.js deleted file mode 100644 index c69522fb..00000000 --- a/packages/domain/src/entities/invoice.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=invoice.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/invoice.js.map b/packages/domain/src/entities/invoice.js.map deleted file mode 100644 index 86fffbe9..00000000 --- a/packages/domain/src/entities/invoice.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invoice.js","sourceRoot":"","sources":["invoice.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/entities/invoice.ts b/packages/domain/src/entities/invoice.ts deleted file mode 100644 index c2592f66..00000000 --- a/packages/domain/src/entities/invoice.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { - Invoice as InvoiceContract, - InvoiceItem as InvoiceItemContract, - InvoiceList as InvoiceListContract, -} from "@customer-portal/contracts/billing"; -import type { - InvoiceSchema as InvoiceSchemaType, - InvoiceItemSchema as InvoiceItemSchemaType, - InvoiceListSchema as InvoiceListSchemaType, -} from "@customer-portal/schemas/billing/invoice.schema"; - -export type Invoice = InvoiceContract; -export type InvoiceItem = InvoiceItemContract; -export type InvoiceList = InvoiceListContract; - -export type InvoiceSchema = InvoiceSchemaType; -export type InvoiceItemSchema = InvoiceItemSchemaType; -export type InvoiceListSchema = InvoiceListSchemaType; - -export interface InvoiceSsoLink { - url: string; - expiresAt: string; -} diff --git a/packages/domain/src/entities/payment.d.ts b/packages/domain/src/entities/payment.d.ts deleted file mode 100644 index 78eccca3..00000000 --- a/packages/domain/src/entities/payment.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { PaymentGateway as PaymentGatewayContract, PaymentGatewayList as PaymentGatewayListContract, PaymentMethod as PaymentMethodContract, PaymentMethodList as PaymentMethodListContract } from "@customer-portal/contracts/payments"; -import type { PaymentGatewaySchema as PaymentGatewaySchemaType, PaymentMethodSchema as PaymentMethodSchemaType } from "@customer-portal/schemas/payments/payment.schema"; -export type PaymentMethod = PaymentMethodContract; -export type PaymentMethodList = PaymentMethodListContract; -export type PaymentGateway = PaymentGatewayContract; -export type PaymentGatewayList = PaymentGatewayListContract; -export type PaymentMethodSchema = PaymentMethodSchemaType; -export type PaymentGatewaySchema = PaymentGatewaySchemaType; -export interface CreatePaymentMethodRequest { - type: "CreditCard" | "BankAccount" | "RemoteCreditCard"; - description: string; - gatewayName?: string; - cardNumber?: string; - expiryMonth?: string; - expiryYear?: string; - cvv?: string; - cardholderName?: string; - bankName?: string; - accountType?: "checking" | "savings"; - routingNumber?: string; - accountNumber?: string; - accountHolderName?: string; - remoteToken?: string; - billingContactId?: number; -} -export interface InvoicePaymentLink { - url: string; - expiresAt: string; - paymentMethodId?: number; - gatewayName?: string; -} -export interface PaymentInvoiceRequest { - invoiceId: number; - paymentMethodId?: number; - gatewayName?: string; - amount?: number; -} diff --git a/packages/domain/src/entities/payment.js b/packages/domain/src/entities/payment.js deleted file mode 100644 index 296d0270..00000000 --- a/packages/domain/src/entities/payment.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=payment.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/payment.js.map b/packages/domain/src/entities/payment.js.map deleted file mode 100644 index 76123853..00000000 --- a/packages/domain/src/entities/payment.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"payment.js","sourceRoot":"","sources":["payment.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/entities/payment.ts b/packages/domain/src/entities/payment.ts deleted file mode 100644 index 49164ad1..00000000 --- a/packages/domain/src/entities/payment.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Payment method types for WHMCS integration -import type { - PaymentGateway as PaymentGatewayContract, - PaymentGatewayList as PaymentGatewayListContract, - PaymentMethod as PaymentMethodContract, - PaymentMethodList as PaymentMethodListContract, -} from "@customer-portal/contracts/payments"; -import type { - PaymentGatewaySchema as PaymentGatewaySchemaType, - PaymentMethodSchema as PaymentMethodSchemaType, -} from "@customer-portal/schemas/payments/payment.schema"; - -export type PaymentMethod = PaymentMethodContract; -export type PaymentMethodList = PaymentMethodListContract; -export type PaymentGateway = PaymentGatewayContract; -export type PaymentGatewayList = PaymentGatewayListContract; - -export type PaymentMethodSchema = PaymentMethodSchemaType; -export type PaymentGatewaySchema = PaymentGatewaySchemaType; - -export interface CreatePaymentMethodRequest { - type: "CreditCard" | "BankAccount" | "RemoteCreditCard"; - description: string; - gatewayName?: string; - // Credit Card specific - cardNumber?: string; - expiryMonth?: string; - expiryYear?: string; - cvv?: string; - cardholderName?: string; - // Bank Account specific - bankName?: string; - accountType?: "checking" | "savings"; - routingNumber?: string; - accountNumber?: string; - accountHolderName?: string; - // Remote/Tokenized - remoteToken?: string; - // Billing info - billingContactId?: number; -} - -export interface InvoicePaymentLink { - url: string; - expiresAt: string; - paymentMethodId?: number; - gatewayName?: string; -} - -export interface PaymentInvoiceRequest { - invoiceId: number; - paymentMethodId?: number; - gatewayName?: string; - amount?: number; -} diff --git a/packages/domain/src/entities/skus.d.ts b/packages/domain/src/entities/skus.d.ts deleted file mode 100644 index 3a1c0bc1..00000000 --- a/packages/domain/src/entities/skus.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type InternetTier = "Platinum" | "Gold" | "Silver"; -export type AccessMode = "IPoE-HGW" | "IPoE-BYOR" | "PPPoE"; -export type InstallPlan = "One-time" | "12-Month" | "24-Month"; -export declare function getInternetServiceSku(tier: InternetTier, mode: AccessMode): string; -export declare function getInternetInstallSku(plan: InstallPlan): string; -export declare function getVpnServiceSku(region: string): string; -export declare function getVpnActivationSku(): string; -export type SimFormat = "eSIM" | "Physical"; -export type SimPlanType = "DataOnly" | "DataSmsVoice" | "VoiceOnly"; -export type SimDataSize = "5GB" | "10GB" | "25GB" | "50GB" | "None"; -export declare function getSimServiceSku(format: SimFormat, planType: SimPlanType, dataSize: SimDataSize): string; diff --git a/packages/domain/src/entities/skus.js b/packages/domain/src/entities/skus.js deleted file mode 100644 index 9fa18061..00000000 --- a/packages/domain/src/entities/skus.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getInternetServiceSku = getInternetServiceSku; -exports.getInternetInstallSku = getInternetInstallSku; -exports.getVpnServiceSku = getVpnServiceSku; -exports.getVpnActivationSku = getVpnActivationSku; -exports.getSimServiceSku = getSimServiceSku; -const INTERNET_SKU = { - Platinum: { - "IPoE-HGW": "INT-1G-PLAT-HGW", - "IPoE-BYOR": "INT-1G-PLAT-BYOR", - PPPoE: "INT-1G-PLAT-PPPOE", - }, - Gold: { - "IPoE-HGW": "INT-1G-GOLD-HGW", - "IPoE-BYOR": "INT-1G-GOLD-BYOR", - PPPoE: "INT-1G-GOLD-PPPOE", - }, - Silver: { - "IPoE-HGW": "INT-1G-SILV-HGW", - "IPoE-BYOR": "INT-1G-SILV-BYOR", - PPPoE: "INT-1G-SILV-PPPOE", - }, -}; -const INSTALL_SKU = { - "One-time": "INT-INSTALL-ONETIME", - "12-Month": "INT-INSTALL-12M", - "24-Month": "INT-INSTALL-24M", -}; -const VPN_SKU = { - "USA-SF": "VPN-USA-SF", - "UK-London": "VPN-UK-LON", -}; -function getInternetServiceSku(tier, mode) { - return INTERNET_SKU[tier][mode]; -} -function getInternetInstallSku(plan) { - return INSTALL_SKU[plan]; -} -function getVpnServiceSku(region) { - return VPN_SKU[region] || ""; -} -function getVpnActivationSku() { - return "VPN-ACTIVATION"; -} -const DEFAULT_SIM_SKU_MAP = { - eSIM: { - DataOnly: { - "5GB": "SIM-ESIM-DATA-5GB", - "10GB": "SIM-ESIM-DATA-10GB", - "25GB": "SIM-ESIM-DATA-25GB", - "50GB": "SIM-ESIM-DATA-50GB", - }, - DataSmsVoice: { - "5GB": "SIM-ESIM-VOICE-5GB", - "10GB": "SIM-ESIM-VOICE-10GB", - "25GB": "SIM-ESIM-VOICE-25GB", - "50GB": "SIM-ESIM-VOICE-50GB", - }, - VoiceOnly: { - None: "SIM-ESIM-VOICEONLY", - }, - }, - Physical: { - DataOnly: { - "5GB": "SIM-PHYS-DATA-5GB", - "10GB": "SIM-PHYS-DATA-10GB", - "25GB": "SIM-PHYS-DATA-25GB", - "50GB": "SIM-PHYS-DATA-50GB", - }, - DataSmsVoice: { - "5GB": "SIM-PHYS-VOICE-5GB", - "10GB": "SIM-PHYS-VOICE-10GB", - "25GB": "SIM-PHYS-VOICE-25GB", - "50GB": "SIM-PHYS-VOICE-50GB", - }, - VoiceOnly: { - None: "SIM-PHYS-VOICEONLY", - }, - }, -}; -function getEnvSimSkuMap() { - try { - const raw = process.env.NEXT_PUBLIC_SIM_SKU_MAP; - if (!raw) - return null; - const parsed = JSON.parse(raw); - if (parsed && typeof parsed === "object") { - return parsed; - } - return null; - } - catch { - return null; - } -} -function getSimServiceSku(format, planType, dataSize) { - const map = getEnvSimSkuMap() || DEFAULT_SIM_SKU_MAP; - const byFormat = map[format] || {}; - const byType = (byFormat[planType] || {}); - return typeof byType[dataSize] === "string" ? byType[dataSize] : ""; -} -//# sourceMappingURL=skus.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/skus.js.map b/packages/domain/src/entities/skus.js.map deleted file mode 100644 index f7c7dda2..00000000 --- a/packages/domain/src/entities/skus.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"skus.js","sourceRoot":"","sources":["skus.ts"],"names":[],"mappings":";;AAoCA,sDAEC;AAED,sDAEC;AAED,4CAEC;AAED,kDAEC;AAmED,4CASC;AAvHD,MAAM,YAAY,GAAqD;IACrE,QAAQ,EAAE;QACR,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,mBAAmB;KAC3B;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,mBAAmB;KAC3B;IACD,MAAM,EAAE;QACN,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,mBAAmB;KAC3B;CACF,CAAC;AAEF,MAAM,WAAW,GAAgC;IAC/C,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AAEF,MAAM,OAAO,GAA2B;IACtC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,YAAY;CAC1B,CAAC;AAEF,SAAgB,qBAAqB,CAAC,IAAkB,EAAE,IAAgB;IACxE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAiB;IACrD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CA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AAiB,EACjB,QAAqB,EACrB,QAAqB;IAErB,MAAM,GAAG,GAAG,eAAe,EAAE,IAAI,mBAAmB,CAAC;IACrD,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAA2B,CAAC;IACpE,OAAO,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/entities/skus.ts b/packages/domain/src/entities/skus.ts deleted file mode 100644 index 57c0561d..00000000 --- a/packages/domain/src/entities/skus.ts +++ /dev/null @@ -1,127 +0,0 @@ -// Central SKU registry for Product2 <-> portal mappings. -// Replace the placeholder codes with your actual Product2.SKU__c values. - -export type InternetTier = "Platinum" | "Gold" | "Silver"; -export type AccessMode = "IPoE-HGW" | "IPoE-BYOR" | "PPPoE"; -export type InstallPlan = "One-time" | "12-Month" | "24-Month"; - -const INTERNET_SKU: Record> = { - Platinum: { - "IPoE-HGW": "INT-1G-PLAT-HGW", - "IPoE-BYOR": "INT-1G-PLAT-BYOR", - PPPoE: "INT-1G-PLAT-PPPOE", - }, - Gold: { - "IPoE-HGW": "INT-1G-GOLD-HGW", - "IPoE-BYOR": "INT-1G-GOLD-BYOR", - PPPoE: "INT-1G-GOLD-PPPOE", - }, - Silver: { - "IPoE-HGW": "INT-1G-SILV-HGW", - "IPoE-BYOR": "INT-1G-SILV-BYOR", - PPPoE: "INT-1G-SILV-PPPOE", - }, -}; - -const INSTALL_SKU: Record = { - "One-time": "INT-INSTALL-ONETIME", - "12-Month": "INT-INSTALL-12M", - "24-Month": "INT-INSTALL-24M", -}; - -const VPN_SKU: Record = { - "USA-SF": "VPN-USA-SF", - "UK-London": "VPN-UK-LON", -}; - -export function getInternetServiceSku(tier: InternetTier, mode: AccessMode): string { - return INTERNET_SKU[tier][mode]; -} - -export function getInternetInstallSku(plan: InstallPlan): string { - return INSTALL_SKU[plan]; -} - -export function getVpnServiceSku(region: string): string { - return VPN_SKU[region] || ""; -} - -export function getVpnActivationSku(): string { - return "VPN-ACTIVATION"; -} - -// ===== SIM / eSIM ===== -export type SimFormat = "eSIM" | "Physical"; -export type SimPlanType = "DataOnly" | "DataSmsVoice" | "VoiceOnly"; -export type SimDataSize = "5GB" | "10GB" | "25GB" | "50GB" | "None"; - -type SimSkuMap = Record>>>; - -// Default mapping. Replace with your actual Product2.SKU__c codes in Salesforce. -// Can be overridden at runtime via NEXT_PUBLIC_SIM_SKU_MAP (JSON with the same shape as SimSkuMap). -const DEFAULT_SIM_SKU_MAP: SimSkuMap = { - eSIM: { - DataOnly: { - "5GB": "SIM-ESIM-DATA-5GB", - "10GB": "SIM-ESIM-DATA-10GB", - "25GB": "SIM-ESIM-DATA-25GB", - "50GB": "SIM-ESIM-DATA-50GB", - }, - DataSmsVoice: { - "5GB": "SIM-ESIM-VOICE-5GB", - "10GB": "SIM-ESIM-VOICE-10GB", - "25GB": "SIM-ESIM-VOICE-25GB", - "50GB": "SIM-ESIM-VOICE-50GB", - }, - VoiceOnly: { - None: "SIM-ESIM-VOICEONLY", - }, - }, - Physical: { - DataOnly: { - "5GB": "SIM-PHYS-DATA-5GB", - "10GB": "SIM-PHYS-DATA-10GB", - "25GB": "SIM-PHYS-DATA-25GB", - "50GB": "SIM-PHYS-DATA-50GB", - }, - DataSmsVoice: { - "5GB": "SIM-PHYS-VOICE-5GB", - "10GB": "SIM-PHYS-VOICE-10GB", - "25GB": "SIM-PHYS-VOICE-25GB", - "50GB": "SIM-PHYS-VOICE-50GB", - }, - VoiceOnly: { - None: "SIM-PHYS-VOICEONLY", - }, - }, -}; - -function getEnvSimSkuMap(): SimSkuMap | null { - try { - const raw = process.env.NEXT_PUBLIC_SIM_SKU_MAP; - if (!raw) return null; - const parsed: unknown = JSON.parse(raw); - // Best-effort structural check - if (parsed && typeof parsed === "object") { - return parsed as SimSkuMap; - } - return null; - } catch { - return null; - } -} - -/** - * Returns the Product2 SKU for the given SIM configuration. - * If an environment override is present, it takes precedence. - */ -export function getSimServiceSku( - format: SimFormat, - planType: SimPlanType, - dataSize: SimDataSize -): string { - const map = getEnvSimSkuMap() || DEFAULT_SIM_SKU_MAP; - const byFormat = map[format] || {}; - const byType = (byFormat[planType] || {}) as Record; - return typeof byType[dataSize] === "string" ? byType[dataSize] : ""; -} diff --git a/packages/domain/src/entities/subscription.d.ts b/packages/domain/src/entities/subscription.d.ts deleted file mode 100644 index e6760bb5..00000000 --- a/packages/domain/src/entities/subscription.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Subscription as SubscriptionContract, SubscriptionList as SubscriptionListContract } from "@customer-portal/contracts/subscriptions"; -import type { SubscriptionSchema as SubscriptionSchemaType, SubscriptionListSchema as SubscriptionListSchemaType } from "@customer-portal/schemas/subscriptions/subscription.schema"; -export type Subscription = SubscriptionContract; -export type SubscriptionList = SubscriptionListContract; -export type SubscriptionSchema = SubscriptionSchemaType; -export type SubscriptionListSchema = SubscriptionListSchemaType; diff --git a/packages/domain/src/entities/subscription.js b/packages/domain/src/entities/subscription.js deleted file mode 100644 index dcd4e045..00000000 --- a/packages/domain/src/entities/subscription.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=subscription.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/subscription.js.map b/packages/domain/src/entities/subscription.js.map deleted file mode 100644 index 08cc3100..00000000 --- a/packages/domain/src/entities/subscription.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"subscription.js","sourceRoot":"","sources":["subscription.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/entities/subscription.ts b/packages/domain/src/entities/subscription.ts deleted file mode 100644 index cc8339f0..00000000 --- a/packages/domain/src/entities/subscription.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { - Subscription as SubscriptionContract, - SubscriptionList as SubscriptionListContract, -} from "@customer-portal/contracts/subscriptions"; -import type { - SubscriptionSchema as SubscriptionSchemaType, - SubscriptionListSchema as SubscriptionListSchemaType, -} from "@customer-portal/schemas/subscriptions/subscription.schema"; - -export type Subscription = SubscriptionContract; -export type SubscriptionList = SubscriptionListContract; - -export type SubscriptionSchema = SubscriptionSchemaType; -export type SubscriptionListSchema = SubscriptionListSchemaType; diff --git a/packages/domain/src/entities/user.js b/packages/domain/src/entities/user.js deleted file mode 100644 index 33269d36..00000000 --- a/packages/domain/src/entities/user.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=user.js.map \ No newline at end of file diff --git a/packages/domain/src/entities/user.js.map b/packages/domain/src/entities/user.js.map deleted file mode 100644 index ff1a289b..00000000 --- a/packages/domain/src/entities/user.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"user.js","sourceRoot":"","sources":["user.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/enums/index.d.ts b/packages/domain/src/enums/index.d.ts deleted file mode 100644 index ed1ec7ef..00000000 --- a/packages/domain/src/enums/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./status"; diff --git a/packages/domain/src/enums/index.js b/packages/domain/src/enums/index.js deleted file mode 100644 index 73b5778e..00000000 --- a/packages/domain/src/enums/index.js +++ /dev/null @@ -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("./status"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/enums/index.js.map b/packages/domain/src/enums/index.js.map deleted file mode 100644 index 18f1a4ae..00000000 --- a/packages/domain/src/enums/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAAyB"} \ No newline at end of file diff --git a/packages/domain/src/enums/index.ts b/packages/domain/src/enums/index.ts deleted file mode 100644 index 2eecc3b5..00000000 --- a/packages/domain/src/enums/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Export all enums and status types -export * from "./status"; diff --git a/packages/domain/src/enums/status.d.ts b/packages/domain/src/enums/status.d.ts deleted file mode 100644 index 1e224b2b..00000000 --- a/packages/domain/src/enums/status.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export declare const USER_STATUS: { - readonly ACTIVE: "active"; - readonly INACTIVE: "inactive"; - readonly PENDING: "pending"; - readonly SUSPENDED: "suspended"; -}; -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 declare const SUBSCRIPTION_STATUS: { - readonly ACTIVE: "Active"; - readonly INACTIVE: "Inactive"; - readonly PENDING: "Pending"; - readonly CANCELLED: "Cancelled"; - readonly SUSPENDED: "Suspended"; - readonly TERMINATED: "Terminated"; - readonly COMPLETED: "Completed"; -}; -export declare const CASE_STATUS: { - readonly NEW: "New"; - readonly WORKING: "Working"; - readonly ESCALATED: "Escalated"; - readonly CLOSED: "Closed"; -}; -export declare const CASE_PRIORITY: { - readonly LOW: "Low"; - readonly MEDIUM: "Medium"; - readonly HIGH: "High"; - readonly CRITICAL: "Critical"; -}; -export declare const PAYMENT_STATUS: { - readonly PENDING: "pending"; - readonly PROCESSING: "processing"; - readonly COMPLETED: "completed"; - readonly FAILED: "failed"; - readonly CANCELLED: "cancelled"; - readonly REFUNDED: "refunded"; -}; -export type UserStatus = (typeof USER_STATUS)[keyof typeof USER_STATUS]; -export type InvoiceStatus = (typeof INVOICE_STATUS)[keyof typeof INVOICE_STATUS]; -export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS)[keyof typeof SUBSCRIPTION_STATUS]; -export type CaseStatus = (typeof CASE_STATUS)[keyof typeof CASE_STATUS]; -export type CasePriority = (typeof CASE_PRIORITY)[keyof typeof CASE_PRIORITY]; -export type PaymentStatus = (typeof PAYMENT_STATUS)[keyof typeof PAYMENT_STATUS]; diff --git a/packages/domain/src/enums/status.js b/packages/domain/src/enums/status.js deleted file mode 100644 index 64d98db4..00000000 --- a/packages/domain/src/enums/status.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PAYMENT_STATUS = exports.CASE_PRIORITY = exports.CASE_STATUS = exports.SUBSCRIPTION_STATUS = exports.INVOICE_STATUS = exports.USER_STATUS = void 0; -exports.USER_STATUS = { - ACTIVE: "active", - INACTIVE: "inactive", - PENDING: "pending", - SUSPENDED: "suspended", -}; -exports.INVOICE_STATUS = { - DRAFT: "Draft", - PENDING: "Pending", - PAID: "Paid", - UNPAID: "Unpaid", - OVERDUE: "Overdue", - CANCELLED: "Cancelled", - REFUNDED: "Refunded", - COLLECTIONS: "Collections", -}; -exports.SUBSCRIPTION_STATUS = { - ACTIVE: "Active", - INACTIVE: "Inactive", - PENDING: "Pending", - CANCELLED: "Cancelled", - SUSPENDED: "Suspended", - TERMINATED: "Terminated", - COMPLETED: "Completed", -}; -exports.CASE_STATUS = { - NEW: "New", - WORKING: "Working", - ESCALATED: "Escalated", - CLOSED: "Closed", -}; -exports.CASE_PRIORITY = { - LOW: "Low", - MEDIUM: "Medium", - HIGH: "High", - CRITICAL: "Critical", -}; -exports.PAYMENT_STATUS = { - PENDING: "pending", - PROCESSING: "processing", - COMPLETED: "completed", - FAILED: "failed", - CANCELLED: "cancelled", - REFUNDED: "refunded", -}; -//# sourceMappingURL=status.js.map \ No newline at end of file diff --git a/packages/domain/src/enums/status.js.map b/packages/domain/src/enums/status.js.map deleted file mode 100644 index 8f730643..00000000 --- a/packages/domain/src/enums/status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"status.js","sourceRoot":"","sources":["status.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG;IACzB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACd,CAAC;AAEE,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;AAEE,QAAA,mBAAmB,GAAG;IACjC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;CACd,CAAC;AAEE,QAAA,WAAW,GAAG;IACzB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAEE,QAAA,aAAa,GAAG;IAC3B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEE,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACZ,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/enums/status.ts b/packages/domain/src/enums/status.ts deleted file mode 100644 index d94c2502..00000000 --- a/packages/domain/src/enums/status.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Status constants used across the application - -export const USER_STATUS = { - ACTIVE: "active", - INACTIVE: "inactive", - PENDING: "pending", - SUSPENDED: "suspended", -} as const; - -export const INVOICE_STATUS = { - DRAFT: "Draft", - PENDING: "Pending", - PAID: "Paid", - UNPAID: "Unpaid", - OVERDUE: "Overdue", - CANCELLED: "Cancelled", - REFUNDED: "Refunded", - COLLECTIONS: "Collections", -} as const; - -export const SUBSCRIPTION_STATUS = { - ACTIVE: "Active", - INACTIVE: "Inactive", - PENDING: "Pending", - CANCELLED: "Cancelled", - SUSPENDED: "Suspended", - TERMINATED: "Terminated", - COMPLETED: "Completed", -} as const; - -export const CASE_STATUS = { - NEW: "New", - WORKING: "Working", - ESCALATED: "Escalated", - CLOSED: "Closed", -} as const; - -export const CASE_PRIORITY = { - LOW: "Low", - MEDIUM: "Medium", - HIGH: "High", - CRITICAL: "Critical", -} as const; - -export const PAYMENT_STATUS = { - PENDING: "pending", - PROCESSING: "processing", - COMPLETED: "completed", - FAILED: "failed", - CANCELLED: "cancelled", - REFUNDED: "refunded", -} as const; - -// Type helpers for the constants -export type UserStatus = (typeof USER_STATUS)[keyof typeof USER_STATUS]; -export type InvoiceStatus = (typeof INVOICE_STATUS)[keyof typeof INVOICE_STATUS]; -export type SubscriptionStatus = (typeof SUBSCRIPTION_STATUS)[keyof typeof SUBSCRIPTION_STATUS]; -export type CaseStatus = (typeof CASE_STATUS)[keyof typeof CASE_STATUS]; -export type CasePriority = (typeof CASE_PRIORITY)[keyof typeof CASE_PRIORITY]; -export type PaymentStatus = (typeof PAYMENT_STATUS)[keyof typeof PAYMENT_STATUS]; diff --git a/packages/domain/src/index.d.ts b/packages/domain/src/index.d.ts deleted file mode 100644 index 16fb5e5f..00000000 --- a/packages/domain/src/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from "./common"; -export * from "./entities"; -export * from "./enums"; -export * from "./contracts"; -export * from "./utils"; -export * from "./patterns"; -export * from "./validation"; -export type { AsyncState, PaginatedAsyncState, PaginationInfo, PaginationParams, PaginatedResponse, } from "./patterns"; -export type { CreateInput, UpdateInput, WithId, WithTimestamps, FormData, SelectionState, FilterState, ValidationResult, } from "./utils/type-utils"; -export type { UserId, OrderId, InvoiceId, SubscriptionId, PaymentId, CaseId, SessionId, WhmcsClientId, WhmcsInvoiceId, WhmcsProductId, SalesforceContactId, SalesforceAccountId, SalesforceCaseId, } from "./common"; diff --git a/packages/domain/src/index.js b/packages/domain/src/index.js deleted file mode 100644 index 3c025bbc..00000000 --- a/packages/domain/src/index.js +++ /dev/null @@ -1,24 +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("./common"), exports); -__exportStar(require("./entities"), exports); -__exportStar(require("./enums"), exports); -__exportStar(require("./contracts"), exports); -__exportStar(require("./utils"), exports); -__exportStar(require("./patterns"), exports); -__exportStar(require("./validation"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/index.js.map b/packages/domain/src/index.js.map deleted file mode 100644 index 23d4ce6e..00000000 --- a/packages/domain/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,2CAAyB;AAGzB,6CAA2B;AAG3B,0CAAwB;AAGxB,8CAA4B;AAG5B,0CAAwB;AAGxB,6CAA2B;AAG3B,+CAA6B"} \ No newline at end of file diff --git a/packages/domain/src/index.ts b/packages/domain/src/index.ts deleted file mode 100644 index 1db7feab..00000000 --- a/packages/domain/src/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -// Export organized domain types - -// Common types and base interfaces -export * from "./common"; - -// Domain entities -export * from "./entities"; - -// Enums and status types -export * from "./enums"; - -// API contracts -export * from "./contracts"; - -// Utilities -export * from "./utils"; - -// NEW: Patterns for modern state management -export * from "./patterns"; - -// NEW: Runtime validation with Zod -export * from "./validation"; - -// Re-export commonly used pattern types for convenience -export type { - AsyncState, - PaginatedAsyncState, - PaginationInfo, - PaginationParams, - PaginatedResponse, -} from "./patterns"; - -// Re-export commonly used utility types for convenience -export type { - CreateInput, - UpdateInput, - WithId, - WithTimestamps, - FormData, - SelectionState, - FilterState, - ValidationResult, -} from "./utils/type-utils"; - -// Re-export branded types for convenience -export type { - UserId, - OrderId, - InvoiceId, - SubscriptionId, - PaymentId, - CaseId, - SessionId, - WhmcsClientId, - WhmcsInvoiceId, - WhmcsProductId, - SalesforceContactId, - SalesforceAccountId, - SalesforceCaseId, -} from "./common"; diff --git a/packages/domain/src/patterns/async-state.d.ts b/packages/domain/src/patterns/async-state.d.ts deleted file mode 100644 index 500e5e66..00000000 --- a/packages/domain/src/patterns/async-state.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export type AsyncState = { - status: "idle"; -} | { - status: "loading"; -} | { - status: "success"; - data: TData; -} | { - status: "error"; - error: TError; -}; -export type PaginatedAsyncState = { - status: "idle"; -} | { - status: "loading"; -} | { - status: "success"; - data: TData[]; - pagination: PaginationInfo; -} | { - status: "error"; - error: TError; -}; -export interface PaginationInfo { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; -} -export declare const createIdleState: () => AsyncState; -export declare const createLoadingState: () => AsyncState; -export declare const createSuccessState: (data: T) => AsyncState; -export declare const createErrorState: (error: string) => AsyncState; -export declare const isIdle: (state: AsyncState) => state is { - status: "idle"; -}; -export declare const isLoading: (state: AsyncState) => state is { - status: "loading"; -}; -export declare const isSuccess: (state: AsyncState) => state is { - status: "success"; - data: T; -}; -export declare const isError: (state: AsyncState) => state is { - status: "error"; - error: string; -}; -export declare const getDataOrNull: (state: AsyncState) => T | null; -export declare const getErrorOrNull: (state: AsyncState) => string | null; -export declare const mapAsyncState: (state: AsyncState, mapper: (data: T) => U) => AsyncState; -export interface SelectionState { - selected: T[]; - selectAll: boolean; - indeterminate: boolean; -} -export interface FilterState { - filters: T; - activeCount: number; -} -export declare const createSelectionState: () => SelectionState; -export declare const updateSelectionState: (state: SelectionState, item: T, isSelected: boolean) => SelectionState; -export declare const createFilterState: (initialFilters: T) => FilterState; -export declare const updateFilterState: (state: FilterState, filters: Partial) => FilterState; diff --git a/packages/domain/src/patterns/async-state.js b/packages/domain/src/patterns/async-state.js deleted file mode 100644 index b6e29b33..00000000 --- a/packages/domain/src/patterns/async-state.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateFilterState = exports.createFilterState = exports.updateSelectionState = exports.createSelectionState = exports.mapAsyncState = exports.getErrorOrNull = exports.getDataOrNull = exports.isError = exports.isSuccess = exports.isLoading = exports.isIdle = exports.createErrorState = exports.createSuccessState = exports.createLoadingState = exports.createIdleState = void 0; -const createIdleState = () => ({ status: "idle" }); -exports.createIdleState = createIdleState; -const createLoadingState = () => ({ status: "loading" }); -exports.createLoadingState = createLoadingState; -const createSuccessState = (data) => ({ status: "success", data }); -exports.createSuccessState = createSuccessState; -const createErrorState = (error) => ({ status: "error", error }); -exports.createErrorState = createErrorState; -const isIdle = (state) => state.status === "idle"; -exports.isIdle = isIdle; -const isLoading = (state) => state.status === "loading"; -exports.isLoading = isLoading; -const isSuccess = (state) => state.status === "success"; -exports.isSuccess = isSuccess; -const isError = (state) => state.status === "error"; -exports.isError = isError; -const getDataOrNull = (state) => (0, exports.isSuccess)(state) ? state.data : null; -exports.getDataOrNull = getDataOrNull; -const getErrorOrNull = (state) => (0, exports.isError)(state) ? state.error : null; -exports.getErrorOrNull = getErrorOrNull; -const mapAsyncState = (state, mapper) => { - if ((0, exports.isSuccess)(state)) { - return (0, exports.createSuccessState)(mapper(state.data)); - } - return state; -}; -exports.mapAsyncState = mapAsyncState; -const createSelectionState = () => ({ - selected: [], - selectAll: false, - indeterminate: false, -}); -exports.createSelectionState = createSelectionState; -const updateSelectionState = (state, item, isSelected) => { - const selected = isSelected - ? [...state.selected, item] - : state.selected.filter(selectedItem => selectedItem !== item); - return { - selected, - selectAll: false, - indeterminate: selected.length > 0, - }; -}; -exports.updateSelectionState = updateSelectionState; -const createFilterState = (initialFilters) => ({ - filters: initialFilters, - activeCount: 0, -}); -exports.createFilterState = createFilterState; -const updateFilterState = (state, filters) => { - const newFilters = { ...state.filters, ...filters }; - const activeCount = Object.values(newFilters).filter(value => value !== null && value !== undefined && value !== "").length; - return { - filters: newFilters, - activeCount, - }; -}; -exports.updateFilterState = updateFilterState; -//# sourceMappingURL=async-state.js.map \ No newline at end of file diff --git a/packages/domain/src/patterns/async-state.js.map b/packages/domain/src/patterns/async-state.js.map deleted file mode 100644 index 1036eb40..00000000 --- a/packages/domain/src/patterns/async-state.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"async-state.js","sourceRoot":"","sources":["async-state.ts"],"names":[],"mappings":";;;AA2BO,MAAM,eAAe,GAAG,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MAAM,UAAU,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAClD,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAC/D,CAAC,MAAM,CAAC;IAET,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B"} \ No newline at end of file diff --git a/packages/domain/src/patterns/async-state.ts b/packages/domain/src/patterns/async-state.ts deleted file mode 100644 index f9ee1f4a..00000000 --- a/packages/domain/src/patterns/async-state.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Unified Async State Patterns - * Replaces scattered AsyncState interfaces with discriminated unions - */ - -export type AsyncState = - | { status: "idle" } - | { status: "loading" } - | { status: "success"; data: TData } - | { status: "error"; error: TError }; - -export type PaginatedAsyncState = - | { status: "idle" } - | { status: "loading" } - | { status: "success"; data: TData[]; pagination: PaginationInfo } - | { status: "error"; error: TError }; - -export interface PaginationInfo { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; -} - -// Helper functions for state transitions -export const createIdleState = (): AsyncState => ({ status: "idle" }); -export const createLoadingState = (): AsyncState => ({ status: "loading" }); -export const createSuccessState = (data: T): AsyncState => ({ status: "success", data }); -export const createErrorState = (error: string): AsyncState => ({ status: "error", error }); - -// Type guards -export const isIdle = (state: AsyncState): state is { status: "idle" } => - state.status === "idle"; - -export const isLoading = (state: AsyncState): state is { status: "loading" } => - state.status === "loading"; - -export const isSuccess = (state: AsyncState): state is { status: "success"; data: T } => - state.status === "success"; - -export const isError = (state: AsyncState): state is { status: "error"; error: string } => - state.status === "error"; - -// Utility functions for working with async states -export const getDataOrNull = (state: AsyncState): T | null => - isSuccess(state) ? state.data : null; - -export const getErrorOrNull = (state: AsyncState): string | null => - isError(state) ? state.error : null; - -export const mapAsyncState = ( - state: AsyncState, - mapper: (data: T) => U -): AsyncState => { - if (isSuccess(state)) { - return createSuccessState(mapper(state.data)); - } - return state as AsyncState; -}; - -// ===================================================== -// ADDITIONAL UI STATE PATTERNS -// ===================================================== - -// Selection state for lists and tables -export interface SelectionState { - selected: T[]; - selectAll: boolean; - indeterminate: boolean; -} - -// Filter state for search and filtering -export interface FilterState { - filters: T; - activeCount: number; -} - -// Helper functions for selection state -export const createSelectionState = (): SelectionState => ({ - selected: [], - selectAll: false, - indeterminate: false, -}); - -export const updateSelectionState = ( - state: SelectionState, - item: T, - isSelected: boolean -): SelectionState => { - const selected = isSelected - ? [...state.selected, item] - : state.selected.filter(selectedItem => selectedItem !== item); - - return { - selected, - selectAll: false, - indeterminate: selected.length > 0, - }; -}; - -// Helper functions for filter state -export const createFilterState = (initialFilters: T): FilterState => ({ - filters: initialFilters, - activeCount: 0, -}); - -export const updateFilterState = ( - state: FilterState, - filters: Partial -): FilterState => { - const newFilters = { ...state.filters, ...filters }; - const activeCount = Object.values(newFilters).filter( - value => value !== null && value !== undefined && value !== "" - ).length; - - return { - filters: newFilters, - activeCount, - }; -}; diff --git a/packages/domain/src/patterns/index.d.ts b/packages/domain/src/patterns/index.d.ts deleted file mode 100644 index 6a3c1105..00000000 --- a/packages/domain/src/patterns/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./async-state"; -export * from "./pagination"; -export type { AsyncState, PaginatedAsyncState, PaginationInfo, SelectionState, FilterState, } from "./async-state"; -export type { PaginationParams, PaginatedResponse } from "./pagination"; diff --git a/packages/domain/src/patterns/index.js b/packages/domain/src/patterns/index.js deleted file mode 100644 index 8b0cc412..00000000 --- a/packages/domain/src/patterns/index.js +++ /dev/null @@ -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("./async-state"), exports); -__exportStar(require("./pagination"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/patterns/index.js.map b/packages/domain/src/patterns/index.js.map deleted file mode 100644 index e8ce262f..00000000 --- a/packages/domain/src/patterns/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,gDAA8B;AAG9B,+CAA6B"} \ No newline at end of file diff --git a/packages/domain/src/patterns/index.ts b/packages/domain/src/patterns/index.ts deleted file mode 100644 index c1a6b8b4..00000000 --- a/packages/domain/src/patterns/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Export all patterns - */ - -// Async state patterns -export * from "./async-state"; - -// Pagination patterns -export * from "./pagination"; - -// Re-export commonly used types for convenience -export type { - AsyncState, - PaginatedAsyncState, - PaginationInfo, - SelectionState, - FilterState, -} from "./async-state"; - -export type { PaginationParams, PaginatedResponse } from "./pagination"; diff --git a/packages/domain/src/patterns/pagination.d.ts b/packages/domain/src/patterns/pagination.d.ts deleted file mode 100644 index 203db64e..00000000 --- a/packages/domain/src/patterns/pagination.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export interface PaginationInfo { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; -} -export interface PaginationParams { - page?: number; - limit?: number; -} -export interface PaginatedResponse { - data: T[]; - pagination: PaginationInfo; -} -export declare const createPaginationInfo: (page: number, limit: number, total: number) => PaginationInfo; -export declare const getDefaultPaginationParams: () => Required; -export declare const validatePaginationParams: (params: PaginationParams) => Required; -export declare const calculateOffset: (page: number, limit: number) => number; -export declare const isPaginationEmpty: (pagination: PaginationInfo) => boolean; -export declare const isFirstPage: (pagination: PaginationInfo) => boolean; -export declare const isLastPage: (pagination: PaginationInfo) => boolean; diff --git a/packages/domain/src/patterns/pagination.js b/packages/domain/src/patterns/pagination.js deleted file mode 100644 index 9de2d3a4..00000000 --- a/packages/domain/src/patterns/pagination.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isLastPage = exports.isFirstPage = exports.isPaginationEmpty = exports.calculateOffset = exports.validatePaginationParams = exports.getDefaultPaginationParams = exports.createPaginationInfo = void 0; -const createPaginationInfo = (page, limit, total) => ({ - page, - limit, - total, - totalPages: Math.ceil(total / limit), - hasNext: page < Math.ceil(total / limit), - hasPrev: page > 1, -}); -exports.createPaginationInfo = createPaginationInfo; -const getDefaultPaginationParams = () => ({ - page: 1, - limit: 10, -}); -exports.getDefaultPaginationParams = getDefaultPaginationParams; -const validatePaginationParams = (params) => { - const { page = 1, limit = 10 } = params; - return { - page: Math.max(1, page), - limit: Math.min(Math.max(1, limit), 100), - }; -}; -exports.validatePaginationParams = validatePaginationParams; -const calculateOffset = (page, limit) => { - return (page - 1) * limit; -}; -exports.calculateOffset = calculateOffset; -const isPaginationEmpty = (pagination) => { - return pagination.total === 0; -}; -exports.isPaginationEmpty = isPaginationEmpty; -const isFirstPage = (pagination) => { - return pagination.page === 1; -}; -exports.isFirstPage = isFirstPage; -const isLastPage = (pagination) => { - return pagination.page >= pagination.totalPages; -}; -exports.isLastPage = isLastPage; -//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/packages/domain/src/patterns/pagination.js.map b/packages/domain/src/patterns/pagination.js.map deleted file mode 100644 index f0aa683d..00000000 --- a/packages/domain/src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AAC,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEK,MAAM,WAAW,GAAG,CAAC,UAA0B,EAAW,EAAE;IACjE,OAAO,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEK,MAAM,UAAU,GAAG,CAAC,UAA0B,EAAW,EAAE;IAChE,OAAO,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB"} \ No newline at end of file diff --git a/packages/domain/src/patterns/pagination.ts b/packages/domain/src/patterns/pagination.ts deleted file mode 100644 index 12065170..00000000 --- a/packages/domain/src/patterns/pagination.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Unified Pagination Types - */ - -export interface PaginationInfo { - page: number; - limit: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; -} - -export interface PaginationParams { - page?: number; - limit?: number; -} - -export interface PaginatedResponse { - data: T[]; - pagination: PaginationInfo; -} - -// Utility functions -export const createPaginationInfo = ( - page: number, - limit: number, - total: number -): PaginationInfo => ({ - page, - limit, - total, - totalPages: Math.ceil(total / limit), - hasNext: page < Math.ceil(total / limit), - hasPrev: page > 1, -}); - -export const getDefaultPaginationParams = (): Required => ({ - page: 1, - limit: 10, -}); - -export const validatePaginationParams = (params: PaginationParams): Required => { - const { page = 1, limit = 10 } = params; - - return { - page: Math.max(1, page), - limit: Math.min(Math.max(1, limit), 100), // Cap at 100 items per page - }; -}; - -export const calculateOffset = (page: number, limit: number): number => { - return (page - 1) * limit; -}; - -export const isPaginationEmpty = (pagination: PaginationInfo): boolean => { - return pagination.total === 0; -}; - -export const isFirstPage = (pagination: PaginationInfo): boolean => { - return pagination.page === 1; -}; - -export const isLastPage = (pagination: PaginationInfo): boolean => { - return pagination.page >= pagination.totalPages; -}; diff --git a/packages/domain/src/utils/array-utils.d.ts b/packages/domain/src/utils/array-utils.d.ts deleted file mode 100644 index 4eca898e..00000000 --- a/packages/domain/src/utils/array-utils.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export declare function groupBy(array: T[], keyFn: (item: T) => K): Record; -export declare function chunk(array: T[], size: number): T[][]; -export declare function unique(array: T[]): T[]; -export declare function unique(array: T[], keyFn: (item: T) => K): T[]; -export declare function safeAt(array: T[], index: number): T | undefined; -export declare function partition(array: T[], predicate: (item: T) => boolean): [T[], T[]]; -export declare function intersection(...arrays: T[][]): T[]; -export declare const SafeArray: { - readonly first: (array: T[]) => T | null; - readonly last: (array: T[]) => T | null; - readonly random: (array: T[]) => T | null; -}; diff --git a/packages/domain/src/utils/array-utils.js b/packages/domain/src/utils/array-utils.js deleted file mode 100644 index ef24fd4b..00000000 --- a/packages/domain/src/utils/array-utils.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SafeArray = void 0; -exports.groupBy = groupBy; -exports.chunk = chunk; -exports.unique = unique; -exports.safeAt = safeAt; -exports.partition = partition; -exports.intersection = intersection; -function groupBy(array, keyFn) { - return array.reduce((groups, item) => { - const key = keyFn(item); - (groups[key] ??= []).push(item); - return groups; - }, {}); -} -function chunk(array, size) { - if (size <= 0) - return []; - const chunks = []; - for (let i = 0; i < array.length; i += size) { - chunks.push(array.slice(i, i + size)); - } - return chunks; -} -function unique(array, keyFn) { - if (!keyFn) { - return [...new Set(array)]; - } - const seen = new Set(); - return array.filter(item => { - const key = keyFn(item); - if (seen.has(key)) { - return false; - } - seen.add(key); - return true; - }); -} -function safeAt(array, index) { - return array.at?.(index) ?? array[index]; -} -function partition(array, predicate) { - const truthy = []; - const falsy = []; - for (const item of array) { - if (predicate(item)) { - truthy.push(item); - } - else { - falsy.push(item); - } - } - return [truthy, falsy]; -} -function intersection(...arrays) { - if (arrays.length === 0) - return []; - if (arrays.length === 1) - return [...arrays[0]]; - const [first, ...rest] = arrays; - const sets = rest.map(arr => new Set(arr)); - return first.filter(item => sets.every(set => set.has(item))); -} -exports.SafeArray = { - first: (array) => array[0] ?? null, - last: (array) => array.at?.(-1) ?? array[array.length - 1] ?? null, - random: (array) => { - if (array.length === 0) - return null; - return array[Math.floor(Math.random() * array.length)]; - }, -}; -//# sourceMappingURL=array-utils.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/array-utils.js.map b/packages/domain/src/utils/array-utils.js.map deleted file mode 100644 index 2eb5288f..00000000 --- a/packages/domain/src/utils/array-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array-utils.js","sourceRoot":"","sources":["array-utils.ts"],"names":[],"mappings":";;;AAQA,0BAYC;AAMD,sBAQC;AAQD,wBAcC;AAMD,wBAEC;AAKD,8BAaC;AAKD,oCAQC;AAvFD,SAAgB,OAAO,CACrB,KAAU,EACV,KAAqB;IAErB,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QACf,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,EAAoB,CACrB,CAAC;AACJ,CAAC;AAMD,SAAgB,KAAK,CAAI,KAAU,EAAE,IAAY;IAC/C,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAQD,SAAgB,MAAM,CAAO,KAAU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CAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAKY,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,CAAI,KAAU,EAAY,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI;IACpD,IAAI,EAAE,CAAI,KAAU,EAAY,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI;IACpF,MAAM,EAAE,CAAI,KAAU,EAAY,EAAE;QAClC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,CAAC;CACO,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/utils/array-utils.ts b/packages/domain/src/utils/array-utils.ts deleted file mode 100644 index 1f15ecef..00000000 --- a/packages/domain/src/utils/array-utils.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Modern array utilities leveraging ES2024 features - */ - -/** - * Group array items by a key using ES2024 Object.groupBy - * This is more efficient than manual grouping - */ -export function groupBy( - array: T[], - keyFn: (item: T) => K -): Record { - return array.reduce( - (groups, item) => { - const key = keyFn(item); - (groups[key] ??= []).push(item); - return groups; - }, - {} as Record - ); -} - -/** - * Chunk array into smaller arrays of specified size - * Uses modern array methods for efficiency - */ -export function chunk(array: T[], size: number): T[][] { - if (size <= 0) return []; - - const chunks: T[][] = []; - for (let i = 0; i < array.length; i += size) { - chunks.push(array.slice(i, i + size)); - } - return chunks; -} - -/** - * Get unique items from array with optional key function - * Leverages Set for better performance - */ -export function unique(array: T[]): T[]; -export function unique(array: T[], keyFn: (item: T) => K): T[]; -export function unique(array: T[], keyFn?: (item: T) => K): T[] { - if (!keyFn) { - return [...new Set(array)]; - } - - const seen = new Set(); - return array.filter(item => { - const key = keyFn(item); - if (seen.has(key)) { - return false; - } - seen.add(key); - return true; - }); -} - -/** - * Safe array access using ES2024 .at() method - * Returns undefined for out-of-bounds access - */ -export function safeAt(array: T[], index: number): T | undefined { - return array.at?.(index) ?? array[index]; -} - -/** - * Partition array into two arrays based on predicate - */ -export function partition(array: T[], predicate: (item: T) => boolean): [T[], T[]] { - const truthy: T[] = []; - const falsy: T[] = []; - - for (const item of array) { - if (predicate(item)) { - truthy.push(item); - } else { - falsy.push(item); - } - } - - return [truthy, falsy]; -} - -/** - * Modern intersection of arrays - */ -export function intersection(...arrays: T[][]): T[] { - if (arrays.length === 0) return []; - if (arrays.length === 1) return [...arrays[0]]; - - const [first, ...rest] = arrays; - const sets = rest.map(arr => new Set(arr)); - - return first.filter(item => sets.every(set => set.has(item))); -} - -/** - * Safe array operations that return null on empty arrays - */ -export const SafeArray = { - first: (array: T[]): T | null => array[0] ?? null, - last: (array: T[]): T | null => array.at?.(-1) ?? array[array.length - 1] ?? null, - random: (array: T[]): T | null => { - if (array.length === 0) return null; - return array[Math.floor(Math.random() * array.length)]; - }, -} as const; diff --git a/packages/domain/src/utils/currency.d.ts b/packages/domain/src/utils/currency.d.ts deleted file mode 100644 index 5a7c649f..00000000 --- a/packages/domain/src/utils/currency.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface FormatCurrencyOptions { - currency: string; - locale?: string; - minimumFractionDigits?: number; - maximumFractionDigits?: number; -} -export declare const getCurrencyLocale: (currency: string) => string; -export declare const formatCurrency: (amount: number, currencyOrOptions?: string | FormatCurrencyOptions) => string; diff --git a/packages/domain/src/utils/currency.js b/packages/domain/src/utils/currency.js deleted file mode 100644 index 6e2350f4..00000000 --- a/packages/domain/src/utils/currency.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.formatCurrency = exports.getCurrencyLocale = void 0; -const DEFAULT_CURRENCY_LOCALE = "en-US"; -const currencyLocaleMap = { - USD: "en-US", - EUR: "de-DE", - GBP: "en-GB", - JPY: "ja-JP", - AUD: "en-AU", - CAD: "en-CA", -}; -const getCurrencyLocale = (currency) => currencyLocaleMap[currency.toUpperCase()] ?? DEFAULT_CURRENCY_LOCALE; -exports.getCurrencyLocale = getCurrencyLocale; -const formatCurrency = (amount, currencyOrOptions = "JPY") => { - const options = typeof currencyOrOptions === "string" ? { currency: currencyOrOptions } : currencyOrOptions; - const { currency, locale = (0, exports.getCurrencyLocale)(options.currency), minimumFractionDigits, maximumFractionDigits, } = options; - return new Intl.NumberFormat(locale, { - style: "currency", - currency, - minimumFractionDigits, - maximumFractionDigits, - }).format(amount); -}; -exports.formatCurrency = formatCurrency; -//# sourceMappingURL=currency.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/currency.js.map b/packages/domain/src/utils/currency.js.map deleted file mode 100644 index 11c8f973..00000000 --- a/packages/domain/src/utils/currency.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"currency.js","sourceRoot":"","sources":["currency.ts"],"names":[],"mappings":";;;AAAA,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAExC,MAAM,iBAAiB,GAA2B;IAChD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACb,CAAC;AASK,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC5D,iBAAiB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,uBAAuB,CAAC;AAD1D,QAAA,iBAAiB,qBACyC;AAEhE,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,oBAAoD,KAAK,EACjD,EAAE;IACV,MAAM,OAAO,GACX,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAE9F,MAAM,EACJ,QAAQ,EACR,MAAM,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,QAAQ,CAAC,EAC5C,qBAAqB,EACrB,qBAAqB,GACtB,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACnC,KAAK,EAAE,UAAU;QACjB,QAAQ;QACR,qBAAqB;QACrB,qBAAqB;KACtB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC,CAAC;AApBW,QAAA,cAAc,kBAoBzB"} \ No newline at end of file diff --git a/packages/domain/src/utils/currency.ts b/packages/domain/src/utils/currency.ts deleted file mode 100644 index d4d27fe3..00000000 --- a/packages/domain/src/utils/currency.ts +++ /dev/null @@ -1,42 +0,0 @@ -const DEFAULT_CURRENCY_LOCALE = "en-US"; - -const currencyLocaleMap: Record = { - USD: "en-US", - EUR: "de-DE", - GBP: "en-GB", - JPY: "ja-JP", - AUD: "en-AU", - CAD: "en-CA", -}; - -export interface FormatCurrencyOptions { - currency: string; - locale?: string; - minimumFractionDigits?: number; - maximumFractionDigits?: number; -} - -export const getCurrencyLocale = (currency: string): string => - currencyLocaleMap[currency.toUpperCase()] ?? DEFAULT_CURRENCY_LOCALE; - -export const formatCurrency = ( - amount: number, - currencyOrOptions: string | FormatCurrencyOptions = "JPY" -): string => { - const options = - typeof currencyOrOptions === "string" ? { currency: currencyOrOptions } : currencyOrOptions; - - const { - currency, - locale = getCurrencyLocale(options.currency), - minimumFractionDigits, - maximumFractionDigits, - } = options; - - return new Intl.NumberFormat(locale, { - style: "currency", - currency, - minimumFractionDigits, - maximumFractionDigits, - }).format(amount); -}; diff --git a/packages/domain/src/utils/filters.d.ts b/packages/domain/src/utils/filters.d.ts deleted file mode 100644 index 7e64f847..00000000 --- a/packages/domain/src/utils/filters.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -export interface BaseFilter { - search?: string; - dateFrom?: string; - dateTo?: string; -} -export interface StatusFilter { - status?: string; -} -export interface AmountFilter { - amountMin?: number; - amountMax?: number; -} -export interface TypeFilter { - type?: string; -} -export interface CategoryFilter { - category?: string; -} -export interface PriceRangeFilter { - priceRange?: { - min: number; - max: number; - }; -} -export interface BillingFilter extends BaseFilter, StatusFilter, AmountFilter { -} -export interface SubscriptionFilter extends BaseFilter, StatusFilter, TypeFilter { -} -export interface OrderFilter extends BaseFilter, StatusFilter, AmountFilter { -} -export interface CatalogFilter extends BaseFilter, CategoryFilter, PriceRangeFilter { - category?: "internet" | "sim" | "vpn" | "hosting" | "addon"; -} -export interface PaginationParams { - page?: number; - limit?: number; - offset?: number; -} -export interface SortOptions { - sortBy?: string; - sortOrder?: "asc" | "desc"; -} -export interface QueryFilter extends BaseFilter, PaginationParams, SortOptions { - [key: string]: unknown; -} diff --git a/packages/domain/src/utils/filters.js b/packages/domain/src/utils/filters.js deleted file mode 100644 index 51445efc..00000000 --- a/packages/domain/src/utils/filters.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=filters.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/filters.js.map b/packages/domain/src/utils/filters.js.map deleted file mode 100644 index 035a0f39..00000000 --- a/packages/domain/src/utils/filters.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"filters.js","sourceRoot":"","sources":["filters.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/utils/filters.ts b/packages/domain/src/utils/filters.ts deleted file mode 100644 index b321e576..00000000 --- a/packages/domain/src/utils/filters.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Generic Filter Utilities - * - * Reusable filter patterns to eliminate duplication - */ - -// Base filter interface -export interface BaseFilter { - search?: string; - dateFrom?: string; - dateTo?: string; -} - -// Status filter mixin -export interface StatusFilter { - status?: string; -} - -// Amount filter mixin -export interface AmountFilter { - amountMin?: number; - amountMax?: number; -} - -// Type filter mixin -export interface TypeFilter { - type?: string; -} - -// Category filter mixin -export interface CategoryFilter { - category?: string; -} - -// Price range filter mixin -export interface PriceRangeFilter { - priceRange?: { min: number; max: number }; -} - -// Composed filter types (business logic) -export interface BillingFilter extends BaseFilter, StatusFilter, AmountFilter {} -export interface SubscriptionFilter extends BaseFilter, StatusFilter, TypeFilter {} -export interface OrderFilter extends BaseFilter, StatusFilter, AmountFilter {} -export interface CatalogFilter extends BaseFilter, CategoryFilter, PriceRangeFilter { - category?: "internet" | "sim" | "vpn" | "hosting" | "addon"; -} - -// Generic pagination (business logic) -export interface PaginationParams { - page?: number; - limit?: number; - offset?: number; -} - -// Generic sort options (business logic) -export interface SortOptions { - sortBy?: string; - sortOrder?: "asc" | "desc"; -} - -// Complete query interface (business logic) -export interface QueryFilter extends BaseFilter, PaginationParams, SortOptions { - [key: string]: unknown; -} diff --git a/packages/domain/src/utils/index.d.ts b/packages/domain/src/utils/index.d.ts deleted file mode 100644 index afc34faa..00000000 --- a/packages/domain/src/utils/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./validation"; -export * from "./array-utils"; -export * from "./filters"; -export * from "./currency"; diff --git a/packages/domain/src/utils/index.js b/packages/domain/src/utils/index.js deleted file mode 100644 index df3d99ab..00000000 --- a/packages/domain/src/utils/index.js +++ /dev/null @@ -1,21 +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("./validation"), exports); -__exportStar(require("./array-utils"), exports); -__exportStar(require("./filters"), exports); -__exportStar(require("./currency"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/index.js.map b/packages/domain/src/utils/index.js.map deleted file mode 100644 index 158c2197..00000000 --- a/packages/domain/src/utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+CAA6B;AAC7B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B"} \ No newline at end of file diff --git a/packages/domain/src/utils/index.ts b/packages/domain/src/utils/index.ts deleted file mode 100644 index e8fe893e..00000000 --- a/packages/domain/src/utils/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Export all utilities -export * from "./validation"; -export * from "./array-utils"; -export * from "./filters"; -export * from "./currency"; diff --git a/packages/domain/src/utils/type-utils.d.ts b/packages/domain/src/utils/type-utils.d.ts deleted file mode 100644 index 369ebeb4..00000000 --- a/packages/domain/src/utils/type-utils.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import type { BaseEntity } from "../common"; -export type WithId = T & { - id: string; -}; -export type WithTimestamps = T & BaseEntity; -export type CreateInput = Omit; -export type UpdateInput = Partial>; -export type WithOptionalId = T & { - id?: string; -}; -export type WithOptionalTimestamps = T & Partial>; -export type ApiEndpoint = TParams extends void ? () => Promise : (params: TParams) => Promise; -export type RequestWithId = T & { - id: string; -}; -export type ResponseWithMeta = T & { - meta?: { - timestamp: string; - requestId?: string; - version?: string; - }; -}; -export type FormData = { - [K in keyof T]: T[K] extends string | number | boolean | Date | null | undefined ? T[K] : never; -}; -export type ValidationResult = { - isValid: boolean; - errors: Partial>; -}; -export type FormValidator = (data: Partial) => ValidationResult; -export type SelectionState = { - selected: T[]; - selectAll: boolean; - indeterminate: boolean; -}; -export type SelectionActions = { - selectItem: (item: T) => void; - deselectItem: (item: T) => void; - selectAll: () => void; - deselectAll: () => void; - toggleItem: (item: T) => void; - toggleAll: () => void; -}; -export type FilterState = { - filters: T; - activeCount: number; -}; -export type DateRangeFilter = { - startDate?: string; - endDate?: string; -}; -export type SearchFilter = { - query: string; - fields?: string[]; -}; -export type StatusFilter = { - statuses: T[]; -}; -export type AsyncOperationMeta = { - startTime: number; - endTime?: number; - duration?: number; - retryCount?: number; -}; -export type AsyncOperationWithMeta = { - data: T; - meta: AsyncOperationMeta; -}; -export type PartialBy = Omit & Partial>; -export type RequiredBy = T & Required>; -export type DeepPartial = { - [P in keyof T]?: T[P] extends object ? DeepPartial : T[P]; -}; -export type DeepReadonly = { - readonly [P in keyof T]: T[P] extends object ? DeepReadonly : T[P]; -}; -export type KeysOfType = { - [K in keyof T]: T[K] extends U ? K : never; -}[keyof T]; -export type NonNullable = T extends null | undefined ? never : T; -export type IsArray = T extends readonly unknown[] ? true : false; -export type IsObject = T extends object ? true : false; -export type IsFunction = T extends (...args: unknown[]) => unknown ? true : false; -export type ArrayElement = T extends readonly (infer U)[] ? U : never; -export type PromiseType = T extends Promise ? U : never; -export type ReturnTypeOf = T extends (...args: unknown[]) => infer R ? R : never; -export type ParametersOf = T extends (...args: infer P) => unknown ? P : never; diff --git a/packages/domain/src/utils/type-utils.js b/packages/domain/src/utils/type-utils.js deleted file mode 100644 index 3cc79891..00000000 --- a/packages/domain/src/utils/type-utils.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=type-utils.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/type-utils.js.map b/packages/domain/src/utils/type-utils.js.map deleted file mode 100644 index 738a8551..00000000 --- a/packages/domain/src/utils/type-utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type-utils.js","sourceRoot":"","sources":["type-utils.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/utils/type-utils.ts b/packages/domain/src/utils/type-utils.ts deleted file mode 100644 index c84e1ee7..00000000 --- a/packages/domain/src/utils/type-utils.ts +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Common Utility Types - */ - -import type { BaseEntity } from "../common"; - -// ===================================================== -// ENTITY UTILITIES -// ===================================================== - -// Entity utilities -export type WithId = T & { id: string }; -export type WithTimestamps = T & BaseEntity; -export type CreateInput = Omit; -export type UpdateInput = Partial>; - -// Optional field utilities -export type WithOptionalId = T & { id?: string }; -export type WithOptionalTimestamps = T & Partial>; - -// ===================================================== -// API UTILITIES -// ===================================================== - -// API endpoint type utilities -export type ApiEndpoint = TParams extends void - ? () => Promise - : (params: TParams) => Promise; - -// Request/Response utilities -export type RequestWithId = T & { id: string }; -export type ResponseWithMeta = T & { - meta?: { - timestamp: string; - requestId?: string; - version?: string; - }; -}; - -// ===================================================== -// FORM UTILITIES -// ===================================================== - -// Form data type that only includes serializable fields -export type FormData = { - [K in keyof T]: T[K] extends string | number | boolean | Date | null | undefined ? T[K] : never; -}; - -// Form validation utilities -export type ValidationResult = { - isValid: boolean; - errors: Partial>; -}; - -export type FormValidator = (data: Partial) => ValidationResult; - -// ===================================================== -// SELECTION UTILITIES -// ===================================================== - -// Selection state for lists and tables -export type SelectionState = { - selected: T[]; - selectAll: boolean; - indeterminate: boolean; -}; - -// Selection actions -export type SelectionActions = { - selectItem: (item: T) => void; - deselectItem: (item: T) => void; - selectAll: () => void; - deselectAll: () => void; - toggleItem: (item: T) => void; - toggleAll: () => void; -}; - -// ===================================================== -// FILTER UTILITIES -// ===================================================== - -// Filter state for search and filtering -export type FilterState = { - filters: T; - activeCount: number; -}; - -// Common filter types -export type DateRangeFilter = { - startDate?: string; - endDate?: string; -}; - -export type SearchFilter = { - query: string; - fields?: string[]; -}; - -export type StatusFilter = { - statuses: T[]; -}; - -// ===================================================== -// ASYNC OPERATION UTILITIES -// ===================================================== - -// Async operation metadata -export type AsyncOperationMeta = { - startTime: number; - endTime?: number; - duration?: number; - retryCount?: number; -}; - -// Async operation with metadata -export type AsyncOperationWithMeta = { - data: T; - meta: AsyncOperationMeta; -}; - -// ===================================================== -// UTILITY TYPE HELPERS -// ===================================================== - -// Make specific fields optional -export type PartialBy = Omit & Partial>; - -// Make specific fields required -export type RequiredBy = T & Required>; - -// Deep partial type -export type DeepPartial = { - [P in keyof T]?: T[P] extends object ? DeepPartial : T[P]; -}; - -// Deep readonly type -export type DeepReadonly = { - readonly [P in keyof T]: T[P] extends object ? DeepReadonly : T[P]; -}; - -// Extract keys of a specific type -export type KeysOfType = { - [K in keyof T]: T[K] extends U ? K : never; -}[keyof T]; - -// Non-nullable type -export type NonNullable = T extends null | undefined ? never : T; - -// ===================================================== -// CONDITIONAL TYPE UTILITIES -// ===================================================== - -// Check if type is array -export type IsArray = T extends readonly unknown[] ? true : false; - -// Check if type is object -export type IsObject = T extends object ? true : false; - -// Check if type is function -export type IsFunction = T extends (...args: unknown[]) => unknown ? true : false; - -// Extract array element type -export type ArrayElement = T extends readonly (infer U)[] ? U : never; - -// Extract promise type -export type PromiseType = T extends Promise ? U : never; - -// Extract function return type -export type ReturnTypeOf = T extends (...args: unknown[]) => infer R ? R : never; - -// Extract function parameters -export type ParametersOf = T extends (...args: infer P) => unknown ? P : never; diff --git a/packages/domain/src/utils/validation.d.ts b/packages/domain/src/utils/validation.d.ts deleted file mode 100644 index 76406f9a..00000000 --- a/packages/domain/src/utils/validation.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type ValidationResult = { - success: true; - data: T; -} | { - success: false; - error: string; - errors?: Record; -}; -export declare function success(data: T): ValidationResult; -export declare function failure(error: string, errors?: Record): ValidationResult; -export declare function validateEmail(email: string): ValidationResult; -export declare function validatePhoneNumber(phone: string): ValidationResult; -export declare function isStrongPassword(password: string): boolean; -export declare function isValidUUID(uuid: string): boolean; -export declare function sanitizeString(input: string): string; -export declare function formatDate(date: Date | string, locale?: string): string; -export declare function truncateString(str: string, maxLength: number): string; diff --git a/packages/domain/src/utils/validation.js b/packages/domain/src/utils/validation.js deleted file mode 100644 index ceded2b7..00000000 --- a/packages/domain/src/utils/validation.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.success = success; -exports.failure = failure; -exports.validateEmail = validateEmail; -exports.validatePhoneNumber = validatePhoneNumber; -exports.isStrongPassword = isStrongPassword; -exports.isValidUUID = isValidUUID; -exports.sanitizeString = sanitizeString; -exports.formatDate = formatDate; -exports.truncateString = truncateString; -function success(data) { - return { success: true, data }; -} -function failure(error, errors) { - return { success: false, error, errors }; -} -function validateEmail(email) { - if (!email || typeof email !== "string") { - return failure("Email is required"); - } - const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - if (!emailRegex.test(email)) { - return failure("Invalid email format"); - } - const trimmed = email.trim().toLowerCase(); - if (trimmed.length > 254) { - return failure("Email is too long"); - } - return success(trimmed); -} -function validatePhoneNumber(phone) { - if (!phone || typeof phone !== "string") { - return failure("Phone number is required"); - } - const phoneRegex = /^\+?[\d\s\-()]{10,}$/; - if (!phoneRegex.test(phone)) { - return failure("Invalid phone number format"); - } - const cleaned = phone.replace(/[\s\-()]/g, ""); - if (cleaned.length < 10) { - return failure("Phone number is too short"); - } - return success(cleaned); -} -function isStrongPassword(password) { - const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/; - return passwordRegex.test(password); -} -function isValidUUID(uuid) { - const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; - return uuidRegex.test(uuid); -} -function sanitizeString(input) { - return input - .replace(/)<[^<]*)*<\/script>/gi, "") - .replace(/<[^>]*>/g, "") - .trim(); -} -function formatDate(date, locale = "en-US") { - const dateObj = typeof date === "string" ? new Date(date) : date; - return dateObj.toLocaleDateString(locale); -} -function truncateString(str, maxLength) { - if (str.length <= maxLength) - return str; - return str.slice(0, maxLength - 3) + "..."; -} -//# sourceMappingURL=validation.js.map \ No newline at end of file diff --git a/packages/domain/src/utils/validation.js.map b/packages/domain/src/utils/validation.js.map deleted file mode 100644 index aadb0e30..00000000 --- a/packages/domain/src/utils/validation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"validation.js","sourceRoot":"","sources":["validation.ts"],"names":[],"mappings":";;AAmBA,0BAEC;AAKD,0BAEC;AAKD,sCAkBC;AAKD,kDAkBC;AAKD,4CAIC;AAKD,kCAGC;AAKD,wCAKC;AAKD,gCAGC;AAKD,wCAGC;AAlGD,SAAgB,OAAO,CAAI,IAAO;IAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAKD,SAAgB,OAAO,CAAI,KAAa,EAAE,MAAiC;IACzE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3C,CAAC;AAKD,SAAgB,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,UAAU,GAAG,4BAA4B,CAAC;IAEhD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,C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,SAAgB,UAAU,CAAC,IAAmB,EAAE,MAAM,GAAG,OAAO;IAC9D,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,OAAO,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAKD,SAAgB,cAAc,CAAC,GAAW,EAAE,SAAiB;IAC3D,IAAI,GAAG,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/utils/validation.ts b/packages/domain/src/utils/validation.ts deleted file mode 100644 index 16d64ebc..00000000 --- a/packages/domain/src/utils/validation.ts +++ /dev/null @@ -1,118 +0,0 @@ -// Modern validation utilities with ES2024 features - -/** - * Modern validation result type - */ -export type ValidationResult = - | { - success: true; - data: T; - } - | { - success: false; - error: string; - errors?: Record; - }; - -/** - * Create a successful validation result - */ -export function success(data: T): ValidationResult { - return { success: true, data }; -} - -/** - * Create a failed validation result - */ -export function failure(error: string, errors?: Record): ValidationResult { - return { success: false, error, errors }; -} - -/** - * Enhanced email validation with better error reporting - */ -export function validateEmail(email: string): ValidationResult { - if (!email || typeof email !== "string") { - return failure("Email is required"); - } - - const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - - if (!emailRegex.test(email)) { - return failure("Invalid email format"); - } - - const trimmed = email.trim().toLowerCase(); - - if (trimmed.length > 254) { - return failure("Email is too long"); - } - - return success(trimmed); -} - -/** - * Enhanced phone validation with better error reporting - */ -export function validatePhoneNumber(phone: string): ValidationResult { - if (!phone || typeof phone !== "string") { - return failure("Phone number is required"); - } - - const phoneRegex = /^\+?[\d\s\-()]{10,}$/; - - if (!phoneRegex.test(phone)) { - return failure("Invalid phone number format"); - } - - const cleaned = phone.replace(/[\s\-()]/g, ""); - - if (cleaned.length < 10) { - return failure("Phone number is too short"); - } - - return success(cleaned); -} - -/** - * Validates password strength - */ -export function isStrongPassword(password: string): boolean { - // At least 8 characters, one uppercase, one lowercase, one number - const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/; - return passwordRegex.test(password); -} - -/** - * Validates UUID format - */ -export function isValidUUID(uuid: string): boolean { - const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; - return uuidRegex.test(uuid); -} - -/** - * Sanitizes string by removing HTML tags and scripts - */ -export function sanitizeString(input: string): string { - return input - .replace(/)<[^<]*)*<\/script>/gi, "") - .replace(/<[^>]*>/g, "") - .trim(); -} - -/** - * Formats date to locale string - */ -export function formatDate(date: Date | string, locale = "en-US"): string { - const dateObj = typeof date === "string" ? new Date(date) : date; - return dateObj.toLocaleDateString(locale); -} - -/** - * Truncates string to specified length with ellipsis - */ -export function truncateString(str: string, maxLength: number): string { - if (str.length <= maxLength) return str; - return str.slice(0, maxLength - 3) + "..."; -} diff --git a/packages/domain/src/validation/api/requests.js.map b/packages/domain/src/validation/api/requests.js.map deleted file mode 100644 index 777474b5..00000000 --- a/packages/domain/src/validation/api/requests.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"requests.js","sourceRoot":"","sources":["requests.ts"],"names":[],"mappings":";;;AAMA,6BAAwB;AACxB,qDAQ8B;AAC9B,iDAAyD;AAEzD,MAAM,iBAAiB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAC5F,MAAM,sBAAsB,GAAG,OAAC,CAAC,IAAI,CAAC;IACpC,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,WAAW;IACX,SAAS;CACV,CAAC,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6DAA6D,CAC9D;SACA,QAAQ,EAAE;IACb,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/api/responses.js.map b/packages/domain/src/validation/api/responses.js.map deleted file mode 100644 index c91eb173..00000000 --- a/packages/domain/src/validation/api/responses.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"responses.js","sourceRoot":"","sources":["responses.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,iDAAuD;AAE1C,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,4BAAiB;IACvB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;QACf,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;QAC1D,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC;QAC5D,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC;QAC5D,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;QACpE,SAAS,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/business/index.d.ts b/packages/domain/src/validation/business/index.d.ts deleted file mode 100644 index a9739fa0..00000000 --- a/packages/domain/src/validation/business/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./orders"; diff --git a/packages/domain/src/validation/business/index.js.map b/packages/domain/src/validation/business/index.js.map deleted file mode 100644 index e20b8a03..00000000 --- a/packages/domain/src/validation/business/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,2CAAyB"} \ No newline at end of file diff --git a/packages/domain/src/validation/business/orders.d.ts b/packages/domain/src/validation/business/orders.d.ts deleted file mode 100644 index 0acf20a4..00000000 --- a/packages/domain/src/validation/business/orders.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { z } from "zod"; -export declare const orderBusinessValidationSchema: z.ZodObject<{ - orderType: z.ZodEnum<{ - Internet: "Internet"; - SIM: "SIM"; - VPN: "VPN"; - Other: "Other"; - }>; - skus: z.ZodArray; - configurations: z.ZodOptional>; - scheduledAt: z.ZodOptional; - accessMode: z.ZodOptional>; - simType: z.ZodOptional>; - eid: z.ZodOptional; - isMnp: z.ZodOptional; - mnpNumber: z.ZodOptional; - mnpExpiry: z.ZodOptional; - mnpPhone: z.ZodOptional; - mvnoAccountNumber: z.ZodOptional; - portingLastName: z.ZodOptional; - portingFirstName: z.ZodOptional; - portingLastNameKatakana: z.ZodOptional; - portingFirstNameKatakana: z.ZodOptional; - portingGender: z.ZodOptional>; - portingDateOfBirth: z.ZodOptional; - address: z.ZodOptional; - streetLine2: z.ZodNullable; - city: z.ZodNullable; - state: z.ZodNullable; - postalCode: z.ZodNullable; - country: z.ZodNullable; - }, z.core.$strip>>; - }, z.core.$strip>>; - userId: z.core.$ZodBranded; - opportunityId: z.ZodOptional; -}, z.core.$strip>; -export declare const skuValidationSchema: z.ZodObject<{ - sku: z.ZodString; - isActive: z.ZodBoolean; - productType: z.ZodEnum<{ - Internet: "Internet"; - SIM: "SIM"; - VPN: "VPN"; - Addon: "Addon"; - Fee: "Fee"; - }>; - price: z.ZodNumber; - currency: z.ZodString; -}, z.core.$strip>; -export declare const userMappingValidationSchema: z.ZodObject<{ - userId: z.core.$ZodBranded; - sfAccountId: z.ZodString; - whmcsClientId: z.ZodNumber; -}, z.core.$strip>; -export declare const paymentMethodValidationSchema: z.ZodObject<{ - userId: z.core.$ZodBranded; - whmcsClientId: z.ZodNumber; - hasValidPaymentMethod: z.ZodBoolean; - paymentMethods: z.ZodArray>; -}, z.core.$strip>; -export type OrderBusinessValidation = z.infer; -export type SkuValidation = z.infer; -export type UserMappingValidation = z.infer; -export type PaymentMethodValidation = z.infer; diff --git a/packages/domain/src/validation/business/orders.js.map b/packages/domain/src/validation/business/orders.js.map deleted file mode 100644 index f9a4953c..00000000 --- a/packages/domain/src/validation/business/orders.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"orders.js","sourceRoot":"","sources":["orders.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AACxB,8CAA2D;AAC3D,uDAAqD;AAMxC,QAAA,6BAA6B,GAAG,mCAAwB;KAClE,MAAM,CAAC;IACN,MAAM,EAAE,0BAAY;IACpB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC;KACD,MAAM,CACL,IAAI,CAAC,EAAE;IAEL,IAAI,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QAGlC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YAC7C,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACnC,OAAO,CACL,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC7B,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC3B,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAChC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC1B,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,EACD;IACE,OAAO,EACL,uFAAuF;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AC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC;IACzC,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE;IACrB,WAAW,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/D,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IAC/B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;CAC/B,CAAC,CAAC;AAGU,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,MAAM,EAAE,0BAAY;IACpB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,sDAAsD,CAAC;IACvF,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CAC7E,CAAC,CAAC;AAGU,QAAA,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IACpD,MAAM,EAAE,0BAAY;IACpB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC1C,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE;IAClC,cAAc,EAAE,OAAC,CAAC,KAAK,CACrB,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE;KACvB,CAAC,CACH;CACF,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/forms/auth.js b/packages/domain/src/validation/forms/auth.js deleted file mode 100644 index 0ea2980e..00000000 --- a/packages/domain/src/validation/forms/auth.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.changePasswordFormToRequest = exports.setPasswordFormToRequest = exports.passwordResetFormToRequest = exports.signupFormToRequest = exports.loginFormToRequest = exports.linkWhmcsFormSchema = exports.changePasswordFormSchema = exports.setPasswordFormSchema = exports.passwordResetFormSchema = exports.passwordResetRequestFormSchema = exports.signupFormSchema = exports.loginFormSchema = void 0; -const requests_1 = require("../api/requests"); -exports.loginFormSchema = requests_1.loginRequestSchema; -exports.signupFormSchema = requests_1.signupRequestSchema; -exports.passwordResetRequestFormSchema = requests_1.passwordResetRequestSchema; -exports.passwordResetFormSchema = requests_1.passwordResetSchema; -exports.setPasswordFormSchema = requests_1.setPasswordRequestSchema; -exports.changePasswordFormSchema = requests_1.changePasswordRequestSchema; -exports.linkWhmcsFormSchema = requests_1.linkWhmcsRequestSchema; -const loginFormToRequest = (formData) => requests_1.loginRequestSchema.parse(formData); -exports.loginFormToRequest = loginFormToRequest; -const signupFormToRequest = (formData) => requests_1.signupRequestSchema.parse(formData); -exports.signupFormToRequest = signupFormToRequest; -const passwordResetFormToRequest = (formData) => requests_1.passwordResetSchema.parse(formData); -exports.passwordResetFormToRequest = passwordResetFormToRequest; -const setPasswordFormToRequest = (formData) => requests_1.setPasswordRequestSchema.parse(formData); -exports.setPasswordFormToRequest = setPasswordFormToRequest; -const changePasswordFormToRequest = (formData) => requests_1.changePasswordRequestSchema.parse(formData); -exports.changePasswordFormToRequest = changePasswordFormToRequest; -//# sourceMappingURL=auth.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/forms/auth.js.map b/packages/domain/src/validation/forms/auth.js.map deleted file mode 100644 index 456a1b34..00000000 --- a/packages/domain/src/validation/forms/auth.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":";;;AAKA,8CAQyB;AAMZ,QAAA,eAAe,GAAG,6BAAkB,CAAC;AAErC,QAAA,gBAAgB,GAAG,8BAAmB,CAAC;AAEvC,QAAA,8BAA8B,GAAG,qCAA0B,CAAC;AAE5D,QAAA,uBAAuB,GAAG,8BAAmB,CAAC;AAE9C,QAAA,qBAAqB,GAAG,mCAAwB,CAAC;AAEjD,QAAA,wBAAwB,GAAG,sCAA2B,CAAC;AAEvD,QAAA,mBAAmB,GAAG,iCAAsB,CAAC;AAMnD,MAAM,kBAAkB,GAAG,CAAC,QAAuB,EAAoB,EAAE,CAC9E,6BAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AADxB,QAAA,kBAAkB,sBACM;AAE9B,MAAM,mBAAmB,GAAG,CAAC,QAAwB,EAAqB,EAAE,CACjF,8BAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AADzB,QAAA,mBAAmB,uBACM;AAE/B,MAAM,0BAA0B,GAAG,CAAC,QAA+B,EAAqB,EAAE,CAC/F,8BAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AADzB,QAAA,0BAA0B,8BACD;AAE/B,MAAM,wBAAwB,GAAG,CAAC,QAA6B,EAA0B,EAAE,CAChG,mCAAwB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAD9B,QAAA,wBAAwB,4BACM;AAEpC,MAAM,2BAA2B,GAAG,CACzC,QAAgC,EACL,EAAE,CAAC,sCAA2B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAF/D,QAAA,2BAA2B,+BAEoC"} \ No newline at end of file diff --git a/packages/domain/src/validation/forms/profile.d.ts b/packages/domain/src/validation/forms/profile.d.ts deleted file mode 100644 index 2c9f80ae..00000000 --- a/packages/domain/src/validation/forms/profile.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod"; -export declare const profileEditFormSchema: any; -export declare const profileDisplaySchema: any; -export declare const addressFormSchema: z.ZodObject<{ - street: z.ZodString; - streetLine2: z.ZodOptional; - city: z.ZodString; - state: z.ZodString; - postalCode: z.ZodString; - country: z.ZodString; -}, z.core.$strip>; -export declare const contactFormSchema: any; -export declare const profileFormToRequest: (formData: ProfileEditFormData) => UpdateProfileRequestData; -export declare const addressFormToRequest: (formData: AddressFormData) => UpdateAddressRequestData; -export declare const contactFormToRequest: (formData: ContactFormData) => ContactRequestData; -import type { UpdateProfileRequest as UpdateProfileRequestData, ContactRequest as ContactRequestData, UpdateAddressRequest as UpdateAddressRequestData } from "../api/requests"; -export type ProfileEditFormData = z.infer; -export type ProfileDisplayData = z.infer; -export type AddressFormData = z.infer; -export type ContactFormData = z.infer; -export type { UpdateProfileRequestData, UpdateAddressRequestData, ContactRequestData }; diff --git a/packages/domain/src/validation/forms/profile.js b/packages/domain/src/validation/forms/profile.js deleted file mode 100644 index d9c9452f..00000000 --- a/packages/domain/src/validation/forms/profile.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.contactFormToRequest = exports.addressFormToRequest = exports.profileFormToRequest = exports.contactFormSchema = exports.addressFormSchema = exports.profileDisplaySchema = exports.profileEditFormSchema = void 0; -const zod_1 = require("zod"); -const requests_1 = require("../api/requests"); -const primitives_1 = require("../shared/primitives"); -exports.profileEditFormSchema = requests_1.updateProfileRequestSchema.extend({ - firstName: primitives_1.nameSchema, - lastName: primitives_1.nameSchema, -}); -exports.profileDisplaySchema = exports.profileEditFormSchema.extend({ - email: primitives_1.emailSchema, -}); -exports.addressFormSchema = primitives_1.requiredAddressSchema; -exports.contactFormSchema = requests_1.contactRequestSchema.extend({ - priority: zod_1.z.enum(["low", "medium", "high", "urgent"]).optional().default("medium"), -}); -const profileFormToRequest = (formData) => { - return formData; -}; -exports.profileFormToRequest = profileFormToRequest; -const addressFormToRequest = (formData) => { - return { - street: formData.street || null, - streetLine2: formData.streetLine2 || null, - city: formData.city || null, - state: formData.state || null, - postalCode: formData.postalCode || null, - country: formData.country || null, - }; -}; -exports.addressFormToRequest = addressFormToRequest; -const contactFormToRequest = (formData) => { - return { - ...formData, - priority: formData.priority || "medium", - }; -}; -exports.contactFormToRequest = contactFormToRequest; -//# sourceMappingURL=profile.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/forms/profile.js.map b/packages/domain/src/validation/forms/profile.js.map deleted file mode 100644 index 9d108d67..00000000 --- a/packages/domain/src/validation/forms/profile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"profile.js","sourceRoot":"","sources":["profile.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AACxB,8CAAmF;AACnF,qDAAsF;AAMzE,QAAA,qBAAqB,GAAG,qCAA0B,CAAC,MAAM,CAAC;IAErE,SAAS,EAAE,uBAAU;IACrB,QAAQ,EAAE,uBAAU;CACrB,CAAC,CAAC;AAGU,QAAA,oBAAoB,GAAG,6BAAqB,CAAC,MAAM,CAAC;IAC/D,KAAK,EAAE,wBAAW;CACnB,CAAC,CAAC;AAGU,QAAA,iBAAiB,GAAG,kCAAqB,CAAC;AAG1C,QAAA,iBAAiB,GAAG,+BAAoB,CAAC,MAAM,CAAC;IAE3D,QAAQ,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;CACnF,CAAC,CAAC;AAMI,MAAM,oBAAoB,GAAG,CAAC,QAA6B,EAA4B,EAAE;IAC9F,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B;AAEK,MAAM,oBAAoB,GAAG,CAAC,QAAyB,EAA4B,EAAE;IAE1F,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,IAAI;QAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,IAAI;QACzC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI;QAC3B,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,IAAI;QAC7B,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,IAAI;QACvC,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,IAAI;KAClC,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,oBAAoB,wBAU/B;AAEK,MAAM,oBAAoB,GAAG,CAAC,QAAyB,EAAsB,EAAE;IAEpF,OAAO;QACL,GAAG,QAAQ;QACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,QAAQ;KACxC,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B"} \ No newline at end of file diff --git a/packages/domain/src/validation/forms/profile.ts b/packages/domain/src/validation/forms/profile.ts deleted file mode 100644 index 0fcf13ca..00000000 --- a/packages/domain/src/validation/forms/profile.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Profile Form Schemas - * Frontend form schemas for profile and address management - */ - -import { z } from "zod"; -import { updateProfileRequestSchema, contactRequestSchema } from "../api/requests"; -import { requiredAddressSchema, nameSchema, emailSchema } from "../shared/primitives"; - -// ===================================================== -// PROFILE FORM SCHEMAS -// ===================================================== - -export const profileEditFormSchema = updateProfileRequestSchema.extend({ - // Make fields required for the form (even though API accepts partial updates) - firstName: nameSchema, - lastName: nameSchema, -}); - -// Profile display schema includes non-editable fields like email -export const profileDisplaySchema = profileEditFormSchema.extend({ - email: emailSchema, // Read-only field for display -}); - -// Use required address schema for forms where address is mandatory -export const addressFormSchema = requiredAddressSchema; - -// Contact form extends the API schema with user-friendly defaults -export const contactFormSchema = contactRequestSchema.extend({ - // Make priority optional in the form with a default - priority: z.enum(["low", "medium", "high", "urgent"]).optional().default("medium"), -}); - -// ===================================================== -// FORM TO API TRANSFORMATIONS -// ===================================================== - -export const profileFormToRequest = (formData: ProfileEditFormData): UpdateProfileRequestData => { - return formData; -}; - -export const addressFormToRequest = (formData: AddressFormData): UpdateAddressRequestData => { - // Convert required address form data to nullable address request data - return { - street: formData.street || null, - streetLine2: formData.streetLine2 || null, - city: formData.city || null, - state: formData.state || null, - postalCode: formData.postalCode || null, - country: formData.country || null, - }; -}; - -export const contactFormToRequest = (formData: ContactFormData): ContactRequestData => { - // Ensure priority has a default value - return { - ...formData, - priority: formData.priority || "medium", - }; -}; - -// ===================================================== -// TYPE EXPORTS -// ===================================================== - -// Import API types -import type { - UpdateProfileRequest as UpdateProfileRequestData, - ContactRequest as ContactRequestData, - UpdateAddressRequest as UpdateAddressRequestData, -} from "../api/requests"; - - -// Export form types and API request types -export type ProfileEditFormData = z.infer; -export type ProfileDisplayData = z.infer; -export type AddressFormData = z.infer; -export type ContactFormData = z.infer; - -export type { UpdateProfileRequestData, UpdateAddressRequestData, ContactRequestData }; diff --git a/packages/domain/src/validation/forms/sim-configure.d.ts b/packages/domain/src/validation/forms/sim-configure.d.ts deleted file mode 100644 index 01d35153..00000000 --- a/packages/domain/src/validation/forms/sim-configure.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { z } from "zod"; -export declare const simTypeEnum: z.ZodEnum<{ - eSIM: "eSIM"; - "Physical SIM": "Physical SIM"; -}>; -export declare const activationTypeEnum: z.ZodEnum<{ - Immediate: "Immediate"; - Scheduled: "Scheduled"; -}>; -export declare const mnpGenderEnum: z.ZodEnum<{ - "": ""; - Male: "Male"; - Female: "Female"; - "Corporate/Other": "Corporate/Other"; -}>; -export declare const mnpDataSchema: z.ZodObject<{ - reservationNumber: z.ZodString; - expiryDate: z.ZodString; - phoneNumber: z.ZodString; - mvnoAccountNumber: z.ZodString; - portingLastName: z.ZodString; - portingFirstName: z.ZodString; - portingLastNameKatakana: z.ZodString; - portingFirstNameKatakana: z.ZodString; - portingGender: z.ZodEnum<{ - "": ""; - Male: "Male"; - Female: "Female"; - "Corporate/Other": "Corporate/Other"; - }>; - portingDateOfBirth: z.ZodString; -}, z.core.$strip>; -export declare const simConfigureFormSchema: z.ZodObject<{ - simType: z.ZodEnum<{ - eSIM: "eSIM"; - "Physical SIM": "Physical SIM"; - }>; - eid: z.ZodOptional; - selectedAddons: z.ZodDefault>; - activationType: z.ZodEnum<{ - Immediate: "Immediate"; - Scheduled: "Scheduled"; - }>; - scheduledActivationDate: z.ZodOptional; - wantsMnp: z.ZodDefault; - mnpData: z.ZodOptional; - portingDateOfBirth: z.ZodString; - }, z.core.$strip>>; -}, z.core.$strip>; -export type SimType = z.infer; -export type ActivationType = z.infer; -export type MnpGender = z.infer; -export type MnpData = z.infer; -export type SimConfigureFormData = z.infer; -export declare const simConfigureFormToRequest: (formData: SimConfigureFormData) => { - simType: "eSIM" | "Physical SIM"; - eid: string | null; - selectedAddons: string[]; - activationType: "Immediate" | "Scheduled"; - scheduledActivationDate: string | null; - wantsMnp: boolean; - mnpData: { - reservationNumber: string; - expiryDate: string; - phoneNumber: string; - mvnoAccountNumber: string; - portingLastName: string; - portingFirstName: string; - portingLastNameKatakana: string; - portingFirstNameKatakana: string; - portingGender: "" | "Male" | "Female" | "Corporate/Other"; - portingDateOfBirth: string; - } | null; -}; diff --git a/packages/domain/src/validation/forms/sim-configure.js b/packages/domain/src/validation/forms/sim-configure.js deleted file mode 100644 index 525fbde5..00000000 --- a/packages/domain/src/validation/forms/sim-configure.js +++ /dev/null @@ -1,97 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.simConfigureFormToRequest = exports.simConfigureFormSchema = exports.mnpDataSchema = exports.mnpGenderEnum = exports.activationTypeEnum = exports.simTypeEnum = void 0; -const zod_1 = require("zod"); -exports.simTypeEnum = zod_1.z.enum(["eSIM", "Physical SIM"]); -exports.activationTypeEnum = zod_1.z.enum(["Immediate", "Scheduled"]); -exports.mnpGenderEnum = zod_1.z.enum(["Male", "Female", "Corporate/Other", ""]); -exports.mnpDataSchema = zod_1.z.object({ - reservationNumber: zod_1.z.string().min(1, "Reservation number is required"), - expiryDate: zod_1.z.string().min(1, "Expiry date is required"), - phoneNumber: zod_1.z.string().min(1, "Phone number is required"), - mvnoAccountNumber: zod_1.z.string().min(1, "MVNO account number is required"), - portingLastName: zod_1.z.string().min(1, "Last name is required"), - portingFirstName: zod_1.z.string().min(1, "First name is required"), - portingLastNameKatakana: zod_1.z.string().min(1, "Last name (Katakana) is required"), - portingFirstNameKatakana: zod_1.z.string().min(1, "First name (Katakana) is required"), - portingGender: exports.mnpGenderEnum, - portingDateOfBirth: zod_1.z.string().min(1, "Date of birth is required"), -}); -exports.simConfigureFormSchema = zod_1.z - .object({ - simType: exports.simTypeEnum, - eid: zod_1.z.string().optional(), - selectedAddons: zod_1.z.array(zod_1.z.string()).default([]), - activationType: exports.activationTypeEnum, - scheduledActivationDate: zod_1.z.string().optional(), - wantsMnp: zod_1.z.boolean().default(false), - mnpData: exports.mnpDataSchema.optional(), -}) - .superRefine((data, ctx) => { - if (data.simType === "eSIM") { - if (!data.eid || data.eid.trim().length === 0) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "EID is required for eSIM activation", - path: ["eid"], - }); - } - else if (data.eid.length < 15) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "EID must be at least 15 characters", - path: ["eid"], - }); - } - } - if (data.activationType === "Scheduled") { - if (!data.scheduledActivationDate) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "Activation date is required when scheduling activation", - path: ["scheduledActivationDate"], - }); - } - else { - const selectedDate = new Date(data.scheduledActivationDate); - const today = new Date(); - today.setHours(0, 0, 0, 0); - if (selectedDate < today) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "Activation date cannot be in the past", - path: ["scheduledActivationDate"], - }); - } - const maxDate = new Date(); - maxDate.setDate(maxDate.getDate() + 30); - if (selectedDate > maxDate) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "Activation date cannot be more than 30 days in the future", - path: ["scheduledActivationDate"], - }); - } - } - } - if (data.wantsMnp && !data.mnpData) { - ctx.addIssue({ - code: zod_1.z.ZodIssueCode.custom, - message: "MNP data is required when mobile number portability is selected", - path: ["mnpData"], - }); - } -}); -const simConfigureFormToRequest = (formData) => { - return { - simType: formData.simType, - eid: formData.eid || null, - selectedAddons: formData.selectedAddons, - activationType: formData.activationType, - scheduledActivationDate: formData.scheduledActivationDate || null, - wantsMnp: formData.wantsMnp, - mnpData: formData.mnpData || null, - }; -}; -exports.simConfigureFormToRequest = simConfigureFormToRequest; -//# sourceMappingURL=sim-configure.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/forms/sim-configure.js.map b/packages/domain/src/validation/forms/sim-configure.js.map deleted file mode 100644 index 53f38964..00000000 --- a/packages/domain/src/validation/forms/sim-configure.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sim-configure.js","sourceRoot":"","sources":["sim-configure.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGX,QAAA,WAAW,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AAC/C,QAAA,kBAAkB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AACxD,QAAA,aAAa,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC;AAGlE,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gCAAgC,CAAC;IACtE,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;IACxD,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;IAC1D,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,iCAAiC,CAAC;IACvE,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IAC3D,gBAAgB,EAAE,OAAC,CAAC,MAAM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AAO,EAAE,2DAA2D;oBACpE,IAAI,EAAE,CAAC,yBAAyB,CAAC;iBAClC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAGD,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,iEAAiE;YAC1E,IAAI,EAAE,CAAC,SAAS,CAAC;SAClB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAUE,MAAM,yBAAyB,GAAG,CAAC,QAA8B,EAAE,EAAE;IAC1E,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,IAAI;QACzB,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,uBAAuB,EAAE,QAAQ,CAAC,uBAAuB,IAAI,IAAI;QACjE,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,IAAI;KAClC,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC"} \ No newline at end of file diff --git a/packages/domain/src/validation/forms/sim-configure.ts b/packages/domain/src/validation/forms/sim-configure.ts deleted file mode 100644 index 36c2167f..00000000 --- a/packages/domain/src/validation/forms/sim-configure.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { z } from "zod"; - -// SIM configuration enums -export const simTypeEnum = z.enum(["eSIM", "Physical SIM"]); -export const activationTypeEnum = z.enum(["Immediate", "Scheduled"]); -export const mnpGenderEnum = z.enum(["Male", "Female", "Corporate/Other", ""]); - -// MNP (Mobile Number Portability) data schema -export const mnpDataSchema = z.object({ - reservationNumber: z.string().min(1, "Reservation number is required"), - expiryDate: z.string().min(1, "Expiry date is required"), - phoneNumber: z.string().min(1, "Phone number is required"), - mvnoAccountNumber: z.string().min(1, "MVNO account number is required"), - portingLastName: z.string().min(1, "Last name is required"), - portingFirstName: z.string().min(1, "First name is required"), - portingLastNameKatakana: z.string().min(1, "Last name (Katakana) is required"), - portingFirstNameKatakana: z.string().min(1, "First name (Katakana) is required"), - portingGender: mnpGenderEnum, - portingDateOfBirth: z.string().min(1, "Date of birth is required"), -}); - -// SIM configuration form schema -export const simConfigureFormSchema = z - .object({ - // Basic SIM configuration - simType: simTypeEnum, - eid: z.string().optional(), - - // Selected addons - selectedAddons: z.array(z.string()).default([]), - - // Activation configuration - activationType: activationTypeEnum, - scheduledActivationDate: z.string().optional(), - - // MNP configuration - wantsMnp: z.boolean().default(false), - mnpData: mnpDataSchema.optional(), - }) - .superRefine((data, ctx) => { - // EID validation for eSIM - if (data.simType === "eSIM") { - if (!data.eid || data.eid.trim().length === 0) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "EID is required for eSIM activation", - path: ["eid"], - }); - } else if (data.eid.length < 15) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "EID must be at least 15 characters", - path: ["eid"], - }); - } - } - - // Scheduled activation date validation - if (data.activationType === "Scheduled") { - if (!data.scheduledActivationDate) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "Activation date is required when scheduling activation", - path: ["scheduledActivationDate"], - }); - } else { - const selectedDate = new Date(data.scheduledActivationDate); - const today = new Date(); - today.setHours(0, 0, 0, 0); - - if (selectedDate < today) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "Activation date cannot be in the past", - path: ["scheduledActivationDate"], - }); - } - - const maxDate = new Date(); - maxDate.setDate(maxDate.getDate() + 30); - - if (selectedDate > maxDate) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "Activation date cannot be more than 30 days in the future", - path: ["scheduledActivationDate"], - }); - } - } - } - - // MNP data validation - if (data.wantsMnp && !data.mnpData) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: "MNP data is required when mobile number portability is selected", - path: ["mnpData"], - }); - } - }); - -// Type exports -export type SimType = z.infer; -export type ActivationType = z.infer; -export type MnpGender = z.infer; -export type MnpData = z.infer; -export type SimConfigureFormData = z.infer; - -// Transformation function for API requests -export const simConfigureFormToRequest = (formData: SimConfigureFormData) => { - return { - simType: formData.simType, - eid: formData.eid || null, - selectedAddons: formData.selectedAddons, - activationType: formData.activationType, - scheduledActivationDate: formData.scheduledActivationDate || null, - wantsMnp: formData.wantsMnp, - mnpData: formData.mnpData || null, - }; -}; diff --git a/packages/domain/src/validation/index.js b/packages/domain/src/validation/index.js deleted file mode 100644 index 4a3eb4f2..00000000 --- a/packages/domain/src/validation/index.js +++ /dev/null @@ -1,92 +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 }); -exports.mnpGenderEnum = exports.activationTypeEnum = exports.simTypeEnum = exports.contactFormToRequest = exports.addressFormToRequest = exports.profileFormToRequest = exports.contactFormSchema = exports.addressFormSchema = exports.profileDisplaySchema = exports.profileEditFormSchema = exports.setPasswordFormToRequest = exports.passwordResetFormToRequest = exports.signupFormToRequest = exports.loginFormToRequest = exports.linkWhmcsFormSchema = exports.setPasswordFormSchema = exports.passwordResetFormSchema = exports.passwordResetRequestFormSchema = exports.signupFormSchema = exports.loginFormSchema = exports.authResponseSchema = exports.sfOrderIdParamSchema = exports.invoicePaymentLinkSchema = exports.subscriptionQuerySchema = exports.paginationQuerySchema = exports.invoiceListQuerySchema = exports.invoiceListSchema = exports.invoiceSchema = exports.invoiceItemSchema = exports.contactRequestSchema = exports.simFeaturesRequestSchema = exports.simChangePlanRequestSchema = exports.simCancelRequestSchema = exports.simTopupRequestSchema = exports.orderConfigurationsSchema = exports.createOrderRequestSchema = exports.updateAddressRequestSchema = exports.updateProfileRequestSchema = exports.refreshTokenRequestSchema = exports.checkPasswordNeededRequestSchema = exports.ssoLinkRequestSchema = exports.accountStatusRequestSchema = exports.validateSignupRequestSchema = exports.linkWhmcsRequestSchema = exports.changePasswordRequestSchema = exports.setPasswordRequestSchema = exports.passwordResetSchema = exports.passwordResetRequestSchema = exports.signupRequestSchema = exports.loginRequestSchema = void 0; -exports.safeParse = exports.parseOrThrow = exports.z = exports.paymentMethodValidationSchema = exports.userMappingValidationSchema = exports.skuValidationSchema = exports.orderBusinessValidationSchema = exports.simConfigureFormToRequest = exports.simConfigureFormSchema = exports.mnpDataSchema = void 0; -__exportStar(require("./shared/primitives"), exports); -__exportStar(require("./shared/identifiers"), exports); -__exportStar(require("./shared/common"), exports); -__exportStar(require("./shared/utilities"), exports); -__exportStar(require("./shared/entities"), exports); -__exportStar(require("./shared/order"), exports); -var requests_1 = require("./api/requests"); -Object.defineProperty(exports, "loginRequestSchema", { enumerable: true, get: function () { return requests_1.loginRequestSchema; } }); -Object.defineProperty(exports, "signupRequestSchema", { enumerable: true, get: function () { return requests_1.signupRequestSchema; } }); -Object.defineProperty(exports, "passwordResetRequestSchema", { enumerable: true, get: function () { return requests_1.passwordResetRequestSchema; } }); -Object.defineProperty(exports, "passwordResetSchema", { enumerable: true, get: function () { return requests_1.passwordResetSchema; } }); -Object.defineProperty(exports, "setPasswordRequestSchema", { enumerable: true, get: function () { return requests_1.setPasswordRequestSchema; } }); -Object.defineProperty(exports, "changePasswordRequestSchema", { enumerable: true, get: function () { return requests_1.changePasswordRequestSchema; } }); -Object.defineProperty(exports, "linkWhmcsRequestSchema", { enumerable: true, get: function () { return requests_1.linkWhmcsRequestSchema; } }); -Object.defineProperty(exports, "validateSignupRequestSchema", { enumerable: true, get: function () { return requests_1.validateSignupRequestSchema; } }); -Object.defineProperty(exports, "accountStatusRequestSchema", { enumerable: true, get: function () { return requests_1.accountStatusRequestSchema; } }); -Object.defineProperty(exports, "ssoLinkRequestSchema", { enumerable: true, get: function () { return requests_1.ssoLinkRequestSchema; } }); -Object.defineProperty(exports, "checkPasswordNeededRequestSchema", { enumerable: true, get: function () { return requests_1.checkPasswordNeededRequestSchema; } }); -Object.defineProperty(exports, "refreshTokenRequestSchema", { enumerable: true, get: function () { return requests_1.refreshTokenRequestSchema; } }); -Object.defineProperty(exports, "updateProfileRequestSchema", { enumerable: true, get: function () { return requests_1.updateProfileRequestSchema; } }); -Object.defineProperty(exports, "updateAddressRequestSchema", { enumerable: true, get: function () { return requests_1.updateAddressRequestSchema; } }); -Object.defineProperty(exports, "createOrderRequestSchema", { enumerable: true, get: function () { return requests_1.createOrderRequestSchema; } }); -Object.defineProperty(exports, "orderConfigurationsSchema", { enumerable: true, get: function () { return requests_1.orderConfigurationsSchema; } }); -Object.defineProperty(exports, "simTopupRequestSchema", { enumerable: true, get: function () { return requests_1.simTopupRequestSchema; } }); -Object.defineProperty(exports, "simCancelRequestSchema", { enumerable: true, get: function () { return requests_1.simCancelRequestSchema; } }); -Object.defineProperty(exports, "simChangePlanRequestSchema", { enumerable: true, get: function () { return requests_1.simChangePlanRequestSchema; } }); -Object.defineProperty(exports, "simFeaturesRequestSchema", { enumerable: true, get: function () { return requests_1.simFeaturesRequestSchema; } }); -Object.defineProperty(exports, "contactRequestSchema", { enumerable: true, get: function () { return requests_1.contactRequestSchema; } }); -Object.defineProperty(exports, "invoiceItemSchema", { enumerable: true, get: function () { return requests_1.invoiceItemSchema; } }); -Object.defineProperty(exports, "invoiceSchema", { enumerable: true, get: function () { return requests_1.invoiceSchema; } }); -Object.defineProperty(exports, "invoiceListSchema", { enumerable: true, get: function () { return requests_1.invoiceListSchema; } }); -Object.defineProperty(exports, "invoiceListQuerySchema", { enumerable: true, get: function () { return requests_1.invoiceListQuerySchema; } }); -Object.defineProperty(exports, "paginationQuerySchema", { enumerable: true, get: function () { return requests_1.paginationQuerySchema; } }); -Object.defineProperty(exports, "subscriptionQuerySchema", { enumerable: true, get: function () { return requests_1.subscriptionQuerySchema; } }); -Object.defineProperty(exports, "invoicePaymentLinkSchema", { enumerable: true, get: function () { return requests_1.invoicePaymentLinkSchema; } }); -Object.defineProperty(exports, "sfOrderIdParamSchema", { enumerable: true, get: function () { return requests_1.sfOrderIdParamSchema; } }); -var responses_1 = require("./api/responses"); -Object.defineProperty(exports, "authResponseSchema", { enumerable: true, get: function () { return responses_1.authResponseSchema; } }); -var auth_1 = require("./forms/auth"); -Object.defineProperty(exports, "loginFormSchema", { enumerable: true, get: function () { return auth_1.loginFormSchema; } }); -Object.defineProperty(exports, "signupFormSchema", { enumerable: true, get: function () { return auth_1.signupFormSchema; } }); -Object.defineProperty(exports, "passwordResetRequestFormSchema", { enumerable: true, get: function () { return auth_1.passwordResetRequestFormSchema; } }); -Object.defineProperty(exports, "passwordResetFormSchema", { enumerable: true, get: function () { return auth_1.passwordResetFormSchema; } }); -Object.defineProperty(exports, "setPasswordFormSchema", { enumerable: true, get: function () { return auth_1.setPasswordFormSchema; } }); -Object.defineProperty(exports, "linkWhmcsFormSchema", { enumerable: true, get: function () { return auth_1.linkWhmcsFormSchema; } }); -Object.defineProperty(exports, "loginFormToRequest", { enumerable: true, get: function () { return auth_1.loginFormToRequest; } }); -Object.defineProperty(exports, "signupFormToRequest", { enumerable: true, get: function () { return auth_1.signupFormToRequest; } }); -Object.defineProperty(exports, "passwordResetFormToRequest", { enumerable: true, get: function () { return auth_1.passwordResetFormToRequest; } }); -Object.defineProperty(exports, "setPasswordFormToRequest", { enumerable: true, get: function () { return auth_1.setPasswordFormToRequest; } }); -var profile_1 = require("./forms/profile"); -Object.defineProperty(exports, "profileEditFormSchema", { enumerable: true, get: function () { return profile_1.profileEditFormSchema; } }); -Object.defineProperty(exports, "profileDisplaySchema", { enumerable: true, get: function () { return profile_1.profileDisplaySchema; } }); -Object.defineProperty(exports, "addressFormSchema", { enumerable: true, get: function () { return profile_1.addressFormSchema; } }); -Object.defineProperty(exports, "contactFormSchema", { enumerable: true, get: function () { return profile_1.contactFormSchema; } }); -Object.defineProperty(exports, "profileFormToRequest", { enumerable: true, get: function () { return profile_1.profileFormToRequest; } }); -Object.defineProperty(exports, "addressFormToRequest", { enumerable: true, get: function () { return profile_1.addressFormToRequest; } }); -Object.defineProperty(exports, "contactFormToRequest", { enumerable: true, get: function () { return profile_1.contactFormToRequest; } }); -var sim_configure_1 = require("./forms/sim-configure"); -Object.defineProperty(exports, "simTypeEnum", { enumerable: true, get: function () { return sim_configure_1.simTypeEnum; } }); -Object.defineProperty(exports, "activationTypeEnum", { enumerable: true, get: function () { return sim_configure_1.activationTypeEnum; } }); -Object.defineProperty(exports, "mnpGenderEnum", { enumerable: true, get: function () { return sim_configure_1.mnpGenderEnum; } }); -Object.defineProperty(exports, "mnpDataSchema", { enumerable: true, get: function () { return sim_configure_1.mnpDataSchema; } }); -Object.defineProperty(exports, "simConfigureFormSchema", { enumerable: true, get: function () { return sim_configure_1.simConfigureFormSchema; } }); -Object.defineProperty(exports, "simConfigureFormToRequest", { enumerable: true, get: function () { return sim_configure_1.simConfigureFormToRequest; } }); -var business_1 = require("./business"); -Object.defineProperty(exports, "orderBusinessValidationSchema", { enumerable: true, get: function () { return business_1.orderBusinessValidationSchema; } }); -Object.defineProperty(exports, "skuValidationSchema", { enumerable: true, get: function () { return business_1.skuValidationSchema; } }); -Object.defineProperty(exports, "userMappingValidationSchema", { enumerable: true, get: function () { return business_1.userMappingValidationSchema; } }); -Object.defineProperty(exports, "paymentMethodValidationSchema", { enumerable: true, get: function () { return business_1.paymentMethodValidationSchema; } }); -var utilities_1 = require("./shared/utilities"); -Object.defineProperty(exports, "z", { enumerable: true, get: function () { return utilities_1.z; } }); -Object.defineProperty(exports, "parseOrThrow", { enumerable: true, get: function () { return utilities_1.parseOrThrow; } }); -Object.defineProperty(exports, "safeParse", { enumerable: true, get: function () { return utilities_1.safeParse; } }); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/index.js.map b/packages/domain/src/validation/index.js.map deleted file mode 100644 index 6efaca7d..00000000 --- a/packages/domain/src/validation/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,sDAAoC;AACpC,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,oDAAkC;AAClC,iDAA+B;AAM/B,2CAmEwB;AAjEtB,8GAAA,kBAAkB,OAAA;AAClB,+GAAA,mBAAmB,OAAA;AACnB,sHAAA,0BAA0B,OAAA;AAC1B,+GAAA,mBAAmB,OAAA;AACnB,oHAAA,wBAAwB,OAAA;AACxB,uHAAA,2BAA2B,OAAA;AAC3B,kHAAA,sBAAsB,OAAA;AACtB,uHAAA,2BAA2B,OAAA;AAC3B,sHAAA,0BAA0B,OAAA;AAC1B,gHAAA,oBAAoB,OAAA;AACpB,4HAAA,gCAAgC,OAAA;AAChC,qHAAA,yBAAyB,OAAA;AAGzB,sHAAA,0BAA0B,OAAA;AAC1B,sHAAA,0BAA0B,OAAA;AAG1B,oHAAA,wBAAwB,OAAA;AACxB,qHAAA,yBAAyB,OAAA;AAGzB,iHAAA,qBAAqB,OAAA;AACrB,kHAAA,sBAAsB,OAAA;AACtB,sHAAA,0BAA0B,OAAA;AAC1B,oHAAA,wBAAwB,OAAA;AAGxB,gHAAA,oBAAoB,OAAA;AACpB,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,kHAAA,sBAAsB,OAAA;AACtB,iHAAA,qBAAqB,OAAA;AACrB,mHAAA,uBAAuB,OAAA;AACvB,oHAAA,wBAAwB,OAAA;AACxB,gHAAA,oBAAoB,OAAA;AAgCtB,6CAA+F;AAAtF,+GAAA,kBAAkB,OAAA;AAE3B,qCAyBsB;AAvBpB,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA;AAChB,sHAAA,8BAA8B,OAAA;AAC9B,+GAAA,uBAAuB,OAAA;AACvB,6GAAA,qBAAqB,OAAA;AACrB,2GAAA,mBAAmB,OAAA;AAWnB,0GAAA,kBAAkB,OAAA;AAClB,2GAAA,mBAAmB,OAAA;AACnB,kHAAA,0BAA0B,OAAA;AAC1B,gHAAA,wBAAwB,OAAA;AAM1B,2CAiByB;AAfvB,gHAAA,qBAAqB,OAAA;AACrB,+GAAA,oBAAoB,OAAA;AACpB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AASjB,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AACpB,+GAAA,oBAAoB,OAAA;AAItB,uDAY+B;AAX7B,4GAAA,WAAW,OAAA;AACX,mHAAA,kBAAkB,OAAA;AAClB,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,uHAAA,sBAAsB,OAAA;AACtB,0HAAA,yBAAyB,OAAA;AAS3B,uCASoB;AARlB,yHAAA,6BAA6B,OAAA;AAC7B,+GAAA,mBAAmB,OAAA;AACnB,uHAAA,2BAA2B,OAAA;AAC3B,yHAAA,6BAA6B,OAAA;AAU/B,gDAAgE;AAAvD,8FAAA,CAAC,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,sGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/common.d.ts b/packages/domain/src/validation/shared/common.d.ts deleted file mode 100644 index 6616233c..00000000 --- a/packages/domain/src/validation/shared/common.d.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { z } from "zod"; -export declare const baseEntitySchema: z.ZodObject<{ - id: z.ZodString; - createdAt: z.ZodString; - updatedAt: z.ZodString; -}, z.core.$strip>; -export declare const whmcsEntitySchema: z.ZodObject<{ - id: z.ZodNumber; -}, z.core.$strip>; -export declare const salesforceEntitySchema: z.ZodObject<{ - id: z.ZodString; - createdDate: z.ZodString; - lastModifiedDate: z.ZodString; -}, z.core.$strip>; -export declare const paginationParamsSchema: z.ZodObject<{ - page: z.ZodDefault; - limit: z.ZodDefault; -}, z.core.$strip>; -export declare const paginationInfoSchema: z.ZodObject<{ - currentPage: z.ZodNumber; - totalPages: z.ZodNumber; - totalItems: z.ZodNumber; - itemsPerPage: z.ZodNumber; - hasNextPage: z.ZodBoolean; - hasPreviousPage: z.ZodBoolean; -}, z.core.$strip>; -export declare const apiErrorSchema: z.ZodObject<{ - code: z.ZodString; - message: z.ZodString; - details: z.ZodOptional>; - timestamp: z.ZodString; -}, z.core.$strip>; -export declare const apiMetaSchema: z.ZodObject<{ - requestId: z.ZodString; - timestamp: z.ZodString; - version: z.ZodOptional; -}, z.core.$strip>; -export declare const apiSuccessSchema: (dataSchema: z.ZodSchema) => z.ZodObject<{ - success: z.ZodLiteral; - data: z.ZodType>; - meta: z.ZodObject<{ - requestId: z.ZodString; - timestamp: z.ZodString; - version: z.ZodOptional; - }, z.core.$strip>; -}, z.core.$strip>; -export declare const apiFailureSchema: z.ZodObject<{ - success: z.ZodLiteral; - error: z.ZodObject<{ - code: z.ZodString; - message: z.ZodString; - details: z.ZodOptional>; - timestamp: z.ZodString; - }, z.core.$strip>; - meta: z.ZodObject<{ - requestId: z.ZodString; - timestamp: z.ZodString; - version: z.ZodOptional; - }, z.core.$strip>; -}, z.core.$strip>; -export declare const apiResponseSchema: (dataSchema: z.ZodSchema) => z.ZodDiscriminatedUnion<[z.ZodObject<{ - success: z.ZodLiteral; - data: z.ZodType>; - meta: z.ZodObject<{ - requestId: z.ZodString; - timestamp: z.ZodString; - version: z.ZodOptional; - }, z.core.$strip>; -}, z.core.$strip>, z.ZodObject<{ - success: z.ZodLiteral; - error: z.ZodObject<{ - code: z.ZodString; - message: z.ZodString; - details: z.ZodOptional>; - timestamp: z.ZodString; - }, z.core.$strip>; - meta: z.ZodObject<{ - requestId: z.ZodString; - timestamp: z.ZodString; - version: z.ZodOptional; - }, z.core.$strip>; -}, z.core.$strip>], "success">; -export declare const formFieldSchema: (valueSchema: z.ZodSchema) => z.ZodObject<{ - value: z.ZodType>; - error: z.ZodOptional; - touched: z.ZodDefault; - dirty: z.ZodDefault; -}, z.core.$strip>; -export declare const formStateSchema: (fieldSchema: TField) => z.ZodObject<{ - fields: z.ZodRecord>; - error: z.ZodOptional; - touched: z.ZodDefault; - dirty: z.ZodDefault; - }, z.core.$strip>>; - isValid: z.ZodBoolean; - isSubmitting: z.ZodDefault; - submitCount: z.ZodDefault; - errors: z.ZodDefault>; -}, z.core.$strip>; -export declare const asyncStateIdleSchema: z.ZodObject<{ - status: z.ZodLiteral<"idle">; -}, z.core.$strip>; -export declare const asyncStateLoadingSchema: z.ZodObject<{ - status: z.ZodLiteral<"loading">; -}, z.core.$strip>; -export declare const asyncStateSuccessSchema: (dataSchema: z.ZodSchema) => z.ZodObject<{ - status: z.ZodLiteral<"success">; - data: z.ZodType>; -}, z.core.$strip>; -export declare const asyncStateErrorSchema: z.ZodObject<{ - status: z.ZodLiteral<"error">; - error: z.ZodString; -}, z.core.$strip>; -export declare const asyncStateSchema: (dataSchema: z.ZodSchema) => z.ZodDiscriminatedUnion<[z.ZodObject<{ - status: z.ZodLiteral<"idle">; -}, z.core.$strip>, z.ZodObject<{ - status: z.ZodLiteral<"loading">; -}, z.core.$strip>, z.ZodObject<{ - status: z.ZodLiteral<"success">; - data: z.ZodType>; -}, z.core.$strip>, z.ZodObject<{ - status: z.ZodLiteral<"error">; - error: z.ZodString; -}, z.core.$strip>], "status">; -export type BaseEntitySchemaType = z.infer; -export type WhmcsEntitySchemaType = z.infer; -export type SalesforceEntitySchemaType = z.infer; -export type PaginationParamsSchema = z.infer; -export type PaginationInfoSchema = z.infer; -export type ApiErrorSchema = z.infer; -export type ApiMetaSchema = z.infer; -export type ApiSuccessSchema = z.infer>>; -export type ApiFailureSchema = z.infer; -export type ApiResponseSchema = z.infer>>; -export type FormFieldSchema = z.infer>>; -export type FormStateSchema = z.infer>>; -export type AsyncStateIdleSchema = z.infer; -export type AsyncStateLoadingSchema = z.infer; -export type AsyncStateSuccessSchema = z.infer>>; -export type AsyncStateErrorSchema = z.infer; -export type AsyncStateSchemaType = z.infer>>; diff --git a/packages/domain/src/validation/shared/common.js b/packages/domain/src/validation/shared/common.js deleted file mode 100644 index 06474c32..00000000 --- a/packages/domain/src/validation/shared/common.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.asyncStateSchema = exports.asyncStateErrorSchema = exports.asyncStateSuccessSchema = exports.asyncStateLoadingSchema = exports.asyncStateIdleSchema = exports.formStateSchema = exports.formFieldSchema = exports.apiResponseSchema = exports.apiFailureSchema = exports.apiSuccessSchema = exports.apiMetaSchema = exports.apiErrorSchema = exports.paginationInfoSchema = exports.paginationParamsSchema = exports.salesforceEntitySchema = exports.whmcsEntitySchema = exports.baseEntitySchema = void 0; -const zod_1 = require("zod"); -const primitives_1 = require("./primitives"); -exports.baseEntitySchema = zod_1.z.object({ - id: zod_1.z.string().min(1, "ID is required"), - createdAt: primitives_1.timestampSchema, - updatedAt: primitives_1.timestampSchema, -}); -exports.whmcsEntitySchema = zod_1.z.object({ - id: zod_1.z.number().int().positive("WHMCS ID must be a positive integer"), -}); -exports.salesforceEntitySchema = zod_1.z.object({ - id: zod_1.z.string().min(15, "Salesforce ID must be at least 15 characters"), - createdDate: primitives_1.timestampSchema, - lastModifiedDate: primitives_1.timestampSchema, -}); -exports.paginationParamsSchema = zod_1.z.object({ - page: zod_1.z.number().int().min(1, "Page must be at least 1").default(1), - limit: zod_1.z.number().int().min(1).max(100, "Limit must be between 1 and 100").default(20), -}); -exports.paginationInfoSchema = zod_1.z.object({ - currentPage: zod_1.z.number().int().min(1), - totalPages: zod_1.z.number().int().min(0), - totalItems: zod_1.z.number().int().min(0), - itemsPerPage: zod_1.z.number().int().min(1), - hasNextPage: zod_1.z.boolean(), - hasPreviousPage: zod_1.z.boolean(), -}); -exports.apiErrorSchema = zod_1.z.object({ - code: zod_1.z.string(), - message: zod_1.z.string(), - details: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(), - timestamp: primitives_1.timestampSchema, -}); -exports.apiMetaSchema = zod_1.z.object({ - requestId: zod_1.z.string(), - timestamp: primitives_1.timestampSchema, - version: zod_1.z.string().optional(), -}); -const apiSuccessSchema = (dataSchema) => zod_1.z.object({ - success: zod_1.z.literal(true), - data: dataSchema, - meta: exports.apiMetaSchema, -}); -exports.apiSuccessSchema = apiSuccessSchema; -exports.apiFailureSchema = zod_1.z.object({ - success: zod_1.z.literal(false), - error: exports.apiErrorSchema, - meta: exports.apiMetaSchema, -}); -const apiResponseSchema = (dataSchema) => zod_1.z.discriminatedUnion("success", [(0, exports.apiSuccessSchema)(dataSchema), exports.apiFailureSchema]); -exports.apiResponseSchema = apiResponseSchema; -const formFieldSchema = (valueSchema) => zod_1.z.object({ - value: valueSchema, - error: zod_1.z.string().optional(), - touched: zod_1.z.boolean().default(false), - dirty: zod_1.z.boolean().default(false), -}); -exports.formFieldSchema = formFieldSchema; -const formStateSchema = (fieldSchema) => zod_1.z.object({ - fields: zod_1.z.record(zod_1.z.string(), (0, exports.formFieldSchema)(fieldSchema)), - isValid: zod_1.z.boolean(), - isSubmitting: zod_1.z.boolean().default(false), - submitCount: zod_1.z.number().int().min(0).default(0), - errors: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).default({}), -}); -exports.formStateSchema = formStateSchema; -exports.asyncStateIdleSchema = zod_1.z.object({ - status: zod_1.z.literal("idle"), -}); -exports.asyncStateLoadingSchema = zod_1.z.object({ - status: zod_1.z.literal("loading"), -}); -const asyncStateSuccessSchema = (dataSchema) => zod_1.z.object({ - status: zod_1.z.literal("success"), - data: dataSchema, -}); -exports.asyncStateSuccessSchema = asyncStateSuccessSchema; -exports.asyncStateErrorSchema = zod_1.z.object({ - status: zod_1.z.literal("error"), - error: zod_1.z.string(), -}); -const asyncStateSchema = (dataSchema) => zod_1.z.discriminatedUnion("status", [ - exports.asyncStateIdleSchema, - exports.asyncStateLoadingSchema, - (0, exports.asyncStateSuccessSchema)(dataSchema), - exports.asyncStateErrorSchema, -]); -exports.asyncStateSchema = asyncStateSchema; -//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/common.js.map b/packages/domain/src/validation/shared/common.js.map deleted file mode 100644 index c074cc88..00000000 --- a/packages/domain/src/validation/shared/common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AACxB,6CAA+C;AAMlC,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,4BAAe;IAC1B,SAAS,EAAE,4BAAe;CAC3B,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CACrE,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,8CAA8C,CAAC;IACtE,WAAW,EAAE,4BAAe;IAC5B,gBAAgB,EAAE,4BAAe;CAClC,CAAC,CAAC;AAMU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,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ain/src/validation/shared/common.ts b/packages/domain/src/validation/shared/common.ts deleted file mode 100644 index c2f74707..00000000 --- a/packages/domain/src/validation/shared/common.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Common Patterns - * Reusable validation patterns for pagination, API responses, etc. - */ - -import { z } from "zod"; -import { timestampSchema } from "./primitives"; - -// ===================================================== -// BASE ENTITY PATTERNS -// ===================================================== - -export const baseEntitySchema = z.object({ - id: z.string().min(1, "ID is required"), - createdAt: timestampSchema, - updatedAt: timestampSchema, -}); - -export const whmcsEntitySchema = z.object({ - id: z.number().int().positive("WHMCS ID must be a positive integer"), -}); - -export const salesforceEntitySchema = z.object({ - id: z.string().min(15, "Salesforce ID must be at least 15 characters"), - createdDate: timestampSchema, - lastModifiedDate: timestampSchema, -}); - -// ===================================================== -// PAGINATION PATTERNS -// ===================================================== - -export const paginationParamsSchema = z.object({ - page: z.number().int().min(1, "Page must be at least 1").default(1), - limit: z.number().int().min(1).max(100, "Limit must be between 1 and 100").default(20), -}); - -export const paginationInfoSchema = z.object({ - currentPage: z.number().int().min(1), - totalPages: z.number().int().min(0), - totalItems: z.number().int().min(0), - itemsPerPage: z.number().int().min(1), - hasNextPage: z.boolean(), - hasPreviousPage: z.boolean(), -}); - -// ===================================================== -// API RESPONSE PATTERNS -// ===================================================== - -export const apiErrorSchema = z.object({ - code: z.string(), - message: z.string(), - details: z.record(z.string(), z.unknown()).optional(), - timestamp: timestampSchema, -}); - -export const apiMetaSchema = z.object({ - requestId: z.string(), - timestamp: timestampSchema, - version: z.string().optional(), -}); - -export const apiSuccessSchema = (dataSchema: z.ZodSchema) => - z.object({ - success: z.literal(true), - data: dataSchema, - meta: apiMetaSchema, - }); - -export const apiFailureSchema = z.object({ - success: z.literal(false), - error: apiErrorSchema, - meta: apiMetaSchema, -}); - -export const apiResponseSchema = (dataSchema: z.ZodSchema) => - z.discriminatedUnion("success", [apiSuccessSchema(dataSchema), apiFailureSchema]); - -// ===================================================== -// FORM STATE PATTERNS -// ===================================================== - -export const formFieldSchema = (valueSchema: z.ZodSchema) => - z.object({ - value: valueSchema, - error: z.string().optional(), - touched: z.boolean().default(false), - dirty: z.boolean().default(false), - }); - -export const formStateSchema = (fieldSchema: TField) => - z.object({ - fields: z.record(z.string(), formFieldSchema(fieldSchema)), - isValid: z.boolean(), - isSubmitting: z.boolean().default(false), - submitCount: z.number().int().min(0).default(0), - errors: z.record(z.string(), z.string()).default({}), - }); - -// ===================================================== -// ASYNC STATE PATTERNS -// ===================================================== - -export const asyncStateIdleSchema = z.object({ - status: z.literal("idle"), -}); - -export const asyncStateLoadingSchema = z.object({ - status: z.literal("loading"), -}); - -export const asyncStateSuccessSchema = (dataSchema: z.ZodSchema) => - z.object({ - status: z.literal("success"), - data: dataSchema, - }); - -export const asyncStateErrorSchema = z.object({ - status: z.literal("error"), - error: z.string(), -}); - -export const asyncStateSchema = (dataSchema: z.ZodSchema) => - z.discriminatedUnion("status", [ - asyncStateIdleSchema, - asyncStateLoadingSchema, - asyncStateSuccessSchema(dataSchema), - asyncStateErrorSchema, - ]); - -// ===================================================== -// TYPE EXPORTS -// ===================================================== - -export type BaseEntitySchemaType = z.infer; -export type WhmcsEntitySchemaType = z.infer; -export type SalesforceEntitySchemaType = z.infer; -export type PaginationParamsSchema = z.infer; -export type PaginationInfoSchema = z.infer; -export type ApiErrorSchema = z.infer; -export type ApiMetaSchema = z.infer; -export type ApiSuccessSchema = z.infer>>; -export type ApiFailureSchema = z.infer; -export type ApiResponseSchema = z.infer>>; -export type FormFieldSchema = z.infer>>; -export type FormStateSchema = z.infer< - ReturnType> ->; -export type AsyncStateIdleSchema = z.infer; -export type AsyncStateLoadingSchema = z.infer; -export type AsyncStateSuccessSchema = z.infer>>; -export type AsyncStateErrorSchema = z.infer; -export type AsyncStateSchemaType = z.infer>>; diff --git a/packages/domain/src/validation/shared/entities.d.ts b/packages/domain/src/validation/shared/entities.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/domain/src/validation/shared/entities.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/domain/src/validation/shared/entities.js b/packages/domain/src/validation/shared/entities.js deleted file mode 100644 index e30a8d69..00000000 --- a/packages/domain/src/validation/shared/entities.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=entities.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/entities.js.map b/packages/domain/src/validation/shared/entities.js.map deleted file mode 100644 index fa764abe..00000000 --- a/packages/domain/src/validation/shared/entities.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"entities.js","sourceRoot":"","sources":["entities.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/identifiers.d.ts b/packages/domain/src/validation/shared/identifiers.d.ts deleted file mode 100644 index a97b4e1b..00000000 --- a/packages/domain/src/validation/shared/identifiers.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { z } from "zod"; -export declare const userIdSchema: z.core.$ZodBranded; -export declare const orderIdSchema: z.core.$ZodBranded; -export declare const invoiceIdSchema: z.core.$ZodBranded; -export declare const subscriptionIdSchema: z.core.$ZodBranded; -export declare const paymentIdSchema: z.core.$ZodBranded; -export declare const caseIdSchema: z.core.$ZodBranded; -export declare const sessionIdSchema: z.core.$ZodBranded; -export declare const whmcsClientIdSchema: z.core.$ZodBranded; -export declare const whmcsInvoiceIdSchema: z.core.$ZodBranded; -export declare const whmcsProductIdSchema: z.core.$ZodBranded; -export declare const salesforceContactIdSchema: z.core.$ZodBranded; -export declare const salesforceAccountIdSchema: z.core.$ZodBranded; -export declare const salesforceCaseIdSchema: z.core.$ZodBranded; -export type UserIdSchema = z.infer; -export type OrderIdSchema = z.infer; -export type InvoiceIdSchema = z.infer; -export type SubscriptionIdSchema = z.infer; -export type PaymentIdSchema = z.infer; -export type CaseIdSchema = z.infer; -export type SessionIdSchema = z.infer; -export type WhmcsClientIdSchema = z.infer; -export type WhmcsInvoiceIdSchema = z.infer; -export type WhmcsProductIdSchema = z.infer; -export type SalesforceContactIdSchema = z.infer; -export type SalesforceAccountIdSchema = z.infer; -export type SalesforceCaseIdSchema = z.infer; diff --git a/packages/domain/src/validation/shared/identifiers.js b/packages/domain/src/validation/shared/identifiers.js deleted file mode 100644 index 467dc773..00000000 --- a/packages/domain/src/validation/shared/identifiers.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.salesforceCaseIdSchema = exports.salesforceAccountIdSchema = exports.salesforceContactIdSchema = exports.whmcsProductIdSchema = exports.whmcsInvoiceIdSchema = exports.whmcsClientIdSchema = exports.sessionIdSchema = exports.caseIdSchema = exports.paymentIdSchema = exports.subscriptionIdSchema = exports.invoiceIdSchema = exports.orderIdSchema = exports.userIdSchema = void 0; -const zod_1 = require("zod"); -exports.userIdSchema = zod_1.z.string().min(1, "User ID is required").brand(); -exports.orderIdSchema = zod_1.z.string().min(1, "Order ID is required").brand(); -exports.invoiceIdSchema = zod_1.z.string().min(1, "Invoice ID is required").brand(); -exports.subscriptionIdSchema = zod_1.z - .string() - .min(1, "Subscription ID is required") - .brand(); -exports.paymentIdSchema = zod_1.z.string().min(1, "Payment ID is required").brand(); -exports.caseIdSchema = zod_1.z.string().min(1, "Case ID is required").brand(); -exports.sessionIdSchema = zod_1.z.string().min(1, "Session ID is required").brand(); -exports.whmcsClientIdSchema = zod_1.z - .number() - .int() - .positive("WHMCS Client ID must be positive") - .brand(); -exports.whmcsInvoiceIdSchema = zod_1.z - .number() - .int() - .positive("WHMCS Invoice ID must be positive") - .brand(); -exports.whmcsProductIdSchema = zod_1.z - .number() - .int() - .positive("WHMCS Product ID must be positive") - .brand(); -exports.salesforceContactIdSchema = zod_1.z - .string() - .length(18, "Salesforce Contact ID must be 18 characters") - .brand(); -exports.salesforceAccountIdSchema = zod_1.z - .string() - .length(18, "Salesforce Account ID must be 18 characters") - .brand(); -exports.salesforceCaseIdSchema = zod_1.z - .string() - .length(18, "Salesforce Case ID must be 18 characters") - .brand(); -//# sourceMappingURL=identifiers.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/identifiers.js.map b/packages/domain/src/validation/shared/identifiers.js.map deleted file mode 100644 index 2a2a146e..00000000 --- a/packages/domain/src/validation/shared/identifiers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["identifiers.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AAMX,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,KAAK,EAAY,CAAC;AAC1E,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC,KAAK,EAAa,CAAC;AAC7E,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,KAAK,EAAe,CAAC;AACnF,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,6BAA6B,CAAC;KACrC,KAAK,EAAoB,CAAC;AAChB,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,KAAK,EAAe,CAAC;AACnF,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,KAAK,EAAY,CAAC;AAC1E,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,KAAK,EAAe,CAAC;AAMnF,QAAA,mBAAmB,GAAG,OAAC;KACjC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,QAAQ,CAAC,kCAAkC,CAAC;KAC5C,KAAK,EAAmB,CAAC;AACf,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,QAAQ,CAAC,mCAAmC,CAAC;KAC7C,KAAK,EAAoB,CAAC;AAChB,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,QAAQ,CAAC,mCAAmC,CAAC;KAC7C,KAAK,EAAoB,CAAC;AAMhB,QAAA,yBAAyB,GAAG,OAAC;KACvC,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,EAAE,6CAA6C,CAAC;KACzD,KAAK,EAAyB,CAAC;AACrB,QAAA,yBAAyB,GAAG,OAAC;KACvC,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,EAAE,6CAA6C,CAAC;KACzD,KAAK,EAAyB,CAAC;AACrB,QAAA,sBAAsB,GAAG,OAAC;KACpC,MAAM,EAAE;KACR,MAAM,CAAC,EAAE,EAAE,0CAA0C,CAAC;KACtD,KAAK,EAAsB,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/identifiers.ts b/packages/domain/src/validation/shared/identifiers.ts deleted file mode 100644 index 0a0da625..00000000 --- a/packages/domain/src/validation/shared/identifiers.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Identifier Schemas - * Branded types for entity IDs and external system identifiers - */ - -import { z } from "zod"; - -// ===================================================== -// INTERNAL ENTITY IDS (Branded Types) -// ===================================================== - -export const userIdSchema = z.string().min(1, "User ID is required").brand<"UserId">(); -export const orderIdSchema = z.string().min(1, "Order ID is required").brand<"OrderId">(); -export const invoiceIdSchema = z.string().min(1, "Invoice ID is required").brand<"InvoiceId">(); -export const subscriptionIdSchema = z - .string() - .min(1, "Subscription ID is required") - .brand<"SubscriptionId">(); -export const paymentIdSchema = z.string().min(1, "Payment ID is required").brand<"PaymentId">(); -export const caseIdSchema = z.string().min(1, "Case ID is required").brand<"CaseId">(); -export const sessionIdSchema = z.string().min(1, "Session ID is required").brand<"SessionId">(); - -// ===================================================== -// WHMCS SYSTEM IDS -// ===================================================== - -export const whmcsClientIdSchema = z - .number() - .int() - .positive("WHMCS Client ID must be positive") - .brand<"WhmcsClientId">(); -export const whmcsInvoiceIdSchema = z - .number() - .int() - .positive("WHMCS Invoice ID must be positive") - .brand<"WhmcsInvoiceId">(); -export const whmcsProductIdSchema = z - .number() - .int() - .positive("WHMCS Product ID must be positive") - .brand<"WhmcsProductId">(); - -// ===================================================== -// SALESFORCE SYSTEM IDS -// ===================================================== - -export const salesforceContactIdSchema = z - .string() - .length(18, "Salesforce Contact ID must be 18 characters") - .brand<"SalesforceContactId">(); -export const salesforceAccountIdSchema = z - .string() - .length(18, "Salesforce Account ID must be 18 characters") - .brand<"SalesforceAccountId">(); -export const salesforceCaseIdSchema = z - .string() - .length(18, "Salesforce Case ID must be 18 characters") - .brand<"SalesforceCaseId">(); - -// ===================================================== -// TYPE EXPORTS -// ===================================================== - -export type UserIdSchema = z.infer; -export type OrderIdSchema = z.infer; -export type InvoiceIdSchema = z.infer; -export type SubscriptionIdSchema = z.infer; -export type PaymentIdSchema = z.infer; -export type CaseIdSchema = z.infer; -export type SessionIdSchema = z.infer; - -export type WhmcsClientIdSchema = z.infer; -export type WhmcsInvoiceIdSchema = z.infer; -export type WhmcsProductIdSchema = z.infer; - -export type SalesforceContactIdSchema = z.infer; -export type SalesforceAccountIdSchema = z.infer; -export type SalesforceCaseIdSchema = z.infer; diff --git a/packages/domain/src/validation/shared/index.ts b/packages/domain/src/validation/shared/index.ts deleted file mode 100644 index fcf39eae..00000000 --- a/packages/domain/src/validation/shared/index.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Shared Validation Modules - * Modular architecture for validation primitives and patterns - */ - -// Core validation primitives -export * from "./primitives"; - -// Entity identifiers and branded types (schemas only, types are in domain/common) -export { - userIdSchema, - orderIdSchema, - invoiceIdSchema, - subscriptionIdSchema, - paymentIdSchema, - caseIdSchema, - sessionIdSchema, - whmcsClientIdSchema, - whmcsInvoiceIdSchema, - whmcsProductIdSchema, - salesforceContactIdSchema, - salesforceAccountIdSchema, - salesforceCaseIdSchema, -} from "./identifiers"; - -// Common patterns and schemas (schemas only, avoid type conflicts) -export { - baseEntitySchema, - whmcsEntitySchema, - salesforceEntitySchema, - paginationParamsSchema, - paginationInfoSchema, - apiErrorSchema, - apiMetaSchema, - apiSuccessSchema, - apiFailureSchema, - apiResponseSchema, - formFieldSchema, - formStateSchema, - asyncStateIdleSchema, - asyncStateLoadingSchema, - asyncStateSuccessSchema, - asyncStateErrorSchema, - asyncStateSchema, -} from "./common"; - -// Validation utilities and helpers -export * from "./utilities"; - -export { - userSchema, - userProfileSchema, - invoiceItemSchema, - invoiceSchema, - invoiceListSchema, - subscriptionSchema, - paymentMethodSchema, - paymentSchema, - caseCommentSchema, - supportCaseSchema, -} from "./entities"; -export type { - UserSchema, - UserProfileSchema, - InvoiceItemSchema, - InvoiceSchema, - InvoiceListSchema, - SubscriptionSchema, - PaymentMethodSchema, - PaymentSchema, - CaseCommentSchema, - SupportCaseSchema, -} from "./entities"; -export { - orderItemProductSchema, - orderDetailItemSchema, - orderSummaryItemSchema, - orderDetailsSchema, - orderSummarySchema, -} from "./order"; diff --git a/packages/domain/src/validation/shared/order.d.ts b/packages/domain/src/validation/shared/order.d.ts deleted file mode 100644 index 61933d51..00000000 --- a/packages/domain/src/validation/shared/order.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { z } from "zod"; -export declare const orderItemProductSchema: z.ZodObject<{ - id: z.ZodOptional; - name: z.ZodOptional; - sku: z.ZodString; - whmcsProductId: z.ZodOptional; - itemClass: z.ZodOptional; - billingCycle: z.ZodOptional; -}, z.core.$strip>; -export declare const orderDetailItemSchema: z.ZodObject<{ - id: z.ZodString; - orderId: z.ZodString; - quantity: z.ZodNumber; - unitPrice: z.ZodNumber; - totalPrice: z.ZodNumber; - billingCycle: z.ZodOptional; - product: z.ZodObject<{ - id: z.ZodOptional; - name: z.ZodOptional; - sku: z.ZodString; - whmcsProductId: z.ZodOptional; - itemClass: z.ZodOptional; - billingCycle: z.ZodOptional; - }, z.core.$strip>; -}, z.core.$strip>; -export declare const orderSummaryItemSchema: z.ZodObject<{ - name: z.ZodOptional; - sku: z.ZodOptional; - itemClass: z.ZodOptional; - quantity: z.ZodNumber; - unitPrice: z.ZodOptional; - totalPrice: z.ZodOptional; - billingCycle: z.ZodOptional; -}, z.core.$strip>; -export declare const orderDetailsSchema: z.ZodObject<{ - id: z.ZodString; - orderNumber: z.ZodString; - status: z.ZodString; - orderType: z.ZodOptional; - effectiveDate: z.ZodString; - totalAmount: z.ZodNumber; - accountId: z.ZodOptional; - accountName: z.ZodOptional; - createdDate: z.ZodString; - lastModifiedDate: z.ZodString; - activationType: z.ZodOptional; - activationStatus: z.ZodOptional; - scheduledAt: z.ZodOptional; - whmcsOrderId: z.ZodOptional; - items: z.ZodArray; - product: z.ZodObject<{ - id: z.ZodOptional; - name: z.ZodOptional; - sku: z.ZodString; - whmcsProductId: z.ZodOptional; - itemClass: z.ZodOptional; - billingCycle: z.ZodOptional; - }, z.core.$strip>; - }, z.core.$strip>>; -}, z.core.$strip>; -export declare const orderSummarySchema: z.ZodObject<{ - id: z.ZodString; - orderNumber: z.ZodString; - status: z.ZodString; - orderType: z.ZodOptional; - effectiveDate: z.ZodString; - totalAmount: z.ZodNumber; - createdDate: z.ZodString; - lastModifiedDate: z.ZodString; - whmcsOrderId: z.ZodOptional; - itemsSummary: z.ZodArray; - sku: z.ZodOptional; - itemClass: z.ZodOptional; - quantity: z.ZodNumber; - unitPrice: z.ZodOptional; - totalPrice: z.ZodOptional; - billingCycle: z.ZodOptional; - }, z.core.$strip>>; -}, z.core.$strip>; -export type OrderItemProduct = z.infer; -export type OrderDetailItem = z.infer; -export type OrderItemSummary = z.infer; -export type OrderDetailsResponse = z.infer; -export type OrderSummaryResponse = z.infer; diff --git a/packages/domain/src/validation/shared/order.js b/packages/domain/src/validation/shared/order.js deleted file mode 100644 index be641f7c..00000000 --- a/packages/domain/src/validation/shared/order.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.orderSummarySchema = exports.orderDetailsSchema = exports.orderSummaryItemSchema = exports.orderDetailItemSchema = exports.orderItemProductSchema = void 0; -const zod_1 = require("zod"); -const primitives_1 = require("./primitives"); -exports.orderItemProductSchema = zod_1.z.object({ - id: zod_1.z.string().optional(), - name: zod_1.z.string().optional(), - sku: zod_1.z.string(), - whmcsProductId: zod_1.z.string().optional(), - itemClass: zod_1.z.string().optional(), - billingCycle: zod_1.z.string().optional(), -}); -exports.orderDetailItemSchema = zod_1.z.object({ - id: zod_1.z.string(), - orderId: zod_1.z.string(), - quantity: zod_1.z.number(), - unitPrice: zod_1.z.number(), - totalPrice: zod_1.z.number(), - billingCycle: zod_1.z.string().optional(), - product: exports.orderItemProductSchema, -}); -exports.orderSummaryItemSchema = zod_1.z.object({ - name: zod_1.z.string().optional(), - sku: zod_1.z.string().optional(), - itemClass: zod_1.z.string().optional(), - quantity: zod_1.z.number(), - unitPrice: zod_1.z.number().optional(), - totalPrice: zod_1.z.number().optional(), - billingCycle: zod_1.z.string().optional(), -}); -exports.orderDetailsSchema = zod_1.z.object({ - id: zod_1.z.string(), - orderNumber: zod_1.z.string(), - status: zod_1.z.string(), - orderType: zod_1.z.string().optional(), - effectiveDate: zod_1.z.string(), - totalAmount: primitives_1.moneyAmountSchema, - accountId: zod_1.z.string().optional(), - accountName: zod_1.z.string().optional(), - createdDate: zod_1.z.string(), - lastModifiedDate: zod_1.z.string(), - activationType: zod_1.z.string().optional(), - activationStatus: zod_1.z.string().optional(), - scheduledAt: zod_1.z.string().optional(), - whmcsOrderId: zod_1.z.string().optional(), - items: zod_1.z.array(exports.orderDetailItemSchema), -}); -exports.orderSummarySchema = zod_1.z.object({ - id: zod_1.z.string(), - orderNumber: zod_1.z.string(), - status: zod_1.z.string(), - orderType: zod_1.z.string().optional(), - effectiveDate: zod_1.z.string(), - totalAmount: primitives_1.moneyAmountSchema, - createdDate: zod_1.z.string(), - lastModifiedDate: zod_1.z.string(), - whmcsOrderId: zod_1.z.string().optional(), - itemsSummary: zod_1.z.array(exports.orderSummaryItemSchema), -}); -//# sourceMappingURL=order.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/order.js.map b/packages/domain/src/validation/shared/order.js.map deleted file mode 100644 index cc4aecc6..00000000 --- a/packages/domain/src/validation/shared/order.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"order.js","sourceRoot":"","sources":["order.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,6CAAiD;AAEpC,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,8BAAsB;CAChC,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,C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,KAAK,CAAC,6BAAqB,CAAC;CACtC,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,WAAW,EAAE,8BAAiB;IAC9B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE;IAC5B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,YAAY,EAAE,OAAC,CAAC,KAAK,CAAC,8BAAsB,CAAC;CAC9C,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/order.ts b/packages/domain/src/validation/shared/order.ts deleted file mode 100644 index efd9e2a8..00000000 --- a/packages/domain/src/validation/shared/order.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { z } from "zod"; - -import { moneyAmountSchema } from "./primitives"; - -export const orderItemProductSchema = z.object({ - id: z.string().optional(), - name: z.string().optional(), - sku: z.string(), - whmcsProductId: z.string().optional(), - itemClass: z.string().optional(), - billingCycle: z.string().optional(), -}); - -export const orderDetailItemSchema = z.object({ - id: z.string(), - orderId: z.string(), - quantity: z.number(), - unitPrice: z.number(), - totalPrice: z.number(), - billingCycle: z.string().optional(), - product: orderItemProductSchema, -}); - -export const orderSummaryItemSchema = z.object({ - name: z.string().optional(), - sku: z.string().optional(), - itemClass: z.string().optional(), - quantity: z.number(), - unitPrice: z.number().optional(), - totalPrice: z.number().optional(), - billingCycle: z.string().optional(), -}); - -export const orderDetailsSchema = z.object({ - id: z.string(), - orderNumber: z.string(), - status: z.string(), - orderType: z.string().optional(), - effectiveDate: z.string(), - totalAmount: moneyAmountSchema, - accountId: z.string().optional(), - accountName: z.string().optional(), - createdDate: z.string(), - lastModifiedDate: z.string(), - activationType: z.string().optional(), - activationStatus: z.string().optional(), - scheduledAt: z.string().optional(), - whmcsOrderId: z.string().optional(), - items: z.array(orderDetailItemSchema), -}); - -export const orderSummarySchema = z.object({ - id: z.string(), - orderNumber: z.string(), - status: z.string(), - orderType: z.string().optional(), - effectiveDate: z.string(), - totalAmount: moneyAmountSchema, - createdDate: z.string(), - lastModifiedDate: z.string(), - whmcsOrderId: z.string().optional(), - itemsSummary: z.array(orderSummaryItemSchema), -}); - -export type OrderItemProduct = z.infer; -export type OrderDetailItem = z.infer; -export type OrderItemSummary = z.infer; -export type OrderDetailsResponse = z.infer; -export type OrderSummaryResponse = z.infer; diff --git a/packages/domain/src/validation/shared/primitives.d.ts b/packages/domain/src/validation/shared/primitives.d.ts deleted file mode 100644 index 1e75df9f..00000000 --- a/packages/domain/src/validation/shared/primitives.d.ts +++ /dev/null @@ -1,84 +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 addressSchema: z.ZodObject<{ - street: z.ZodNullable; - streetLine2: z.ZodNullable; - city: z.ZodNullable; - state: z.ZodNullable; - postalCode: z.ZodNullable; - country: z.ZodNullable; -}, z.core.$strip>; -export declare const requiredAddressSchema: z.ZodObject<{ - street: z.ZodString; - streetLine2: z.ZodOptional; - city: z.ZodString; - state: z.ZodString; - postalCode: z.ZodString; - country: z.ZodString; -}, z.core.$strip>; -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<{ - pending: "pending"; - active: "active"; - inactive: "inactive"; - suspended: "suspended"; -}>; -export declare const priorityEnum: z.ZodEnum<{ - low: "low"; - medium: "medium"; - high: "high"; - urgent: "urgent"; -}>; -export declare const categoryEnum: z.ZodEnum<{ - billing: "billing"; - account: "account"; - technical: "technical"; - general: "general"; -}>; -export declare const billingCycleEnum: z.ZodEnum<{ - Monthly: "Monthly"; - Quarterly: "Quarterly"; - Annually: "Annually"; - Free: "Free"; - Onetime: "Onetime"; -}>; -export declare const subscriptionBillingCycleEnum: z.ZodEnum<{ - Monthly: "Monthly"; - Quarterly: "Quarterly"; - "Semi-Annually": "Semi-Annually"; - Annually: "Annually"; - Biennially: "Biennially"; - Triennially: "Triennially"; - "One-time": "One-time"; - Free: "Free"; -}>; -export type EmailSchema = z.infer; -export type PasswordSchema = z.infer; -export type NameSchema = z.infer; -export type PhoneSchema = z.infer; -export type AddressSchema = z.infer; -export type CountryCodeSchema = z.infer; -export type CurrencyCodeSchema = z.infer; -export type TimestampSchema = z.infer; -export type DateStringSchema = z.infer; -export type MoneyAmountSchema = z.infer; -export type PercentageSchema = z.infer; -export type GenderSchema = z.infer; -export type StatusSchema = z.infer; -export type PrioritySchema = z.infer; -export type CategorySchema = z.infer; -export type BillingCycleSchema = z.infer; -export type SubscriptionBillingCycleSchema = z.infer; diff --git a/packages/domain/src/validation/shared/primitives.js b/packages/domain/src/validation/shared/primitives.js deleted file mode 100644 index 781d8a58..00000000 --- a/packages/domain/src/validation/shared/primitives.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -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.requiredAddressSchema = exports.addressSchema = 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}$/, "Please enter a valid phone number") - .trim(); -exports.addressSchema = zod_1.z.object({ - street: zod_1.z.string().max(200, "Street address is too long").nullable(), - streetLine2: zod_1.z.string().max(200, "Street address line 2 is too long").nullable(), - city: zod_1.z.string().max(100, "City name is too long").nullable(), - state: zod_1.z.string().max(100, "State/Prefecture name is too long").nullable(), - postalCode: zod_1.z.string().max(20, "Postal code is too long").nullable(), - country: zod_1.z.string().max(100, "Country name is too long").nullable(), -}); -exports.requiredAddressSchema = zod_1.z.object({ - street: zod_1.z - .string() - .min(1, "Street address is required") - .max(200, "Street address is too long") - .trim(), - streetLine2: zod_1.z.string().max(200, "Street address line 2 is too long").optional(), - city: zod_1.z.string().min(1, "City is required").max(100, "City name is too long").trim(), - state: zod_1.z - .string() - .min(1, "State/Prefecture is required") - .max(100, "State/Prefecture name is too long") - .trim(), - postalCode: zod_1.z - .string() - .min(1, "Postal code is required") - .max(20, "Postal code is too long") - .trim(), - country: zod_1.z.string().min(1, "Country is required").max(100, "Country name is too long").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", -]); -//# sourceMappingURL=primitives.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/primitives.js.map b/packages/domain/src/validation/shared/primitives.js.map deleted file mode 100644 index e91f4db3..00000000 --- a/packages/domain/src/validation/shared/primitives.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"primitives.js","sourceRoot":"","sources":["primitives.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AAMX,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;KACxB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC;KAC1B,GAAG,CAAC,GAAG,EAAE,uCAAuC,CAAC;KACjD,IAAI,EAAE,CAAC;AAEG,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UAAU,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE,QAAA,YAAY,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC3D,QAAA,YAAY,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGtE,QAAA,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AACnF,QAAA,4BAA4B,GAAG,OAAC,CAAC,IAAI,CAAC;IACjD,SAAS;IACT,WAAW;IACX,eAAe;IACf,UAAU;IACV,YAAY;IACZ,aAAa;IACb,UAAU;IACV,MAAM;CACP,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/primitives.ts b/packages/domain/src/validation/shared/primitives.ts deleted file mode 100644 index 37727c98..00000000 --- a/packages/domain/src/validation/shared/primitives.ts +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Validation Primitives - * Core validation building blocks - single source of truth for basic patterns - */ - -import { z } from "zod"; - -// ===================================================== -// BASIC FIELD VALIDATION -// ===================================================== - -export const emailSchema = z - .string() - .email("Please enter a valid email address") - .toLowerCase() - .trim(); - -export const passwordSchema = 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"); - -export const nameSchema = z - .string() - .min(1, "Name is required") - .max(100, "Name must be less than 100 characters") - .trim(); - -export const phoneSchema = z - .string() - .regex(/^[+]?[0-9\s\-()]{7,20}$/, "Please enter a valid phone number") - .trim(); - -// ===================================================== -// GEOGRAPHIC DATA -// ===================================================== - -// Canonical address schema - single source of truth -export const addressSchema = z.object({ - street: z.string().max(200, "Street address is too long").nullable(), - streetLine2: z.string().max(200, "Street address line 2 is too long").nullable(), - city: z.string().max(100, "City name is too long").nullable(), - state: z.string().max(100, "State/Prefecture name is too long").nullable(), - postalCode: z.string().max(20, "Postal code is too long").nullable(), - country: z.string().max(100, "Country name is too long").nullable(), -}); - -// Required address schema for forms -export const requiredAddressSchema = z.object({ - street: z - .string() - .min(1, "Street address is required") - .max(200, "Street address is too long") - .trim(), - streetLine2: z.string().max(200, "Street address line 2 is too long").optional(), - city: z.string().min(1, "City is required").max(100, "City name is too long").trim(), - state: z - .string() - .min(1, "State/Prefecture is required") - .max(100, "State/Prefecture name is too long") - .trim(), - postalCode: z - .string() - .min(1, "Postal code is required") - .max(20, "Postal code is too long") - .trim(), - country: z.string().min(1, "Country is required").max(100, "Country name is too long").trim(), -}); - -export const countryCodeSchema = z.string().length(2, "Country code must be 2 characters"); -export const currencyCodeSchema = z.string().length(3, "Currency code must be 3 characters"); - -// ===================================================== -// TEMPORAL DATA -// ===================================================== - -export const timestampSchema = z.string().datetime("Invalid timestamp format"); -export const dateSchema = z.string().date("Invalid date format"); - -// ===================================================== -// NUMERIC DATA -// ===================================================== - -export const moneyAmountSchema = z.number().int().nonnegative("Amount must be non-negative"); -export const percentageSchema = z.number().min(0).max(100, "Percentage must be between 0 and 100"); - -// ===================================================== -// COMMON ENUMS -// ===================================================== - -export const genderEnum = z.enum(["male", "female", "other"]); -export const statusEnum = z.enum(["active", "inactive", "pending", "suspended"]); -export const priorityEnum = z.enum(["low", "medium", "high", "urgent"]); -export const categoryEnum = z.enum(["technical", "billing", "account", "general"]); - -// Billing cycle enums -export const billingCycleEnum = z.enum(["Monthly", "Quarterly", "Annually", "Onetime", "Free"]); -export const subscriptionBillingCycleEnum = z.enum([ - "Monthly", - "Quarterly", - "Semi-Annually", - "Annually", - "Biennially", - "Triennially", - "One-time", - "Free", -]); - -// ===================================================== -// TYPE EXPORTS -// ===================================================== - -export type EmailSchema = z.infer; -export type PasswordSchema = z.infer; -export type NameSchema = z.infer; -export type PhoneSchema = z.infer; -export type AddressSchema = z.infer; -export type CountryCodeSchema = z.infer; -export type CurrencyCodeSchema = z.infer; -export type TimestampSchema = z.infer; -export type DateStringSchema = z.infer; -export type MoneyAmountSchema = z.infer; -export type PercentageSchema = z.infer; -export type GenderSchema = z.infer; -export type StatusSchema = z.infer; -export type PrioritySchema = z.infer; -export type CategorySchema = z.infer; -export type BillingCycleSchema = z.infer; -export type SubscriptionBillingCycleSchema = z.infer; diff --git a/packages/domain/src/validation/shared/utilities.d.ts b/packages/domain/src/validation/shared/utilities.d.ts deleted file mode 100644 index 741fd395..00000000 --- a/packages/domain/src/validation/shared/utilities.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { z } from "zod"; -export { z }; -export declare const parseOrThrow: (schema: z.ZodSchema, data: unknown) => T; -export declare const safeParse: (schema: z.ZodSchema, data: unknown) => z.ZodSafeParseResult; diff --git a/packages/domain/src/validation/shared/utilities.js b/packages/domain/src/validation/shared/utilities.js deleted file mode 100644 index ff5aaaf0..00000000 --- a/packages/domain/src/validation/shared/utilities.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.safeParse = exports.parseOrThrow = exports.z = void 0; -const zod_1 = require("zod"); -Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } }); -const parseOrThrow = (schema, data) => { - return schema.parse(data); -}; -exports.parseOrThrow = parseOrThrow; -const safeParse = (schema, data) => { - return schema.safeParse(data); -}; -exports.safeParse = safeParse; -//# sourceMappingURL=utilities.js.map \ No newline at end of file diff --git a/packages/domain/src/validation/shared/utilities.js.map b/packages/domain/src/validation/shared/utilities.js.map deleted file mode 100644 index 24e74657..00000000 --- a/packages/domain/src/validation/shared/utilities.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utilities.js","sourceRoot":"","sources":["utilities.ts"],"names":[],"mappings":";;;AAKA,6BAAwB;AAOf,kFAPA,OAAC,OAOA;AAGH,MAAM,YAAY,GAAG,CAAI,MAAsB,EAAE,IAAa,EAAK,EAAE;IAC1E,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAGK,MAAM,SAAS,GAAG,CAAI,MAAsB,EAAE,IAAa,EAAE,EAAE;IACpE,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"} \ No newline at end of file diff --git a/packages/domain/src/validation/shared/utilities.ts b/packages/domain/src/validation/shared/utilities.ts deleted file mode 100644 index 0b5ea3ba..00000000 --- a/packages/domain/src/validation/shared/utilities.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Simple Validation Utilities - * Use Zod directly - these are just convenience re-exports - */ - -import { z } from "zod"; - -// ===================================================== -// DIRECT ZOD USAGE - NO ABSTRACTIONS -// ===================================================== - -// Just re-export Zod - use it directly -export { z }; - -// Simple helper for common pattern -export const parseOrThrow = (schema: z.ZodSchema, data: unknown): T => { - return schema.parse(data); // Let Zod handle the error -}; - -// Simple helper for safe parsing -export const safeParse = (schema: z.ZodSchema, data: unknown) => { - return schema.safeParse(data); // Direct Zod usage -}; diff --git a/packages/schemas/src/integrations/freebit/quota.schema.ts b/packages/schemas/src/integrations/freebit/quota.schema.ts deleted file mode 100644 index fedbbb7f..00000000 --- a/packages/schemas/src/integrations/freebit/quota.schema.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod"; - -export const freebitQuotaHistoryItemSchema = z.object({ - quota: z.string(), - date: z.string(), - expire: z.string(), - quotaCode: z.string().optional(), -}); - -export const freebitQuotaHistoryResponseSchema = z.object({ - resultCode: z.string(), - status: z.object({ - message: z.string().optional(), - statusCode: z.union([z.string(), z.number()]).optional(), - }), - total: z.union([z.string(), z.number()]), - count: z.union([z.string(), z.number()]), - quotaHistory: z.array(freebitQuotaHistoryItemSchema), -}); - -export type FreebitQuotaHistoryResponseSchema = typeof freebitQuotaHistoryResponseSchema;