import type { Address } from '../../../../types/address.js'; import type { ShippingZoneRow, ShippingZoneProviderRow } from '../../../../types/db/index.js'; import type { ShippingContext, ShippingProvider } from '../../../../types/shippingProvider.js'; interface CartLike { getData(key: string): unknown; getItems(): Array<{ getData(key: string): unknown; }>; } export interface BuildShippingContextArgs { cart: CartLike; provider: ShippingProvider; zone: ShippingZoneRow; /** Pre-loaded row from `shipping_zone_provider` (the attachment). */ attachment?: Pick | null; /** Optional address override (used when the caller supplies a tentative address). */ destinationOverride?: Address | null; } /** * Compose a `ShippingContext` for a single (cart, provider, zone) tuple. * * The orchestrator (see Phase 3's rewrite of `getAvailableShippingMethods.ts`) * resolves zones from the destination address, loads the provider attachment * rows for those zones, and calls this helper once per (zone, provider) * combination. Pre-loading `attachment` avoids per-call round trips to * Postgres when iterating across many zones / providers. * * Origin is composed from store settings via `getOriginAddress`. Items are * serialized into plain DTOs via `serializeItems` — providers never see * `CartItem` class instances. * * See wiki/shipping-provider-design.md → "Data flow". */ export declare function buildShippingContext(args: BuildShippingContextArgs): Promise; export {};