@wocart/storefront / astro / StorefrontMiddlewareOptions
Interface: StorefrontMiddlewareOptions<TContext, TStore, TResult, TSerialized>
Type Parameters
TContext
TContext extends StorefrontMiddlewareContext
TStore
TStore
TResult
TResult extends ActionHandlerResult
TSerialized
TSerialized
Properties
client
client: (
locale?) =>object
The theme's one client factory: in locale, or in the store's primary language when absent.
Parameters
locale?
string
Returns
object
cart
cart:
CartNamespace
categories
categories:
CategoriesNamespace
collections
collections:
CollectionsNamespace
config
config:
ConfigNamespace
geo
geo:
GeoNamespace
menus
menus:
MenusNamespace
orders
orders:
OrdersNamespace
pageData
pageData:
PageDataNamespace
pages
pages:
PagesNamespace
products
products:
ProductsNamespace
shipping
shipping:
ShippingNamespace
context
context: (
store) =>TStore
The theme's context for a resolved store; it becomes locals.store.
Parameters
store
Returns
TStore
embedded?
optionalembedded?: (pathname) =>boolean
Whether a path serves part of a page rather than a page. Default: /api/ and /_server-islands/.
Parameters
pathname
string
Returns
boolean
fallback
fallback:
StoreConfig
What renders when the store's config cannot be read: unavailableStoreConfig(…).
getActionContext
getActionContext: (
context) =>StorefrontActionContext<TResult,TSerialized>
Astro's getActionContext, from astro:actions.
Parameters
context
TContext
Returns
StorefrontActionContext<TResult, TSerialized>
preview
preview:
object&Pick<PreviewRequestOptions,"theme"|"maxBytes">
The editor's preview route (THEME_PREVIEW_PATH) and how its token is
checked; no publicKey: the route answers 404. Pass the key as a
function to read it on each request: a secret from astro:env/server
can be set after the module loads.
Type Declaration
path
path:
string
publicKey
publicKey:
string|JsonWebKey| (() =>string|JsonWebKey)