Interface: CartManagerProviderProps
Optional lifecycle callbacks fired around every cart and checkout operation the hook drives. Centralise cross-cutting side-effects — a global loading indicator, a toast on failure, a router refresh on success — in one place instead of wrapping each call site.
onMutationError fires only for failures you can surface to the buyer: its
error carries a backend-translated message. Cart expiry is delivered
through its own dedicated channel (onExpired) — it carries an SDK-internal
message and does NOT trigger onMutationError. A transient missing-cart
error that the manager recovers from (by recreating the cart) resolves as
success, so it never reaches the error callback either.
Callbacks are invoked defensively: a throwing callback never rejects the underlying mutation.
Extends
Properties
children
children:
ReactNode
cookieDebug?
optionalcookieDebug?: (event) =>void
Optional debug sink forwarded to useCartManager — emits a phase: 'cookie' DebugEvent
on every cart-id set/clear (including the complete() clear). Wire it to the same transport
the GraphQL client uses for one shared debug timeline.
Parameters
event
Returns
void
initialCartId?
optionalinitialCartId?:string|null
Server-known cart-id seed forwarded to useCartManager. Used only when the
cart-id cookie is empty on mount — the cookie always wins when present.
Accepts a bare cart id or the composite "<cartId>.<secret>" cookie value;
pass the composite when the cart secret is known server-side so the seeded
cart stays reachable on reads and writes.
onMutationError?
optionalonMutationError?: (operation,error) =>void
Fired when an operation fails with a buyer-surfaceable error. Cart expiry
is routed to onExpired instead, not here.
Parameters
operation
error
Error
Returns
void
Inherited from
CartManagerLifecycleCallbacks.onMutationError
onMutationStart?
optionalonMutationStart?: (operation) =>void
Fired when an operation starts, before the request is sent.
Parameters
operation
Returns
void
Inherited from
CartManagerLifecycleCallbacks.onMutationStart
onMutationSuccess?
optionalonMutationSuccess?: (operation) =>void
Fired after an operation resolves successfully.
Parameters
operation
Returns
void