@usethrottle/quotes 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/hooks.ts","../src/QuoteView.tsx","../src/QuoteRequestForm.tsx"],"sourcesContent":["import { ThrottleError } from '@usethrottle/errors';\n\n/**\n * Every failure from the quote-link routes surfaces as this. The `code` is the\n * API's own error code, so callers can branch on the ones that matter to a\n * buyer flow rather than parsing messages:\n *\n * revision_superseded — a newer revision was issued; `details.currentRevisionId`\n * tells you what to reload\n * quote_expired — the offer lapsed (HTTP 410)\n * invalid_item_selection — locked-line edit, non-optional deselect, or unknown item\n * accept_in_progress — a concurrent accept won; retry shortly\n * not_found — unknown/rotated token, or a draft/archived quote\n */\nexport class ThrottleQuotesError extends ThrottleError {\n constructor(args: {\n code: string;\n message: string;\n statusCode: number;\n details?: unknown;\n }) {\n super(args);\n this.name = 'ThrottleQuotesError';\n }\n\n /** The offer moved on — reload and show the buyer the current revision. */\n get isSuperseded(): boolean {\n return this.code === 'revision_superseded';\n }\n\n get isExpired(): boolean {\n return this.code === 'quote_expired';\n }\n\n /** Revision the server considers current, when it told us (spec §8.1). */\n get currentRevisionId(): string | undefined {\n const d = this.details as { currentRevisionId?: string } | undefined;\n return d?.currentRevisionId;\n }\n}\n","import { ThrottleQuotesError } from './errors';\nimport type {\n AcceptQuoteInput,\n AcceptQuoteResult,\n BuyerQuote,\n QuoteComment,\n QuotesClientOptions,\n RequestFormConfig,\n SubmitQuoteRequestInput,\n ThrottleEnvelope,\n} from './types';\n\nconst DEFAULT_BASE = 'https://api.usethrottle.dev';\n\n/**\n * Headless client for the public quote surfaces. Everything is authorized by\n * the capability token in the URL — there is no API key here, and there must\n * not be: this runs in the buyer's browser.\n */\nexport class QuotesClient {\n private readonly baseUrl: string;\n private readonly fetchImpl: typeof globalThis.fetch;\n private readonly timeoutMs: number;\n\n constructor(opts: QuotesClientOptions = {}) {\n const fetchImpl = opts.fetch ?? globalThis.fetch;\n if (!fetchImpl) throw new Error('QuotesClient: fetch is required');\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE).replace(/\\/+$/, '');\n this.fetchImpl = fetchImpl;\n this.timeoutMs = opts.timeoutMs ?? 30_000;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), this.timeoutMs);\n try {\n const res = await this.fetchImpl(`${this.baseUrl}${path}`, {\n method,\n headers: body === undefined ? {} : { 'content-type': 'application/json' },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n signal: ctrl.signal,\n });\n const json = (await res.json().catch(() => ({}))) as ThrottleEnvelope<T>;\n if (!res.ok) {\n throw new ThrottleQuotesError({\n code: json.error?.code ?? 'unknown_error',\n message: json.error?.message ?? `HTTP ${res.status}`,\n statusCode: res.status,\n details: json.error?.details,\n });\n }\n return json.data as T;\n } finally {\n clearTimeout(timer);\n }\n }\n\n /** Fetch the quote a buyer link points at. 404s for unknown/rotated tokens. */\n getQuote(token: string): Promise<BuyerQuote> {\n return this.request<BuyerQuote>('GET', `/api/v1/quote-links/${encodeURIComponent(token)}`);\n }\n\n /**\n * Tell the merchant the buyer opened the quote. Fire-and-forget: the server\n * throttles the resulting webhook to one per revision per 6h, and a failed\n * beacon must never break the page.\n */\n async recordView(token: string): Promise<void> {\n try {\n await this.request('POST', `/api/v1/quote-links/${encodeURIComponent(token)}/view`, {});\n } catch {\n /* telemetry only */\n }\n }\n\n addComment(token: string, input: { body: string; authorName?: string; authorEmail?: string }) {\n return this.request<QuoteComment>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/comments`,\n input,\n );\n }\n\n requestRevision(token: string, input: { message?: string; authorName?: string } = {}) {\n return this.request<BuyerQuote>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/request-revision`,\n input,\n );\n }\n\n decline(token: string, input: { reason?: string; authorName?: string } = {}) {\n return this.request<BuyerQuote>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/decline`,\n input,\n );\n }\n\n /**\n * Accept and get the checkout URL to send the buyer to.\n *\n * Re-accepting the same revision is idempotent and replays the same URL.\n * Accepting a superseded revision throws `revision_superseded` carrying\n * `currentRevisionId`; an expired offer throws `quote_expired`.\n */\n accept(token: string, input: AcceptQuoteInput): Promise<AcceptQuoteResult> {\n return this.request<AcceptQuoteResult>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/accept`,\n input,\n );\n }\n\n /** URL of the PDF for the revision the buyer is looking at (server 302s to signed storage). */\n pdfUrl(token: string): string {\n return `${this.baseUrl}/api/v1/quote-links/${encodeURIComponent(token)}/pdf`;\n }\n\n // ── RFQ intake ─────────────────────────────────────────────────────────────\n\n getRequestForm(formToken: string): Promise<RequestFormConfig> {\n return this.request<RequestFormConfig>(\n 'GET',\n `/api/v1/quote-request-forms/${encodeURIComponent(formToken)}/public`,\n );\n }\n\n /**\n * Submit an RFQ. The response is deliberately thin (`{ submitted: true }`) —\n * anonymous callers learn no internal identifiers. A submission caught by\n * the honeypot returns the same shape without creating anything, so a bot\n * cannot tell it was detected; treat success as \"accepted\", not \"created\".\n */\n submitRequest(formToken: string, input: SubmitQuoteRequestInput): Promise<{ submitted: boolean }> {\n return this.request<{ submitted: boolean }>('POST', '/api/v1/quote-requests', {\n formToken,\n ...input,\n });\n }\n}\n\nexport function createQuotesClient(opts: QuotesClientOptions = {}): QuotesClient {\n return new QuotesClient(opts);\n}\n\n// ── money formatting ─────────────────────────────────────────────────────────\n\n/** Minor units → a display string, e.g. (104000, 'USD') → \"$1,040.00\". */\nexport function formatMoney(minorUnits: number, currency: string, locale?: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(minorUnits / 100);\n}\n\n/**\n * Scale a line's quoted tax/discount to an edited quantity.\n *\n * MUST match `scaleLineCharges` in @commerce/quotes — the server recomputes\n * the accepted total with this rule, and any divergence shows the buyer one\n * total and charges another.\n */\nexport function scaleLineCharges(\n item: { quantity: number; taxAmount: number; discountAmount: number },\n quantity: number,\n): { taxAmount: number; discountAmount: number } {\n const base = item.quantity;\n if (!base || base <= 0 || quantity === base) {\n return { taxAmount: item.taxAmount, discountAmount: item.discountAmount };\n }\n const ratio = quantity / base;\n return {\n taxAmount: Math.round(item.taxAmount * ratio),\n discountAmount: Math.round(item.discountAmount * ratio),\n };\n}\n\n/** Effective total for a selection, using the same math the server will apply. */\nexport function computeSelectionTotal(\n items: Array<{\n id: string;\n unitPrice: number;\n quantity: number;\n taxAmount: number;\n discountAmount: number;\n optional: boolean;\n }>,\n selections: Record<string, { selected: boolean; quantity: number }>,\n shippingTotal = 0,\n): number {\n let total = shippingTotal;\n for (const item of items) {\n const state = selections[item.id];\n if (item.optional && state && !state.selected) continue;\n const qty = state?.quantity ?? item.quantity;\n const { taxAmount, discountAmount } = scaleLineCharges(item, qty);\n total += item.unitPrice * qty + taxAmount - discountAmount;\n }\n return total;\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { QuotesClient, computeSelectionTotal, createQuotesClient } from './client';\nimport { ThrottleQuotesError } from './errors';\nimport type {\n AcceptQuoteInput,\n BuyerQuote,\n ItemSelection,\n QuotesClientOptions,\n RequestFormConfig,\n SubmitQuoteRequestInput,\n} from './types';\n\nexport interface UseQuoteResult {\n quote: BuyerQuote | null;\n loading: boolean;\n error: ThrottleQuotesError | null;\n /** Re-fetch — call after a `revision_superseded` to show the current offer. */\n refresh: () => Promise<void>;\n /** Buyer's current line choices, keyed by item id. */\n selections: Record<string, { selected: boolean; quantity: number }>;\n setSelected: (itemId: string, selected: boolean) => void;\n setQuantity: (itemId: string, quantity: number) => void;\n /** Live total for the current selections, using the server's own math. */\n total: number;\n accept: (\n input: Omit<AcceptQuoteInput, 'revisionId' | 'itemSelections'>,\n ) => Promise<{ checkoutUrl: string }>;\n requestRevision: (message: string, authorName?: string) => Promise<void>;\n decline: (reason?: string, authorName?: string) => Promise<void>;\n addComment: (body: string, authorName?: string) => Promise<void>;\n pdfUrl: string;\n submitting: boolean;\n}\n\n/**\n * Everything the buyer quote page needs.\n *\n * Fires the view beacon once per mount, keeps line selections in local state,\n * and recomputes the total with the same rule the server applies at\n * acceptance — so the number the buyer sees is the number they are charged.\n */\nexport function useQuote(token: string, options: QuotesClientOptions = {}): UseQuoteResult {\n const client = useMemo(\n () => new QuotesClient(options),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.baseUrl, options.timeoutMs],\n );\n const [quote, setQuote] = useState<BuyerQuote | null>(null);\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<ThrottleQuotesError | null>(null);\n const [selections, setSelections] = useState<Record<string, { selected: boolean; quantity: number }>>({});\n const beaconSent = useRef(false);\n\n const load = useCallback(async () => {\n setLoading(true);\n try {\n const q = await client.getQuote(token);\n setQuote(q);\n setError(null);\n // Seed selections from the revision's own defaults so a re-issue that\n // adds or locks lines resets the buyer's choices to the new offer.\n const next: Record<string, { selected: boolean; quantity: number }> = {};\n for (const item of q.currentRevision?.items ?? []) {\n next[item.id] = { selected: item.optional ? item.optionalSelected : true, quantity: item.quantity };\n }\n setSelections(next);\n } catch (e) {\n setError(e as ThrottleQuotesError);\n } finally {\n setLoading(false);\n }\n }, [client, token]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n useEffect(() => {\n if (!quote || beaconSent.current) return;\n beaconSent.current = true;\n void client.recordView(token);\n }, [client, quote, token]);\n\n const setSelected = useCallback((itemId: string, selected: boolean) => {\n setSelections((prev) => ({ ...prev, [itemId]: { ...(prev[itemId] ?? { quantity: 1 }), selected } }));\n }, []);\n\n const setQuantity = useCallback((itemId: string, quantity: number) => {\n setSelections((prev) => ({\n ...prev,\n [itemId]: { ...(prev[itemId] ?? { selected: true }), quantity: Math.max(1, Math.floor(quantity) || 1) },\n }));\n }, []);\n\n const total = useMemo(\n () =>\n computeSelectionTotal(\n quote?.currentRevision?.items ?? [],\n selections,\n quote?.currentRevision?.shippingTotal ?? 0,\n ),\n [quote, selections],\n );\n\n /** Only send selections the rep actually allows the buyer to change. */\n const buildSelections = useCallback((): ItemSelection[] => {\n const items = quote?.currentRevision?.items ?? [];\n const out: ItemSelection[] = [];\n for (const item of items) {\n const state = selections[item.id];\n if (!state) continue;\n const sel: ItemSelection = { itemId: item.id };\n let include = false;\n if (item.optional && state.selected !== item.optionalSelected) {\n sel.selected = state.selected;\n include = true;\n }\n if (item.qtyEditable && state.quantity !== item.quantity) {\n sel.quantity = state.quantity;\n include = true;\n }\n if (include) out.push(sel);\n }\n return out;\n }, [quote, selections]);\n\n const guard = useCallback(\n async <T,>(fn: () => Promise<T>): Promise<T> => {\n setSubmitting(true);\n try {\n const result = await fn();\n setError(null);\n return result;\n } catch (e) {\n const err = e as ThrottleQuotesError;\n setError(err);\n // A superseded offer means our copy is stale — pull the current one so\n // the buyer sees what they can actually accept (spec §8.1).\n if (err.isSuperseded) void load();\n throw err;\n } finally {\n setSubmitting(false);\n }\n },\n [load],\n );\n\n const accept = useCallback(\n async (input: Omit<AcceptQuoteInput, 'revisionId' | 'itemSelections'>) => {\n const revisionId = quote?.currentRevision?.id;\n if (!revisionId) throw new Error('useQuote: no current revision to accept');\n const itemSelections = buildSelections();\n const res = await guard(() =>\n client.accept(token, {\n ...input,\n revisionId,\n ...(itemSelections.length ? { itemSelections } : {}),\n }),\n );\n return { checkoutUrl: res.checkoutUrl };\n },\n [buildSelections, client, guard, quote, token],\n );\n\n const requestRevision = useCallback(\n async (message: string, authorName?: string) => {\n const q = await guard(() => client.requestRevision(token, { message, authorName }));\n setQuote(q);\n },\n [client, guard, token],\n );\n\n const decline = useCallback(\n async (reason?: string, authorName?: string) => {\n const q = await guard(() => client.decline(token, { reason, authorName }));\n setQuote(q);\n },\n [client, guard, token],\n );\n\n const addComment = useCallback(\n async (body: string, authorName?: string) => {\n await guard(() => client.addComment(token, { body, authorName }));\n await load();\n },\n [client, guard, load, token],\n );\n\n return {\n quote,\n loading,\n error,\n refresh: load,\n selections,\n setSelected,\n setQuantity,\n total,\n accept,\n requestRevision,\n decline,\n addComment,\n pdfUrl: client.pdfUrl(token),\n submitting,\n };\n}\n\nexport interface UseQuoteRequestFormResult {\n config: RequestFormConfig | null;\n loading: boolean;\n error: ThrottleQuotesError | null;\n submitting: boolean;\n submitted: boolean;\n submit: (input: SubmitQuoteRequestInput) => Promise<void>;\n /** Mount time; pass through so the API's minimum-fill-time check passes. */\n formLoadedAt: number;\n}\n\n/** Loads a hosted RFQ form's config and submits it, with bot fields handled. */\nexport function useQuoteRequestForm(\n formToken: string,\n options: QuotesClientOptions = {},\n): UseQuoteRequestFormResult {\n const client = useMemo(\n () => new QuotesClient(options),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.baseUrl, options.timeoutMs],\n );\n const [config, setConfig] = useState<RequestFormConfig | null>(null);\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<ThrottleQuotesError | null>(null);\n const formLoadedAt = useRef(Date.now()).current;\n\n useEffect(() => {\n let cancelled = false;\n (async () => {\n try {\n const cfg = await client.getRequestForm(formToken);\n if (!cancelled) setConfig(cfg);\n } catch (e) {\n if (!cancelled) setError(e as ThrottleQuotesError);\n } finally {\n if (!cancelled) setLoading(false);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [client, formToken]);\n\n const submit = useCallback(\n async (input: SubmitQuoteRequestInput) => {\n setSubmitting(true);\n try {\n await client.submitRequest(formToken, { formLoadedAt, ...input });\n setSubmitted(true);\n setError(null);\n } catch (e) {\n setError(e as ThrottleQuotesError);\n throw e;\n } finally {\n setSubmitting(false);\n }\n },\n [client, formLoadedAt, formToken],\n );\n\n return { config, loading, error, submitting, submitted, submit, formLoadedAt };\n}\n\nexport { createQuotesClient };\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { formatMoney } from './client';\nimport { useQuote } from './hooks';\nimport type { QuotesClientOptions } from './types';\n\nexport interface QuoteViewProps {\n /** The `qtl_…` token from the buyer's link. */\n token: string;\n options?: QuotesClientOptions;\n /**\n * Where to send the buyer after acceptance. Defaults to assigning\n * `window.location.href`, which is what the hosted page does.\n */\n onCheckout?: (checkoutUrl: string) => void;\n /** Rendered instead of the built-in markup while loading. */\n loadingFallback?: ReactNode;\n className?: string;\n}\n\nconst row: CSSProperties = { display: 'flex', justifyContent: 'space-between', gap: 16, padding: '8px 0' };\nconst muted: CSSProperties = { color: '#666', fontSize: 13 };\n\n/**\n * Drop-in buyer quote page: line items with optional toggles and quantity\n * editing, live totals, revision history, comment thread, and the\n * accept / request-changes / decline actions.\n *\n * Intentionally unstyled beyond a readable default — it is meant to be\n * restyled or replaced. `useQuote` carries all the behaviour if you want to\n * build your own presentation.\n */\nexport function QuoteView({ token, options, onCheckout, loadingFallback, className }: QuoteViewProps) {\n const q = useQuote(token, options ?? {});\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [showAccept, setShowAccept] = useState(false);\n const [comment, setComment] = useState('');\n\n if (q.loading) return <>{loadingFallback ?? <p>Loading quote…</p>}</>;\n if (!q.quote) {\n return <p>This quote link is no longer available.</p>;\n }\n\n const quote = q.quote;\n const rev = quote.currentRevision;\n const currency = quote.currency;\n const ordered = quote.status === 'ordered';\n const canAct = quote.status === 'ready';\n\n const handleAccept = async () => {\n const { checkoutUrl } = await q.accept({ acceptedByName: name, acceptedByEmail: email });\n if (onCheckout) onCheckout(checkoutUrl);\n else if (typeof window !== 'undefined') window.location.href = checkoutUrl;\n };\n\n return (\n <div className={className}>\n <header>\n {quote.branding?.displayName ? <p style={muted}>{quote.branding.displayName}</p> : null}\n <h1>Quote {quote.quoteNumber}</h1>\n <p style={muted}>{statusLabel(quote.status)}</p>\n {quote.buyerReference ? <p style={muted}>Your reference: {quote.buyerReference}</p> : null}\n {rev ? (\n <p style={muted}>\n Revision {rev.revisionNumber}\n {rev.expiresAt ? ` · valid until ${new Date(rev.expiresAt).toLocaleDateString()}` : null}\n {' · '}\n <a href={q.pdfUrl}>Download PDF</a>\n </p>\n ) : null}\n </header>\n\n {q.error ? (\n <p role=\"alert\">\n {q.error.isSuperseded\n ? 'This quote was updated — showing the latest version.'\n : q.error.message}\n </p>\n ) : null}\n\n {rev ? (\n <table style={{ width: '100%', borderCollapse: 'collapse' }}>\n <thead>\n <tr>\n <th align=\"left\">Item</th>\n <th align=\"right\">Unit price</th>\n <th align=\"right\">Qty</th>\n <th align=\"right\">Total</th>\n </tr>\n </thead>\n <tbody>\n {rev.items.map((item) => {\n const state = q.selections[item.id] ?? { selected: true, quantity: item.quantity };\n const included = item.optional ? state.selected : true;\n return (\n <tr key={item.id}>\n <td>\n {item.optional ? (\n <label>\n <input\n type=\"checkbox\"\n checked={state.selected}\n disabled={!canAct}\n onChange={(e) => q.setSelected(item.id, e.target.checked)}\n />{' '}\n {item.name} <span style={muted}>optional</span>\n </label>\n ) : (\n item.name\n )}\n {item.description ? <div style={muted}>{item.description}</div> : null}\n </td>\n <td align=\"right\">{formatMoney(item.unitPrice, currency)}</td>\n <td align=\"right\">\n {item.qtyEditable && canAct ? (\n <input\n type=\"number\"\n min={1}\n value={state.quantity}\n disabled={!included}\n aria-label={`Quantity for ${item.name}`}\n onChange={(e) => q.setQuantity(item.id, Number(e.target.value))}\n style={{ width: 64 }}\n />\n ) : (\n state.quantity\n )}\n </td>\n <td align=\"right\">\n {included\n ? formatMoney(\n item.unitPrice * state.quantity + item.taxAmount - item.discountAmount,\n currency,\n )\n : formatMoney(0, currency)}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n ) : null}\n\n {rev ? (\n <section>\n <div style={row}>\n <strong>Total</strong>\n <strong>{formatMoney(q.total, currency)}</strong>\n </div>\n <p style={muted}>{termsLabel(rev.paymentTerms, rev.depositAmount, currency)}</p>\n {rev.leadTime ? <p style={muted}>Lead time: {rev.leadTime}</p> : null}\n {rev.buyerNote ? <blockquote>{rev.buyerNote}</blockquote> : null}\n </section>\n ) : null}\n\n {ordered ? (\n <p>\n Ordered{quote.orderId ? ` — order ${quote.orderId}` : ''}. Thank you.\n </p>\n ) : canAct ? (\n <section>\n {showAccept ? (\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void handleAccept();\n }}\n >\n <label>\n Your name\n <input value={name} onChange={(e) => setName(e.target.value)} required />\n </label>\n <label>\n Email\n <input type=\"email\" value={email} onChange={(e) => setEmail(e.target.value)} required />\n </label>\n <button type=\"submit\" disabled={q.submitting || !name || !email}>\n Confirm &amp; continue to payment\n </button>\n </form>\n ) : (\n <button type=\"button\" onClick={() => setShowAccept(true)}>\n Accept &amp; checkout\n </button>\n )}\n <button\n type=\"button\"\n disabled={q.submitting}\n onClick={() => void q.requestRevision('Please revise this quote.', name || undefined)}\n >\n Request changes\n </button>\n <button type=\"button\" disabled={q.submitting} onClick={() => void q.decline(undefined, name || undefined)}>\n Decline\n </button>\n </section>\n ) : null}\n\n {quote.revisionHistory.length > 0 ? (\n <details>\n <summary>Previous versions ({quote.revisionHistory.length})</summary>\n <ul>\n {quote.revisionHistory.map((r) => (\n <li key={r.id}>\n Revision {r.revisionNumber} — {formatMoney(r.total, currency)}\n {r.changeSummary ? ` · ${r.changeSummary}` : ''}\n </li>\n ))}\n </ul>\n </details>\n ) : null}\n\n <section>\n <h2>Questions</h2>\n {quote.comments.map((c) => (\n <p key={c.id}>\n <strong>{c.authorName ?? (c.authorType === 'merchant' ? 'Seller' : 'You')}:</strong> {c.body}\n </p>\n ))}\n <form\n onSubmit={(e) => {\n e.preventDefault();\n const body = comment.trim();\n if (!body) return;\n setComment('');\n void q.addComment(body, name || undefined);\n }}\n >\n <input\n value={comment}\n onChange={(e) => setComment(e.target.value)}\n placeholder=\"Ask a question…\"\n aria-label=\"Ask a question\"\n />\n <button type=\"submit\" disabled={q.submitting || !comment.trim()}>\n Send\n </button>\n </form>\n </section>\n </div>\n );\n}\n\nfunction statusLabel(status: string): string {\n switch (status) {\n case 'in_progress':\n return 'We are preparing your quote';\n case 'ready':\n return 'Ready for your review';\n case 'being_revised':\n return 'We are revising this quote';\n case 'accepted':\n return 'Accepted — completing payment';\n case 'ordered':\n return 'Ordered';\n case 'declined':\n return 'Declined';\n case 'expired':\n return 'This quote has expired — request updated pricing';\n default:\n return status;\n }\n}\n\nfunction termsLabel(\n terms: { mode: string; netN?: number; balanceNetN?: number },\n depositAmount: number | null,\n currency: string,\n): string {\n if (terms.mode === 'net_terms') return `Payment terms: Net ${terms.netN}`;\n if (terms.mode === 'deposit_balance') {\n const dep = depositAmount != null ? formatMoney(depositAmount, currency) : 'a deposit';\n return `${dep} due today, balance Net ${terms.balanceNetN}`;\n }\n return 'Payment in full';\n}\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { useQuoteRequestForm } from './hooks';\nimport type { QuotesClientOptions } from './types';\n\nexport interface QuoteRequestFormProps {\n /** The `qrf_…` token from the merchant's hosted form URL. */\n formToken: string;\n options?: QuotesClientOptions;\n /**\n * Turnstile token, when the form requires it. Render the widget yourself and\n * pass its token through — this package deliberately pulls in no Cloudflare\n * script. If `config.fields.requireTurnstile` is set and this is empty, the\n * API fails the submission closed.\n */\n turnstileToken?: string;\n onSubmitted?: () => void;\n loadingFallback?: ReactNode;\n className?: string;\n}\n\n/** Off-screen but still focusable-free; bots fill it, humans never see it. */\nconst honeypotStyle: CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\n/**\n * Hosted RFQ intake form.\n *\n * Bot protection is wired in for you: the honeypot field and the mount-time\n * anchor that feeds the API's minimum-fill-time check. A honeypot hit returns\n * a success-shaped response and creates nothing, so `onSubmitted` fires either\n * way — by design, a bot must not learn it was caught.\n */\nexport function QuoteRequestForm({\n formToken,\n options,\n turnstileToken,\n onSubmitted,\n loadingFallback,\n className,\n}: QuoteRequestFormProps) {\n const f = useQuoteRequestForm(formToken, options ?? {});\n const [values, setValues] = useState({\n email: '',\n name: '',\n companyName: '',\n phone: '',\n buyerReference: '',\n message: '',\n website: '', // honeypot\n });\n\n const set = (k: keyof typeof values) => (e: { target: { value: string } }) =>\n setValues((prev) => ({ ...prev, [k]: e.target.value }));\n\n if (f.loading) return <>{loadingFallback ?? <p>Loading…</p>}</>;\n if (!f.config) return <p>This request form is not available.</p>;\n\n if (f.submitted) {\n const redirect = f.config.redirectUrl;\n // Re-check the scheme client-side even though the API rejects non-http(s)\n // on write — a stale row must not be able to script the host page.\n if (redirect && /^https?:\\/\\//i.test(redirect) && typeof window !== 'undefined') {\n window.location.href = redirect;\n }\n return <p>{f.config.successMessage ?? 'Thanks — we will be in touch shortly.'}</p>;\n }\n\n const fields = f.config.fields ?? {};\n\n return (\n <form\n className={className}\n onSubmit={(e) => {\n e.preventDefault();\n void f\n .submit({\n email: values.email,\n message: values.message,\n name: values.name || null,\n companyName: fields.companyName ? values.companyName || null : null,\n phone: fields.phone ? values.phone || null : null,\n buyerReference: fields.buyerReference ? values.buyerReference || null : null,\n website: values.website || null,\n ...(turnstileToken ? { turnstileToken } : {}),\n })\n .then(() => onSubmitted?.())\n .catch(() => {\n /* surfaced via f.error */\n });\n }}\n >\n {f.config.title ? <h1>{f.config.title}</h1> : null}\n {f.config.introText ? <p>{f.config.introText}</p> : null}\n {f.error ? <p role=\"alert\">{f.error.message}</p> : null}\n\n <label>\n Email\n <input type=\"email\" value={values.email} onChange={set('email')} required />\n </label>\n <label>\n Name\n <input value={values.name} onChange={set('name')} />\n </label>\n {fields.companyName ? (\n <label>\n Company\n <input value={values.companyName} onChange={set('companyName')} />\n </label>\n ) : null}\n {fields.phone ? (\n <label>\n Phone\n <input value={values.phone} onChange={set('phone')} />\n </label>\n ) : null}\n {fields.buyerReference ? (\n <label>\n Your reference #\n <input value={values.buyerReference} onChange={set('buyerReference')} />\n </label>\n ) : null}\n <label>\n What do you need?\n <textarea value={values.message} onChange={set('message')} required />\n </label>\n\n <div style={honeypotStyle} aria-hidden=\"true\">\n <label>\n Website\n <input\n name=\"website\"\n tabIndex={-1}\n autoComplete=\"off\"\n value={values.website}\n onChange={set('website')}\n />\n </label>\n </div>\n\n <button type=\"submit\" disabled={f.submitting || !values.email || !values.message}>\n {f.submitting ? 'Sending…' : 'Request a quote'}\n </button>\n </form>\n );\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAcvB,IAAM,sBAAN,cAAkC,cAAc;AAAA,EACrD,YAAY,MAKT;AACD,UAAM,IAAI;AACV,SAAK,OAAO;AAAA,EACd;AAAA;AAAA,EAGA,IAAI,eAAwB;AAC1B,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,IAAI,YAAqB;AACvB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA;AAAA,EAGA,IAAI,oBAAwC;AAC1C,UAAM,IAAI,KAAK;AACf,WAAO,GAAG;AAAA,EACZ;AACF;;;AC3BA,IAAM,eAAe;AAOd,IAAM,eAAN,MAAmB;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,OAA4B,CAAC,GAAG;AAC1C,UAAM,YAAY,KAAK,SAAS,WAAW;AAC3C,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,iCAAiC;AACjE,SAAK,WAAW,KAAK,WAAW,cAAc,QAAQ,QAAQ,EAAE;AAChE,SAAK,YAAY;AACjB,SAAK,YAAY,KAAK,aAAa;AAAA,EACrC;AAAA,EAEA,MAAc,QAAW,QAAgB,MAAc,MAA4B;AACjF,UAAM,OAAO,IAAI,gBAAgB;AACjC,UAAM,QAAQ,WAAW,MAAM,KAAK,MAAM,GAAG,KAAK,SAAS;AAC3D,QAAI;AACF,YAAM,MAAM,MAAM,KAAK,UAAU,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,QACzD;AAAA,QACA,SAAS,SAAS,SAAY,CAAC,IAAI,EA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cACb,OAAO,OAAO;AAAA,cACd,UAAU,IAAI,SAAS;AAAA;AAAA,UACzB;AAAA,WACF,GACF;AAAA,QAEA,gBAAAA,KAAC,YAAO,MAAK,UAAS,UAAU,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,OAAO,SACtE,YAAE,aAAa,kBAAa,mBAC/B;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["useState","useState","useState","Fragment","jsx","jsxs","useState"]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/hooks.ts","../src/quote-cart.ts","../src/QuoteView.tsx","../src/QuoteRequestForm.tsx"],"sourcesContent":["import { ThrottleError } from '@usethrottle/errors';\n\n/**\n * Every failure from the quote-link routes surfaces as this. The `code` is the\n * API's own error code, so callers can branch on the ones that matter to a\n * buyer flow rather than parsing messages:\n *\n * revision_superseded — a newer revision was issued; `details.currentRevisionId`\n * tells you what to reload\n * quote_expired — the offer lapsed (HTTP 410)\n * invalid_item_selection — locked-line edit, non-optional deselect, or unknown item\n * accept_in_progress — a concurrent accept won; retry shortly\n * not_found — unknown/rotated token, or a draft/archived quote\n */\nexport class ThrottleQuotesError extends ThrottleError {\n constructor(args: {\n code: string;\n message: string;\n statusCode: number;\n details?: unknown;\n }) {\n super(args);\n this.name = 'ThrottleQuotesError';\n }\n\n /** The offer moved on — reload and show the buyer the current revision. */\n get isSuperseded(): boolean {\n return this.code === 'revision_superseded';\n }\n\n get isExpired(): boolean {\n return this.code === 'quote_expired';\n }\n\n /** Revision the server considers current, when it told us (spec §8.1). */\n get currentRevisionId(): string | undefined {\n const d = this.details as { currentRevisionId?: string } | undefined;\n return d?.currentRevisionId;\n }\n}\n","import { ThrottleQuotesError } from './errors';\nimport type {\n AcceptQuoteInput,\n AcceptQuoteResult,\n BuyerQuote,\n QuoteComment,\n QuotesClientOptions,\n RequestFormConfig,\n SubmitQuoteRequestInput,\n ThrottleEnvelope,\n} from './types';\n\nconst DEFAULT_BASE = 'https://api.usethrottle.dev';\n\n/**\n * Headless client for the public quote surfaces. Everything is authorized by\n * the capability token in the URL — there is no API key here, and there must\n * not be: this runs in the buyer's browser.\n */\nexport class QuotesClient {\n private readonly baseUrl: string;\n private readonly fetchImpl: typeof globalThis.fetch;\n private readonly timeoutMs: number;\n\n constructor(opts: QuotesClientOptions = {}) {\n const fetchImpl = opts.fetch ?? globalThis.fetch;\n if (!fetchImpl) throw new Error('QuotesClient: fetch is required');\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE).replace(/\\/+$/, '');\n this.fetchImpl = fetchImpl;\n this.timeoutMs = opts.timeoutMs ?? 30_000;\n }\n\n private async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), this.timeoutMs);\n try {\n const res = await this.fetchImpl(`${this.baseUrl}${path}`, {\n method,\n headers: body === undefined ? {} : { 'content-type': 'application/json' },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n signal: ctrl.signal,\n });\n const json = (await res.json().catch(() => ({}))) as ThrottleEnvelope<T>;\n if (!res.ok) {\n throw new ThrottleQuotesError({\n code: json.error?.code ?? 'unknown_error',\n message: json.error?.message ?? `HTTP ${res.status}`,\n statusCode: res.status,\n details: json.error?.details,\n });\n }\n return json.data as T;\n } finally {\n clearTimeout(timer);\n }\n }\n\n /** Fetch the quote a buyer link points at. 404s for unknown/rotated tokens. */\n getQuote(token: string): Promise<BuyerQuote> {\n return this.request<BuyerQuote>('GET', `/api/v1/quote-links/${encodeURIComponent(token)}`);\n }\n\n /**\n * Tell the merchant the buyer opened the quote. Fire-and-forget: the server\n * throttles the resulting webhook to one per revision per 6h, and a failed\n * beacon must never break the page.\n */\n async recordView(token: string): Promise<void> {\n try {\n await this.request('POST', `/api/v1/quote-links/${encodeURIComponent(token)}/view`, {});\n } catch {\n /* telemetry only */\n }\n }\n\n addComment(token: string, input: { body: string; authorName?: string; authorEmail?: string }) {\n return this.request<QuoteComment>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/comments`,\n input,\n );\n }\n\n requestRevision(token: string, input: { message?: string; authorName?: string } = {}) {\n return this.request<BuyerQuote>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/request-revision`,\n input,\n );\n }\n\n decline(token: string, input: { reason?: string; authorName?: string } = {}) {\n return this.request<BuyerQuote>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/decline`,\n input,\n );\n }\n\n /**\n * Accept and get the checkout URL to send the buyer to.\n *\n * Re-accepting the same revision is idempotent and replays the same URL.\n * Accepting a superseded revision throws `revision_superseded` carrying\n * `currentRevisionId`; an expired offer throws `quote_expired`.\n */\n accept(token: string, input: AcceptQuoteInput): Promise<AcceptQuoteResult> {\n return this.request<AcceptQuoteResult>(\n 'POST',\n `/api/v1/quote-links/${encodeURIComponent(token)}/accept`,\n input,\n );\n }\n\n /** URL of the PDF for the revision the buyer is looking at (server 302s to signed storage). */\n pdfUrl(token: string): string {\n return `${this.baseUrl}/api/v1/quote-links/${encodeURIComponent(token)}/pdf`;\n }\n\n // ── RFQ intake ─────────────────────────────────────────────────────────────\n\n getRequestForm(formToken: string): Promise<RequestFormConfig> {\n return this.request<RequestFormConfig>(\n 'GET',\n `/api/v1/quote-request-forms/${encodeURIComponent(formToken)}/public`,\n );\n }\n\n /**\n * Submit an RFQ. The response is deliberately thin (`{ submitted: true }`) —\n * anonymous callers learn no internal identifiers. A submission caught by\n * the honeypot returns the same shape without creating anything, so a bot\n * cannot tell it was detected; treat success as \"accepted\", not \"created\".\n */\n submitRequest(formToken: string, input: SubmitQuoteRequestInput): Promise<{ submitted: boolean }> {\n return this.request<{ submitted: boolean }>('POST', '/api/v1/quote-requests', {\n formToken,\n ...input,\n });\n }\n}\n\nexport function createQuotesClient(opts: QuotesClientOptions = {}): QuotesClient {\n return new QuotesClient(opts);\n}\n\n// ── money formatting ─────────────────────────────────────────────────────────\n\n/** Minor units → a display string, e.g. (104000, 'USD') → \"$1,040.00\". */\nexport function formatMoney(minorUnits: number, currency: string, locale?: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(minorUnits / 100);\n}\n\n/**\n * Scale a line's quoted tax/discount to an edited quantity.\n *\n * MUST match `scaleLineCharges` in @commerce/quotes — the server recomputes\n * the accepted total with this rule, and any divergence shows the buyer one\n * total and charges another.\n */\nexport function scaleLineCharges(\n item: { quantity: number; taxAmount: number; discountAmount: number },\n quantity: number,\n): { taxAmount: number; discountAmount: number } {\n const base = item.quantity;\n if (!base || base <= 0 || quantity === base) {\n return { taxAmount: item.taxAmount, discountAmount: item.discountAmount };\n }\n const ratio = quantity / base;\n return {\n taxAmount: Math.round(item.taxAmount * ratio),\n discountAmount: Math.round(item.discountAmount * ratio),\n };\n}\n\n/** Effective total for a selection, using the same math the server will apply. */\nexport function computeSelectionTotal(\n items: Array<{\n id: string;\n unitPrice: number;\n quantity: number;\n taxAmount: number;\n discountAmount: number;\n optional: boolean;\n }>,\n selections: Record<string, { selected: boolean; quantity: number }>,\n shippingTotal = 0,\n): number {\n let total = shippingTotal;\n for (const item of items) {\n const state = selections[item.id];\n if (item.optional && state && !state.selected) continue;\n const qty = state?.quantity ?? item.quantity;\n const { taxAmount, discountAmount } = scaleLineCharges(item, qty);\n total += item.unitPrice * qty + taxAmount - discountAmount;\n }\n return total;\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { QuotesClient, computeSelectionTotal, createQuotesClient } from './client';\nimport { ThrottleQuotesError } from './errors';\nimport { createQuoteCart, type QuoteCart, type QuoteCartLine, type QuoteCartOptions } from './quote-cart';\nimport type {\n AcceptQuoteInput,\n BuyerQuote,\n ItemSelection,\n QuoteRequestItem,\n QuotesClientOptions,\n RequestFormConfig,\n SubmitQuoteRequestInput,\n} from './types';\n\nexport interface UseQuoteResult {\n quote: BuyerQuote | null;\n loading: boolean;\n error: ThrottleQuotesError | null;\n /** Re-fetch — call after a `revision_superseded` to show the current offer. */\n refresh: () => Promise<void>;\n /** Buyer's current line choices, keyed by item id. */\n selections: Record<string, { selected: boolean; quantity: number }>;\n setSelected: (itemId: string, selected: boolean) => void;\n setQuantity: (itemId: string, quantity: number) => void;\n /** Live total for the current selections, using the server's own math. */\n total: number;\n accept: (\n input: Omit<AcceptQuoteInput, 'revisionId' | 'itemSelections'>,\n ) => Promise<{ checkoutUrl: string }>;\n requestRevision: (message: string, authorName?: string) => Promise<void>;\n decline: (reason?: string, authorName?: string) => Promise<void>;\n addComment: (body: string, authorName?: string) => Promise<void>;\n pdfUrl: string;\n submitting: boolean;\n}\n\n/**\n * Everything the buyer quote page needs.\n *\n * Fires the view beacon once per mount, keeps line selections in local state,\n * and recomputes the total with the same rule the server applies at\n * acceptance — so the number the buyer sees is the number they are charged.\n */\nexport function useQuote(token: string, options: QuotesClientOptions = {}): UseQuoteResult {\n const client = useMemo(\n () => new QuotesClient(options),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.baseUrl, options.timeoutMs],\n );\n const [quote, setQuote] = useState<BuyerQuote | null>(null);\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<ThrottleQuotesError | null>(null);\n const [selections, setSelections] = useState<Record<string, { selected: boolean; quantity: number }>>({});\n const beaconSent = useRef(false);\n\n const load = useCallback(async () => {\n setLoading(true);\n try {\n const q = await client.getQuote(token);\n setQuote(q);\n setError(null);\n // Seed selections from the revision's own defaults so a re-issue that\n // adds or locks lines resets the buyer's choices to the new offer.\n const next: Record<string, { selected: boolean; quantity: number }> = {};\n for (const item of q.currentRevision?.items ?? []) {\n next[item.id] = { selected: item.optional ? item.optionalSelected : true, quantity: item.quantity };\n }\n setSelections(next);\n } catch (e) {\n setError(e as ThrottleQuotesError);\n } finally {\n setLoading(false);\n }\n }, [client, token]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n useEffect(() => {\n if (!quote || beaconSent.current) return;\n beaconSent.current = true;\n void client.recordView(token);\n }, [client, quote, token]);\n\n const setSelected = useCallback((itemId: string, selected: boolean) => {\n setSelections((prev) => ({ ...prev, [itemId]: { ...(prev[itemId] ?? { quantity: 1 }), selected } }));\n }, []);\n\n const setQuantity = useCallback((itemId: string, quantity: number) => {\n setSelections((prev) => ({\n ...prev,\n [itemId]: { ...(prev[itemId] ?? { selected: true }), quantity: Math.max(1, Math.floor(quantity) || 1) },\n }));\n }, []);\n\n const total = useMemo(\n () =>\n computeSelectionTotal(\n quote?.currentRevision?.items ?? [],\n selections,\n quote?.currentRevision?.shippingTotal ?? 0,\n ),\n [quote, selections],\n );\n\n /** Only send selections the rep actually allows the buyer to change. */\n const buildSelections = useCallback((): ItemSelection[] => {\n const items = quote?.currentRevision?.items ?? [];\n const out: ItemSelection[] = [];\n for (const item of items) {\n const state = selections[item.id];\n if (!state) continue;\n const sel: ItemSelection = { itemId: item.id };\n let include = false;\n if (item.optional && state.selected !== item.optionalSelected) {\n sel.selected = state.selected;\n include = true;\n }\n if (item.qtyEditable && state.quantity !== item.quantity) {\n sel.quantity = state.quantity;\n include = true;\n }\n if (include) out.push(sel);\n }\n return out;\n }, [quote, selections]);\n\n const guard = useCallback(\n async <T,>(fn: () => Promise<T>): Promise<T> => {\n setSubmitting(true);\n try {\n const result = await fn();\n setError(null);\n return result;\n } catch (e) {\n const err = e as ThrottleQuotesError;\n setError(err);\n // A superseded offer means our copy is stale — pull the current one so\n // the buyer sees what they can actually accept (spec §8.1).\n if (err.isSuperseded) void load();\n throw err;\n } finally {\n setSubmitting(false);\n }\n },\n [load],\n );\n\n const accept = useCallback(\n async (input: Omit<AcceptQuoteInput, 'revisionId' | 'itemSelections'>) => {\n const revisionId = quote?.currentRevision?.id;\n if (!revisionId) throw new Error('useQuote: no current revision to accept');\n const itemSelections = buildSelections();\n const res = await guard(() =>\n client.accept(token, {\n ...input,\n revisionId,\n ...(itemSelections.length ? { itemSelections } : {}),\n }),\n );\n return { checkoutUrl: res.checkoutUrl };\n },\n [buildSelections, client, guard, quote, token],\n );\n\n const requestRevision = useCallback(\n async (message: string, authorName?: string) => {\n const q = await guard(() => client.requestRevision(token, { message, authorName }));\n setQuote(q);\n },\n [client, guard, token],\n );\n\n const decline = useCallback(\n async (reason?: string, authorName?: string) => {\n const q = await guard(() => client.decline(token, { reason, authorName }));\n setQuote(q);\n },\n [client, guard, token],\n );\n\n const addComment = useCallback(\n async (body: string, authorName?: string) => {\n await guard(() => client.addComment(token, { body, authorName }));\n await load();\n },\n [client, guard, load, token],\n );\n\n return {\n quote,\n loading,\n error,\n refresh: load,\n selections,\n setSelected,\n setQuantity,\n total,\n accept,\n requestRevision,\n decline,\n addComment,\n pdfUrl: client.pdfUrl(token),\n submitting,\n };\n}\n\nexport interface UseQuoteRequestFormResult {\n config: RequestFormConfig | null;\n loading: boolean;\n error: ThrottleQuotesError | null;\n submitting: boolean;\n submitted: boolean;\n submit: (input: SubmitQuoteRequestInput) => Promise<void>;\n /** Mount time; pass through so the API's minimum-fill-time check passes. */\n formLoadedAt: number;\n}\n\n/** Loads a hosted RFQ form's config and submits it, with bot fields handled. */\nexport function useQuoteRequestForm(\n formToken: string,\n options: QuotesClientOptions = {},\n): UseQuoteRequestFormResult {\n const client = useMemo(\n () => new QuotesClient(options),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.baseUrl, options.timeoutMs],\n );\n const [config, setConfig] = useState<RequestFormConfig | null>(null);\n const [loading, setLoading] = useState(true);\n const [submitting, setSubmitting] = useState(false);\n const [submitted, setSubmitted] = useState(false);\n const [error, setError] = useState<ThrottleQuotesError | null>(null);\n const formLoadedAt = useRef(Date.now()).current;\n\n useEffect(() => {\n let cancelled = false;\n (async () => {\n try {\n const cfg = await client.getRequestForm(formToken);\n if (!cancelled) setConfig(cfg);\n } catch (e) {\n if (!cancelled) setError(e as ThrottleQuotesError);\n } finally {\n if (!cancelled) setLoading(false);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [client, formToken]);\n\n const submit = useCallback(\n async (input: SubmitQuoteRequestInput) => {\n setSubmitting(true);\n try {\n await client.submitRequest(formToken, { formLoadedAt, ...input });\n setSubmitted(true);\n setError(null);\n } catch (e) {\n setError(e as ThrottleQuotesError);\n throw e;\n } finally {\n setSubmitting(false);\n }\n },\n [client, formLoadedAt, formToken],\n );\n\n return { config, loading, error, submitting, submitted, submit, formLoadedAt };\n}\n\nexport { createQuotesClient };\n\nexport interface UseQuoteCartResult {\n lines: QuoteCartLine[];\n /** Total quantity across lines — for a header badge. */\n count: number;\n add: (item: QuoteRequestItem) => void;\n addMany: (items: QuoteRequestItem[]) => void;\n update: (key: string, patch: Partial<Omit<QuoteCartLine, 'key'>>) => void;\n remove: (key: string) => void;\n clear: () => void;\n /** The underlying cart, for use outside React (an Add to Quote button in plain JS). */\n cart: QuoteCart;\n}\n\n/**\n * A quote cart the buyer fills while browsing, then submits as one request.\n *\n * The cart persists across page views, so an Add to Quote button on a product\n * page and a Request quote page elsewhere on the site see the same lines.\n * Pass the result of `toRequestItems()` (or `lines`) to\n * `useQuoteRequestForm().submit` as `items`.\n */\nexport function useQuoteCart(options: QuoteCartOptions = {}): UseQuoteCartResult {\n const cart = useMemo(\n () => createQuoteCart(options),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.storageKey, options.maxLines],\n );\n // Seeded empty rather than from storage: reading localStorage during render\n // makes the server and the first client render disagree, which is a\n // hydration mismatch. The effect below fills it in immediately after mount.\n const [lines, setLines] = useState<QuoteCartLine[]>([]);\n\n useEffect(() => {\n setLines(cart.read());\n return cart.subscribe(setLines);\n }, [cart]);\n\n return {\n lines,\n count: lines.reduce((sum, line) => sum + line.quantity, 0),\n add: useCallback((item: QuoteRequestItem) => void cart.add(item), [cart]),\n addMany: useCallback((items: QuoteRequestItem[]) => void cart.addMany(items), [cart]),\n update: useCallback(\n (key: string, patch: Partial<Omit<QuoteCartLine, 'key'>>) => void cart.update(key, patch),\n [cart],\n ),\n remove: useCallback((key: string) => void cart.remove(key), [cart]),\n clear: useCallback(() => cart.clear(), [cart]),\n cart,\n };\n}\n","import type { QuoteRequestItem } from './types';\n\n/**\n * A quote cart: the buyer's running list of things to be quoted, built up\n * while they browse.\n *\n * Throttle stores no catalog, so the storefront owns product data and hands\n * lines in — the same arrangement as the shopping cart. Nothing here is sent\n * until `read()` is submitted through `QuotesClient.submitRequest`, and the\n * amounts a storefront attaches are the buyer's TARGET price, never a price\n * we will honour.\n *\n * Lines are keyed by `sku ?? referenceId ?? name`, so adding the same product\n * twice increases its quantity instead of stacking duplicate rows.\n */\n\nexport interface QuoteCartLine extends QuoteRequestItem {\n /** Stable identity for updates and removals. */\n key: string;\n quantity: number;\n}\n\nexport interface QuoteCartStorage {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\nexport interface QuoteCartOptions {\n /** Namespacing key, so two storefronts on one origin cannot collide. */\n storageKey?: string;\n /**\n * Where the cart survives page navigation. Defaults to `localStorage` in a\n * browser and to memory everywhere else (SSR, tests) — a cart that throws\n * during server rendering would take the whole page down.\n */\n storage?: QuoteCartStorage | null;\n /** Refuse to grow past this many distinct lines. The API caps at 100. */\n maxLines?: number;\n}\n\nconst DEFAULT_KEY = 'throttle:quote-cart';\nconst DEFAULT_MAX_LINES = 100;\n\nfunction memoryStorage(): QuoteCartStorage {\n const map = new Map<string, string>();\n return {\n getItem: (key) => map.get(key) ?? null,\n setItem: (key, value) => void map.set(key, value),\n removeItem: (key) => void map.delete(key),\n };\n}\n\nfunction defaultStorage(): QuoteCartStorage {\n try {\n if (typeof globalThis !== 'undefined' && (globalThis as any).localStorage) {\n return (globalThis as any).localStorage as QuoteCartStorage;\n }\n } catch {\n // Safari in private mode throws on access rather than returning null.\n }\n return memoryStorage();\n}\n\nfunction lineKey(item: QuoteRequestItem): string {\n const raw = item.sku?.trim() || item.referenceId?.trim() || item.name.trim();\n return raw.toLowerCase();\n}\n\nfunction normalizeQuantity(value: number | null | undefined): number {\n const n = Math.floor(Number(value ?? 1));\n return Number.isFinite(n) && n > 0 ? n : 1;\n}\n\nexport interface QuoteCart {\n /** Current lines, oldest first. */\n read(): QuoteCartLine[];\n /** Total quantity across lines — what a header badge should show. */\n count(): number;\n /** Add a line, merging quantities into an existing one with the same key. */\n add(item: QuoteRequestItem): QuoteCartLine[];\n /** Add several at once (a \"quote this whole cart\" button). */\n addMany(items: QuoteRequestItem[]): QuoteCartLine[];\n /** Change any field of a line. A quantity below 1 removes it. */\n update(key: string, patch: Partial<Omit<QuoteCartLine, 'key'>>): QuoteCartLine[];\n remove(key: string): QuoteCartLine[];\n clear(): void;\n /** Subscribe to every change. Returns an unsubscribe function. */\n subscribe(listener: (lines: QuoteCartLine[]) => void): () => void;\n /** The `items` payload for `QuotesClient.submitRequest`. */\n toRequestItems(): QuoteRequestItem[];\n}\n\nexport function createQuoteCart(options: QuoteCartOptions = {}): QuoteCart {\n const storageKey = options.storageKey ?? DEFAULT_KEY;\n const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;\n const storage = options.storage === null ? memoryStorage() : (options.storage ?? defaultStorage());\n const listeners = new Set<(lines: QuoteCartLine[]) => void>();\n\n function load(): QuoteCartLine[] {\n try {\n const raw = storage.getItem(storageKey);\n if (!raw) return [];\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n // Storage is buyer-writable — anything shaped wrong is dropped rather\n // than trusted into a submission.\n return parsed\n .filter((line: any) => line && typeof line.name === 'string' && line.name.trim())\n .map((line: any) => ({\n ...line,\n key: typeof line.key === 'string' && line.key ? line.key : lineKey(line),\n quantity: normalizeQuantity(line.quantity),\n }))\n .slice(0, maxLines);\n } catch {\n return [];\n }\n }\n\n function save(lines: QuoteCartLine[]): QuoteCartLine[] {\n try {\n storage.setItem(storageKey, JSON.stringify(lines));\n } catch {\n // Quota or a disabled store — the cart still works for this page view.\n }\n for (const listener of listeners) listener(lines);\n return lines;\n }\n\n return {\n read: load,\n\n count() {\n return load().reduce((sum, line) => sum + line.quantity, 0);\n },\n\n add(item) {\n return this.addMany([item]);\n },\n\n addMany(items) {\n const lines = load();\n for (const item of items) {\n if (!item?.name?.trim()) continue;\n const key = lineKey(item);\n const existing = lines.find((line) => line.key === key);\n if (existing) {\n existing.quantity += normalizeQuantity(item.quantity);\n // Later detail wins — a product page knows more than a listing card.\n if (item.note) existing.note = item.note;\n if (item.targetUnitPrice != null) existing.targetUnitPrice = item.targetUnitPrice;\n continue;\n }\n if (lines.length >= maxLines) break;\n lines.push({ ...item, key, quantity: normalizeQuantity(item.quantity) });\n }\n return save(lines);\n },\n\n update(key, patch) {\n const lines = load();\n const index = lines.findIndex((line) => line.key === key);\n if (index === -1) return lines;\n if (patch.quantity != null && Math.floor(Number(patch.quantity)) < 1) {\n lines.splice(index, 1);\n return save(lines);\n }\n lines[index] = {\n ...lines[index],\n ...patch,\n key,\n quantity: normalizeQuantity(patch.quantity ?? lines[index].quantity),\n };\n return save(lines);\n },\n\n remove(key) {\n return save(load().filter((line) => line.key !== key));\n },\n\n clear() {\n try {\n storage.removeItem(storageKey);\n } catch {\n // Ignore — the notification below still resets any subscriber.\n }\n for (const listener of listeners) listener([]);\n },\n\n subscribe(listener) {\n listeners.add(listener);\n return () => void listeners.delete(listener);\n },\n\n toRequestItems() {\n return load().map(({ key: _key, ...item }) => item);\n },\n };\n}\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { formatMoney } from './client';\nimport { useQuote } from './hooks';\nimport type { QuotesClientOptions } from './types';\n\nexport interface QuoteViewProps {\n /** The `qtl_…` token from the buyer's link. */\n token: string;\n options?: QuotesClientOptions;\n /**\n * Where to send the buyer after acceptance. Defaults to assigning\n * `window.location.href`, which is what the hosted page does.\n */\n onCheckout?: (checkoutUrl: string) => void;\n /** Rendered instead of the built-in markup while loading. */\n loadingFallback?: ReactNode;\n className?: string;\n}\n\nconst row: CSSProperties = { display: 'flex', justifyContent: 'space-between', gap: 16, padding: '8px 0' };\nconst muted: CSSProperties = { color: '#666', fontSize: 13 };\n\n/**\n * Drop-in buyer quote page: line items with optional toggles and quantity\n * editing, live totals, revision history, comment thread, and the\n * accept / request-changes / decline actions.\n *\n * Intentionally unstyled beyond a readable default — it is meant to be\n * restyled or replaced. `useQuote` carries all the behaviour if you want to\n * build your own presentation.\n */\nexport function QuoteView({ token, options, onCheckout, loadingFallback, className }: QuoteViewProps) {\n const q = useQuote(token, options ?? {});\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [showAccept, setShowAccept] = useState(false);\n const [comment, setComment] = useState('');\n\n if (q.loading) return <>{loadingFallback ?? <p>Loading quote…</p>}</>;\n if (!q.quote) {\n return <p>This quote link is no longer available.</p>;\n }\n\n const quote = q.quote;\n const rev = quote.currentRevision;\n const currency = quote.currency;\n const ordered = quote.status === 'ordered';\n const canAct = quote.status === 'ready';\n\n const handleAccept = async () => {\n const { checkoutUrl } = await q.accept({ acceptedByName: name, acceptedByEmail: email });\n if (onCheckout) onCheckout(checkoutUrl);\n else if (typeof window !== 'undefined') window.location.href = checkoutUrl;\n };\n\n return (\n <div className={className}>\n <header>\n {quote.branding?.displayName ? <p style={muted}>{quote.branding.displayName}</p> : null}\n <h1>Quote {quote.quoteNumber}</h1>\n <p style={muted}>{statusLabel(quote.status)}</p>\n {quote.buyerReference ? <p style={muted}>Your reference: {quote.buyerReference}</p> : null}\n {rev ? (\n <p style={muted}>\n Revision {rev.revisionNumber}\n {rev.expiresAt ? ` · valid until ${new Date(rev.expiresAt).toLocaleDateString()}` : null}\n {' · '}\n <a href={q.pdfUrl}>Download PDF</a>\n </p>\n ) : null}\n </header>\n\n {q.error ? (\n <p role=\"alert\">\n {q.error.isSuperseded\n ? 'This quote was updated — showing the latest version.'\n : q.error.message}\n </p>\n ) : null}\n\n {rev ? (\n <table style={{ width: '100%', borderCollapse: 'collapse' }}>\n <thead>\n <tr>\n <th align=\"left\">Item</th>\n <th align=\"right\">Unit price</th>\n <th align=\"right\">Qty</th>\n <th align=\"right\">Total</th>\n </tr>\n </thead>\n <tbody>\n {rev.items.map((item) => {\n const state = q.selections[item.id] ?? { selected: true, quantity: item.quantity };\n const included = item.optional ? state.selected : true;\n return (\n <tr key={item.id}>\n <td>\n {item.optional ? (\n <label>\n <input\n type=\"checkbox\"\n checked={state.selected}\n disabled={!canAct}\n onChange={(e) => q.setSelected(item.id, e.target.checked)}\n />{' '}\n {item.name} <span style={muted}>optional</span>\n </label>\n ) : (\n item.name\n )}\n {item.description ? <div style={muted}>{item.description}</div> : null}\n </td>\n <td align=\"right\">{formatMoney(item.unitPrice, currency)}</td>\n <td align=\"right\">\n {item.qtyEditable && canAct ? (\n <input\n type=\"number\"\n min={1}\n value={state.quantity}\n disabled={!included}\n aria-label={`Quantity for ${item.name}`}\n onChange={(e) => q.setQuantity(item.id, Number(e.target.value))}\n style={{ width: 64 }}\n />\n ) : (\n state.quantity\n )}\n </td>\n <td align=\"right\">\n {included\n ? formatMoney(\n item.unitPrice * state.quantity + item.taxAmount - item.discountAmount,\n currency,\n )\n : formatMoney(0, currency)}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n ) : null}\n\n {rev ? (\n <section>\n <div style={row}>\n <strong>Total</strong>\n <strong>{formatMoney(q.total, currency)}</strong>\n </div>\n <p style={muted}>{termsLabel(rev.paymentTerms, rev.depositAmount, currency)}</p>\n {rev.leadTime ? <p style={muted}>Lead time: {rev.leadTime}</p> : null}\n {rev.buyerNote ? <blockquote>{rev.buyerNote}</blockquote> : null}\n </section>\n ) : null}\n\n {ordered ? (\n <p>\n Ordered{quote.orderId ? ` — order ${quote.orderId}` : ''}. Thank you.\n </p>\n ) : canAct ? (\n <section>\n {showAccept ? (\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void handleAccept();\n }}\n >\n <label>\n Your name\n <input value={name} onChange={(e) => setName(e.target.value)} required />\n </label>\n <label>\n Email\n <input type=\"email\" value={email} onChange={(e) => setEmail(e.target.value)} required />\n </label>\n <button type=\"submit\" disabled={q.submitting || !name || !email}>\n Confirm &amp; continue to payment\n </button>\n </form>\n ) : (\n <button type=\"button\" onClick={() => setShowAccept(true)}>\n Accept &amp; checkout\n </button>\n )}\n <button\n type=\"button\"\n disabled={q.submitting}\n onClick={() => void q.requestRevision('Please revise this quote.', name || undefined)}\n >\n Request changes\n </button>\n <button type=\"button\" disabled={q.submitting} onClick={() => void q.decline(undefined, name || undefined)}>\n Decline\n </button>\n </section>\n ) : null}\n\n {quote.revisionHistory.length > 0 ? (\n <details>\n <summary>Previous versions ({quote.revisionHistory.length})</summary>\n <ul>\n {quote.revisionHistory.map((r) => (\n <li key={r.id}>\n Revision {r.revisionNumber} — {formatMoney(r.total, currency)}\n {r.changeSummary ? ` · ${r.changeSummary}` : ''}\n </li>\n ))}\n </ul>\n </details>\n ) : null}\n\n <section>\n <h2>Questions</h2>\n {quote.comments.map((c) => (\n <p key={c.id}>\n <strong>{c.authorName ?? (c.authorType === 'merchant' ? 'Seller' : 'You')}:</strong> {c.body}\n </p>\n ))}\n <form\n onSubmit={(e) => {\n e.preventDefault();\n const body = comment.trim();\n if (!body) return;\n setComment('');\n void q.addComment(body, name || undefined);\n }}\n >\n <input\n value={comment}\n onChange={(e) => setComment(e.target.value)}\n placeholder=\"Ask a question…\"\n aria-label=\"Ask a question\"\n />\n <button type=\"submit\" disabled={q.submitting || !comment.trim()}>\n Send\n </button>\n </form>\n </section>\n </div>\n );\n}\n\nfunction statusLabel(status: string): string {\n switch (status) {\n case 'in_progress':\n return 'We are preparing your quote';\n case 'ready':\n return 'Ready for your review';\n case 'being_revised':\n return 'We are revising this quote';\n case 'accepted':\n return 'Accepted — completing payment';\n case 'ordered':\n return 'Ordered';\n case 'declined':\n return 'Declined';\n case 'expired':\n return 'This quote has expired — request updated pricing';\n default:\n return status;\n }\n}\n\nfunction termsLabel(\n terms: { mode: string; netN?: number; balanceNetN?: number },\n depositAmount: number | null,\n currency: string,\n): string {\n if (terms.mode === 'net_terms') return `Payment terms: Net ${terms.netN}`;\n if (terms.mode === 'deposit_balance') {\n const dep = depositAmount != null ? formatMoney(depositAmount, currency) : 'a deposit';\n return `${dep} due today, balance Net ${terms.balanceNetN}`;\n }\n return 'Payment in full';\n}\n","import { useState, type CSSProperties, type ReactNode } from 'react';\nimport { useQuoteRequestForm } from './hooks';\nimport type { QuoteRequestItem, QuotesClientOptions } from './types';\n\nexport interface QuoteRequestFormProps {\n /** The `qrf_…` token from the merchant's hosted form URL. */\n formToken: string;\n options?: QuotesClientOptions;\n /**\n * Turnstile token, when the form requires it. Render the widget yourself and\n * pass its token through — this package deliberately pulls in no Cloudflare\n * script. If `config.fields.requireTurnstile` is set and this is empty, the\n * API fails the submission closed.\n */\n turnstileToken?: string;\n /**\n * Lines to submit with the request — typically `useQuoteCart().lines` after\n * the buyer has been adding products while browsing. When present, the\n * written message is optional.\n */\n items?: QuoteRequestItem[];\n onSubmitted?: () => void;\n loadingFallback?: ReactNode;\n className?: string;\n}\n\n/** Off-screen but still focusable-free; bots fill it, humans never see it. */\nconst honeypotStyle: CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\n/**\n * Hosted RFQ intake form.\n *\n * Bot protection is wired in for you: the honeypot field and the mount-time\n * anchor that feeds the API's minimum-fill-time check. A honeypot hit returns\n * a success-shaped response and creates nothing, so `onSubmitted` fires either\n * way — by design, a bot must not learn it was caught.\n */\nexport function QuoteRequestForm({\n formToken,\n options,\n turnstileToken,\n items,\n onSubmitted,\n loadingFallback,\n className,\n}: QuoteRequestFormProps) {\n const f = useQuoteRequestForm(formToken, options ?? {});\n // Lines the host collected while the buyer browsed (see `useQuoteCart`).\n // With any of these present the written message becomes optional: the ask\n // is the list.\n const lines = items ?? [];\n const [values, setValues] = useState({\n email: '',\n name: '',\n companyName: '',\n phone: '',\n buyerReference: '',\n message: '',\n website: '', // honeypot\n });\n\n const set = (k: keyof typeof values) => (e: { target: { value: string } }) =>\n setValues((prev) => ({ ...prev, [k]: e.target.value }));\n\n if (f.loading) return <>{loadingFallback ?? <p>Loading…</p>}</>;\n if (!f.config) return <p>This request form is not available.</p>;\n\n if (f.submitted) {\n const redirect = f.config.redirectUrl;\n // Re-check the scheme client-side even though the API rejects non-http(s)\n // on write — a stale row must not be able to script the host page.\n if (redirect && /^https?:\\/\\//i.test(redirect) && typeof window !== 'undefined') {\n window.location.href = redirect;\n }\n return <p>{f.config.successMessage ?? 'Thanks — we will be in touch shortly.'}</p>;\n }\n\n const fields = f.config.fields ?? {};\n\n return (\n <form\n className={className}\n onSubmit={(e) => {\n e.preventDefault();\n void f\n .submit({\n email: values.email,\n message: values.message || null,\n ...(lines.length > 0 ? { items: lines } : {}),\n name: values.name || null,\n companyName: fields.companyName ? values.companyName || null : null,\n phone: fields.phone ? values.phone || null : null,\n buyerReference: fields.buyerReference ? values.buyerReference || null : null,\n website: values.website || null,\n ...(turnstileToken ? { turnstileToken } : {}),\n })\n .then(() => onSubmitted?.())\n .catch(() => {\n /* surfaced via f.error */\n });\n }}\n >\n {f.config.title ? <h1>{f.config.title}</h1> : null}\n {f.config.introText ? <p>{f.config.introText}</p> : null}\n {f.error ? <p role=\"alert\">{f.error.message}</p> : null}\n\n <label>\n Email\n <input type=\"email\" value={values.email} onChange={set('email')} required />\n </label>\n <label>\n Name\n <input value={values.name} onChange={set('name')} />\n </label>\n {fields.companyName ? (\n <label>\n Company\n <input value={values.companyName} onChange={set('companyName')} />\n </label>\n ) : null}\n {fields.phone ? (\n <label>\n Phone\n <input value={values.phone} onChange={set('phone')} />\n </label>\n ) : null}\n {fields.buyerReference ? (\n <label>\n Your reference #\n <input value={values.buyerReference} onChange={set('buyerReference')} />\n </label>\n ) : null}\n {lines.length > 0 ? (\n <ul aria-label=\"Items on this request\">\n {lines.map((line, index) => (\n <li key={line.sku ?? line.referenceId ?? `${line.name}-${index}`}>\n {line.quantity ?? 1} × {line.name}\n {line.sku ? ` (${line.sku})` : ''}\n {line.note ? ` — ${line.note}` : ''}\n </li>\n ))}\n </ul>\n ) : null}\n <label>\n {lines.length > 0 ? 'Anything else we should know?' : 'What do you need?'}\n <textarea\n value={values.message}\n onChange={set('message')}\n required={lines.length === 0}\n />\n </label>\n\n <div style={honeypotStyle} aria-hidden=\"true\">\n <label>\n Website\n <input\n name=\"website\"\n tabIndex={-1}\n autoComplete=\"off\"\n value={values.website}\n onChange={set('website')}\n />\n </label>\n </div>\n\n <button\n type=\"submit\"\n disabled={f.submitting || !values.email || (!values.message && lines.length === 0)}\n >\n {f.submitting ? 'Sending…' : 'Request a quote'}\n </button>\n </form>\n );\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAcvB,IAAM,sBAAN,cAAkC,cAAc;AAAA,EACrD,YAAY,MAKT;AACD,UAAM,IAAI;AACV,SAAK,OAAO;AAAA,EACd;AAAA;AAAA,EAGA,IAAI,eAAwB;AAC1B,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,IAAI,YAAqB;AACvB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA;AAAA,EAGA,IAAI,oBAAwC;AAC1C,UAAM,IAAI,KAAK;AACf,WAAO,GAAG;AAAA,EACZ;AACF;;;AC3BA,IAAM,eAAe;AAOd,IAAM,eAAN,MAAmB;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,OAA4B,CAAC,GAAG;AAC1C,UAAM,YAAY,KAAK,SAAS,WAAW;AAC3C,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,iCAAiC;AACjE,SAAK,WAAW,KAAK,WAAW,cAAc,QAAQ,QAAQ,EAAE;AAChE,SAAK,YAAY;AACjB,SAAK,YAAY,KAAK,aAAa;AAAA,EACrC;AAAA,EAEA,MAAc,QAAW,QAAgB,MAAc,MAA4B;AACjF,UAAM,OAAO,IAAI,gBAAgB;AACjC,UAAM,QAAQ,WAAW,MAAM,KAAK,MAAM,GAAG,KAAK,SAAS;AAC3D,QAAI;AACF,YAAM,MAAM,MAAM,KAAK,UAAU,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,Q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AAAA;AAAA,UACzB;AAAA,WACF,GACF;AAAA,QAEA,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,UAAU,EAAE,cAAc,CAAC,OAAO,SAAU,CAAC,OAAO,WAAW,MAAM,WAAW;AAAA,YAE/E,YAAE,aAAa,kBAAa;AAAA;AAAA,QAC/B;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["useState","useState","useState","Fragment","jsx","jsxs","useState"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usethrottle/quotes",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Buyer-facing React components, hooks and server proxy for Throttle B2B quotes — hosted quote links and RFQ request forms.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",