@simpleapps-com/augur-hooks 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-DS2ECDHJ.js +312 -0
- package/dist/chunk-DS2ECDHJ.js.map +1 -0
- package/dist/chunk-YSRBE3YI.cjs +312 -0
- package/dist/chunk-YSRBE3YI.cjs.map +1 -0
- package/dist/index.cjs +199 -322
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -275
- package/dist/index.d.ts +34 -275
- package/dist/index.js +169 -292
- package/dist/index.js.map +1 -1
- package/dist/server-CF43MUMf.d.cts +432 -0
- package/dist/server-CF43MUMf.d.ts +432 -0
- package/dist/server.cjs +65 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +4 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +65 -0
- package/dist/server.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import * as _simpleapps_com_augur_utils from '@simpleapps-com/augur-utils';
|
|
2
|
+
import { TPriceData, TItemDetails, TInvMastDoc, TCategory, TAttribute, TItemsFilters, TProductItem, TProductCategory } from '@simpleapps-com/augur-utils';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook-specific types that don't belong in augur-utils.
|
|
8
|
+
* These describe hook parameters and API response shapes.
|
|
9
|
+
*/
|
|
10
|
+
/** Parameters for product search queries. */
|
|
11
|
+
type PageData = {
|
|
12
|
+
categoryIdList?: string;
|
|
13
|
+
filters?: [string, string][];
|
|
14
|
+
limit: number;
|
|
15
|
+
page: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
q: string;
|
|
18
|
+
sortBy: string;
|
|
19
|
+
tagslist?: string;
|
|
20
|
+
itemCategoryUid?: number;
|
|
21
|
+
};
|
|
22
|
+
/** A single search suggestion from OpenSearch. */
|
|
23
|
+
type SearchSuggestion = {
|
|
24
|
+
suggestionsUid: number;
|
|
25
|
+
queryStringUid: number;
|
|
26
|
+
suggestionsString: string;
|
|
27
|
+
suggestionsMetaphone: string | null;
|
|
28
|
+
avgTotalResults: number;
|
|
29
|
+
dateCreated: string;
|
|
30
|
+
dateLastModified: string;
|
|
31
|
+
updateCd: number;
|
|
32
|
+
statusCd: number;
|
|
33
|
+
processCd: number;
|
|
34
|
+
score: number;
|
|
35
|
+
};
|
|
36
|
+
/** Response shape from the search suggestions endpoint. */
|
|
37
|
+
type SearchSuggestionsResponse = {
|
|
38
|
+
count: number;
|
|
39
|
+
data: SearchSuggestion[];
|
|
40
|
+
message: string;
|
|
41
|
+
options: unknown[];
|
|
42
|
+
params: unknown[];
|
|
43
|
+
status: number;
|
|
44
|
+
total: number;
|
|
45
|
+
totalResults: number;
|
|
46
|
+
};
|
|
47
|
+
/** API options for item category queries. */
|
|
48
|
+
interface GetItemCategoryApiOptions {
|
|
49
|
+
childrenFilter?: string;
|
|
50
|
+
childrenLimit?: number;
|
|
51
|
+
childrenOffset?: number;
|
|
52
|
+
classId5List?: string;
|
|
53
|
+
filters?: Record<string, string>;
|
|
54
|
+
orderBy?: string;
|
|
55
|
+
path?: string;
|
|
56
|
+
productCollection?: string;
|
|
57
|
+
rootItemCategoryId?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Typed callback registry for provider-level queryFn overrides,
|
|
62
|
+
* and auth context for provider-level session injection.
|
|
63
|
+
*
|
|
64
|
+
* Sites register server actions once at the provider level,
|
|
65
|
+
* eliminating per-hook wrappers for CORS/server action routing.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Auth context provided at the provider level.
|
|
70
|
+
* Auth-provider-agnostic — works with NextAuth, Clerk, Supabase Auth, etc.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* const { data: session, status } = useSession();
|
|
75
|
+
*
|
|
76
|
+
* <AugurHooksProvider
|
|
77
|
+
* api={api}
|
|
78
|
+
* auth={{
|
|
79
|
+
* status,
|
|
80
|
+
* customerId: session?.user?.customerId ?? process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
|
|
81
|
+
* userId: session?.user?.id,
|
|
82
|
+
* cartHdrUid: session?.user?.cartHdrUid,
|
|
83
|
+
* }}
|
|
84
|
+
* >
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
interface AugurAuthContext {
|
|
88
|
+
/** Auth loading state — hooks disable queries while "loading". */
|
|
89
|
+
status: "loading" | "authenticated" | "unauthenticated";
|
|
90
|
+
/** Customer ID for pricing. Falls back to env default if undefined. */
|
|
91
|
+
customerId?: string | number;
|
|
92
|
+
/** User ID for cart ownership. */
|
|
93
|
+
userId?: string | number;
|
|
94
|
+
/** Cart header UID from session (if available). */
|
|
95
|
+
cartHdrUid?: string | number;
|
|
96
|
+
}
|
|
97
|
+
/** Paginated response for infinite scroll hooks. */
|
|
98
|
+
interface InfiniteScrollPage {
|
|
99
|
+
data: TProductItem[];
|
|
100
|
+
total: number;
|
|
101
|
+
nextCursor?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Provider-level callback map. Register server actions here to override
|
|
105
|
+
* the default SDK calls in all hooks. Hook-level `queryFn` takes priority
|
|
106
|
+
* over provider callbacks; provider callbacks take priority over the SDK.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* <AugurHooksProvider
|
|
111
|
+
* api={api}
|
|
112
|
+
* callbacks={{
|
|
113
|
+
* getItemPrice: (itemId, customerId, qty) => getItemPriceAction(itemId, customerId, qty),
|
|
114
|
+
* getItemCategory: (uid, opts) => getItemCategoryAction(uid, opts),
|
|
115
|
+
* getCategoryItemsInfinite: (p) => getCategoryItemsAction(p),
|
|
116
|
+
* }}
|
|
117
|
+
* >
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
interface AugurCallbacks {
|
|
121
|
+
/** Override item price fetching (used by useItemPrice and useCartPricing). */
|
|
122
|
+
getItemPrice?: (itemId: string, customerId: string | number, quantity: number) => Promise<TPriceData>;
|
|
123
|
+
/** Override inventory master fetching. */
|
|
124
|
+
getInvMast?: (invMastUid: number, itemId: string) => Promise<TItemDetails>;
|
|
125
|
+
/** Override inventory master doc fetching. */
|
|
126
|
+
getInvMastDoc?: (invMastUid: number, itemId: string, includePricing: "Y" | "N") => Promise<TInvMastDoc>;
|
|
127
|
+
/** Override inventory stock fetching. */
|
|
128
|
+
getInvMastStock?: (invMastUid: number | string) => Promise<number>;
|
|
129
|
+
/** Override item category fetching. */
|
|
130
|
+
getItemCategory?: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => Promise<TCategory>;
|
|
131
|
+
/** Override item details fetching. */
|
|
132
|
+
getItemDetails?: (itemId: number | string) => Promise<TItemDetails>;
|
|
133
|
+
/** Override item attributes fetching. */
|
|
134
|
+
getItemAttributes?: (itemCategoryUid: number | string) => Promise<{
|
|
135
|
+
attributes: TAttribute[];
|
|
136
|
+
}>;
|
|
137
|
+
/** Override product category fetching. */
|
|
138
|
+
getProductCategory?: (itemCategoryUid: number | string) => Promise<{
|
|
139
|
+
itemCategoryDesc: string;
|
|
140
|
+
childrenTotal: number;
|
|
141
|
+
children: unknown[];
|
|
142
|
+
categoryImage: string | null;
|
|
143
|
+
}>;
|
|
144
|
+
/** Override product search. */
|
|
145
|
+
getProductSearch?: (pageData: PageData) => Promise<{
|
|
146
|
+
items: unknown[];
|
|
147
|
+
totalResults: number;
|
|
148
|
+
}>;
|
|
149
|
+
/** Override search suggestions. */
|
|
150
|
+
getSearchSuggestions?: (query: string, limit: number, offset: number) => Promise<SearchSuggestionsResponse>;
|
|
151
|
+
/** Override category items infinite scroll. */
|
|
152
|
+
getCategoryItemsInfinite?: (params: {
|
|
153
|
+
itemCategoryUid: number;
|
|
154
|
+
itemsFilters: TItemsFilters;
|
|
155
|
+
pageParam: number;
|
|
156
|
+
}) => Promise<InfiniteScrollPage>;
|
|
157
|
+
/** Override item search infinite scroll. */
|
|
158
|
+
getItemSearchInfinite?: (params: {
|
|
159
|
+
itemsFilters: TItemsFilters;
|
|
160
|
+
itemCategoryUid?: number | string;
|
|
161
|
+
pageParam: number;
|
|
162
|
+
}) => Promise<InfiniteScrollPage>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Minimal type for the augur-api SDK instance.
|
|
167
|
+
* Consumers provide their concrete AugurAPI instance; we keep the type
|
|
168
|
+
* loose so augur-hooks doesn't need to depend directly on the SDK package.
|
|
169
|
+
*/
|
|
170
|
+
type AugurApiClient = any;
|
|
171
|
+
interface AugurHooksProviderProps {
|
|
172
|
+
api: AugurApiClient;
|
|
173
|
+
/** Optional callback registry for routing SDK calls through server actions. */
|
|
174
|
+
callbacks?: AugurCallbacks;
|
|
175
|
+
/** Optional auth context — hooks fall back to these values when not passed directly. */
|
|
176
|
+
auth?: AugurAuthContext;
|
|
177
|
+
children: ReactNode;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Provides the augur-api SDK instance and optional callbacks to all hooks.
|
|
181
|
+
*
|
|
182
|
+
* ```tsx
|
|
183
|
+
* import { AugurAPI } from "@simpleapps-com/augur-api";
|
|
184
|
+
* const api = new AugurAPI({ baseUrl: "...", token: "..." });
|
|
185
|
+
*
|
|
186
|
+
* <AugurHooksProvider api={api}>
|
|
187
|
+
* <App />
|
|
188
|
+
* </AugurHooksProvider>
|
|
189
|
+
*
|
|
190
|
+
* // With callbacks and auth (eliminates per-hook wrappers):
|
|
191
|
+
* <AugurHooksProvider
|
|
192
|
+
* api={api}
|
|
193
|
+
* callbacks={{
|
|
194
|
+
* getItemPrice: (id, cust, qty) => getItemPriceAction(id, cust, qty),
|
|
195
|
+
* }}
|
|
196
|
+
* auth={{ status, customerId, userId, cartHdrUid }}
|
|
197
|
+
* >
|
|
198
|
+
* <App />
|
|
199
|
+
* </AugurHooksProvider>
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare function AugurHooksProvider({ api, callbacks, auth, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
|
|
203
|
+
/**
|
|
204
|
+
* Returns the augur-api SDK instance from context.
|
|
205
|
+
* Throws if called outside of `<AugurHooksProvider>`.
|
|
206
|
+
*/
|
|
207
|
+
declare function useAugurApi(): AugurApiClient;
|
|
208
|
+
/**
|
|
209
|
+
* Returns the provider-level auth context, if any.
|
|
210
|
+
* Used internally by hooks to fall back to provider auth when
|
|
211
|
+
* auth fields are not passed directly as hook parameters.
|
|
212
|
+
*/
|
|
213
|
+
declare function useAugurAuth(): AugurAuthContext | undefined;
|
|
214
|
+
|
|
215
|
+
declare const PRICE_CACHE_OPTIONS: {
|
|
216
|
+
readonly refetchOnReconnect: true;
|
|
217
|
+
readonly refetchOnWindowFocus: false;
|
|
218
|
+
readonly meta: {
|
|
219
|
+
readonly persist: true;
|
|
220
|
+
};
|
|
221
|
+
readonly staleTime: number;
|
|
222
|
+
readonly gcTime: number;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Generates a consistent query key for item price queries.
|
|
226
|
+
* Usable in both client hooks and server-side prefetch.
|
|
227
|
+
*/
|
|
228
|
+
declare const getItemPriceKey: (itemId: string | undefined, customerId: string | number | undefined, quantity?: number) => readonly ["price", string, string | number | undefined, number];
|
|
229
|
+
/**
|
|
230
|
+
* Query options for item price. Accepts the SDK instance so it works
|
|
231
|
+
* in both client (via provider) and server (via direct construction).
|
|
232
|
+
*/
|
|
233
|
+
declare const getItemPriceOptions: (api: AugurApiClient, itemId: string | undefined, customerId: string | number | undefined, quantity?: number) => {
|
|
234
|
+
refetchOnReconnect: true;
|
|
235
|
+
refetchOnWindowFocus: false;
|
|
236
|
+
meta: {
|
|
237
|
+
readonly persist: true;
|
|
238
|
+
};
|
|
239
|
+
staleTime: number;
|
|
240
|
+
gcTime: number;
|
|
241
|
+
queryKey: readonly ["price", string, string | number | undefined, number];
|
|
242
|
+
queryFn: () => Promise<TPriceData>;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare const INV_MAST_DOC_CACHE_OPTIONS: {
|
|
246
|
+
readonly staleTime: number;
|
|
247
|
+
readonly gcTime: number;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Generates a consistent query key for inv mast doc queries.
|
|
251
|
+
* Usable in both client hooks and server-side prefetch.
|
|
252
|
+
*/
|
|
253
|
+
declare const getInvMastDocKey: (invMastUid: number, itemId: string, includePricing: "Y" | "N") => readonly ["invMastDoc", number, string, "Y" | "N"];
|
|
254
|
+
/**
|
|
255
|
+
* Query options for inv mast doc. Accepts the SDK instance so it works
|
|
256
|
+
* in both client (via provider) and server (via direct construction).
|
|
257
|
+
*/
|
|
258
|
+
declare const getInvMastDocOptions: (api: AugurApiClient, invMastUid: number, itemId: string, includePricing: "Y" | "N") => {
|
|
259
|
+
staleTime: number;
|
|
260
|
+
gcTime: number;
|
|
261
|
+
queryKey: readonly ["invMastDoc", number, string, "Y" | "N"];
|
|
262
|
+
queryFn: () => Promise<TInvMastDoc>;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
declare const CATEGORY_CACHE_OPTIONS: {
|
|
266
|
+
readonly staleTime: number;
|
|
267
|
+
readonly gcTime: number;
|
|
268
|
+
};
|
|
269
|
+
type ItemCategoryQueryKey = readonly [
|
|
270
|
+
"itemCategory",
|
|
271
|
+
number,
|
|
272
|
+
GetItemCategoryApiOptions | undefined
|
|
273
|
+
];
|
|
274
|
+
/**
|
|
275
|
+
* Generates a consistent query key for item category queries.
|
|
276
|
+
* Usable in both client hooks and server-side prefetch.
|
|
277
|
+
*/
|
|
278
|
+
declare const getItemCategoryKey: (itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => ItemCategoryQueryKey;
|
|
279
|
+
/**
|
|
280
|
+
* Query options for item category. Accepts the SDK instance so it works
|
|
281
|
+
* in both client (via provider) and server (via direct construction).
|
|
282
|
+
*/
|
|
283
|
+
declare const getItemCategoryOptions: (api: AugurApiClient, itemCategoryUid: number, apiOptions?: GetItemCategoryApiOptions) => {
|
|
284
|
+
staleTime: number;
|
|
285
|
+
gcTime: number;
|
|
286
|
+
queryKey: ItemCategoryQueryKey;
|
|
287
|
+
queryFn: () => Promise<TCategory>;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
declare const INV_MAST_CACHE_OPTIONS: {
|
|
291
|
+
readonly staleTime: number;
|
|
292
|
+
readonly gcTime: number;
|
|
293
|
+
};
|
|
294
|
+
declare const getInvMastKey: (invMastUid: number, itemId: string) => readonly ["invMast", number, string];
|
|
295
|
+
declare const getInvMastOptions: (api: AugurApiClient, invMastUid: number, itemId: string) => {
|
|
296
|
+
staleTime: number;
|
|
297
|
+
gcTime: number;
|
|
298
|
+
queryKey: readonly ["invMast", number, string];
|
|
299
|
+
queryFn: () => Promise<TItemDetails>;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
declare const getInvMastStockKey: (invMastUid: number | string) => readonly ["invMastStock", string | number];
|
|
303
|
+
declare const getInvMastStockOptions: (api: AugurApiClient, invMastUid: number | string) => {
|
|
304
|
+
staleTime: number;
|
|
305
|
+
gcTime: number;
|
|
306
|
+
queryKey: readonly ["invMastStock", string | number];
|
|
307
|
+
queryFn: () => Promise<number>;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
type ProductCategoryResponse = {
|
|
311
|
+
itemCategoryDesc: string;
|
|
312
|
+
childrenTotal: number;
|
|
313
|
+
children: TProductCategory[];
|
|
314
|
+
categoryImage: string | null;
|
|
315
|
+
};
|
|
316
|
+
declare const getProductCategoryKey: (itemCategoryUid: number | string | null) => readonly ["productCategory", string | number | null];
|
|
317
|
+
declare const getProductCategoryOptions: (api: AugurApiClient, itemCategoryUid: number | string) => {
|
|
318
|
+
staleTime: number;
|
|
319
|
+
gcTime: number;
|
|
320
|
+
queryKey: readonly ["productCategory", string | number | null];
|
|
321
|
+
queryFn: () => Promise<ProductCategoryResponse>;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
declare const getItemDetailsKey: (itemId: number | string) => readonly ["itemDetails", string | number];
|
|
325
|
+
declare const getItemDetailsOptions: (api: AugurApiClient, itemId: number | string) => {
|
|
326
|
+
staleTime: number;
|
|
327
|
+
gcTime: number;
|
|
328
|
+
queryKey: readonly ["itemDetails", string | number];
|
|
329
|
+
queryFn: () => Promise<TItemDetails>;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
declare const getItemAttributesKey: (itemCategoryUid: number | string | null) => readonly ["itemAttributes", string | number | null];
|
|
333
|
+
declare const getItemAttributesOptions: (api: AugurApiClient, itemCategoryUid: number | string) => {
|
|
334
|
+
staleTime: number;
|
|
335
|
+
gcTime: number;
|
|
336
|
+
queryKey: readonly ["itemAttributes", string | number | null];
|
|
337
|
+
queryFn: () => Promise<any>;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
type ProductSearchResponse = {
|
|
341
|
+
items: TProductItem[];
|
|
342
|
+
totalResults: number;
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Generates a consistent query key for product search queries.
|
|
346
|
+
*/
|
|
347
|
+
declare const getProductSearchKey: (pageData: PageData) => readonly ["productSearch", string, number, number, string, number | undefined];
|
|
348
|
+
/**
|
|
349
|
+
* Query options for product search. Accepts the SDK instance so it works
|
|
350
|
+
* in both client (via provider) and server (via direct construction).
|
|
351
|
+
*/
|
|
352
|
+
declare const getProductSearchOptions: (api: AugurApiClient, pageData: PageData) => {
|
|
353
|
+
staleTime: number;
|
|
354
|
+
gcTime: number;
|
|
355
|
+
queryKey: readonly ["productSearch", string, number, number, string, number | undefined];
|
|
356
|
+
queryFn: () => Promise<ProductSearchResponse>;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
declare const SEARCH_SUGGESTIONS_CACHE_OPTIONS: {
|
|
360
|
+
readonly staleTime: number;
|
|
361
|
+
readonly gcTime: number;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Generates a consistent query key for search suggestion queries.
|
|
365
|
+
*/
|
|
366
|
+
declare const getSearchSuggestionsKey: (query: string, limit: number, offset: number) => readonly ["searchSuggestions", string, number, number];
|
|
367
|
+
/**
|
|
368
|
+
* Query options for search suggestions. Accepts the SDK instance so it works
|
|
369
|
+
* in both client (via provider) and server (via direct construction).
|
|
370
|
+
*/
|
|
371
|
+
declare const getSearchSuggestionsOptions: (api: AugurApiClient, query: string, limit?: number, offset?: number) => {
|
|
372
|
+
staleTime: number;
|
|
373
|
+
gcTime: number;
|
|
374
|
+
queryKey: readonly ["searchSuggestions", string, number, number];
|
|
375
|
+
queryFn: () => Promise<SearchSuggestionsResponse>;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Get cart pricing query options for prefetching or parent components.
|
|
380
|
+
*/
|
|
381
|
+
declare function getCartPricingQueryOptions(api: AugurApiClient, cartLines: Array<{
|
|
382
|
+
itemId: string;
|
|
383
|
+
quantity: number;
|
|
384
|
+
}>, customerId: string | number | undefined): {
|
|
385
|
+
enabled: boolean;
|
|
386
|
+
refetchOnReconnect: true;
|
|
387
|
+
refetchOnWindowFocus: false;
|
|
388
|
+
meta: {
|
|
389
|
+
readonly persist: true;
|
|
390
|
+
};
|
|
391
|
+
staleTime: number;
|
|
392
|
+
gcTime: number;
|
|
393
|
+
queryKey: readonly ["price", string, string | number | undefined, number];
|
|
394
|
+
queryFn: () => Promise<_simpleapps_com_augur_utils.TPriceData>;
|
|
395
|
+
}[];
|
|
396
|
+
|
|
397
|
+
declare const getCategoryItemsInfiniteKey: (itemCategoryUid: number, itemsFilters: TItemsFilters) => readonly ["categoryItemsInfinite", number, string];
|
|
398
|
+
/**
|
|
399
|
+
* Full infinite query options for category items.
|
|
400
|
+
* Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.
|
|
401
|
+
*/
|
|
402
|
+
declare const getCategoryItemsInfiniteOptions: (api: AugurApiClient, itemCategoryUid: number, itemsFilters: TItemsFilters) => {
|
|
403
|
+
staleTime: number;
|
|
404
|
+
gcTime: number;
|
|
405
|
+
queryKey: readonly ["categoryItemsInfinite", number, string];
|
|
406
|
+
queryFn: ({ pageParam, }: {
|
|
407
|
+
pageParam?: unknown;
|
|
408
|
+
}) => Promise<InfiniteScrollPage>;
|
|
409
|
+
initialPageParam: number;
|
|
410
|
+
getNextPageParam: (lastPage: InfiniteScrollPage) => number | undefined;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
declare const getItemSearchInfiniteKey: (itemsFilters: TItemsFilters, itemCategoryUid?: number | string) => readonly ["itemSearchInfinite", string, string | number | undefined];
|
|
414
|
+
/**
|
|
415
|
+
* Full infinite query options for item search.
|
|
416
|
+
* Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.
|
|
417
|
+
*/
|
|
418
|
+
declare const getItemSearchInfiniteOptions: (api: AugurApiClient, itemsFilters: TItemsFilters, itemCategoryUid?: number | string) => {
|
|
419
|
+
meta: {
|
|
420
|
+
persist: boolean;
|
|
421
|
+
};
|
|
422
|
+
staleTime: number;
|
|
423
|
+
gcTime: number;
|
|
424
|
+
queryKey: readonly ["itemSearchInfinite", string, string | number | undefined];
|
|
425
|
+
queryFn: ({ pageParam, }: {
|
|
426
|
+
pageParam?: unknown;
|
|
427
|
+
}) => Promise<InfiniteScrollPage>;
|
|
428
|
+
initialPageParam: number;
|
|
429
|
+
getNextPageParam: (lastPage: InfiniteScrollPage) => number | undefined;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
export { type AugurApiClient as A, getItemSearchInfiniteOptions as B, CATEGORY_CACHE_OPTIONS as C, getProductCategoryKey as D, getProductCategoryOptions as E, getProductSearchKey as F, type GetItemCategoryApiOptions as G, getProductSearchOptions as H, type InfiniteScrollPage as I, getSearchSuggestionsKey as J, getSearchSuggestionsOptions as K, useAugurApi as L, useAugurAuth as M, type PageData as P, type SearchSuggestionsResponse as S, type SearchSuggestion as a, type AugurAuthContext as b, type AugurCallbacks as c, AugurHooksProvider as d, INV_MAST_CACHE_OPTIONS as e, INV_MAST_DOC_CACHE_OPTIONS as f, PRICE_CACHE_OPTIONS as g, SEARCH_SUGGESTIONS_CACHE_OPTIONS as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getInvMastDocKey as l, getInvMastDocOptions as m, getInvMastKey as n, getInvMastOptions as o, getInvMastStockKey as p, getInvMastStockOptions as q, getItemAttributesKey as r, getItemAttributesOptions as s, getItemCategoryKey as t, getItemCategoryOptions as u, getItemDetailsKey as v, getItemDetailsOptions as w, getItemPriceKey as x, getItemPriceOptions as y, getItemSearchInfiniteKey as z };
|
package/dist/server.cjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var _chunkYSRBE3YIcjs = require('./chunk-YSRBE3YI.cjs');
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
exports.CATEGORY_CACHE_OPTIONS = _chunkYSRBE3YIcjs.CATEGORY_CACHE_OPTIONS; exports.INV_MAST_CACHE_OPTIONS = _chunkYSRBE3YIcjs.INV_MAST_CACHE_OPTIONS; exports.INV_MAST_DOC_CACHE_OPTIONS = _chunkYSRBE3YIcjs.INV_MAST_DOC_CACHE_OPTIONS; exports.PRICE_CACHE_OPTIONS = _chunkYSRBE3YIcjs.PRICE_CACHE_OPTIONS; exports.SEARCH_SUGGESTIONS_CACHE_OPTIONS = _chunkYSRBE3YIcjs.SEARCH_SUGGESTIONS_CACHE_OPTIONS; exports.getCartPricingQueryOptions = _chunkYSRBE3YIcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkYSRBE3YIcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkYSRBE3YIcjs.getCategoryItemsInfiniteOptions; exports.getInvMastDocKey = _chunkYSRBE3YIcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkYSRBE3YIcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkYSRBE3YIcjs.getInvMastKey; exports.getInvMastOptions = _chunkYSRBE3YIcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkYSRBE3YIcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkYSRBE3YIcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkYSRBE3YIcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkYSRBE3YIcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkYSRBE3YIcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkYSRBE3YIcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkYSRBE3YIcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkYSRBE3YIcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkYSRBE3YIcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkYSRBE3YIcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkYSRBE3YIcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkYSRBE3YIcjs.getItemSearchInfiniteOptions; exports.getProductCategoryKey = _chunkYSRBE3YIcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkYSRBE3YIcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkYSRBE3YIcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkYSRBE3YIcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkYSRBE3YIcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkYSRBE3YIcjs.getSearchSuggestionsOptions;
|
|
65
|
+
//# sourceMappingURL=server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/server.cjs"],"names":[],"mappings":"AAAA;AACE;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;AACF,wDAA6B;AAC7B;AACE;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;AACF,msEAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/server.cjs"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { A as AugurApiClient, b as AugurAuthContext, c as AugurCallbacks, C as CATEGORY_CACHE_OPTIONS, e as INV_MAST_CACHE_OPTIONS, f as INV_MAST_DOC_CACHE_OPTIONS, I as InfiniteScrollPage, g as PRICE_CACHE_OPTIONS, P as PageData, h as SEARCH_SUGGESTIONS_CACHE_OPTIONS, i as getCartPricingQueryOptions, j as getCategoryItemsInfiniteKey, k as getCategoryItemsInfiniteOptions, l as getInvMastDocKey, m as getInvMastDocOptions, n as getInvMastKey, o as getInvMastOptions, p as getInvMastStockKey, q as getInvMastStockOptions, r as getItemAttributesKey, s as getItemAttributesOptions, t as getItemCategoryKey, u as getItemCategoryOptions, v as getItemDetailsKey, w as getItemDetailsOptions, x as getItemPriceKey, y as getItemPriceOptions, z as getItemSearchInfiniteKey, B as getItemSearchInfiniteOptions, D as getProductCategoryKey, E as getProductCategoryOptions, F as getProductSearchKey, H as getProductSearchOptions, J as getSearchSuggestionsKey, K as getSearchSuggestionsOptions } from './server-CF43MUMf.cjs';
|
|
2
|
+
import '@simpleapps-com/augur-utils';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { A as AugurApiClient, b as AugurAuthContext, c as AugurCallbacks, C as CATEGORY_CACHE_OPTIONS, e as INV_MAST_CACHE_OPTIONS, f as INV_MAST_DOC_CACHE_OPTIONS, I as InfiniteScrollPage, g as PRICE_CACHE_OPTIONS, P as PageData, h as SEARCH_SUGGESTIONS_CACHE_OPTIONS, i as getCartPricingQueryOptions, j as getCategoryItemsInfiniteKey, k as getCategoryItemsInfiniteOptions, l as getInvMastDocKey, m as getInvMastDocOptions, n as getInvMastKey, o as getInvMastOptions, p as getInvMastStockKey, q as getInvMastStockOptions, r as getItemAttributesKey, s as getItemAttributesOptions, t as getItemCategoryKey, u as getItemCategoryOptions, v as getItemDetailsKey, w as getItemDetailsOptions, x as getItemPriceKey, y as getItemPriceOptions, z as getItemSearchInfiniteKey, B as getItemSearchInfiniteOptions, D as getProductCategoryKey, E as getProductCategoryOptions, F as getProductSearchKey, H as getProductSearchOptions, J as getSearchSuggestionsKey, K as getSearchSuggestionsOptions } from './server-CF43MUMf.js';
|
|
2
|
+
import '@simpleapps-com/augur-utils';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CATEGORY_CACHE_OPTIONS,
|
|
3
|
+
INV_MAST_CACHE_OPTIONS,
|
|
4
|
+
INV_MAST_DOC_CACHE_OPTIONS,
|
|
5
|
+
PRICE_CACHE_OPTIONS,
|
|
6
|
+
SEARCH_SUGGESTIONS_CACHE_OPTIONS,
|
|
7
|
+
getCartPricingQueryOptions,
|
|
8
|
+
getCategoryItemsInfiniteKey,
|
|
9
|
+
getCategoryItemsInfiniteOptions,
|
|
10
|
+
getInvMastDocKey,
|
|
11
|
+
getInvMastDocOptions,
|
|
12
|
+
getInvMastKey,
|
|
13
|
+
getInvMastOptions,
|
|
14
|
+
getInvMastStockKey,
|
|
15
|
+
getInvMastStockOptions,
|
|
16
|
+
getItemAttributesKey,
|
|
17
|
+
getItemAttributesOptions,
|
|
18
|
+
getItemCategoryKey,
|
|
19
|
+
getItemCategoryOptions,
|
|
20
|
+
getItemDetailsKey,
|
|
21
|
+
getItemDetailsOptions,
|
|
22
|
+
getItemPriceKey,
|
|
23
|
+
getItemPriceOptions,
|
|
24
|
+
getItemSearchInfiniteKey,
|
|
25
|
+
getItemSearchInfiniteOptions,
|
|
26
|
+
getProductCategoryKey,
|
|
27
|
+
getProductCategoryOptions,
|
|
28
|
+
getProductSearchKey,
|
|
29
|
+
getProductSearchOptions,
|
|
30
|
+
getSearchSuggestionsKey,
|
|
31
|
+
getSearchSuggestionsOptions
|
|
32
|
+
} from "./chunk-DS2ECDHJ.js";
|
|
33
|
+
export {
|
|
34
|
+
CATEGORY_CACHE_OPTIONS,
|
|
35
|
+
INV_MAST_CACHE_OPTIONS,
|
|
36
|
+
INV_MAST_DOC_CACHE_OPTIONS,
|
|
37
|
+
PRICE_CACHE_OPTIONS,
|
|
38
|
+
SEARCH_SUGGESTIONS_CACHE_OPTIONS,
|
|
39
|
+
getCartPricingQueryOptions,
|
|
40
|
+
getCategoryItemsInfiniteKey,
|
|
41
|
+
getCategoryItemsInfiniteOptions,
|
|
42
|
+
getInvMastDocKey,
|
|
43
|
+
getInvMastDocOptions,
|
|
44
|
+
getInvMastKey,
|
|
45
|
+
getInvMastOptions,
|
|
46
|
+
getInvMastStockKey,
|
|
47
|
+
getInvMastStockOptions,
|
|
48
|
+
getItemAttributesKey,
|
|
49
|
+
getItemAttributesOptions,
|
|
50
|
+
getItemCategoryKey,
|
|
51
|
+
getItemCategoryOptions,
|
|
52
|
+
getItemDetailsKey,
|
|
53
|
+
getItemDetailsOptions,
|
|
54
|
+
getItemPriceKey,
|
|
55
|
+
getItemPriceOptions,
|
|
56
|
+
getItemSearchInfiniteKey,
|
|
57
|
+
getItemSearchInfiniteOptions,
|
|
58
|
+
getProductCategoryKey,
|
|
59
|
+
getProductCategoryOptions,
|
|
60
|
+
getProductSearchKey,
|
|
61
|
+
getProductSearchOptions,
|
|
62
|
+
getSearchSuggestionsKey,
|
|
63
|
+
getSearchSuggestionsOptions
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-hooks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
16
|
"require": "./dist/index.cjs"
|
|
17
17
|
},
|
|
18
|
+
"./server": {
|
|
19
|
+
"types": "./dist/server.d.ts",
|
|
20
|
+
"import": "./dist/server.js",
|
|
21
|
+
"require": "./dist/server.cjs"
|
|
22
|
+
},
|
|
18
23
|
"./web": {
|
|
19
24
|
"types": "./dist/web.d.ts",
|
|
20
25
|
"import": "./dist/web.js",
|
|
@@ -26,7 +31,7 @@
|
|
|
26
31
|
"dist"
|
|
27
32
|
],
|
|
28
33
|
"dependencies": {
|
|
29
|
-
"@simpleapps-com/augur-utils": "0.1.
|
|
34
|
+
"@simpleapps-com/augur-utils": "0.1.6"
|
|
30
35
|
},
|
|
31
36
|
"peerDependencies": {
|
|
32
37
|
"@simpleapps-com/augur-api": "^0.9.6",
|