@simpleapps-com/augur-hooks 1.0.7 → 1.0.9

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-DYM6U3QO.cjs","../src/queries/stable-stringify.ts","../src/queries/cache-helper.ts","../src/queries/item-price.ts","../src/queries/inv-mast-doc.ts","../src/queries/item-category.ts","../src/queries/inv-mast.ts","../src/queries/inv-mast-stock.ts","../src/queries/stock.ts","../src/queries/batch-inv-mast-doc.ts","../src/queries/batch-query.ts","../src/queries/product-category.ts","../src/queries/item-details.ts","../src/queries/item-attributes.ts","../src/queries/product-search.ts","../src/queries/search-suggestions.ts","../src/queries/cart-pricing.ts","../src/queries/category-items-infinite.ts","../src/queries/item-search-infinite.ts","../src/queries/joomla-content.ts","../src/queries/joomla-content-list.ts","../src/queries/joomla-menu.ts","../src/queries/joomla-menu-doc.ts","../src/queries/customer-orders.ts","../src/queries/customer-invoices.ts","../src/queries/customer-quotes.ts"],"names":[],"mappings":"AAAA;ACIA,uDAAgC;ADFhC;AACA;AEGA,SAAS,KAAA,CAAM,GAAA,EAAqB;AAClC,EAAA,IAAI,EAAA,EAAI,UAAA;AACR,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,GAAA,CAAI,MAAA,EAAQ,CAAA,EAAA,EAAK;AACnC,IAAA,EAAA,GAAK,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA;AACrB,IAAA,EAAA,EAAI,IAAA,CAAK,IAAA,CAAK,CAAA,EAAG,QAAU,CAAA;AAAA,EAC7B;AACA,EAAA,OAAA,CAAQ,EAAA,IAAM,CAAA,CAAA,CAAG,QAAA,CAAS,EAAE,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAA;AAC/C;AAeA,MAAA,SAAsB,SAAA,CACpB,QAAA,EACA,IAAA,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,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACE,YAAA;AACE,YAAA;AACJ,UAAA;AACK,UAAA;AACL,UAAA;AACF,QAAA;AACA,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;AL4Ee;AACA;AMjIF;AACH,EAAA;AACV;AAGa;AAME,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACM,YAAA;AACL,UAAA;AACI,UAAA;AACL,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;AN4He;AACA;AO9JF;AACH,EAAA;AACV;AAGa;AAKE,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACM,YAAA;AACL,UAAA;AACD,UAAA;AACA,UAAA;AACG,YAAA;AACD,YAAA;AACF,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;AP0Je;AACA;AQ/LF;AACH,EAAA;AACV;AAEa;AAKE,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACM,YAAA;AACL,UAAA;AACD,UAAA;AACA,UAAA;AACA,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;AR4Le;AACA;ASjNF;AAIL,EAAA;AACJ,IAAA;AACF,EAAA;AACO,EAAA;AACL,IAAA;AACA,IAAA;AACA,IAAA;AACF,EAAA;AACF;AASa;AAME,EAAA;AAC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;AAME,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACE,YAAA;AACG,YAAA;AACC,YAAA;AACL,UAAA;AACD,UAAA;AACF,QAAA;AACA,QAAA;AAAY,QAAA;AACd,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;ApBqkBe;AACA;AqB9mBF;AAGH,EAAA;AACV;AAGa;AAKE,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACK,YAAA;AACC,YAAA;AACL,UAAA;AACD,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;ArBwmBe;AACA;AsB3oBF;AACH,EAAA;AACV;AAGa;AAKE,EAAA;AACN,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACE,wBAAA;AACP,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACM,YAAA;AACL,UAAA;AACI,UAAA;AACL,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACW,IAAA;AACH,IAAA;AACV,EAAA;AACF;AtBuoBe;AACA;AuB7qBF;AAIH,EAAA;AACV;AAGa;AAIH,EAAA;AACV;AvBuqBe;AACA;AwBrrBF;AAIH,EAAA;AACV;AAGa;AAIH,EAAA;AACV;AxB+qBe;AACA;AyB7rBF;AAIH,EAAA;AACV;AAGa;AAIH,EAAA;AACV;AzBurBe;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-DYM6U3QO.cjs","sourcesContent":[null,"/**\n * Re-export from augur-core — single source of truth for deterministic key generation.\n * @deprecated Import from `@simpleapps-com/augur-core` instead. Will be removed in the next major version.\n */\nexport { stableStringify } from \"@simpleapps-com/augur-core\";\n","import type { CacheProvider, CacheTierConfig } from \"../types\";\nimport { stableStringify } from \"./stable-stringify\";\n\n/**\n * FNV-1a 32-bit hash. Fast, cross-platform (no Node crypto needed).\n */\nfunction fnv1a(str: string): string {\n let h = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return (h >>> 0).toString(16).padStart(8, \"0\");\n}\n\n/**\n * Wraps an async function with optional Redis caching.\n *\n * - When `provider` and `tier.redis` are both set, checks Redis before\n * calling `fn`, then caches the result on miss.\n * - When either is missing, calls `fn` directly (no-op passthrough).\n *\n * @param provider Redis-compatible get/set + prefix. Undefined = skip Redis.\n * @param tier Cache tier config. Undefined or missing `redis` = skip Redis.\n * @param methodPath Dot-separated SDK method path (used as cache key segment).\n * @param fn The async function to cache (typically the SDK call).\n * @param keyArgs Values to hash for the cache key (e.g. query params).\n */\nexport async function withCache<T>(\n provider: CacheProvider | undefined,\n tier: CacheTierConfig | undefined,\n methodPath: string,\n fn: () => Promise<T>,\n ...keyArgs: unknown[]\n): Promise<T> {\n const redisTtl = tier?.redis;\n if (!provider || !redisTtl) return fn();\n\n const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(stableStringify(keyArgs))}`;\n\n try {\n const cached = await provider.get(key);\n if (cached != null) return JSON.parse(cached) as T;\n } catch {\n /* Redis read error — fall through to SDK call */\n }\n\n const result = await fn();\n\n try {\n provider.set(key, JSON.stringify(result), redisTtl).catch(() => {});\n } catch {\n /* Non-serializable or write error — skip caching */\n }\n\n return result;\n}\n","import type { TPriceData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for item price queries.\n * Usable in both client hooks and server-side prefetch.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getItemPriceKey = (\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n) => {\n return [\"price\", itemId?.toUpperCase() || \"\", customerId, quantity] as const;\n};\n\n/**\n * Query options for item price. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getItemPriceOptions = (\n api: AugurApiClient,\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemPriceKey(itemId, customerId, quantity),\n queryFn: async (): Promise<TPriceData> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"pricing.priceEngine.get\",\n async () => {\n const response = await api.pricing.priceEngine.get({\n itemId: itemId?.toUpperCase() || \"\",\n customerId: Number(customerId),\n quantity,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemId, customerId, quantity,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n refetchOnReconnect: true,\n refetchOnWindowFocus: false,\n meta: { persist: true },\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for inv mast doc queries.\n * Usable in both client hooks and server-side prefetch.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getInvMastDocKey = (\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n) => {\n return [\n \"invMastDoc\",\n invMastUid,\n itemId.toUpperCase(),\n includePricing,\n ] as const;\n};\n\n/**\n * Query options for inv mast doc. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getInvMastDocOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),\n queryFn: async (): Promise<TInvMastDoc> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(invMastUid, {\n itemId: itemId.toUpperCase(),\n includePricing,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n itemId,\n includePricing,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, GetItemCategoryApiOptions } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ItemCategoryQueryKey = readonly [\n \"itemCategory\",\n number,\n GetItemCategoryApiOptions | undefined,\n];\n\n/**\n * Generates a consistent query key for item category queries.\n * Usable in both client hooks and server-side prefetch.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getItemCategoryKey = (\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n): ItemCategoryQueryKey => {\n return [\"itemCategory\", itemCategoryUid, apiOptions] as const;\n};\n\n/**\n * Query options for item category. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getItemCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),\n queryFn: async (): Promise<TCategory> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(\n itemCategoryUid,\n { ...apiOptions, ...(edgeCache != null ? { edgeCache } : {}) },\n );\n if (!response.data) throw new Error(\"Item category not found\");\n return response.data;\n },\n itemCategoryUid,\n apiOptions,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getInvMastKey = (invMastUid: number, itemId: string) => {\n return [\"invMast\", invMastUid, itemId.toUpperCase()] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getInvMastOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastKey(invMastUid, itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.get\",\n async () => {\n const response = await api.items.invMast.get(invMastUid, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TStockData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getInvMastStockKey = (invMastUid: number | string) => {\n return [\"invMastStock\", invMastUid] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getInvMastStockOptions = (\n api: AugurApiClient,\n invMastUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getInvMastStockKey(invMastUid),\n queryFn: async (): Promise<number> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.stock.list\",\n async () => {\n const response = await api.items.invMast.stock.list(Number(invMastUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const stockData: TStockData[] = response.data?.stockData ?? [];\n return stockData.reduce(\n (qty: number, stock: TStockData) => qty + stock.qtyOnHand,\n 0,\n );\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TStock } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getStockKey = (invMastUid: number | string) => {\n return [\"stock\", invMastUid] as const;\n};\n\nexport const getStockOptions = (\n api: AugurApiClient,\n invMastUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getStockKey(invMastUid),\n queryFn: async (): Promise<TStock> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.stock.list\",\n async () => {\n const response = await api.items.invMast.stock.list(Number(invMastUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const stockData = response.data?.stockData ?? [];\n const companySummary = response.data?.companySummary ?? {};\n return { stockData, companySummary } as TStock;\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getInvMastDocOptions } from \"./inv-mast-doc\";\nimport { stableStringify } from \"./stable-stringify\";\n\nexport interface BatchInvMastDocParam {\n invMastUid: number;\n itemId: string;\n}\n\n/**\n * Generates a deterministic query key for a batch inv mast doc query.\n * Params are sorted by uppercased itemId to ensure stable keys\n * regardless of input order.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getBatchInvMastDocKey = (\n params: BatchInvMastDocParam[],\n includePricing: \"Y\" | \"N\",\n) => {\n const sorted = [...params].sort((a, b) =>\n a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase()),\n );\n return [\n \"batchInvMastDoc\",\n stableStringify(sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))),\n includePricing,\n ] as const;\n};\n\n/**\n * Server-side query options for batch inv mast doc.\n * Uses Promise.all over individual getInvMastDocOptions queryFns\n * since queryClient is not available server-side.\n * Failed items are silently excluded from the result.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getBatchInvMastDocOptions = (\n api: AugurApiClient,\n params: BatchInvMastDocParam[],\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getBatchInvMastDocKey(params, includePricing),\n queryFn: async (): Promise<Record<string, TInvMastDoc>> => {\n const results: Record<string, TInvMastDoc> = {};\n const settled = await Promise.allSettled(\n params.map(async (p) => {\n const opts = getInvMastDocOptions(\n api,\n p.invMastUid,\n p.itemId,\n includePricing,\n cache,\n );\n const data = await opts.queryFn();\n return { key: p.itemId.toUpperCase(), data };\n }),\n );\n for (const entry of settled) {\n if (entry.status === \"fulfilled\") {\n results[entry.value.key] = entry.value.data;\n }\n }\n return results;\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { QueryClient } from \"@tanstack/react-query\";\n\nexport interface BatchQueryConfig<TParam, TData> {\n params: TParam[];\n queryClient: QueryClient;\n /** Build individual cache key for a single param. */\n getItemKey: (param: TParam) => readonly unknown[];\n /** Build the string key for the result Record from a param. */\n getResultKey: (param: TParam) => string;\n /** Fetch only uncached items, return keyed Record. */\n fetchItems: (uncached: TParam[]) => Promise<Record<string, TData>>;\n /** Extract individual cache key from a fetched result entry (for seeding). */\n getSeedKey: (resultKey: string, data: TData) => readonly unknown[];\n}\n\n/**\n * Generic batch query executor.\n *\n * 1. Checks queryClient cache for each param\n * 2. Fetches only uncached items in a single batch call\n * 3. Seeds individual cache entries from the response\n * 4. Returns merged cached + fetched record\n */\nexport async function executeBatchQuery<TParam, TData>(\n config: BatchQueryConfig<TParam, TData>,\n): Promise<Record<string, TData>> {\n const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;\n\n if (params.length === 0) {\n return {};\n }\n\n const cached: Record<string, TData> = {};\n const uncached: TParam[] = [];\n\n for (const param of params) {\n const existing = queryClient.getQueryData<TData>(getItemKey(param));\n if (existing !== undefined) {\n cached[getResultKey(param)] = existing;\n } else {\n uncached.push(param);\n }\n }\n\n if (uncached.length === 0) {\n return cached;\n }\n\n const fetched = await fetchItems(uncached);\n\n for (const [key, data] of Object.entries(fetched)) {\n queryClient.setQueryData(getSeedKey(key, data as TData), data);\n }\n\n return { ...cached, ...fetched };\n}\n","import type { TProductCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductCategoryResponse = {\n itemCategoryDesc: string;\n childrenTotal: number;\n children: TProductCategory[];\n categoryImage: string | null;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getProductCategoryKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"productCategory\", itemCategoryUid] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getProductCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getProductCategoryKey(itemCategoryUid),\n queryFn: async (): Promise<ProductCategoryResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(Number(itemCategoryUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getItemDetailsKey = (itemId: number | string) => {\n const normalizedId = typeof itemId === \"string\" ? itemId.toUpperCase() : itemId;\n return [\"itemDetails\", normalizedId] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getItemDetailsOptions = (\n api: AugurApiClient,\n itemId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemDetailsKey(itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(Number(itemId), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n itemId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getItemAttributesKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"itemAttributes\", itemCategoryUid] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getItemAttributesOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemAttributesKey(itemCategoryUid),\n queryFn: async () => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.attributes.list\",\n async () => {\n const response = await api.openSearch.itemSearch.attributes.list({\n q: \"\",\n searchType: \"query\",\n classId5List: String(itemCategoryUid),\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, PageData } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductSearchResponse = {\n items: TProductItem[];\n totalResults: number;\n};\n\n/**\n * Generates a consistent query key for product search queries.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getProductSearchKey = (pageData: PageData) => {\n return [\n \"productSearch\",\n pageData.q,\n pageData.limit,\n pageData.offset,\n pageData.sortBy,\n pageData.itemCategoryUid,\n ] as const;\n};\n\n/**\n * Query options for product search. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getProductSearchOptions = (\n api: AugurApiClient,\n pageData: PageData,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getProductSearchKey(pageData),\n queryFn: async (): Promise<ProductSearchResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: pageData.q,\n searchType: \"query\",\n size: pageData.limit,\n from: pageData.offset,\n classId5List: pageData.itemCategoryUid\n ? String(pageData.itemCategoryUid)\n : undefined,\n filters: pageData.filters\n ? JSON.stringify(pageData.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n pageData,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, SearchSuggestionsResponse } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for search suggestion queries.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.\n */\nexport const getSearchSuggestionsKey = (\n query: string,\n limit: number,\n offset: number,\n) => {\n return [\"searchSuggestions\", query, limit, offset] as const;\n};\n\n/**\n * Query options for search suggestions. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getSearchSuggestionsOptions = (\n api: AugurApiClient,\n query: string,\n limit: number = 10,\n offset: number = 0,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getSearchSuggestionsKey(query, limit, offset),\n queryFn: async (): Promise<SearchSuggestionsResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.suggestions.suggest.list\",\n async () => {\n const response = await api.openSearch.suggestions.suggest.list({\n q: query,\n size: limit,\n from: offset,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n query,\n limit,\n offset,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getItemPriceOptions } from \"./item-price\";\n\n/**\n * Get cart pricing query options for prefetching or parent components.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport function getCartPricingQueryOptions(\n api: AugurApiClient,\n cartLines: Array<{ itemId: string; quantity: number }>,\n customerId: string | number | undefined,\n cache?: CacheConfig,\n) {\n return cartLines.map((line) => ({\n ...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),\n enabled: !!customerId && !!line.itemId,\n }));\n}\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCategoryItemsInfiniteKey = (\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n) => {\n return [\n \"categoryItemsInfinite\",\n itemCategoryUid,\n stableStringify(itemsFilters),\n ] as const;\n};\n\n/**\n * Full infinite query options for category items.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getCategoryItemsInfiniteOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q || \"\",\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: String(itemCategoryUid),\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemCategoryUid, itemsFilters, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getItemSearchInfiniteKey = (\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n) => {\n return [\n \"itemSearchInfinite\",\n stableStringify(itemsFilters),\n itemCategoryUid,\n ] as const;\n};\n\n/**\n * Full infinite query options for item search.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n * @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.\n */\nexport const getItemSearchInfiniteOptions = (\n api: AugurApiClient,\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q,\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: itemCategoryUid ? String(itemCategoryUid) : undefined,\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemsFilters, itemCategoryUid, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n meta: { persist: true },\n };\n};\n","import type { TJoomlaContent } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getJoomlaContentKey = (articleId: number | string) => {\n return [\"joomlaContent\", articleId] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getJoomlaContentOptions = (\n api: AugurApiClient,\n articleId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaContentKey(articleId),\n queryFn: async (): Promise<TJoomlaContent> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.doc.get\",\n async () => {\n const response = await api.joomla.content.doc.get(articleId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Article not found\");\n return response.data;\n },\n articleId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TJoomlaContent,\n type TJoomlaContentFilters,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getJoomlaContentListKey = (\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n) => {\n return [\"joomlaContentList\", categoryId, filters] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getJoomlaContentListOptions = (\n api: AugurApiClient,\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaContentListKey(categoryId, filters),\n queryFn: async (): Promise<TJoomlaContent[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.list\",\n async () => {\n const response = await api.joomla.content.list({\n catid: categoryId,\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n categoryId, filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem, TMenuFilters } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getJoomlaMenuKey = (\n filters?: Partial<TMenuFilters>,\n) => {\n return [\"joomlaMenu\", filters] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getJoomlaMenuOptions = (\n api: AugurApiClient,\n filters?: Partial<TMenuFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaMenuKey(filters),\n queryFn: async (): Promise<MenuItem[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.list\",\n async () => {\n const response = await api.joomla.menu.list({\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getJoomlaMenuDocKey = (menuId: number | string) => {\n return [\"joomlaMenuDoc\", menuId] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */\nexport const getJoomlaMenuDocOptions = (\n api: AugurApiClient,\n menuId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaMenuDocKey(menuId),\n queryFn: async (): Promise<MenuItem> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.doc.get\",\n async () => {\n const response = await api.joomla.menu.doc.get(menuId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Menu item not found\");\n return response.data;\n },\n menuId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerOrdersKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerOrders\", customerId, params] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerOrderDetailKey = (\n customerId: number | string | undefined,\n orderId: number | string | undefined,\n) => {\n return [\"customerOrderDetail\", customerId, orderId] as const;\n};\n","/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerInvoicesKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerInvoices\", customerId, params] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerInvoiceDetailKey = (\n customerId: number | string | undefined,\n invoiceNo: number | string | undefined,\n) => {\n return [\"customerInvoiceDetail\", customerId, invoiceNo] as const;\n};\n","/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerQuotesKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerQuotes\", customerId, params] as const;\n};\n\n/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */\nexport const getCustomerQuoteDetailKey = (\n customerId: number | string | undefined,\n quoteNo: number | string | undefined,\n) => {\n return [\"customerQuoteDetail\", customerId, quoteNo] as const;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as _simpleapps_com_augur_utils from '@simpleapps-com/augur-utils';
2
- import { TPriceData, TItemDetails, TInvMastDoc, TCategory, TAttribute, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
3
- import { InfiniteScrollPage, AugurAuthContext, CacheConfig } from '@simpleapps-com/augur-core';
2
+ import { TPriceData, TItemDetails, TInvMastDoc, TStock, TCategory, TAttribute, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
3
+ import { InfiniteScrollPage, AugurAuthContext, CacheConfig, AugurSiteConfig } from '@simpleapps-com/augur-core';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { ReactNode } from 'react';
@@ -116,6 +116,8 @@ interface AugurCallbacks {
116
116
  }[], includePricing: "Y" | "N") => Promise<Record<string, TInvMastDoc>>;
117
117
  /** Override inventory stock fetching. */
118
118
  getInvMastStock?: (invMastUid: number | string) => Promise<number>;
119
+ /** Override full stock data fetching (used by useStock). */
120
+ getStock?: (invMastUid: number | string) => Promise<TStock>;
119
121
  /** Override item category fetching. */
120
122
  getItemCategory?: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => Promise<TCategory>;
121
123
  /** Override item details fetching. */
@@ -196,6 +198,8 @@ interface AugurHooksProviderProps {
196
198
  auth?: AugurAuthContext;
197
199
  /** Optional cache configuration — controls edge and Redis caching per tier. */
198
200
  cache?: CacheConfig;
201
+ /** Optional site configuration — hooks read defaults and formatting from this. */
202
+ site?: AugurSiteConfig;
199
203
  children: ReactNode;
200
204
  }
201
205
  /**
@@ -213,7 +217,7 @@ interface AugurHooksProviderProps {
213
217
  * const { data } = useQuery(q.items.invMast.get(42));
214
218
  * ```
215
219
  */
216
- declare function AugurHooksProvider({ api, callbacks, auth, cache, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
220
+ declare function AugurHooksProvider({ api, callbacks, auth, cache, site, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
217
221
  /**
218
222
  * Returns the deep proxy for creating TanStack Query options.
219
223
  *
@@ -255,6 +259,11 @@ declare function useAugurAuth(): AugurAuthContext | undefined;
255
259
  * Used internally by hooks to enable edge/Redis caching.
256
260
  */
257
261
  declare function useAugurCache(): CacheConfig | undefined;
262
+ /**
263
+ * Returns the site configuration from the nearest `AugurHooksProvider`.
264
+ * Returns `undefined` when no `site` prop is provided.
265
+ */
266
+ declare function useAugurSite(): AugurSiteConfig | undefined;
258
267
 
259
268
  /**
260
269
  * Generates a consistent query key for item price queries.
@@ -340,6 +349,14 @@ declare const getInvMastStockOptions: (api: AugurApiClient, invMastUid: number |
340
349
  gcTime: number | undefined;
341
350
  };
342
351
 
352
+ declare const getStockKey: (invMastUid: number | string) => readonly ["stock", string | number];
353
+ declare const getStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
354
+ queryKey: readonly ["stock", string | number];
355
+ queryFn: () => Promise<TStock>;
356
+ staleTime: number | undefined;
357
+ gcTime: number | undefined;
358
+ };
359
+
343
360
  interface BatchInvMastDocParam {
344
361
  invMastUid: number;
345
362
  itemId: string;
@@ -575,4 +592,4 @@ declare const getCustomerQuotesKey: (customerId: number | string | undefined, pa
575
592
  /** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
576
593
  declare const getCustomerQuoteDetailKey: (customerId: number | string | undefined, quoteNo: number | string | undefined) => readonly ["customerQuoteDetail", string | number | undefined, string | number | undefined];
577
594
 
578
- export { useAugurApiOptional as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemCategoryOptions as C, getItemDetailsKey as D, getItemDetailsOptions as E, getItemPriceKey as F, type GetItemCategoryApiOptions as G, getItemPriceOptions as H, getItemSearchInfiniteKey as I, getItemSearchInfiniteOptions as J, getJoomlaContentKey as K, getJoomlaContentListKey as L, getJoomlaContentListOptions as M, getJoomlaContentOptions as N, getJoomlaMenuDocKey as O, type PageData as P, getJoomlaMenuDocOptions as Q, getJoomlaMenuKey as R, type SearchSuggestionsResponse as S, getJoomlaMenuOptions as T, getProductCategoryKey as U, getProductCategoryOptions as V, getProductSearchKey as W, getProductSearchOptions as X, getSearchSuggestionsKey as Y, getSearchSuggestionsOptions as Z, useAugurApi as _, type SearchSuggestion as a, useAugurAuth as a0, useAugurCache as a1, useAugurOptions as a2, type AugurApiClient as b, type PersistenceConfig as c, AugurHooksProvider as d, type BatchQueryConfig as e, executeBatchQuery as f, getBatchInvMastDocKey as g, getBatchInvMastDocOptions as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getCustomerInvoiceDetailKey as l, getCustomerInvoicesKey as m, getCustomerOrderDetailKey as n, getCustomerOrdersKey as o, getCustomerQuoteDetailKey as p, getCustomerQuotesKey as q, getInvMastDocKey as r, getInvMastDocOptions as s, getInvMastKey as t, getInvMastOptions as u, getInvMastStockKey as v, getInvMastStockOptions as w, getItemAttributesKey as x, getItemAttributesOptions as y, getItemCategoryKey as z };
595
+ export { getStockOptions as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemCategoryOptions as C, getItemDetailsKey as D, getItemDetailsOptions as E, getItemPriceKey as F, type GetItemCategoryApiOptions as G, getItemPriceOptions as H, getItemSearchInfiniteKey as I, getItemSearchInfiniteOptions as J, getJoomlaContentKey as K, getJoomlaContentListKey as L, getJoomlaContentListOptions as M, getJoomlaContentOptions as N, getJoomlaMenuDocKey as O, type PageData as P, getJoomlaMenuDocOptions as Q, getJoomlaMenuKey as R, type SearchSuggestionsResponse as S, getJoomlaMenuOptions as T, getProductCategoryKey as U, getProductCategoryOptions as V, getProductSearchKey as W, getProductSearchOptions as X, getSearchSuggestionsKey as Y, getSearchSuggestionsOptions as Z, getStockKey as _, type SearchSuggestion as a, useAugurApi as a0, useAugurApiOptional as a1, useAugurAuth as a2, useAugurCache as a3, useAugurOptions as a4, useAugurSite as a5, type AugurApiClient as b, type PersistenceConfig as c, AugurHooksProvider as d, type BatchQueryConfig as e, executeBatchQuery as f, getBatchInvMastDocKey as g, getBatchInvMastDocOptions as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getCustomerInvoiceDetailKey as l, getCustomerInvoicesKey as m, getCustomerOrderDetailKey as n, getCustomerOrdersKey as o, getCustomerQuoteDetailKey as p, getCustomerQuotesKey as q, getInvMastDocKey as r, getInvMastDocOptions as s, getInvMastKey as t, getInvMastOptions as u, getInvMastStockKey as v, getInvMastStockOptions as w, getItemAttributesKey as x, getItemAttributesOptions as y, getItemCategoryKey as z };
@@ -1,6 +1,6 @@
1
1
  import * as _simpleapps_com_augur_utils from '@simpleapps-com/augur-utils';
2
- import { TPriceData, TItemDetails, TInvMastDoc, TCategory, TAttribute, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
3
- import { InfiniteScrollPage, AugurAuthContext, CacheConfig } from '@simpleapps-com/augur-core';
2
+ import { TPriceData, TItemDetails, TInvMastDoc, TStock, TCategory, TAttribute, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
3
+ import { InfiniteScrollPage, AugurAuthContext, CacheConfig, AugurSiteConfig } from '@simpleapps-com/augur-core';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { ReactNode } from 'react';
@@ -116,6 +116,8 @@ interface AugurCallbacks {
116
116
  }[], includePricing: "Y" | "N") => Promise<Record<string, TInvMastDoc>>;
117
117
  /** Override inventory stock fetching. */
118
118
  getInvMastStock?: (invMastUid: number | string) => Promise<number>;
119
+ /** Override full stock data fetching (used by useStock). */
120
+ getStock?: (invMastUid: number | string) => Promise<TStock>;
119
121
  /** Override item category fetching. */
120
122
  getItemCategory?: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => Promise<TCategory>;
121
123
  /** Override item details fetching. */
@@ -196,6 +198,8 @@ interface AugurHooksProviderProps {
196
198
  auth?: AugurAuthContext;
197
199
  /** Optional cache configuration — controls edge and Redis caching per tier. */
198
200
  cache?: CacheConfig;
201
+ /** Optional site configuration — hooks read defaults and formatting from this. */
202
+ site?: AugurSiteConfig;
199
203
  children: ReactNode;
200
204
  }
201
205
  /**
@@ -213,7 +217,7 @@ interface AugurHooksProviderProps {
213
217
  * const { data } = useQuery(q.items.invMast.get(42));
214
218
  * ```
215
219
  */
216
- declare function AugurHooksProvider({ api, callbacks, auth, cache, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
220
+ declare function AugurHooksProvider({ api, callbacks, auth, cache, site, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
217
221
  /**
218
222
  * Returns the deep proxy for creating TanStack Query options.
219
223
  *
@@ -255,6 +259,11 @@ declare function useAugurAuth(): AugurAuthContext | undefined;
255
259
  * Used internally by hooks to enable edge/Redis caching.
256
260
  */
257
261
  declare function useAugurCache(): CacheConfig | undefined;
262
+ /**
263
+ * Returns the site configuration from the nearest `AugurHooksProvider`.
264
+ * Returns `undefined` when no `site` prop is provided.
265
+ */
266
+ declare function useAugurSite(): AugurSiteConfig | undefined;
258
267
 
259
268
  /**
260
269
  * Generates a consistent query key for item price queries.
@@ -340,6 +349,14 @@ declare const getInvMastStockOptions: (api: AugurApiClient, invMastUid: number |
340
349
  gcTime: number | undefined;
341
350
  };
342
351
 
352
+ declare const getStockKey: (invMastUid: number | string) => readonly ["stock", string | number];
353
+ declare const getStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
354
+ queryKey: readonly ["stock", string | number];
355
+ queryFn: () => Promise<TStock>;
356
+ staleTime: number | undefined;
357
+ gcTime: number | undefined;
358
+ };
359
+
343
360
  interface BatchInvMastDocParam {
344
361
  invMastUid: number;
345
362
  itemId: string;
@@ -575,4 +592,4 @@ declare const getCustomerQuotesKey: (customerId: number | string | undefined, pa
575
592
  /** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
576
593
  declare const getCustomerQuoteDetailKey: (customerId: number | string | undefined, quoteNo: number | string | undefined) => readonly ["customerQuoteDetail", string | number | undefined, string | number | undefined];
577
594
 
578
- export { useAugurApiOptional as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemCategoryOptions as C, getItemDetailsKey as D, getItemDetailsOptions as E, getItemPriceKey as F, type GetItemCategoryApiOptions as G, getItemPriceOptions as H, getItemSearchInfiniteKey as I, getItemSearchInfiniteOptions as J, getJoomlaContentKey as K, getJoomlaContentListKey as L, getJoomlaContentListOptions as M, getJoomlaContentOptions as N, getJoomlaMenuDocKey as O, type PageData as P, getJoomlaMenuDocOptions as Q, getJoomlaMenuKey as R, type SearchSuggestionsResponse as S, getJoomlaMenuOptions as T, getProductCategoryKey as U, getProductCategoryOptions as V, getProductSearchKey as W, getProductSearchOptions as X, getSearchSuggestionsKey as Y, getSearchSuggestionsOptions as Z, useAugurApi as _, type SearchSuggestion as a, useAugurAuth as a0, useAugurCache as a1, useAugurOptions as a2, type AugurApiClient as b, type PersistenceConfig as c, AugurHooksProvider as d, type BatchQueryConfig as e, executeBatchQuery as f, getBatchInvMastDocKey as g, getBatchInvMastDocOptions as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getCustomerInvoiceDetailKey as l, getCustomerInvoicesKey as m, getCustomerOrderDetailKey as n, getCustomerOrdersKey as o, getCustomerQuoteDetailKey as p, getCustomerQuotesKey as q, getInvMastDocKey as r, getInvMastDocOptions as s, getInvMastKey as t, getInvMastOptions as u, getInvMastStockKey as v, getInvMastStockOptions as w, getItemAttributesKey as x, getItemAttributesOptions as y, getItemCategoryKey as z };
595
+ export { getStockOptions as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemCategoryOptions as C, getItemDetailsKey as D, getItemDetailsOptions as E, getItemPriceKey as F, type GetItemCategoryApiOptions as G, getItemPriceOptions as H, getItemSearchInfiniteKey as I, getItemSearchInfiniteOptions as J, getJoomlaContentKey as K, getJoomlaContentListKey as L, getJoomlaContentListOptions as M, getJoomlaContentOptions as N, getJoomlaMenuDocKey as O, type PageData as P, getJoomlaMenuDocOptions as Q, getJoomlaMenuKey as R, type SearchSuggestionsResponse as S, getJoomlaMenuOptions as T, getProductCategoryKey as U, getProductCategoryOptions as V, getProductSearchKey as W, getProductSearchOptions as X, getSearchSuggestionsKey as Y, getSearchSuggestionsOptions as Z, getStockKey as _, type SearchSuggestion as a, useAugurApi as a0, useAugurApiOptional as a1, useAugurAuth as a2, useAugurCache as a3, useAugurOptions as a4, useAugurSite as a5, type AugurApiClient as b, type PersistenceConfig as c, AugurHooksProvider as d, type BatchQueryConfig as e, executeBatchQuery as f, getBatchInvMastDocKey as g, getBatchInvMastDocOptions as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getCustomerInvoiceDetailKey as l, getCustomerInvoicesKey as m, getCustomerOrderDetailKey as n, getCustomerOrdersKey as o, getCustomerQuoteDetailKey as p, getCustomerQuotesKey as q, getInvMastDocKey as r, getInvMastDocOptions as s, getInvMastKey as t, getInvMastOptions as u, getInvMastStockKey as v, getInvMastStockOptions as w, getItemAttributesKey as x, getItemAttributesOptions as y, getItemCategoryKey as z };