import type { CartSyncClient } from "./client"; import type { SyncCartArgs } from "./types"; export interface UseCartSyncOptions { client: CartSyncClient; /** Gate: sync only for a signed-in shopper once the Shopify SDK has restored the cart. */ isLoggedIn: boolean; ready: boolean; /** * The cart this device is on, as a GID. A change here re-runs the sync (adoption changes the id). * The sync reads the newest value when it decides, not the one it started with. */ cartId: string | null; resolveCustomerId: () => Promise; adopt: (cartGid: string) => Promise; refresh: () => Promise; reset: () => Promise; notify?: (message: string) => void; readLines?: SyncCartArgs["readLines"]; addLines?: SyncCartArgs["addLines"]; readAttributes?: SyncCartArgs["readAttributes"]; writeAttributes?: SyncCartArgs["writeAttributes"]; } /** * Syncs on sign-in, on the SDK becoming ready, and on the cart id changing; returns a stable `sync` * to attach to focus/foreground triggers the host owns. Overlapping triggers are harmless — a trigger * during a run queues one more run after it, with the newest options. * * The cart controls are read through a ref so `sync` is built once: the focus/foreground triggers must * not rebuild per cart change (re-running on every change is exactly what they avoid), and a captured * `cartId` would freeze, making every later run report a stale cart and re-adopt-and-re-announce. * `cartId` goes to the client as a function over that ref, so a run reads the cart id at the moment * it decides: a run that started before the app restored its cart still sees the restored one. */ export declare function useCartSync(options: UseCartSyncOptions): { sync: () => void; }; /** * Records that the shared cart became an order, so neither this device nor the web store picks it back * up. Call from checkout — the only place that knows an order was placed. `customerGid` is the raw * Shopify customer GID; it is reduced to the numeric id the backend keys on. */ export declare function useCartSyncCheckedOut(client: CartSyncClient, resolveCustomerGid: () => string | null | undefined): (cartId: string | null) => Promise; //# sourceMappingURL=react.d.ts.map