Skip to content

feature-quote setup

Styles

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

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

Translations

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

QuoteProvider

Single provider for the quote feature. Supplies the injected auth/session seam the data hooks read. Quotes are business-only: the feature is inert unless businessUnitId is set.

import { QuoteProvider } from "@evolve-storefront/feature-quote/provider";
Design notes

Two capabilities, not one and not three. Requesting and converting are separate grants because converting is the acceptance — a sent quote is immediately orderable — so committing the company to a negotiated price is a different decision from asking for one. There is no third "decide" capability: a buyer who does not want a quote lets it expire, and a grant with no action behind it reads as protection that is not there.

Defaults are the schema's BusinessUnitCapability values verbatim; pass your own if your project uses a different vocabulary.

PropTypeDescription
childrenReactNode
isAuthenticated?boolean
businessUnitId?string
capabilities?string[]
requestCapability?string

Capability required to request a quote, and to cancel one.

convertCapability?string

Capability required to order a quote. Named for the schema's CONVERT_QUOTES grant, which is the framework's word, not ours.

Prefetching on the server

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

quoteCountsQueryOptionsHow many quotes and how many requests the company holds — the two numbers a tabbed overview shows, and the reason a buyer opens the page at all.
import { quoteCountsQueryOptions } from "@evolve-storefront/feature-quote/queries";

Its own query, because a list read answers for one tab. "Has my request been answered" is a fact about the tab the buyer is not looking at, and no amount of reading the open one produces it.

A count is undefined rather than 0 where the engine would not produce one: totalCount is null wherever it caps or estimates, and a tab reading "0" when the truth is "unknown" is worse than a tab reading nothing.

function quoteCountsQueryOptions(
args: { gqlClient: ClientFetcher; businessUnitId: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<{ quotes: number | undefined; requests: number | undefined; }, Error, { quotes: number | undefined; requests: number | undefined; }, r…
OptionTypeDescription
gqlClientClientFetcher
businessUnitIdstring
enabled?boolean
quoteQueryOptionsA single quote by id.
import { quoteQueryOptions } from "@evolve-storefront/feature-quote/queries";
function quoteQueryOptions(
args: { gqlClient: ClientFetcher; businessUnitId: string; id: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<Quote | null, Error, Quote | null, readonly ["quotes", "detail", string, QuoteKind, string]>, "queryFn"> & { queryFn?: QueryFunction<Q…
OptionTypeDescription
gqlClientClientFetcher
businessUnitIdstring
idstring
enabled?boolean
quoteRequestQueryOptionsA single quote request by id.
import { quoteRequestQueryOptions } from "@evolve-storefront/feature-quote/queries";
function quoteRequestQueryOptions(
args: { gqlClient: ClientFetcher; businessUnitId: string; id: string; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<QuoteRequest | null, Error, QuoteRequest | null, readonly ["quotes", "detail", string, QuoteKind, string]>, "queryFn"> & { queryFn?: Q…
OptionTypeDescription
gqlClientClientFetcher
businessUnitIdstring
idstring
enabled?boolean
quoteRequestsQueryOptionsA page of quote requests for the company.
import { quoteRequestsQueryOptions } from "@evolve-storefront/feature-quote/queries";
function quoteRequestsQueryOptions(
args: { gqlClient: ClientFetcher; businessUnitId: string; page?: number | undefined; pageSize?: number | undefined; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<QuoteRequestResult | null, Error, QuoteRequestResult | null, readonly ["quotes", "list", string, QuoteKind, number, number | "default"…
OptionTypeDescription
gqlClientClientFetcher
businessUnitIdstring
page?number
pageSize?number
enabled?boolean
quotesQueryOptionsA page of quotes for the company.
import { quotesQueryOptions } from "@evolve-storefront/feature-quote/queries";
function quotesQueryOptions(
args: { gqlClient: ClientFetcher; businessUnitId: string; page?: number | undefined; pageSize?: number | undefined; sort?: QuoteSortOrder | undefined; status?: QuoteStatus | null | undefined; enabled?: boolean | undefined; },
): OmitKeyof<UseQueryOptions<QuoteResult | null, Error, QuoteResult | null, readonly ["quotes", "list", string, QuoteKind, number, number | "default", { readonly s…
OptionTypeDescription
gqlClientClientFetcher
businessUnitIdstring
page?number
pageSize?number
sort?QuoteSortOrder
status?QuoteStatus | null
enabled?boolean