NextEventBridgeHandlers

cart · /next·type

Per-event handler map passed to . Each key is a discriminant; TypeScript infers the narrowed event payload for that variant so handlers receive the concrete fields — cart, line, mutation — without casting. Omit keys for events you don't need to handle.

Definition

@nordcom/commerce-cart
type NextEventBridgeHandlers = Partial<{ [K in …]: … }>;

Partial<\{ [K in …]: … \}>

Example

const handlers: NextEventBridgeHandlers = {
    'cart.line.added': async (event) => {
        await analytics.track('AddToCart', { lineId: event.line.id });
    },
};

AuthBridge CartIdStorage CreateTypedCartActionsOpts FormCartActions HttpOnlyCookieStorageOpts NextEventBridge TypedCartActions createCartEnsurer

On this page