feature-quote hooks
The components already use these hooks. Reach for them when you build your own UI on the same data. Open a hook for its options and what it returns.
Reading data
useQuoteRead a single quote by id.
import { useQuote } from "@evolve-storefront/feature-quote/hooks";Gated on auth, so it reports isPending (not isLoading) until the client
auth context validates. Render the skeleton while isPending; only
isSuccess && !data is a real 404.
function useQuote(id: string)Returns A React Query result: data, isPending, error and the rest.
useQuoteCountsHow many quotes and how many requests the company holds — what a tabbed overview puts on its tabs.
import { useQuoteCounts } from "@evolve-storefront/feature-quote/hooks";Gated the same way the lists are, so it stays pending rather than settling empty while the client auth context validates.
function useQuoteCounts()Returns A React Query result: data, isPending, error and the rest.
useQuoteRequestRead a single quote request by id.
import { useQuoteRequest } from "@evolve-storefront/feature-quote/hooks";function useQuoteRequest(id: string)Returns A React Query result: data, isPending, error and the rest.
useQuoteRequestsRead a page of the company's quote requests.
import { useQuoteRequests } from "@evolve-storefront/feature-quote/hooks";function useQuoteRequests(args?: { page?: number | undefined; pageSize?: number | undefined; })| Option | Type | Description |
|---|---|---|
page? | number | |
pageSize? | number |
Returns A React Query result: data, isPending, error and the rest.
useQuotesRead a page of the company's quotes, ready-to-order first unless sort says otherwise.
import { useQuotes } from "@evolve-storefront/feature-quote/hooks";function useQuotes(args?: { page?: number | undefined; pageSize?: number | undefined; sort?: QuoteSortOrder | undefined; status?: QuoteStatus | null | undefined; })| Option | Type | Description |
|---|---|---|
page? | number | |
pageSize? | number | |
sort? | QuoteSortOrder | |
status? | QuoteStatus | null |
Returns A React Query result: data, isPending, error and the rest.
Changing data
useCreateQuoteRequestRequest a quote from a cart.
import { useCreateQuoteRequest } from "@evolve-storefront/feature-quote/hooks";function useCreateQuoteRequest()Returns A React Query mutation: mutate, mutateAsync, isPending and the rest.
useDeclineQuoteTurn the quote down.
import { useDeclineQuote } from "@evolve-storefront/feature-quote/hooks";function useDeclineQuote()Returns A React Query mutation: mutate, mutateAsync, isPending and the rest.
usePlaceQuoteOrderTurn the quote into an order.
import { usePlaceQuoteOrder } from "@evolve-storefront/feature-quote/hooks";It does not pay for it, and must never learn how. An unpaid order is settled
through the same capability that settles any other one, so this hands off — the app
routes to the order and feature-order takes it from there. That rule was written
here before and broken here anyway: this package grew a payment picker, a pay form,
a submit button and a methods query, all of which are gone.
So a quote that is ordered and not paid leaves an unpaid order, which is a normal state and not an error: the quote is already converted and cannot be ordered again, and recovery happens on the order. What nothing here may assume is that the quote returns to orderable.
What becomes of a quoted order nobody pays is an open question in the spec — indefinite, expiring, or cancelled — so do not encode an answer to it here.
Invalidates the quote's detail cache on success, because the quote is converted the moment this resolves.
function usePlaceQuoteOrder()Returns A React Query mutation: mutate, mutateAsync, isPending and the rest.
useReplyToQuoteAsk the seller for a different offer.
import { useReplyToQuote } from "@evolve-storefront/feature-quote/hooks";function useReplyToQuote()Returns A React Query mutation: mutate, mutateAsync, isPending and the rest.
Other hooks
useQuoteRequestEndingRequesting a quote as a way to finish a checkout: the choice, its fields and its button, for feature-cart's CheckoutFinishSection endings.
import { useQuoteRequestEnding } from "@evolve-storefront/feature-quote/checkout";function useQuoteRequestEnding( options?: QuoteRequestEndingOptions,): { id: string; label: string; description: string; isHeld: boolean; requirePurchaseReference: boolean; fields: ReactNode; submitLabel: string; pendingLabel: stri…| Option | Type | Description |
|---|---|---|
comment? | string | null | The buyer's message, held by the app until submit: |
fields? | ReactNode | The ending's fields, usually |
removeCart? | (() => Promise<unknown>) | Delete the cart once the request exists, |
requirePurchaseReference? | boolean | A request needs a reference both sides call it by. On by default. |
onRequested? | ((quoteRequest: QuoteRequest) => void) | Runs with the created request, such as navigating to it. |
useQuoteRequestFormReads the state seeded by QuoteRequestForm.
import { useQuoteRequestForm } from "@evolve-storefront/feature-quote/quote-request-button";function useQuoteRequestForm(): QuoteRequestFormContextValueReturns QuoteRequestFormContextValue

