import { Provider } from '@angular/core'; import { environment } from '../environments/environment'; import { ADMIN_DASHBOARD_METRICS_GATEWAY } from './features/admin/dashboard/services/admin-dashboard-metrics-gateway.token'; import { AdminDashboardMetricsLocalGateway } from './features/admin/dashboard/services/admin-dashboard-metrics.local.gateway'; import { ADMIN_MODERATION_GATEWAY } from './features/admin/moderation/services/admin-moderation-gateway.token'; import { AdminModerationLocalGateway } from './features/admin/moderation/services/admin-moderation-local.gateway'; import { ADMIN_MONITORING_GATEWAY } from './features/admin/monitoring/services/admin-monitoring-gateway.token'; import { AdminMonitoringLocalGateway } from './features/admin/monitoring/services/admin-monitoring-local.gateway'; import { ADMIN_NOTIFICATIONS_GATEWAY } from './features/admin/notifications/services/admin-notifications-gateway.token'; import { AdminNotificationsLocalGateway } from './features/admin/notifications/services/admin-notifications-local.gateway'; import { ADMIN_ORDERS_GATEWAY } from './features/admin/orders/services/admin-orders-gateway.token'; import { AdminOrdersLocalGateway } from './features/admin/orders/services/admin-orders-local.gateway'; import { ADMIN_PRODUCTS_GATEWAY } from './features/admin/products/services/admin-products-gateway.token'; import { AdminProductsLocalGateway } from './features/admin/products/services/admin-products-local.gateway'; import { ADMIN_TRANSACTIONS_GATEWAY } from './features/admin/transactions/services/admin-transactions-gateway.token'; import { AdminTransactionsLocalGateway } from './features/admin/transactions/services/admin-transactions-local.gateway'; import { ADMIN_USERS_GATEWAY } from './features/admin/users/services/admin-users-gateway.token'; import { AdminUsersLocalGateway } from './features/admin/users/services/admin-users-local.gateway'; import { ANALYTICS_GATEWAY } from './core/analytics/services/analytics-gateway.token'; import { AnalyticsLocalGateway } from './core/analytics/services/analytics-local.gateway'; import { CONNECTOR_GATEWAY } from './core/integrations/services/connector-gateway.token'; import { ConnectorLocalGateway } from './core/integrations/services/connector-local.gateway'; import { FINANCE_GATEWAY } from './core/finance/services/finance-gateway.token'; import { FinanceLocalGateway } from './core/finance/services/finance-local.gateway'; import { FX_QUOTE_GATEWAY } from './core/pricing/services/fx-quote-gateway.token'; import { FxQuoteLocalGateway } from './core/pricing/services/fx-quote-local.gateway'; import { MALL_CONTENT_GATEWAY } from './core/content-modules/services/mall-content-gateway.token'; import { MallContentLocalGateway } from './core/content-modules/services/mall-content-local.gateway'; import { MARKETPLACE_GATEWAY } from './core/marketplace-registry/services/marketplace-gateway.token'; import { MarketplaceLocalGateway } from './core/marketplace-registry/services/marketplace-local.gateway'; import { MARKETPLACE_REVISION_GATEWAY } from './core/marketplace-registry/services/marketplace-revision-gateway.token'; import { MarketplaceRevisionLocalGateway } from './core/marketplace-registry/services/marketplace-revision-local.gateway'; import { OFFER_GATEWAY } from './core/offers/services/offer-gateway.token'; import { OfferLocalGateway } from './core/offers/services/offer-local.gateway'; import { PARTNER_HIERARCHY_GATEWAY } from './core/partner-hierarchy/services/partner-hierarchy-gateway.token'; import { PartnerHierarchyLocalGateway } from './core/partner-hierarchy/services/partner-hierarchy-local.gateway'; import { PERMISSION_GATEWAY } from './core/permissions/services/permission-gateway.token'; import { PermissionLocalGateway } from './core/permissions/services/permission-local.gateway'; import { SELLER_GATEWAY } from './core/sellers/services/seller-gateway.token'; import { SellerLocalGateway } from './core/sellers/services/seller-local.gateway'; import { SERVER_CART_GATEWAY } from './core/cart/services/server-cart-gateway.token'; import { ServerCartLocalGateway } from './core/cart/services/server-cart-local.gateway'; import { SOCIAL_IDENTITY_GATEWAY } from './core/identity/services/social-identity-gateway.token'; import { SocialIdentityLocalGateway } from './core/identity/services/social-identity-local.gateway'; /** * Development-only gateway overrides. * * This file is swapped for mock-gateway.providers.production.ts at build time * (see angular.json fileReplacements), the same mechanism * mock-data.interceptor.production.ts already uses. The production copy * imports nothing, so no *LocalGateway class - and none of its seeded * fixtures - can reach a production bundle. * * It used to live inside each token factory as * factory: () => (environment.useMockData ? inject(XLocal) : inject(XApi)) * which reads as a toggle but is not one: naming both classes in the factory * keeps both reachable, so every mock shipped regardless of the flag. A * fixture string from partner-hierarchy-local.gateway.ts was verifiably * present in a production build on 2026-08-21. * * useExisting rather than useClass: the local gateways are already * providedIn: 'root' singletons, and an app-level provider for the token * wins over its tree-shakable default. */ export const MOCK_GATEWAY_PROVIDERS: Provider[] = environment.useMockData ? [ { provide: ADMIN_DASHBOARD_METRICS_GATEWAY, useExisting: AdminDashboardMetricsLocalGateway }, { provide: ADMIN_MODERATION_GATEWAY, useExisting: AdminModerationLocalGateway }, { provide: ADMIN_MONITORING_GATEWAY, useExisting: AdminMonitoringLocalGateway }, { provide: ADMIN_NOTIFICATIONS_GATEWAY, useExisting: AdminNotificationsLocalGateway }, { provide: ADMIN_ORDERS_GATEWAY, useExisting: AdminOrdersLocalGateway }, { provide: ADMIN_PRODUCTS_GATEWAY, useExisting: AdminProductsLocalGateway }, { provide: ADMIN_TRANSACTIONS_GATEWAY, useExisting: AdminTransactionsLocalGateway }, { provide: ADMIN_USERS_GATEWAY, useExisting: AdminUsersLocalGateway }, { provide: ANALYTICS_GATEWAY, useExisting: AnalyticsLocalGateway }, { provide: CONNECTOR_GATEWAY, useExisting: ConnectorLocalGateway }, { provide: FINANCE_GATEWAY, useExisting: FinanceLocalGateway }, { provide: FX_QUOTE_GATEWAY, useExisting: FxQuoteLocalGateway }, { provide: MALL_CONTENT_GATEWAY, useExisting: MallContentLocalGateway }, { provide: MARKETPLACE_GATEWAY, useExisting: MarketplaceLocalGateway }, { provide: MARKETPLACE_REVISION_GATEWAY, useExisting: MarketplaceRevisionLocalGateway }, { provide: OFFER_GATEWAY, useExisting: OfferLocalGateway }, { provide: PARTNER_HIERARCHY_GATEWAY, useExisting: PartnerHierarchyLocalGateway }, { provide: PERMISSION_GATEWAY, useExisting: PermissionLocalGateway }, { provide: SELLER_GATEWAY, useExisting: SellerLocalGateway }, { provide: SERVER_CART_GATEWAY, useExisting: ServerCartLocalGateway }, { provide: SOCIAL_IDENTITY_GATEWAY, useExisting: SocialIdentityLocalGateway }, ] : [];