Skip to content

feature-order setup

Styles

Import them once, in the stylesheet where you load Tailwind:

@import "@evolve-storefront/feature-order/styles.css";

Translations

The package ships its texts in @evolve-storefront/feature-order/messages. evolve messages merges them into your message files and never overwrites a text you changed.

OrderProvider

Single provider for the order feature. Supplies the injected auth/session/mode seam the data hooks read. mode: "business" scopes reads to the company's orders; vatDisplay selects net vs gross presentation.

import { OrderProvider } from "@evolve-storefront/feature-order/provider";
PropTypeDescription
childrenReactNode
mode?OrderMode
isAuthenticated?boolean
businessUnitId?string
permissions?string[]
vatDisplay?VatDisplay
returnUrls?OrderReturnUrls

Where the payment provider returns the buyer after paying an unpaid order. Omit it in a storefront that never offers to pay one; usePayOrder throws rather than guess a route and lose a buyer who has already been charged.

Prefetching on the server

Fetch the data in a Server Component so the page renders with it instead of a skeleton.

orderConfirmationQueryOptionsreadOrderConfirmation as query options, invalidated with the order it shows.
import { orderConfirmationQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderConfirmationQueryOptions(
args: { gqlClient: ClientFetcher; orderId: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<FoundOrder | null, Error, FoundOrder | null, readonly ["orders", "lookup", "confirmation", string]>, "queryFn"> & { queryFn?: QueryFun…
OptionTypeDescription
gqlClientClientFetcher
orderIdstring
enabled?boolean
orderDeliveryPlanQueryOptionsThe slot or pickup point the buyer chose for an order, for OrderDetail's deliveryPlan.
import { orderDeliveryPlanQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderDeliveryPlanQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; orderNumber: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<OrderDeliveryPlan | null, Error, OrderDeliveryPlan | null, readonly ["orders", "detail", string, string, "delivery-plan"]>, "queryFn">…
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
orderNumberstring
enabled?boolean
orderLineReviewsQueryOptionsPer line of an order, whether it may be reviewed and the buyer's own review.
import { orderLineReviewsQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderLineReviewsQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; orderNumber: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<OrderLineReview[], Error, OrderLineReview[], readonly ["orders", "detail", string, string, "line-reviews"]>, "queryFn"> & { queryFn?: …
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
orderNumberstring
enabled?boolean
orderLookupPaymentMethodsQueryOptionsreadOrderPaymentMethods as query options, keyed on the lookup and the device.
import { orderLookupPaymentMethodsQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderLookupPaymentMethodsQueryOptions(
args: { gqlClient: ClientFetcher; lookup: OrderPaymentMethodsLookup; device: OrderClientDevice; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<OrderPaymentMethods | null, Error, OrderPaymentMethods | null, readonly ["orders", "payment-methods", "lookup", ...string[], string]>,…
OptionTypeDescription
gqlClientClientFetcher
lookupOrderPaymentMethodsLookup
deviceOrderClientDevice
enabled?boolean
orderLookupQueryOptionsreadOrder as query options, keyed on how the order was named.
import { orderLookupQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderLookupQueryOptions(
args: { gqlClient: ClientFetcher; lookup: OrderLookup; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<FoundOrder | null, Error, FoundOrder | null, readonly ["orders", "lookup", ...string[]]>, "queryFn"> & { queryFn?: QueryFunction<Found…
OptionTypeDescription
gqlClientClientFetcher
lookupOrderLookup
enabled?boolean
orderPaymentMethodsQueryOptionsThe payment methods offered for one order.
import { orderPaymentMethodsQueryOptions } from "@evolve-storefront/feature-order/queries";

null only when the order itself is missing. An empty array is a real answer — no method is offered for this amount, buyer and device — and a pay surface has to say so rather than render an empty list.

function orderPaymentMethodsQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; orderNumber: string; device: OrderClientDevice; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<{ id: string; availablePaymentMethods: OrderPaymentMethod[]; } | null, Error, { id: string; availablePaymentMethods: OrderPaymentMetho…
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
orderNumberstring
deviceOrderClientDevice
enabled?boolean
orderQueryOptionsA single order by order number.
import { orderQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; orderNumber: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<Order | null, Error, Order | null, readonly ["orders", "detail", string, string]>, "queryFn"> & { queryFn?: QueryFunction<Order | null…
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
orderNumberstring
enabled?boolean
ordersQueryOptionsOrder history (paginated list) for the scope.
import { ordersQueryOptions } from "@evolve-storefront/feature-order/queries";

searchTerm matches the order number, the purchase-order reference or a line item's SKU, each in full; not product names. Omitting status is not "every status" — cancelled orders are left out unless named, so a cancelled-orders view passes ["CANCELLED"] and there is no value meaning "all".

function ordersQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; page?: number | undefined; pageSize?: number | undefined; searchTerm?: string | undefined; status?: readonly OrderStatus[] | undefined; createdFrom?: string | undefined; createdUntil?: string | undefined; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<OrderResult | null, Error, OrderResult | null, readonly ["orders", "list", string, number, string, number | "default", string, string,…
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
page?number
pageSize?number
searchTerm?string
status?readonly OrderStatus[]
createdFrom?string

Inclusive lower bound, an ISO instant — see OrdersVars on the timezone.

createdUntil?string

Inclusive upper bound, an ISO instant.

enabled?boolean
orderStatusCountsQueryOptionsHow many orders each status holds under a search and date range, whatever the list's own status filter, as { OPEN: 3, … }.
import { orderStatusCountsQueryOptions } from "@evolve-storefront/feature-order/queries";
function orderStatusCountsQueryOptions(
args: { gqlClient: ClientFetcher; scope: OrderScope; searchTerm?: string | undefined; createdFrom?: string | undefined; createdUntil?: string | undefined; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<Partial<Record<OrderStatus, number>> | null, Error, Partial<Record<OrderStatus, number>> | null, readonly ["orders", "list", string, "…
OptionTypeDescription
gqlClientClientFetcher
scopeOrderScope
searchTerm?string
createdFrom?string
createdUntil?string
enabled?boolean