Augur

augur-hooks

React Query hooks and Zustand stores for Augur data.

@simpleapps-com/augur-hooks

React Query hooks and Zustand stores for Augur data. Cross-platform — safe for React Native and web.

npm install @simpleapps-com/augur-hooks

Entry Points

ImportEnvironmentPurpose
augur-hooksCross-platformHooks, stores, provider, types
augur-hooks/serverNext.js App RouterServer-side prefetching, query options, keys
augur-hooks/webBrowser onlyDOM-dependent hooks (mobile detection, intersection)

Client Exports

ExportDescription
AugurHooksProviderContext provider that supplies the Augur API client, auth, and cache to all hooks
useAugurApiReturns the Augur API client from context (throws if missing)
useAugurApiOptionalReturns the Augur API client from context or undefined if missing
useAugurAuthReturns the current auth context (customer ID, session, etc.)
useAugurCacheReturns the cache configuration from context
useAugurSiteReturns the site configuration from context (defaults, formatting, analytics)
useAugurOptionsReturns a deep proxy that produces TanStack Query options for every SDK method
useCartStoreZustand store for cart state (header UID, lines, totals)
useCartHdrUidSelector: current cart header UID
useCartLinesSelector: current cart line items
useCartQuantityTotalSelector: sum of all line quantities in the cart
useCartLineCountSelector: number of distinct lines in the cart
useSetCartHdrUidAction: set the cart header UID
useSetCartLinesAction: replace all cart line items
useClearCartAction: clear all cart state
useItemFiltersStoreZustand store for item list filter/sort state
useDebounceDebounces a value by a configurable delay
useFormatPriceFormats a numeric price using the site's locale and currency
useStockFetches full TStock data and resolves it into normalized stock state
executeBatchQueryExecutes a batch query that splits large ID lists into chunked parallel requests
useCartActionsProvides add/update/remove cart mutation actions
useCartInitializationInitializes cart state from session on mount
useCartPricingFetches computed cart pricing (subtotal, tax, shipping)
usePaginationPrefetchPrefetches adjacent pages for faster pagination navigation
useAugurPersistenceProvides offline persistence for React Query cache via configurable storage
usePaymentFlowManages the 5-step Unified payment lifecycle (transactionSetup, cardInfo, validate, accountQuery, billingUpdate)
registerQueryActionRegisters a query action function for auto-detection by the provider and hooks
getRegisteredQueryActionReturns the registered query action function or null
useModalLifecycleModal lifecycle hook -- scroll lock, Escape key, hydration gate
useOrderReadinessDebounced order readiness validation with customReadinessCheck override
determineOrderReadinessPure function that checks all order readiness gates
useCheckoutPersistencePersists checkout fields to sessionStorage with TTL and restore-on-mount
saveToSessionSave a value to sessionStorage with timestamp for TTL
loadFromSessionLoad a value from sessionStorage with TTL check and optional validator
clearFromSessionRemove a key from sessionStorage
clearCheckoutPersistenceClear all checkout persistence keys from sessionStorage

Server Exports

ExportDescription
getQueryClientReturns a per-request singleton QueryClient for React Server Components
createAugurOptionsCreates server-side query options proxy for prefetching with identical keys to useAugurOptions
executeBatchQueryExecutes a batch query that splits large ID lists into chunked parallel requests

Web Exports

ExportDescription
useIsMobileReturns whether the viewport is below the mobile breakpoint
MobileProviderContext provider that tracks viewport size for mobile detection
useIsHydratedReturns true after client-side hydration is complete
useMobileOptimizedIntersectionIntersectionObserver hook with mobile-optimized thresholds
useImageWithFallbackLoads an image with automatic fallback to a placeholder on error

This page is auto-generated from hooks-manifest.json at build time.