CreateTypedCartActionsOpts

cart · /next·interface

Construction options for . Wires together the kernel, storage, and request-context factory that the typed action surface needs; optional authBridge and messageLocalizer let hosts attach identity resolution and i18n without coupling the cart layer to a specific auth or translation library.

Properties

kernel
CartKernel<TExt, TShop>
resolveContext
(opts: { idempotencyKey: string }) => Promise<AdapterCtx<TShop>>
authBridge?
messageLocalizer?
(reason: CartActionFailureReason, userErrorMessage: string) => Promise<string>

Example

const opts: CreateTypedCartActionsOpts<{}, MyShop> = {
    kernel,
    storage: httpOnlyCookieStorage(),
    resolveContext: async ({ idempotencyKey } = {}) => ({ shop, locale, idempotencyKey }),
};

AuthBridge CartIdStorage FormCartActions HttpOnlyCookieStorageOpts NextEventBridge TypedCartActions NextEventBridgeHandlers createCartEnsurer

On this page