@simpleapps-com/augur-hooks 2.0.23 → 2.1.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/EXPORTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @simpleapps-com/augur-hooks exports
2
2
 
3
- Version: 2.0.9
3
+ Version: 2.0.21
4
4
 
5
5
  > Auto-generated from built type declarations. Do not edit manually.
6
6
  > Regenerate with: `pnpm run generate-exports`
@@ -11,14 +11,11 @@ Version: 2.0.9
11
11
 
12
12
  | Export | Kind | Description |
13
13
  |--------|------|-------------|
14
- | `AugurApiClient` | value | |
15
14
  | `AugurAuthContext` | value | |
16
- | `AugurCallbacks` | value | |
17
15
  | `AugurHooksProvider` | value | |
18
16
  | `AugurSiteConfig` | value | |
19
17
  | `AugurSiteDefaults` | value | |
20
18
  | `AugurSiteFormatting` | value | |
21
- | `BatchInvMastDocParam` | value | |
22
19
  | `CacheConfig` | value | |
23
20
  | `CacheProvider` | value | |
24
21
  | `CacheTierConfig` | value | |
@@ -26,9 +23,7 @@ Version: 2.0.9
26
23
  | `DerivePriceInput` | value | |
27
24
  | `DerivedPrice` | value | |
28
25
  | `EdgeCacheValue` | value | |
29
- | `GetItemCategoryApiOptions` | value | |
30
26
  | `InfiniteScrollPage` | value | |
31
- | `PageData` | value | |
32
27
  | `PersistenceConfig` | value | |
33
28
  | `ProxyMutationOptions` | value | |
34
29
  | `ProxyQueryOptions` | value | |
@@ -36,58 +31,17 @@ Version: 2.0.9
36
31
  | `ResolvedStock` | value | |
37
32
  | `SearchSuggestion` | value | |
38
33
  | `SearchSuggestionsResponse` | value | |
39
- | `createSiteHooks` | function | Creates a pre-configured provider component and re-exports all hooks. |
40
34
  | `executeBatchQuery` | function | |
41
- | `getBatchInvMastDocKey` | function | |
42
- | `getBatchInvMastDocOptions` | value | |
43
- | `getCartPricingQueryOptions` | value | |
44
- | `getCategoryItemsInfiniteKey` | value | |
45
- | `getCategoryItemsInfiniteOptions` | value | |
46
- | `getCustomerInvoiceDetailKey` | value | |
47
- | `getCustomerInvoicesKey` | value | |
48
- | `getCustomerOrderDetailKey` | value | |
49
- | `getCustomerOrdersKey` | value | |
50
- | `getCustomerQuoteDetailKey` | value | |
51
- | `getCustomerQuotesKey` | value | |
52
- | `getInvMastDocKey` | value | |
53
- | `getInvMastDocOptions` | value | |
54
- | `getInvMastKey` | value | |
55
- | `getInvMastOptions` | value | |
56
- | `getInvMastStockKey` | function | |
57
- | `getInvMastStockOptions` | value | |
58
- | `getItemAttributesKey` | value | |
59
- | `getItemAttributesOptions` | value | |
60
- | `getItemCategoryKey` | value | |
61
- | `getItemCategoryOptions` | value | |
62
- | `getItemDetailsKey` | value | |
63
- | `getItemDetailsOptions` | value | |
64
- | `getItemPriceKey` | value | |
65
- | `getItemPriceOptions` | value | |
66
- | `getItemSearchInfiniteKey` | value | |
67
- | `getItemSearchInfiniteOptions` | value | |
68
- | `getJoomlaContentKey` | value | |
69
- | `getJoomlaContentListKey` | value | |
70
- | `getJoomlaContentListOptions` | value | |
71
- | `getJoomlaContentOptions` | value | |
72
- | `getJoomlaMenuDocKey` | value | |
73
- | `getJoomlaMenuDocOptions` | value | |
74
- | `getJoomlaMenuKey` | value | |
75
- | `getJoomlaMenuOptions` | value | |
76
- | `getProductCategoryKey` | value | |
77
- | `getProductCategoryOptions` | value | |
78
- | `getProductSearchKey` | value | |
79
- | `getProductSearchOptions` | value | |
80
- | `getSearchSuggestionsKey` | value | |
81
- | `getSearchSuggestionsOptions` | value | |
35
+ | `getCartPricingQueryOptions` | function | |
82
36
  | `getStockKey` | value | |
83
37
  | `getStockOptions` | value | |
84
- | `useAugurApi` | value | |
38
+ | `useAugurApi` | function | |
39
+ | `useAugurApiOptional` | value | |
85
40
  | `useAugurAuth` | value | |
86
41
  | `useAugurCache` | value | |
87
42
  | `useAugurOptions` | value | |
88
43
  | `useAugurPersistence` | function | Returns a fully configured `persistOptions` object for use with |
89
44
  | `useAugurSite` | value | |
90
- | `useBatchInvMastDoc` | function | Fetches and caches multiple inventory master documents in a single batch. |
91
45
  | `useCartActions` | function | Optimistic cart actions hook with automatic rollback on failure. |
92
46
  | `useCartHdrUid` | const | Select the current cart header UID. |
93
47
  | `useCartInitialization` | function | Initialize cart state from session (authenticated) or cookie (guest). |
@@ -96,43 +50,22 @@ Version: 2.0.9
96
50
  | `useCartPricing` | function | Centralized hook for cart/checkout pricing. |
97
51
  | `useCartQuantityTotal` | const | Select the total quantity summed across all cart lines. |
98
52
  | `useCartStore` | const | Zustand store for cart state. Prefer the individual selector hooks below for optimal re-renders. |
99
- | `useCategoryItemsInfinite` | function | Infinite scroll for category product listings. |
100
53
  | `useClearCart` | const | Get the `clearCart` action (stable reference). |
101
- | `useCustomerInvoices` | function | |
102
- | `useCustomerOrders` | function | |
103
- | `useCustomerQuotes` | function | |
104
54
  | `useDebounce` | function | Debounces a rapidly-changing value. |
105
55
  | `useFormatPrice` | function | Hook that returns a price formatter. |
106
- | `useInvMast` | function | |
107
- | `useInvMastDoc` | function | Fetches and caches an inventory master document via the augur-api SDK. |
108
- | `useInvMastStock` | function | |
109
- | `useInvoiceDetail` | function | |
110
- | `useItemAttributes` | function | |
111
- | `useItemCategory` | function | Fetches and caches item category data via the augur-api SDK. |
112
- | `useItemDetails` | function | |
113
56
  | `useItemFiltersStore` | const | Zustand store for item list filters, sorting, and pagination state. |
114
- | `useItemPrice` | function | Fetches and caches item pricing via the augur-api SDK. |
115
- | `useItemSearchInfinite` | function | Infinite scroll for search results. |
116
- | `useJoomlaContent` | function | |
117
- | `useJoomlaContentList` | function | |
118
- | `useJoomlaMenu` | function | |
119
- | `useJoomlaMenuDoc` | function | |
120
- | `useOrderDetail` | function | |
121
57
  | `usePaginationPrefetch` | const | Prefetch adjacent pages on hover for instant pagination. |
122
- | `useProductCategory` | function | |
123
- | `useProductSearch` | function | Searches products via the augur-api OpenSearch endpoint. |
124
- | `useQuoteDetail` | function | |
125
- | `useSearchSuggestions` | function | Fetches search suggestions via the augur-api OpenSearch endpoint. |
58
+ | `usePaymentFlow` | function | Manages the full Element/Unified payment lifecycle: |
126
59
  | `useSetCartHdrUid` | const | Get the `setCartHdrUid` action (stable reference). |
127
60
  | `useSetCartLines` | const | Get the `setCartLines` action (stable reference). Also recomputes totals. |
128
61
  | `useStock` | function | Fetches full TStock data and resolves it into a normalized stock object. |
129
62
 
130
63
  ### Types
131
64
 
132
- `BatchQueryConfig`, `CartActionCallbacks`, `CartInitCallbacks`, `CartPriceData`, `CartPricingResult`, `CartSessionInfo`, `CreateSiteHooksConfig`, `FormatPriceCallOptions`, `UseFormatPriceOptions`, `UseStockOptions`
65
+ `AugurApiClient`, `BatchQueryConfig`, `CartActionCallbacks`, `CartInitCallbacks`, `CartPriceData`, `CartPricingResult`, `CartSessionInfo`, `FormatPriceCallOptions`, `GetItemCategoryApiOptions`, `PageData`, `PaymentBillingAddress`, `PaymentFlowCallbacks`, `UseFormatPriceOptions`, `UseStockOptions`
133
66
 
134
67
  ```ts
135
- import { AugurApiClient, AugurAuthContext, AugurCallbacks } from "@simpleapps-com/augur-hooks";
68
+ import { AugurAuthContext, AugurHooksProvider, AugurSiteConfig } from "@simpleapps-com/augur-hooks";
136
69
  ```
137
70
 
138
71
  ## `@simpleapps-com/augur-hooks/server`
@@ -146,55 +79,15 @@ import { AugurApiClient, AugurAuthContext, AugurCallbacks } from "@simpleapps-co
146
79
  | `InfiniteScrollPage` | value | |
147
80
  | `createAugurOptions` | function | Creates server-side query options proxy for prefetching. |
148
81
  | `executeBatchQuery` | function | |
149
- | `getBatchInvMastDocKey` | function | |
150
- | `getBatchInvMastDocOptions` | value | |
151
- | `getCartPricingQueryOptions` | value | |
152
- | `getCategoryItemsInfiniteKey` | value | |
153
- | `getCategoryItemsInfiniteOptions` | value | |
154
- | `getCustomerInvoiceDetailKey` | value | |
155
- | `getCustomerInvoicesKey` | value | |
156
- | `getCustomerOrderDetailKey` | value | |
157
- | `getCustomerOrdersKey` | value | |
158
- | `getCustomerQuoteDetailKey` | value | |
159
- | `getCustomerQuotesKey` | value | |
160
- | `getInvMastDocKey` | value | |
161
- | `getInvMastDocOptions` | value | |
162
- | `getInvMastKey` | value | |
163
- | `getInvMastOptions` | value | |
164
- | `getInvMastStockKey` | function | |
165
- | `getInvMastStockOptions` | value | |
166
- | `getItemAttributesKey` | value | |
167
- | `getItemAttributesOptions` | value | |
168
- | `getItemCategoryKey` | value | |
169
- | `getItemCategoryOptions` | value | |
170
- | `getItemDetailsKey` | value | |
171
- | `getItemDetailsOptions` | value | |
172
- | `getItemPriceKey` | value | |
173
- | `getItemPriceOptions` | value | |
174
- | `getItemSearchInfiniteKey` | value | |
175
- | `getItemSearchInfiniteOptions` | value | |
176
- | `getJoomlaContentKey` | value | |
177
- | `getJoomlaContentListKey` | value | |
178
- | `getJoomlaContentListOptions` | value | |
179
- | `getJoomlaContentOptions` | value | |
180
- | `getJoomlaMenuDocKey` | value | |
181
- | `getJoomlaMenuDocOptions` | value | |
182
- | `getJoomlaMenuKey` | value | |
183
- | `getJoomlaMenuOptions` | value | |
184
- | `getProductCategoryKey` | value | |
185
- | `getProductCategoryOptions` | value | |
186
- | `getProductSearchKey` | value | |
187
- | `getProductSearchOptions` | value | |
82
+ | `getCartPricingQueryOptions` | function | |
188
83
  | `getQueryClient` | const | Returns a per-request singleton QueryClient for React Server Components. |
189
- | `getSearchSuggestionsKey` | value | |
190
- | `getSearchSuggestionsOptions` | value | |
191
84
  | `getStockKey` | value | |
192
85
  | `getStockOptions` | value | |
193
86
  | `stableStringify` | value | |
194
87
 
195
88
  ### Types
196
89
 
197
- `AugurApiClient`, `AugurCallbacks`, `BatchInvMastDocParam`, `BatchQueryConfig`, `PageData`
90
+ `AugurApiClient`, `BatchQueryConfig`, `PageData`
198
91
 
199
92
  ```ts
200
93
  import { AugurAuthContext, CacheConfig, InfiniteScrollPage } from "@simpleapps-com/augur-hooks/server";
@@ -207,7 +100,7 @@ import { AugurAuthContext, CacheConfig, InfiniteScrollPage } from "@simpleapps-c
207
100
  | Export | Kind | Description |
208
101
  |--------|------|-------------|
209
102
  | `MobileProvider` | function | Optional provider that tracks hydration state. |
210
- | `useImageWithFallback` | function | |
103
+ | `useImageWithFallback` | function | Preloads an agr.media image and shows a fallback while loading. |
211
104
  | `useIsHydrated` | function | Returns true only after the client has hydrated. |
212
105
  | `useIsMobile` | function | Returns whether the screen is mobile-sized. |
213
106
  | `useMobileOptimizedIntersection` | const | IntersectionObserver hook with mobile-optimized root margins. |
@@ -0,0 +1,184 @@
1
+ import { TStock, TPriceData } from '@simpleapps-com/augur-utils';
2
+ import { AugurAuthContext, CacheConfig, AugurSiteConfig } from '@simpleapps-com/augur-core';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Minimal type for the augur-api SDK instance.
9
+ * Consumers provide their concrete AugurAPI instance; we keep the type
10
+ * loose so augur-hooks doesn't need to depend directly on the SDK package.
11
+ */
12
+ type AugurApiClient = any;
13
+ interface AugurHooksProviderProps {
14
+ /** SDK client instance. Required for the proxy-based `useAugurOptions()`. */
15
+ api?: AugurApiClient;
16
+ /** Optional auth context — hooks fall back to these values when not passed directly. */
17
+ auth?: AugurAuthContext;
18
+ /** Optional cache configuration — controls edge and Redis caching per tier. */
19
+ cache?: CacheConfig;
20
+ /** Optional site configuration — hooks read defaults and formatting from this. */
21
+ site?: AugurSiteConfig;
22
+ children: ReactNode;
23
+ }
24
+ /**
25
+ * Provides the augur-api SDK instance, proxy options, and auth to all hooks.
26
+ *
27
+ * ```tsx
28
+ * <AugurHooksProvider api={api} auth={authContext} cache={cacheConfig}>
29
+ * <App />
30
+ * </AugurHooksProvider>
31
+ * ```
32
+ *
33
+ * Components use `useAugurOptions()` to get the proxy:
34
+ * ```tsx
35
+ * const q = useAugurOptions();
36
+ * const { data } = useQuery(q.items.invMast.get(42));
37
+ * ```
38
+ */
39
+ declare function AugurHooksProvider({ api, auth, cache, site, children }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
40
+ /**
41
+ * Returns the deep proxy for creating TanStack Query options.
42
+ *
43
+ * Every SDK method is available as a path:
44
+ * ```tsx
45
+ * const q = useAugurOptions();
46
+ * const { data } = useQuery(q.items.invMast.get(42));
47
+ * const { data: stock } = useQuery(q.items.invMast.stock.get(42));
48
+ * const addToCart = useMutation(q.commerce.cartLine.add.create());
49
+ * ```
50
+ *
51
+ * Override queryFn at the call site:
52
+ * ```tsx
53
+ * const { data } = useQuery({
54
+ * ...q.pricing.priceEngine.get({ itemId, customerId }),
55
+ * queryFn: () => getItemPriceAction(itemId, customerId),
56
+ * });
57
+ * ```
58
+ */
59
+ declare function useAugurOptions<T = unknown>(): T;
60
+ /**
61
+ * Returns the augur-api SDK instance from context, or null if not provided.
62
+ * Used internally by hooks that need the SDK for fallback queries.
63
+ */
64
+ declare function useAugurApiOptional(): AugurApiClient | null;
65
+ /**
66
+ * Returns the augur-api SDK instance from context.
67
+ * Throws if called outside of `<AugurHooksProvider>` or when no api is provided.
68
+ */
69
+ declare function useAugurApi(): AugurApiClient;
70
+ /**
71
+ * Returns the provider-level auth context, if any.
72
+ * Used internally by hooks to fall back to provider auth when
73
+ * auth fields are not passed directly as hook parameters.
74
+ */
75
+ declare function useAugurAuth(): AugurAuthContext | undefined;
76
+ /**
77
+ * Returns the provider-level cache configuration, if any.
78
+ * Used internally by hooks to enable edge/Redis caching.
79
+ */
80
+ declare function useAugurCache(): CacheConfig | undefined;
81
+ /**
82
+ * Returns the site configuration from the nearest `AugurHooksProvider`.
83
+ * Returns `undefined` when no `site` prop is provided.
84
+ */
85
+ declare function useAugurSite(): AugurSiteConfig | undefined;
86
+
87
+ /**
88
+ * Hook-specific types that don't belong in augur-utils or augur-core.
89
+ * These describe hook parameters and API response shapes.
90
+ */
91
+
92
+ /** Parameters for product search queries. */
93
+ type PageData = {
94
+ categoryIdList?: string;
95
+ filters?: [string, string][];
96
+ limit: number;
97
+ page: number;
98
+ offset: number;
99
+ q: string;
100
+ sortBy: string;
101
+ tagslist?: string;
102
+ itemCategoryUid?: number;
103
+ };
104
+
105
+ /** Configuration for React Query localStorage persistence. */
106
+ interface PersistenceConfig {
107
+ /** localStorage key for the persisted cache. */
108
+ key: string;
109
+ /** Cache buster string. When changed, persisted data is discarded. In development, defaults to Date.now(). */
110
+ buster?: string;
111
+ /** Max age of persisted data in ms. Default: 24 hours. */
112
+ maxAge?: number;
113
+ /** Query key prefixes to persist. Only successful queries whose first key element matches are persisted. */
114
+ persistableKeys: string[];
115
+ /** Per-key-prefix LRU limits. Queries exceeding the limit are evicted oldest-first by dataUpdatedAt. */
116
+ limits?: Record<string, number>;
117
+ /** localStorage size threshold in MB before eviction runs. Default: 3. */
118
+ maxStorageMB?: number;
119
+ /** Write throttle in ms. Default: 1000. */
120
+ throttleMs?: number;
121
+ }
122
+ /** API options for item category queries. */
123
+ interface GetItemCategoryApiOptions {
124
+ childrenFilter?: string;
125
+ childrenLimit?: number;
126
+ childrenOffset?: number;
127
+ classId5List?: string;
128
+ filters?: Record<string, string>;
129
+ orderBy?: string;
130
+ path?: string;
131
+ productCollection?: string;
132
+ rootItemCategoryId?: string;
133
+ }
134
+
135
+ declare const getStockKey: (invMastUid: number | string) => readonly ["stock", string | number];
136
+ declare const getStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
137
+ queryKey: readonly ["stock", string | number];
138
+ queryFn: () => Promise<TStock>;
139
+ staleTime: number | undefined;
140
+ gcTime: number | undefined;
141
+ };
142
+
143
+ interface BatchQueryConfig<TParam, TData> {
144
+ params: TParam[];
145
+ queryClient: QueryClient;
146
+ /** Build individual cache key for a single param. */
147
+ getItemKey: (param: TParam) => readonly unknown[];
148
+ /** Build the string key for the result Record from a param. */
149
+ getResultKey: (param: TParam) => string;
150
+ /** Fetch only uncached items, return keyed Record. */
151
+ fetchItems: (uncached: TParam[]) => Promise<Record<string, TData>>;
152
+ /** Extract individual cache key from a fetched result entry (for seeding). */
153
+ getSeedKey: (resultKey: string, data: TData) => readonly unknown[];
154
+ }
155
+ /**
156
+ * Generic batch query executor.
157
+ *
158
+ * 1. Checks queryClient cache for each param
159
+ * 2. Fetches only uncached items in a single batch call
160
+ * 3. Seeds individual cache entries from the response
161
+ * 4. Returns merged cached + fetched record
162
+ */
163
+ declare function executeBatchQuery<TParam, TData>(config: BatchQueryConfig<TParam, TData>): Promise<Record<string, TData>>;
164
+
165
+ /**
166
+ * Get cart pricing query options for prefetching or parent components.
167
+ */
168
+ declare function getCartPricingQueryOptions(api: AugurApiClient, cartLines: Array<{
169
+ itemId: string;
170
+ quantity: number;
171
+ }>, customerId: string | number | undefined, cache?: CacheConfig): {
172
+ enabled: boolean;
173
+ queryKey: readonly ["price", string, string | number | undefined, number];
174
+ queryFn: () => Promise<TPriceData>;
175
+ staleTime: number | undefined;
176
+ gcTime: number | undefined;
177
+ refetchOnReconnect: boolean;
178
+ refetchOnWindowFocus: boolean;
179
+ meta: {
180
+ persist: boolean;
181
+ };
182
+ }[];
183
+
184
+ export { type AugurApiClient as A, type BatchQueryConfig as B, type GetItemCategoryApiOptions as G, type PersistenceConfig as P, AugurHooksProvider as a, type PageData as b, getStockKey as c, getStockOptions as d, executeBatchQuery as e, useAugurApiOptional as f, getCartPricingQueryOptions as g, useAugurAuth as h, useAugurCache as i, useAugurOptions as j, useAugurSite as k, useAugurApi as u };
@@ -0,0 +1,184 @@
1
+ import { TStock, TPriceData } from '@simpleapps-com/augur-utils';
2
+ import { AugurAuthContext, CacheConfig, AugurSiteConfig } from '@simpleapps-com/augur-core';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Minimal type for the augur-api SDK instance.
9
+ * Consumers provide their concrete AugurAPI instance; we keep the type
10
+ * loose so augur-hooks doesn't need to depend directly on the SDK package.
11
+ */
12
+ type AugurApiClient = any;
13
+ interface AugurHooksProviderProps {
14
+ /** SDK client instance. Required for the proxy-based `useAugurOptions()`. */
15
+ api?: AugurApiClient;
16
+ /** Optional auth context — hooks fall back to these values when not passed directly. */
17
+ auth?: AugurAuthContext;
18
+ /** Optional cache configuration — controls edge and Redis caching per tier. */
19
+ cache?: CacheConfig;
20
+ /** Optional site configuration — hooks read defaults and formatting from this. */
21
+ site?: AugurSiteConfig;
22
+ children: ReactNode;
23
+ }
24
+ /**
25
+ * Provides the augur-api SDK instance, proxy options, and auth to all hooks.
26
+ *
27
+ * ```tsx
28
+ * <AugurHooksProvider api={api} auth={authContext} cache={cacheConfig}>
29
+ * <App />
30
+ * </AugurHooksProvider>
31
+ * ```
32
+ *
33
+ * Components use `useAugurOptions()` to get the proxy:
34
+ * ```tsx
35
+ * const q = useAugurOptions();
36
+ * const { data } = useQuery(q.items.invMast.get(42));
37
+ * ```
38
+ */
39
+ declare function AugurHooksProvider({ api, auth, cache, site, children }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
40
+ /**
41
+ * Returns the deep proxy for creating TanStack Query options.
42
+ *
43
+ * Every SDK method is available as a path:
44
+ * ```tsx
45
+ * const q = useAugurOptions();
46
+ * const { data } = useQuery(q.items.invMast.get(42));
47
+ * const { data: stock } = useQuery(q.items.invMast.stock.get(42));
48
+ * const addToCart = useMutation(q.commerce.cartLine.add.create());
49
+ * ```
50
+ *
51
+ * Override queryFn at the call site:
52
+ * ```tsx
53
+ * const { data } = useQuery({
54
+ * ...q.pricing.priceEngine.get({ itemId, customerId }),
55
+ * queryFn: () => getItemPriceAction(itemId, customerId),
56
+ * });
57
+ * ```
58
+ */
59
+ declare function useAugurOptions<T = unknown>(): T;
60
+ /**
61
+ * Returns the augur-api SDK instance from context, or null if not provided.
62
+ * Used internally by hooks that need the SDK for fallback queries.
63
+ */
64
+ declare function useAugurApiOptional(): AugurApiClient | null;
65
+ /**
66
+ * Returns the augur-api SDK instance from context.
67
+ * Throws if called outside of `<AugurHooksProvider>` or when no api is provided.
68
+ */
69
+ declare function useAugurApi(): AugurApiClient;
70
+ /**
71
+ * Returns the provider-level auth context, if any.
72
+ * Used internally by hooks to fall back to provider auth when
73
+ * auth fields are not passed directly as hook parameters.
74
+ */
75
+ declare function useAugurAuth(): AugurAuthContext | undefined;
76
+ /**
77
+ * Returns the provider-level cache configuration, if any.
78
+ * Used internally by hooks to enable edge/Redis caching.
79
+ */
80
+ declare function useAugurCache(): CacheConfig | undefined;
81
+ /**
82
+ * Returns the site configuration from the nearest `AugurHooksProvider`.
83
+ * Returns `undefined` when no `site` prop is provided.
84
+ */
85
+ declare function useAugurSite(): AugurSiteConfig | undefined;
86
+
87
+ /**
88
+ * Hook-specific types that don't belong in augur-utils or augur-core.
89
+ * These describe hook parameters and API response shapes.
90
+ */
91
+
92
+ /** Parameters for product search queries. */
93
+ type PageData = {
94
+ categoryIdList?: string;
95
+ filters?: [string, string][];
96
+ limit: number;
97
+ page: number;
98
+ offset: number;
99
+ q: string;
100
+ sortBy: string;
101
+ tagslist?: string;
102
+ itemCategoryUid?: number;
103
+ };
104
+
105
+ /** Configuration for React Query localStorage persistence. */
106
+ interface PersistenceConfig {
107
+ /** localStorage key for the persisted cache. */
108
+ key: string;
109
+ /** Cache buster string. When changed, persisted data is discarded. In development, defaults to Date.now(). */
110
+ buster?: string;
111
+ /** Max age of persisted data in ms. Default: 24 hours. */
112
+ maxAge?: number;
113
+ /** Query key prefixes to persist. Only successful queries whose first key element matches are persisted. */
114
+ persistableKeys: string[];
115
+ /** Per-key-prefix LRU limits. Queries exceeding the limit are evicted oldest-first by dataUpdatedAt. */
116
+ limits?: Record<string, number>;
117
+ /** localStorage size threshold in MB before eviction runs. Default: 3. */
118
+ maxStorageMB?: number;
119
+ /** Write throttle in ms. Default: 1000. */
120
+ throttleMs?: number;
121
+ }
122
+ /** API options for item category queries. */
123
+ interface GetItemCategoryApiOptions {
124
+ childrenFilter?: string;
125
+ childrenLimit?: number;
126
+ childrenOffset?: number;
127
+ classId5List?: string;
128
+ filters?: Record<string, string>;
129
+ orderBy?: string;
130
+ path?: string;
131
+ productCollection?: string;
132
+ rootItemCategoryId?: string;
133
+ }
134
+
135
+ declare const getStockKey: (invMastUid: number | string) => readonly ["stock", string | number];
136
+ declare const getStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
137
+ queryKey: readonly ["stock", string | number];
138
+ queryFn: () => Promise<TStock>;
139
+ staleTime: number | undefined;
140
+ gcTime: number | undefined;
141
+ };
142
+
143
+ interface BatchQueryConfig<TParam, TData> {
144
+ params: TParam[];
145
+ queryClient: QueryClient;
146
+ /** Build individual cache key for a single param. */
147
+ getItemKey: (param: TParam) => readonly unknown[];
148
+ /** Build the string key for the result Record from a param. */
149
+ getResultKey: (param: TParam) => string;
150
+ /** Fetch only uncached items, return keyed Record. */
151
+ fetchItems: (uncached: TParam[]) => Promise<Record<string, TData>>;
152
+ /** Extract individual cache key from a fetched result entry (for seeding). */
153
+ getSeedKey: (resultKey: string, data: TData) => readonly unknown[];
154
+ }
155
+ /**
156
+ * Generic batch query executor.
157
+ *
158
+ * 1. Checks queryClient cache for each param
159
+ * 2. Fetches only uncached items in a single batch call
160
+ * 3. Seeds individual cache entries from the response
161
+ * 4. Returns merged cached + fetched record
162
+ */
163
+ declare function executeBatchQuery<TParam, TData>(config: BatchQueryConfig<TParam, TData>): Promise<Record<string, TData>>;
164
+
165
+ /**
166
+ * Get cart pricing query options for prefetching or parent components.
167
+ */
168
+ declare function getCartPricingQueryOptions(api: AugurApiClient, cartLines: Array<{
169
+ itemId: string;
170
+ quantity: number;
171
+ }>, customerId: string | number | undefined, cache?: CacheConfig): {
172
+ enabled: boolean;
173
+ queryKey: readonly ["price", string, string | number | undefined, number];
174
+ queryFn: () => Promise<TPriceData>;
175
+ staleTime: number | undefined;
176
+ gcTime: number | undefined;
177
+ refetchOnReconnect: boolean;
178
+ refetchOnWindowFocus: boolean;
179
+ meta: {
180
+ persist: boolean;
181
+ };
182
+ }[];
183
+
184
+ export { type AugurApiClient as A, type BatchQueryConfig as B, type GetItemCategoryApiOptions as G, type PersistenceConfig as P, AugurHooksProvider as a, type PageData as b, getStockKey as c, getStockOptions as d, executeBatchQuery as e, useAugurApiOptional as f, getCartPricingQueryOptions as g, useAugurAuth as h, useAugurCache as i, useAugurOptions as j, useAugurSite as k, useAugurApi as u };