import { BaseResource } from './BaseResource.js'; import type { RequestOptions } from '../types/common.js'; /** * Currency-keyed amount, e.g. `{ USD: { amount: 0 }, EUR: { amount: 0 } }`. * Mirrors the backend's `CurrencyOptions` shape — every supported * presentment currency must be present even if the rate is free. */ export interface ShippingRateAmount { [currency: string]: { amount: number; }; } /** * Input for `tagada.shippingRates.create(...)`. * * Conditions interact additively: a customer must satisfy *all* set * thresholds to be offered the rate. Leave a field undefined to skip * that check (e.g. omit `countryCodes` to allow any country). */ export interface ShippingRateCreateParams { /** Store this rate belongs to. */ storeId: string; /** Display name (required). */ shippingRateName: string; /** Optional human-readable description shown next to the rate. */ description?: string; /** Optional icon URL. */ icon?: string; /** Whether this rate is the default highlighted choice in the UI. */ highlighted?: boolean; /** Per-currency price for the shipping rate itself. */ amount: ShippingRateAmount; /** Set true to mark as free shipping (UX cue — also set `amount` to 0). */ isFree: boolean; /** Set true if this rate is fulfilled by carrier pickup points. */ isPickupPoint: boolean; /** Carriers supported when `isPickupPoint=true` (e.g. `['ups','fedex']`). */ pickupPointCarriers?: string[] | null; /** Min order subtotal to qualify (per-currency). */ shippingRateMinAmount?: ShippingRateAmount | null; /** Max order subtotal to qualify (per-currency). */ shippingRateMaxAmount?: ShippingRateAmount | null; /** Min total cart weight (grams) to qualify. */ shippingRateMinWeight?: number | null; /** Max total cart weight (grams) to qualify. */ shippingRateMaxWeight?: number | null; /** * ISO 3166-1 alpha-2 country codes the rate applies to. * Pass `[]` (or omit) to allow any country. */ countryCodes?: string[]; /** Estimated delivery time in days (optional, surfaced in checkout UI). */ estimatedDeliveryTime?: number; } export interface ShippingRateCreateResult { /** New shipping rate ID. Use it as the input to `selectShippingRate`. */ id: string; } /** * Shipping rates control which delivery options Tagada surfaces at * checkout. A rate is matched against the customer's address, cart * subtotal, and total weight; matching rates are returned by * `GET /api/v1/checkout-sessions/:id/shipping-rates`. * * Without at least one matching rate, the checkout still completes * (clients can choose to skip shipping selection), but the customer * never sees a delivery option. * * @example * ```ts * await tagada.shippingRates.create({ * storeId: 'store_xxx', * shippingRateName: 'Free Standard', * description: '5-7 business days', * isFree: true, * isPickupPoint: false, * amount: { USD: { amount: 0 }, EUR: { amount: 0 } }, * highlighted: true, * estimatedDeliveryTime: 7, * }); * ``` */ export declare class ShippingRates extends BaseResource { /** * Create a shipping rate for a store. * * Requires an API key whose account owns the target store. */ create(params: ShippingRateCreateParams, opts?: RequestOptions): Promise; } //# sourceMappingURL=ShippingRates.d.ts.map