import type { ShippingMethod } from '../../../types/shippingProvider.js'; /** * Available shipping method as exposed to the GraphQL/storefront layer. * * `id` and `code` are intentionally duplicated for back-compat with the * pre-refactor `AvailableShippingMethod` GraphQL type (which had both * `id: String!` and `code: String!`). Phase 4 will widen the GraphQL type * with `providerCode`, `carrier`, `delivery`; consumers continue to read * `id`/`code`/`name`/`cost` unchanged through that transition. */ export interface AvailableShippingMethodResult extends ShippingMethod { id: string; providerCode: string; } /** * Orchestrator. Registry-only provider dispatch — no DB rows for providers * (the in-memory registry IS the provider list): * * 1. Resolve zones that cover the destination address. * 2. Load enabled `shipping_zone_provider` attachment rows for those zones. * 3. For each attachment, look up the registered provider by * `attachment.provider_code`. Missing-from-registry attachments * (extension uninstalled) are silently skipped. * 4. For each (zone, provider) tuple, in parallel: * - Build a ShippingContext. * - Call provider.getMethods(ctx) with a per-provider timeout. * - On error/timeout: log + skip; do not fail the whole list. * 5. Concat results, dedupe by (provider_code, code) keeping the first * occurrence, sort by cost ascending. * * `destination` optionally overrides the cart's stored shipping address field * by field (useful for pre-checkout rate calculators before the customer has * saved an address). Keys follow the address vocabulary (spec § 3.10, D-16). * * See wiki/shipping-provider-design.md → "Data flow" / "Listing methods at checkout". */ export interface ShippingDestination { country?: string | null; administrative_area?: string | null; locality?: string | null; dependent_locality?: string | null; postal_code?: string | null; } export declare function getAvailableShippingMethods(cartId: string, destination?: ShippingDestination): Promise;