@simpleapps-com/augur-hooks 2.0.23 → 2.1.1
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 +10 -118
- package/dist/cart-pricing-D_mSECzx.d.cts +184 -0
- package/dist/cart-pricing-D_mSECzx.d.ts +184 -0
- package/dist/chunk-UMCLTMAJ.cjs +135 -0
- package/dist/chunk-UMCLTMAJ.cjs.map +1 -0
- package/dist/chunk-V2CAXA4X.js +135 -0
- package/dist/chunk-V2CAXA4X.js.map +1 -0
- package/dist/index.cjs +53 -818
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -622
- package/dist/index.d.ts +5 -622
- package/dist/index.js +28 -793
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +2 -84
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +3 -85
- package/dist/server.js.map +1 -1
- package/dist/web.cjs +42 -6
- package/dist/web.cjs.map +1 -1
- package/dist/web.d.cts +16 -3
- package/dist/web.d.ts +16 -3
- package/dist/web.js +40 -4
- package/dist/web.js.map +1 -1
- package/llms.txt +12 -118
- package/package.json +3 -3
- package/dist/chunk-AXCNTEAB.cjs +0 -44
- package/dist/chunk-AXCNTEAB.cjs.map +0 -1
- package/dist/chunk-H7OXSAHP.cjs +0 -748
- package/dist/chunk-H7OXSAHP.cjs.map +0 -1
- package/dist/chunk-LTBEP4MC.js +0 -44
- package/dist/chunk-LTBEP4MC.js.map +0 -1
- package/dist/chunk-QFZHOGID.js +0 -748
- package/dist/chunk-QFZHOGID.js.map +0 -1
- package/dist/customer-quotes-BQYqzomR.d.cts +0 -562
- package/dist/customer-quotes-BQYqzomR.d.ts +0 -562
- package/dist/use-image-with-fallback-DgmtrGZU.d.cts +0 -17
- package/dist/use-image-with-fallback-DgmtrGZU.d.ts +0 -17
|
@@ -1,562 +0,0 @@
|
|
|
1
|
-
import * as _simpleapps_com_augur_utils from '@simpleapps-com/augur-utils';
|
|
2
|
-
import { TPriceData, TItemDetails, TInvMastDoc, TStock, TCategory, TAttribute, TSearchSuggestionsResponse, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
|
|
3
|
-
import { InfiniteScrollPage, ListResult, AugurAuthContext, CacheConfig, AugurSiteConfig } from '@simpleapps-com/augur-core';
|
|
4
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { ReactNode } from 'react';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Hook-specific types that don't belong in augur-utils or augur-core.
|
|
10
|
-
* These describe hook parameters and API response shapes.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/** Parameters for product search queries. */
|
|
14
|
-
type PageData = {
|
|
15
|
-
categoryIdList?: string;
|
|
16
|
-
filters?: [string, string][];
|
|
17
|
-
limit: number;
|
|
18
|
-
page: number;
|
|
19
|
-
offset: number;
|
|
20
|
-
q: string;
|
|
21
|
-
sortBy: string;
|
|
22
|
-
tagslist?: string;
|
|
23
|
-
itemCategoryUid?: number;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/** Configuration for React Query localStorage persistence. */
|
|
27
|
-
interface PersistenceConfig {
|
|
28
|
-
/** localStorage key for the persisted cache. */
|
|
29
|
-
key: string;
|
|
30
|
-
/** Cache buster string. When changed, persisted data is discarded. In development, defaults to Date.now(). */
|
|
31
|
-
buster?: string;
|
|
32
|
-
/** Max age of persisted data in ms. Default: 24 hours. */
|
|
33
|
-
maxAge?: number;
|
|
34
|
-
/** Query key prefixes to persist. Only successful queries whose first key element matches are persisted. */
|
|
35
|
-
persistableKeys: string[];
|
|
36
|
-
/** Per-key-prefix LRU limits. Queries exceeding the limit are evicted oldest-first by dataUpdatedAt. */
|
|
37
|
-
limits?: Record<string, number>;
|
|
38
|
-
/** localStorage size threshold in MB before eviction runs. Default: 3. */
|
|
39
|
-
maxStorageMB?: number;
|
|
40
|
-
/** Write throttle in ms. Default: 1000. */
|
|
41
|
-
throttleMs?: number;
|
|
42
|
-
}
|
|
43
|
-
/** API options for item category queries. */
|
|
44
|
-
interface GetItemCategoryApiOptions {
|
|
45
|
-
childrenFilter?: string;
|
|
46
|
-
childrenLimit?: number;
|
|
47
|
-
childrenOffset?: number;
|
|
48
|
-
classId5List?: string;
|
|
49
|
-
filters?: Record<string, string>;
|
|
50
|
-
orderBy?: string;
|
|
51
|
-
path?: string;
|
|
52
|
-
productCollection?: string;
|
|
53
|
-
rootItemCategoryId?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Typed callback registry for provider-level queryFn overrides,
|
|
58
|
-
* and auth context for provider-level session injection.
|
|
59
|
-
*
|
|
60
|
-
* Sites register server actions once at the provider level,
|
|
61
|
-
* eliminating per-hook wrappers for CORS/server action routing.
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Provider-level callback map. Register server actions here to override
|
|
66
|
-
* the default SDK calls in all hooks. Hook-level `queryFn` takes priority
|
|
67
|
-
* over provider callbacks; provider callbacks take priority over the SDK.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```tsx
|
|
71
|
-
* <AugurHooksProvider
|
|
72
|
-
* api={api}
|
|
73
|
-
* callbacks={{
|
|
74
|
-
* getItemPrice: (itemId, customerId, qty) => getItemPriceAction(itemId, customerId, qty),
|
|
75
|
-
* getItemCategory: (uid, opts) => getItemCategoryAction(uid, opts),
|
|
76
|
-
* getCategoryItemsInfinite: (p) => getCategoryItemsAction(p),
|
|
77
|
-
* }}
|
|
78
|
-
* >
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
interface AugurCallbacks {
|
|
82
|
-
/** Override item price fetching (used by useItemPrice and useCartPricing). */
|
|
83
|
-
getItemPrice?: (itemId: string, customerId: string | number, quantity: number) => Promise<TPriceData>;
|
|
84
|
-
/** Override inventory master fetching. */
|
|
85
|
-
getInvMast?: (invMastUid: number, itemId: string) => Promise<TItemDetails>;
|
|
86
|
-
/** Override inventory master doc fetching. */
|
|
87
|
-
getInvMastDoc?: (invMastUid: number, itemId: string, includePricing: "Y" | "N") => Promise<TInvMastDoc>;
|
|
88
|
-
/** Override batch inventory master doc fetching. */
|
|
89
|
-
batchGetInvMastDocs?: (params: {
|
|
90
|
-
invMastUid: number;
|
|
91
|
-
itemId: string;
|
|
92
|
-
}[], includePricing: "Y" | "N") => Promise<Record<string, TInvMastDoc>>;
|
|
93
|
-
/** Override inventory stock fetching. */
|
|
94
|
-
getInvMastStock?: (invMastUid: number | string) => Promise<number>;
|
|
95
|
-
/** Override full stock data fetching (used by useStock). */
|
|
96
|
-
getStock?: (invMastUid: number | string) => Promise<TStock>;
|
|
97
|
-
/** Override item category fetching. */
|
|
98
|
-
getItemCategory?: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => Promise<TCategory>;
|
|
99
|
-
/** Override item details fetching. */
|
|
100
|
-
getItemDetails?: (itemId: number | string) => Promise<TItemDetails>;
|
|
101
|
-
/** Override item attributes fetching. */
|
|
102
|
-
getItemAttributes?: (itemCategoryUid: number | string) => Promise<{
|
|
103
|
-
attributes: TAttribute[];
|
|
104
|
-
}>;
|
|
105
|
-
/** Override product category fetching. */
|
|
106
|
-
getProductCategory?: (itemCategoryUid: number | string) => Promise<{
|
|
107
|
-
itemCategoryDesc: string;
|
|
108
|
-
childrenTotal: number;
|
|
109
|
-
children: unknown[];
|
|
110
|
-
categoryImage: string | null;
|
|
111
|
-
}>;
|
|
112
|
-
/** Override product search. */
|
|
113
|
-
getProductSearch?: (pageData: PageData) => Promise<{
|
|
114
|
-
items: unknown[];
|
|
115
|
-
totalResults: number;
|
|
116
|
-
}>;
|
|
117
|
-
/** Override search suggestions. */
|
|
118
|
-
getSearchSuggestions?: (query: string, limit: number, offset: number) => Promise<TSearchSuggestionsResponse>;
|
|
119
|
-
/** Override category items infinite scroll. */
|
|
120
|
-
getCategoryItemsInfinite?: (params: {
|
|
121
|
-
itemCategoryUid: number;
|
|
122
|
-
itemsFilters: TItemsFilters;
|
|
123
|
-
pageParam: number;
|
|
124
|
-
}) => Promise<InfiniteScrollPage>;
|
|
125
|
-
/** Override item search infinite scroll. */
|
|
126
|
-
getItemSearchInfinite?: (params: {
|
|
127
|
-
itemsFilters: TItemsFilters;
|
|
128
|
-
itemCategoryUid?: number | string;
|
|
129
|
-
pageParam: number;
|
|
130
|
-
}) => Promise<InfiniteScrollPage>;
|
|
131
|
-
/** Override Joomla content fetching. */
|
|
132
|
-
getJoomlaContent?: (articleId: number | string) => Promise<TJoomlaContent>;
|
|
133
|
-
/** Override Joomla content list fetching. */
|
|
134
|
-
getJoomlaContentList?: (categoryId: number | string, filters?: Partial<TJoomlaContentFilters>) => Promise<ListResult<TJoomlaContent>>;
|
|
135
|
-
/** Override Joomla menu list fetching. */
|
|
136
|
-
getJoomlaMenu?: (filters?: Partial<TMenuFilters>) => Promise<ListResult<MenuItem>>;
|
|
137
|
-
/** Override Joomla menu document fetching. */
|
|
138
|
-
getJoomlaMenuDoc?: (menuId: number | string) => Promise<MenuItem>;
|
|
139
|
-
/** Override customer orders list fetching. */
|
|
140
|
-
getCustomerOrders?: (customerId: number | string, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
141
|
-
/** Override customer order detail fetching. */
|
|
142
|
-
getCustomerOrderDetail?: (customerId: number | string, orderId: number | string) => Promise<unknown>;
|
|
143
|
-
/** Override customer invoices list fetching. */
|
|
144
|
-
getCustomerInvoices?: (customerId: number | string, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
145
|
-
/** Override customer invoice detail fetching. */
|
|
146
|
-
getCustomerInvoiceDetail?: (customerId: number | string, invoiceNo: number | string) => Promise<unknown>;
|
|
147
|
-
/** Override customer quotes list fetching. */
|
|
148
|
-
getCustomerQuotes?: (customerId: number | string, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
149
|
-
/** Override customer quote detail fetching. */
|
|
150
|
-
getCustomerQuoteDetail?: (customerId: number | string, quoteNo: number | string) => Promise<unknown>;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Minimal type for the augur-api SDK instance.
|
|
155
|
-
* Consumers provide their concrete AugurAPI instance; we keep the type
|
|
156
|
-
* loose so augur-hooks doesn't need to depend directly on the SDK package.
|
|
157
|
-
*/
|
|
158
|
-
type AugurApiClient = any;
|
|
159
|
-
interface AugurHooksProviderProps {
|
|
160
|
-
/** SDK client instance. Required for the proxy-based `useAugurOptions()`. */
|
|
161
|
-
api?: AugurApiClient;
|
|
162
|
-
/** Optional callback registry for routing SDK calls through server actions (legacy). */
|
|
163
|
-
callbacks?: AugurCallbacks;
|
|
164
|
-
/** Optional auth context — hooks fall back to these values when not passed directly. */
|
|
165
|
-
auth?: AugurAuthContext;
|
|
166
|
-
/** Optional cache configuration — controls edge and Redis caching per tier. */
|
|
167
|
-
cache?: CacheConfig;
|
|
168
|
-
/** Optional site configuration — hooks read defaults and formatting from this. */
|
|
169
|
-
site?: AugurSiteConfig;
|
|
170
|
-
children: ReactNode;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Provides the augur-api SDK instance, proxy options, and optional callbacks to all hooks.
|
|
174
|
-
*
|
|
175
|
-
* ```tsx
|
|
176
|
-
* <AugurHooksProvider api={api} auth={authContext} cache={cacheConfig}>
|
|
177
|
-
* <App />
|
|
178
|
-
* </AugurHooksProvider>
|
|
179
|
-
* ```
|
|
180
|
-
*
|
|
181
|
-
* Components use `useAugurOptions()` to get the proxy:
|
|
182
|
-
* ```tsx
|
|
183
|
-
* const q = useAugurOptions();
|
|
184
|
-
* const { data } = useQuery(q.items.invMast.get(42));
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
|
-
declare function AugurHooksProvider({ api, callbacks, auth, cache, site, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
|
|
188
|
-
/**
|
|
189
|
-
* Returns the deep proxy for creating TanStack Query options.
|
|
190
|
-
*
|
|
191
|
-
* Every SDK method is available as a path:
|
|
192
|
-
* ```tsx
|
|
193
|
-
* const q = useAugurOptions();
|
|
194
|
-
* const { data } = useQuery(q.items.invMast.get(42));
|
|
195
|
-
* const { data: stock } = useQuery(q.items.invMast.stock.get(42));
|
|
196
|
-
* const addToCart = useMutation(q.commerce.cartLine.add.create());
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* Override queryFn at the call site:
|
|
200
|
-
* ```tsx
|
|
201
|
-
* const { data } = useQuery({
|
|
202
|
-
* ...q.pricing.priceEngine.get({ itemId, customerId }),
|
|
203
|
-
* queryFn: () => getItemPriceAction(itemId, customerId),
|
|
204
|
-
* });
|
|
205
|
-
* ```
|
|
206
|
-
*/
|
|
207
|
-
declare function useAugurOptions<T = unknown>(): T;
|
|
208
|
-
/**
|
|
209
|
-
* Returns the augur-api SDK instance from context, or null if not provided.
|
|
210
|
-
* Used internally by hooks that check for callback overrides first.
|
|
211
|
-
*/
|
|
212
|
-
declare function useAugurApiOptional(): AugurApiClient | null;
|
|
213
|
-
/**
|
|
214
|
-
* Returns the augur-api SDK instance from context.
|
|
215
|
-
* Throws if called outside of `<AugurHooksProvider>` or when no api is provided.
|
|
216
|
-
*/
|
|
217
|
-
declare function useAugurApi(): AugurApiClient;
|
|
218
|
-
/**
|
|
219
|
-
* Returns the provider-level auth context, if any.
|
|
220
|
-
* Used internally by hooks to fall back to provider auth when
|
|
221
|
-
* auth fields are not passed directly as hook parameters.
|
|
222
|
-
*/
|
|
223
|
-
declare function useAugurAuth(): AugurAuthContext | undefined;
|
|
224
|
-
/**
|
|
225
|
-
* Returns the provider-level cache configuration, if any.
|
|
226
|
-
* Used internally by hooks to enable edge/Redis caching.
|
|
227
|
-
*/
|
|
228
|
-
declare function useAugurCache(): CacheConfig | undefined;
|
|
229
|
-
/**
|
|
230
|
-
* Returns the site configuration from the nearest `AugurHooksProvider`.
|
|
231
|
-
* Returns `undefined` when no `site` prop is provided.
|
|
232
|
-
*/
|
|
233
|
-
declare function useAugurSite(): AugurSiteConfig | undefined;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Generates a consistent query key for item price queries.
|
|
237
|
-
* Usable in both client hooks and server-side prefetch.
|
|
238
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
239
|
-
*/
|
|
240
|
-
declare const getItemPriceKey: (itemId: string | undefined, customerId: string | number | undefined, quantity?: number) => readonly ["price", string, string | number | undefined, number];
|
|
241
|
-
/**
|
|
242
|
-
* Query options for item price. Accepts the SDK instance so it works
|
|
243
|
-
* in both client (via provider) and server (via direct construction).
|
|
244
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
245
|
-
*/
|
|
246
|
-
declare const getItemPriceOptions: (api: AugurApiClient, itemId: string | undefined, customerId: string | number | undefined, quantity?: number, cache?: CacheConfig) => {
|
|
247
|
-
queryKey: readonly ["price", string, string | number | undefined, number];
|
|
248
|
-
queryFn: () => Promise<TPriceData>;
|
|
249
|
-
staleTime: number | undefined;
|
|
250
|
-
gcTime: number | undefined;
|
|
251
|
-
refetchOnReconnect: boolean;
|
|
252
|
-
refetchOnWindowFocus: boolean;
|
|
253
|
-
meta: {
|
|
254
|
-
persist: boolean;
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Generates a consistent query key for inv mast doc queries.
|
|
260
|
-
* Usable in both client hooks and server-side prefetch.
|
|
261
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
262
|
-
*/
|
|
263
|
-
declare const getInvMastDocKey: (invMastUid: number, itemId: string, includePricing: "Y" | "N") => readonly ["invMastDoc", number, string, "Y" | "N"];
|
|
264
|
-
/**
|
|
265
|
-
* Query options for inv mast doc. Accepts the SDK instance so it works
|
|
266
|
-
* in both client (via provider) and server (via direct construction).
|
|
267
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
268
|
-
*/
|
|
269
|
-
declare const getInvMastDocOptions: (api: AugurApiClient, invMastUid: number, itemId: string, includePricing: "Y" | "N", cache?: CacheConfig) => {
|
|
270
|
-
queryKey: readonly ["invMastDoc", number, string, "Y" | "N"];
|
|
271
|
-
queryFn: () => Promise<TInvMastDoc>;
|
|
272
|
-
staleTime: number | undefined;
|
|
273
|
-
gcTime: number | undefined;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
type ItemCategoryQueryKey = readonly [
|
|
277
|
-
"itemCategory",
|
|
278
|
-
number,
|
|
279
|
-
GetItemCategoryApiOptions | undefined
|
|
280
|
-
];
|
|
281
|
-
/**
|
|
282
|
-
* Generates a consistent query key for item category queries.
|
|
283
|
-
* Usable in both client hooks and server-side prefetch.
|
|
284
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
285
|
-
*/
|
|
286
|
-
declare const getItemCategoryKey: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => ItemCategoryQueryKey;
|
|
287
|
-
/**
|
|
288
|
-
* Query options for item category. Accepts the SDK instance so it works
|
|
289
|
-
* in both client (via provider) and server (via direct construction).
|
|
290
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
291
|
-
*/
|
|
292
|
-
declare const getItemCategoryOptions: (api: AugurApiClient, itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions, cache?: CacheConfig) => {
|
|
293
|
-
queryKey: ItemCategoryQueryKey;
|
|
294
|
-
queryFn: () => Promise<TCategory>;
|
|
295
|
-
staleTime: number | undefined;
|
|
296
|
-
gcTime: number | undefined;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
300
|
-
declare const getInvMastKey: (invMastUid: number, itemId: string) => readonly ["invMast", number, string];
|
|
301
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
302
|
-
declare const getInvMastOptions: (api: AugurApiClient, invMastUid: number, itemId: string, cache?: CacheConfig) => {
|
|
303
|
-
queryKey: readonly ["invMast", number, string];
|
|
304
|
-
queryFn: () => Promise<TItemDetails>;
|
|
305
|
-
staleTime: number | undefined;
|
|
306
|
-
gcTime: number | undefined;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
310
|
-
declare const getInvMastStockKey: (invMastUid: number | string) => readonly ["invMastStock", string | number];
|
|
311
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
312
|
-
declare const getInvMastStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
|
|
313
|
-
queryKey: readonly ["invMastStock", string | number];
|
|
314
|
-
queryFn: () => Promise<number>;
|
|
315
|
-
staleTime: number | undefined;
|
|
316
|
-
gcTime: number | undefined;
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
declare const getStockKey: (invMastUid: number | string) => readonly ["stock", string | number];
|
|
320
|
-
declare const getStockOptions: (api: AugurApiClient, invMastUid: number | string, cache?: CacheConfig) => {
|
|
321
|
-
queryKey: readonly ["stock", string | number];
|
|
322
|
-
queryFn: () => Promise<TStock>;
|
|
323
|
-
staleTime: number | undefined;
|
|
324
|
-
gcTime: number | undefined;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
interface BatchInvMastDocParam {
|
|
328
|
-
invMastUid: number;
|
|
329
|
-
itemId: string;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Generates a deterministic query key for a batch inv mast doc query.
|
|
333
|
-
* Params are sorted by uppercased itemId to ensure stable keys
|
|
334
|
-
* regardless of input order.
|
|
335
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
336
|
-
*/
|
|
337
|
-
declare const getBatchInvMastDocKey: (params: BatchInvMastDocParam[], includePricing: "Y" | "N") => readonly ["batchInvMastDoc", string, "Y" | "N"];
|
|
338
|
-
/**
|
|
339
|
-
* Server-side query options for batch inv mast doc.
|
|
340
|
-
* Uses Promise.all over individual getInvMastDocOptions queryFns
|
|
341
|
-
* since queryClient is not available server-side.
|
|
342
|
-
* Failed items are silently excluded from the result.
|
|
343
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
344
|
-
*/
|
|
345
|
-
declare const getBatchInvMastDocOptions: (api: AugurApiClient, params: BatchInvMastDocParam[], includePricing: "Y" | "N", cache?: CacheConfig) => {
|
|
346
|
-
queryKey: readonly ["batchInvMastDoc", string, "Y" | "N"];
|
|
347
|
-
queryFn: () => Promise<Record<string, TInvMastDoc>>;
|
|
348
|
-
staleTime: number | undefined;
|
|
349
|
-
gcTime: number | undefined;
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
interface BatchQueryConfig<TParam, TData> {
|
|
353
|
-
params: TParam[];
|
|
354
|
-
queryClient: QueryClient;
|
|
355
|
-
/** Build individual cache key for a single param. */
|
|
356
|
-
getItemKey: (param: TParam) => readonly unknown[];
|
|
357
|
-
/** Build the string key for the result Record from a param. */
|
|
358
|
-
getResultKey: (param: TParam) => string;
|
|
359
|
-
/** Fetch only uncached items, return keyed Record. */
|
|
360
|
-
fetchItems: (uncached: TParam[]) => Promise<Record<string, TData>>;
|
|
361
|
-
/** Extract individual cache key from a fetched result entry (for seeding). */
|
|
362
|
-
getSeedKey: (resultKey: string, data: TData) => readonly unknown[];
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Generic batch query executor.
|
|
366
|
-
*
|
|
367
|
-
* 1. Checks queryClient cache for each param
|
|
368
|
-
* 2. Fetches only uncached items in a single batch call
|
|
369
|
-
* 3. Seeds individual cache entries from the response
|
|
370
|
-
* 4. Returns merged cached + fetched record
|
|
371
|
-
*/
|
|
372
|
-
declare function executeBatchQuery<TParam, TData>(config: BatchQueryConfig<TParam, TData>): Promise<Record<string, TData>>;
|
|
373
|
-
|
|
374
|
-
type ProductCategoryResponse = {
|
|
375
|
-
itemCategoryDesc: string;
|
|
376
|
-
childrenTotal: number;
|
|
377
|
-
children: TProductCategory[];
|
|
378
|
-
categoryImage: string | null;
|
|
379
|
-
};
|
|
380
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
381
|
-
declare const getProductCategoryKey: (itemCategoryUid: number | string | null) => readonly ["productCategory", string | number | null];
|
|
382
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
383
|
-
declare const getProductCategoryOptions: (api: AugurApiClient, itemCategoryUid: number | string, cache?: CacheConfig) => {
|
|
384
|
-
queryKey: readonly ["productCategory", string | number | null];
|
|
385
|
-
queryFn: () => Promise<ProductCategoryResponse>;
|
|
386
|
-
staleTime: number | undefined;
|
|
387
|
-
gcTime: number | undefined;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
391
|
-
declare const getItemDetailsKey: (itemId: number | string) => readonly ["itemDetails", string | number];
|
|
392
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
393
|
-
declare const getItemDetailsOptions: (api: AugurApiClient, itemId: number | string, cache?: CacheConfig) => {
|
|
394
|
-
queryKey: readonly ["itemDetails", string | number];
|
|
395
|
-
queryFn: () => Promise<TItemDetails>;
|
|
396
|
-
staleTime: number | undefined;
|
|
397
|
-
gcTime: number | undefined;
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
401
|
-
declare const getItemAttributesKey: (itemCategoryUid: number | string | null) => readonly ["itemAttributes", string | number | null];
|
|
402
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
403
|
-
declare const getItemAttributesOptions: (api: AugurApiClient, itemCategoryUid: number | string, cache?: CacheConfig) => {
|
|
404
|
-
queryKey: readonly ["itemAttributes", string | number | null];
|
|
405
|
-
queryFn: () => Promise<any>;
|
|
406
|
-
staleTime: number | undefined;
|
|
407
|
-
gcTime: number | undefined;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
type ProductSearchResponse = {
|
|
411
|
-
items: TProductItem[];
|
|
412
|
-
totalResults: number;
|
|
413
|
-
};
|
|
414
|
-
/**
|
|
415
|
-
* Generates a consistent query key for product search queries.
|
|
416
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
417
|
-
*/
|
|
418
|
-
declare const getProductSearchKey: (pageData: PageData) => readonly ["productSearch", string, number, number, string, number | undefined];
|
|
419
|
-
/**
|
|
420
|
-
* Query options for product search. Accepts the SDK instance so it works
|
|
421
|
-
* in both client (via provider) and server (via direct construction).
|
|
422
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
423
|
-
*/
|
|
424
|
-
declare const getProductSearchOptions: (api: AugurApiClient, pageData: PageData, cache?: CacheConfig) => {
|
|
425
|
-
queryKey: readonly ["productSearch", string, number, number, string, number | undefined];
|
|
426
|
-
queryFn: () => Promise<ProductSearchResponse>;
|
|
427
|
-
staleTime: number | undefined;
|
|
428
|
-
gcTime: number | undefined;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Generates a consistent query key for search suggestion queries.
|
|
433
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version.
|
|
434
|
-
*/
|
|
435
|
-
declare const getSearchSuggestionsKey: (query: string, limit: number, offset: number) => readonly ["searchSuggestions", string, number, number];
|
|
436
|
-
/**
|
|
437
|
-
* Query options for search suggestions. Accepts the SDK instance so it works
|
|
438
|
-
* in both client (via provider) and server (via direct construction).
|
|
439
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
440
|
-
*/
|
|
441
|
-
declare const getSearchSuggestionsOptions: (api: AugurApiClient, query: string, limit?: number, offset?: number, cache?: CacheConfig) => {
|
|
442
|
-
queryKey: readonly ["searchSuggestions", string, number, number];
|
|
443
|
-
queryFn: () => Promise<TSearchSuggestionsResponse>;
|
|
444
|
-
staleTime: number | undefined;
|
|
445
|
-
gcTime: number | undefined;
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Get cart pricing query options for prefetching or parent components.
|
|
450
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
451
|
-
*/
|
|
452
|
-
declare function getCartPricingQueryOptions(api: AugurApiClient, cartLines: Array<{
|
|
453
|
-
itemId: string;
|
|
454
|
-
quantity: number;
|
|
455
|
-
}>, customerId: string | number | undefined, cache?: CacheConfig): {
|
|
456
|
-
enabled: boolean;
|
|
457
|
-
queryKey: readonly ["price", string, string | number | undefined, number];
|
|
458
|
-
queryFn: () => Promise<_simpleapps_com_augur_utils.TPriceData>;
|
|
459
|
-
staleTime: number | undefined;
|
|
460
|
-
gcTime: number | undefined;
|
|
461
|
-
refetchOnReconnect: boolean;
|
|
462
|
-
refetchOnWindowFocus: boolean;
|
|
463
|
-
meta: {
|
|
464
|
-
persist: boolean;
|
|
465
|
-
};
|
|
466
|
-
}[];
|
|
467
|
-
|
|
468
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
469
|
-
declare const getCategoryItemsInfiniteKey: (itemCategoryUid: number, itemsFilters: TItemsFilters) => readonly ["categoryItemsInfinite", number, string];
|
|
470
|
-
/**
|
|
471
|
-
* Full infinite query options for category items.
|
|
472
|
-
* Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.
|
|
473
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
474
|
-
*/
|
|
475
|
-
declare const getCategoryItemsInfiniteOptions: (api: AugurApiClient, itemCategoryUid: number, itemsFilters: TItemsFilters, cache?: CacheConfig) => {
|
|
476
|
-
queryKey: readonly ["categoryItemsInfinite", number, string];
|
|
477
|
-
queryFn: ({ pageParam }: {
|
|
478
|
-
pageParam?: unknown;
|
|
479
|
-
}) => Promise<InfiniteScrollPage>;
|
|
480
|
-
initialPageParam: number;
|
|
481
|
-
getNextPageParam: (lastPage: InfiniteScrollPage) => number | undefined;
|
|
482
|
-
staleTime: number | undefined;
|
|
483
|
-
gcTime: number | undefined;
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
487
|
-
declare const getItemSearchInfiniteKey: (itemsFilters: TItemsFilters, itemCategoryUid?: number | string) => readonly ["itemSearchInfinite", string, string | number | undefined];
|
|
488
|
-
/**
|
|
489
|
-
* Full infinite query options for item search.
|
|
490
|
-
* Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.
|
|
491
|
-
* @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version.
|
|
492
|
-
*/
|
|
493
|
-
declare const getItemSearchInfiniteOptions: (api: AugurApiClient, itemsFilters: TItemsFilters, itemCategoryUid?: number | string, cache?: CacheConfig) => {
|
|
494
|
-
queryKey: readonly ["itemSearchInfinite", string, string | number | undefined];
|
|
495
|
-
queryFn: ({ pageParam }: {
|
|
496
|
-
pageParam?: unknown;
|
|
497
|
-
}) => Promise<InfiniteScrollPage>;
|
|
498
|
-
initialPageParam: number;
|
|
499
|
-
getNextPageParam: (lastPage: InfiniteScrollPage) => number | undefined;
|
|
500
|
-
staleTime: number | undefined;
|
|
501
|
-
gcTime: number | undefined;
|
|
502
|
-
meta: {
|
|
503
|
-
persist: boolean;
|
|
504
|
-
};
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
508
|
-
declare const getJoomlaContentKey: (articleId: number | string) => readonly ["joomlaContent", string | number];
|
|
509
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
510
|
-
declare const getJoomlaContentOptions: (api: AugurApiClient, articleId: number | string, cache?: CacheConfig) => {
|
|
511
|
-
queryKey: readonly ["joomlaContent", string | number];
|
|
512
|
-
queryFn: () => Promise<TJoomlaContent>;
|
|
513
|
-
staleTime: number | undefined;
|
|
514
|
-
gcTime: number | undefined;
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
518
|
-
declare const getJoomlaContentListKey: (categoryId: number | string, filters?: Partial<TJoomlaContentFilters>) => readonly ["joomlaContentList", string | number, Partial<TJoomlaContentFilters> | undefined];
|
|
519
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
520
|
-
declare const getJoomlaContentListOptions: (api: AugurApiClient, categoryId: number | string, filters?: Partial<TJoomlaContentFilters>, cache?: CacheConfig) => {
|
|
521
|
-
queryKey: readonly ["joomlaContentList", string | number, Partial<TJoomlaContentFilters> | undefined];
|
|
522
|
-
queryFn: () => Promise<ListResult<TJoomlaContent>>;
|
|
523
|
-
staleTime: number | undefined;
|
|
524
|
-
gcTime: number | undefined;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
528
|
-
declare const getJoomlaMenuKey: (filters?: Partial<TMenuFilters>) => readonly ["joomlaMenu", Partial<TMenuFilters> | undefined];
|
|
529
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
530
|
-
declare const getJoomlaMenuOptions: (api: AugurApiClient, filters?: Partial<TMenuFilters>, cache?: CacheConfig) => {
|
|
531
|
-
queryKey: readonly ["joomlaMenu", Partial<TMenuFilters> | undefined];
|
|
532
|
-
queryFn: () => Promise<ListResult<MenuItem>>;
|
|
533
|
-
staleTime: number | undefined;
|
|
534
|
-
gcTime: number | undefined;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
538
|
-
declare const getJoomlaMenuDocKey: (menuId: number | string) => readonly ["joomlaMenuDoc", string | number];
|
|
539
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead. Will be removed in the next major version. */
|
|
540
|
-
declare const getJoomlaMenuDocOptions: (api: AugurApiClient, menuId: number | string, cache?: CacheConfig) => {
|
|
541
|
-
queryKey: readonly ["joomlaMenuDoc", string | number];
|
|
542
|
-
queryFn: () => Promise<MenuItem>;
|
|
543
|
-
staleTime: number | undefined;
|
|
544
|
-
gcTime: number | undefined;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
548
|
-
declare const getCustomerOrdersKey: (customerId: number | string | undefined, params?: Record<string, unknown>) => readonly ["customerOrders", string | number | undefined, Record<string, unknown> | undefined];
|
|
549
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
550
|
-
declare const getCustomerOrderDetailKey: (customerId: number | string | undefined, orderId: number | string | undefined) => readonly ["customerOrderDetail", string | number | undefined, string | number | undefined];
|
|
551
|
-
|
|
552
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
553
|
-
declare const getCustomerInvoicesKey: (customerId: number | string | undefined, params?: Record<string, unknown>) => readonly ["customerInvoices", string | number | undefined, Record<string, unknown> | undefined];
|
|
554
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
555
|
-
declare const getCustomerInvoiceDetailKey: (customerId: number | string | undefined, invoiceNo: number | string | undefined) => readonly ["customerInvoiceDetail", string | number | undefined, string | number | undefined];
|
|
556
|
-
|
|
557
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
558
|
-
declare const getCustomerQuotesKey: (customerId: number | string | undefined, params?: Record<string, unknown>) => readonly ["customerQuotes", string | number | undefined, Record<string, unknown> | undefined];
|
|
559
|
-
/** @deprecated Use `useAugurOptions()` or `createAugurOptions()` instead — query keys are derived automatically. Will be removed in the next major version. */
|
|
560
|
-
declare const getCustomerQuoteDetailKey: (customerId: number | string | undefined, quoteNo: number | string | undefined) => readonly ["customerQuoteDetail", string | number | undefined, string | number | undefined];
|
|
561
|
-
|
|
562
|
-
export { useAugurApiOptional as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemDetailsKey as C, getItemDetailsOptions as D, getItemPriceKey as E, getItemPriceOptions as F, type GetItemCategoryApiOptions as G, getItemSearchInfiniteKey as H, getItemSearchInfiniteOptions as I, getJoomlaContentKey as J, getJoomlaContentListKey as K, getJoomlaContentListOptions as L, getJoomlaContentOptions as M, getJoomlaMenuDocKey as N, getJoomlaMenuDocOptions as O, type PageData as P, getJoomlaMenuKey as Q, getJoomlaMenuOptions as R, getProductCategoryKey as S, getProductCategoryOptions as T, getProductSearchKey as U, getProductSearchOptions as V, getSearchSuggestionsKey as W, getSearchSuggestionsOptions as X, getStockKey as Y, getStockOptions as Z, useAugurApi as _, type AugurApiClient as a, useAugurAuth as a0, useAugurCache as a1, useAugurOptions as a2, useAugurSite as a3, type PersistenceConfig as b, AugurHooksProvider as c, type BatchQueryConfig as d, executeBatchQuery as e, getBatchInvMastDocOptions as f, getBatchInvMastDocKey as g, getCartPricingQueryOptions as h, getCategoryItemsInfiniteKey as i, getCategoryItemsInfiniteOptions as j, getCustomerInvoiceDetailKey as k, getCustomerInvoicesKey as l, getCustomerOrderDetailKey as m, getCustomerOrdersKey as n, getCustomerQuoteDetailKey as o, getCustomerQuotesKey as p, getInvMastDocKey as q, getInvMastDocOptions as r, getInvMastKey as s, getInvMastOptions as t, getInvMastStockKey as u, getInvMastStockOptions as v, getItemAttributesKey as w, getItemAttributesOptions as x, getItemCategoryKey as y, getItemCategoryOptions as z };
|