@simpleapps-com/augur-hooks 0.5.1 → 1.0.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/dist/{chunk-PZK7QARW.js → chunk-6DSOHS3R.js} +2 -14
- package/dist/chunk-6DSOHS3R.js.map +1 -0
- package/dist/{chunk-FKM6A6QW.cjs → chunk-6MD7RJZ2.cjs} +7 -19
- package/dist/chunk-6MD7RJZ2.cjs.map +1 -0
- package/dist/{customer-quotes-DjCgi3z3.d.cts → customer-quotes-ji9iHUmo.d.cts} +34 -78
- package/dist/{customer-quotes-DjCgi3z3.d.ts → customer-quotes-ji9iHUmo.d.ts} +34 -78
- package/dist/index.cjs +56 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +30 -12
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +8 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +19 -8
- package/dist/server.d.ts +19 -8
- package/dist/server.js +7 -1
- package/dist/server.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-FKM6A6QW.cjs.map +0 -1
- package/dist/chunk-PZK7QARW.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as _simpleapps_com_augur_utils from '@simpleapps-com/augur-utils';
|
|
2
|
-
import { TPriceData, TItemDetails, TInvMastDoc, TCategory, TAttribute, TItemsFilters,
|
|
2
|
+
import { TPriceData, TItemDetails, TInvMastDoc, TCategory, TAttribute, TItemsFilters, TJoomlaContent, TJoomlaContentFilters, TMenuFilters, MenuItem, TProductCategory, TProductItem } from '@simpleapps-com/augur-utils';
|
|
3
|
+
import { InfiniteScrollPage, AugurAuthContext, CacheConfig } from '@simpleapps-com/augur-core';
|
|
3
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* Hook-specific types that don't belong in augur-utils.
|
|
9
|
+
* Hook-specific types that don't belong in augur-utils or augur-core.
|
|
9
10
|
* These describe hook parameters and API response shapes.
|
|
10
11
|
*/
|
|
12
|
+
|
|
11
13
|
/** Parameters for product search queries. */
|
|
12
14
|
type PageData = {
|
|
13
15
|
categoryIdList?: string;
|
|
@@ -45,32 +47,6 @@ type SearchSuggestionsResponse = {
|
|
|
45
47
|
total: number;
|
|
46
48
|
totalResults: number;
|
|
47
49
|
};
|
|
48
|
-
/** Cache provider for Redis-compatible storage. */
|
|
49
|
-
interface CacheProvider {
|
|
50
|
-
prefix: string;
|
|
51
|
-
get: (key: string) => Promise<string | null>;
|
|
52
|
-
set: (key: string, value: string, ttlSeconds: number) => Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
/** Cache settings for a single tier. */
|
|
55
|
-
interface CacheTierConfig {
|
|
56
|
-
/** CDN edge cache. Passed directly to SDK as edgeCache. Valid values: 1–8 (hours) or '30s', '1m', '5m'. */
|
|
57
|
-
edgeCache?: number | string;
|
|
58
|
-
/** Redis cache TTL in seconds. Requires provider. */
|
|
59
|
-
redis?: number;
|
|
60
|
-
/** React Query staleTime in ms. Overrides the built-in default. */
|
|
61
|
-
staleTime?: number;
|
|
62
|
-
/** React Query gcTime (garbage collection) in ms. Overrides the built-in default. */
|
|
63
|
-
gcTime?: number;
|
|
64
|
-
}
|
|
65
|
-
/** Cache configuration. All fields optional, all off by default. */
|
|
66
|
-
interface CacheConfig {
|
|
67
|
-
/** Redis-compatible cache. Required for redis caching. */
|
|
68
|
-
provider?: CacheProvider;
|
|
69
|
-
/** TTLs for long-lived data (categories, item details, docs). */
|
|
70
|
-
static?: CacheTierConfig;
|
|
71
|
-
/** TTLs for frequently-changing data (prices, stock, search). */
|
|
72
|
-
semiStatic?: CacheTierConfig;
|
|
73
|
-
}
|
|
74
50
|
/** Configuration for React Query localStorage persistence. */
|
|
75
51
|
interface PersistenceConfig {
|
|
76
52
|
/** localStorage key for the persisted cache. */
|
|
@@ -109,41 +85,6 @@ interface GetItemCategoryApiOptions {
|
|
|
109
85
|
* eliminating per-hook wrappers for CORS/server action routing.
|
|
110
86
|
*/
|
|
111
87
|
|
|
112
|
-
/**
|
|
113
|
-
* Auth context provided at the provider level.
|
|
114
|
-
* Auth-provider-agnostic — works with NextAuth, Clerk, Supabase Auth, etc.
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```tsx
|
|
118
|
-
* const { data: session, status } = useSession();
|
|
119
|
-
*
|
|
120
|
-
* <AugurHooksProvider
|
|
121
|
-
* api={api}
|
|
122
|
-
* auth={{
|
|
123
|
-
* status,
|
|
124
|
-
* customerId: session?.user?.customerId ?? process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
|
|
125
|
-
* userId: session?.user?.id,
|
|
126
|
-
* cartHdrUid: session?.user?.cartHdrUid,
|
|
127
|
-
* }}
|
|
128
|
-
* >
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
interface AugurAuthContext {
|
|
132
|
-
/** Auth loading state — hooks disable queries while "loading". */
|
|
133
|
-
status: "loading" | "authenticated" | "unauthenticated";
|
|
134
|
-
/** Customer ID for pricing. Falls back to env default if undefined. */
|
|
135
|
-
customerId?: string | number;
|
|
136
|
-
/** User ID for cart ownership. */
|
|
137
|
-
userId?: string | number;
|
|
138
|
-
/** Cart header UID from session (if available). */
|
|
139
|
-
cartHdrUid?: string | number;
|
|
140
|
-
}
|
|
141
|
-
/** Paginated response for infinite scroll hooks. */
|
|
142
|
-
interface InfiniteScrollPage {
|
|
143
|
-
data: TProductItem[];
|
|
144
|
-
total: number;
|
|
145
|
-
nextCursor?: number;
|
|
146
|
-
}
|
|
147
88
|
/**
|
|
148
89
|
* Provider-level callback map. Register server actions here to override
|
|
149
90
|
* the default SDK calls in all hooks. Hook-level `queryFn` takes priority
|
|
@@ -247,9 +188,9 @@ interface AugurCallbacks {
|
|
|
247
188
|
*/
|
|
248
189
|
type AugurApiClient = any;
|
|
249
190
|
interface AugurHooksProviderProps {
|
|
250
|
-
/** SDK client instance.
|
|
191
|
+
/** SDK client instance. Required for the proxy-based `useAugurOptions()`. */
|
|
251
192
|
api?: AugurApiClient;
|
|
252
|
-
/** Optional callback registry for routing SDK calls through server actions. */
|
|
193
|
+
/** Optional callback registry for routing SDK calls through server actions (legacy). */
|
|
253
194
|
callbacks?: AugurCallbacks;
|
|
254
195
|
/** Optional auth context — hooks fall back to these values when not passed directly. */
|
|
255
196
|
auth?: AugurAuthContext;
|
|
@@ -258,26 +199,41 @@ interface AugurHooksProviderProps {
|
|
|
258
199
|
children: ReactNode;
|
|
259
200
|
}
|
|
260
201
|
/**
|
|
261
|
-
* Provides the augur-api SDK instance and optional callbacks to all hooks.
|
|
202
|
+
* Provides the augur-api SDK instance, proxy options, and optional callbacks to all hooks.
|
|
262
203
|
*
|
|
263
204
|
* ```tsx
|
|
264
|
-
*
|
|
265
|
-
* <AugurHooksProvider api={api}>
|
|
205
|
+
* <AugurHooksProvider api={api} auth={authContext} cache={cacheConfig}>
|
|
266
206
|
* <App />
|
|
267
207
|
* </AugurHooksProvider>
|
|
208
|
+
* ```
|
|
268
209
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* }}
|
|
274
|
-
* auth={{ status, customerId, userId, cartHdrUid }}
|
|
275
|
-
* >
|
|
276
|
-
* <App />
|
|
277
|
-
* </AugurHooksProvider>
|
|
210
|
+
* Components use `useAugurOptions()` to get the proxy:
|
|
211
|
+
* ```tsx
|
|
212
|
+
* const q = useAugurOptions();
|
|
213
|
+
* const { data } = useQuery(q.items.invMast.get(42));
|
|
278
214
|
* ```
|
|
279
215
|
*/
|
|
280
216
|
declare function AugurHooksProvider({ api, callbacks, auth, cache, children, }: AugurHooksProviderProps): react_jsx_runtime.JSX.Element;
|
|
217
|
+
/**
|
|
218
|
+
* Returns the deep proxy for creating TanStack Query options.
|
|
219
|
+
*
|
|
220
|
+
* Every SDK method is available as a path:
|
|
221
|
+
* ```tsx
|
|
222
|
+
* const q = useAugurOptions();
|
|
223
|
+
* const { data } = useQuery(q.items.invMast.get(42));
|
|
224
|
+
* const { data: stock } = useQuery(q.items.invMast.stock.get(42));
|
|
225
|
+
* const addToCart = useMutation(q.commerce.cartLine.add.create());
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* Override queryFn at the call site:
|
|
229
|
+
* ```tsx
|
|
230
|
+
* const { data } = useQuery({
|
|
231
|
+
* ...q.pricing.priceEngine.get({ itemId, customerId }),
|
|
232
|
+
* queryFn: () => getItemPriceAction(itemId, customerId),
|
|
233
|
+
* });
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
declare function useAugurOptions<T = unknown>(): T;
|
|
281
237
|
/**
|
|
282
238
|
* Returns the augur-api SDK instance from context, or null if not provided.
|
|
283
239
|
* Used internally by hooks that check for callback overrides first.
|
|
@@ -578,4 +534,4 @@ declare const getCustomerInvoiceDetailKey: (customerId: number | string | undefi
|
|
|
578
534
|
declare const getCustomerQuotesKey: (customerId: number | string | undefined, params?: Record<string, unknown>) => readonly ["customerQuotes", string | number | undefined, Record<string, unknown> | undefined];
|
|
579
535
|
declare const getCustomerQuoteDetailKey: (customerId: number | string | undefined, quoteNo: number | string | undefined) => readonly ["customerQuoteDetail", string | number | undefined, string | number | undefined];
|
|
580
536
|
|
|
581
|
-
export {
|
|
537
|
+
export { useAugurApiOptional as $, type AugurCallbacks as A, type BatchInvMastDocParam as B, getItemCategoryOptions as C, getItemDetailsKey as D, getItemDetailsOptions as E, getItemPriceKey as F, type GetItemCategoryApiOptions as G, getItemPriceOptions as H, getItemSearchInfiniteKey as I, getItemSearchInfiniteOptions as J, getJoomlaContentKey as K, getJoomlaContentListKey as L, getJoomlaContentListOptions as M, getJoomlaContentOptions as N, getJoomlaMenuDocKey as O, type PageData as P, getJoomlaMenuDocOptions as Q, getJoomlaMenuKey as R, type SearchSuggestionsResponse as S, getJoomlaMenuOptions as T, getProductCategoryKey as U, getProductCategoryOptions as V, getProductSearchKey as W, getProductSearchOptions as X, getSearchSuggestionsKey as Y, getSearchSuggestionsOptions as Z, useAugurApi as _, type SearchSuggestion as a, useAugurAuth as a0, useAugurCache as a1, useAugurOptions as a2, type AugurApiClient as b, type PersistenceConfig as c, AugurHooksProvider as d, type BatchQueryConfig as e, executeBatchQuery as f, getBatchInvMastDocKey as g, getBatchInvMastDocOptions as h, getCartPricingQueryOptions as i, getCategoryItemsInfiniteKey as j, getCategoryItemsInfiniteOptions as k, getCustomerInvoiceDetailKey as l, getCustomerInvoicesKey as m, getCustomerOrderDetailKey as n, getCustomerOrdersKey as o, getCustomerQuoteDetailKey as p, getCustomerQuotesKey as q, getInvMastDocKey as r, getInvMastDocOptions as s, getInvMastKey as t, getInvMastOptions as u, getInvMastStockKey as v, getInvMastStockOptions as w, getItemAttributesKey as x, getItemAttributesOptions as y, getItemCategoryKey as z };
|
package/dist/index.cjs
CHANGED
|
@@ -41,13 +41,14 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunk6MD7RJZ2cjs = require('./chunk-6MD7RJZ2.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
var _chunkAXCNTEABcjs = require('./chunk-AXCNTEAB.cjs');
|
|
48
48
|
|
|
49
49
|
// src/provider.tsx
|
|
50
50
|
var _react = require('react');
|
|
51
|
+
var _augurcore = require('@simpleapps-com/augur-core');
|
|
51
52
|
var _jsxruntime = require('react/jsx-runtime');
|
|
52
53
|
var AugurApiContext = _react.createContext.call(void 0, null);
|
|
53
54
|
var AugurCallbacksContext = _react.createContext.call(void 0,
|
|
@@ -57,6 +58,7 @@ var AugurAuthReactContext = _react.createContext.call(void 0,
|
|
|
57
58
|
void 0
|
|
58
59
|
);
|
|
59
60
|
var AugurCacheContext = _react.createContext.call(void 0, void 0);
|
|
61
|
+
var AugurOptionsContext = _react.createContext.call(void 0, null);
|
|
60
62
|
function AugurHooksProvider({
|
|
61
63
|
api,
|
|
62
64
|
callbacks,
|
|
@@ -69,7 +71,22 @@ function AugurHooksProvider({
|
|
|
69
71
|
"AugurHooksProvider: neither `api` nor `callbacks` provided. Hooks will fail at runtime unless every hook receives a queryFn override."
|
|
70
72
|
);
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
const proxyConfig = cache ? { cache: { static: cache.static, semiStatic: cache.semiStatic } } : void 0;
|
|
75
|
+
const options = _react.useMemo.call(void 0,
|
|
76
|
+
() => api ? _augurcore.createOptionsProxy.call(void 0, api, proxyConfig) : null,
|
|
77
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
|
+
[api]
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurApiContext.Provider, { value: _nullishCoalesce(api, () => ( null)), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCallbacksContext.Provider, { value: callbacks, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurAuthReactContext.Provider, { value: auth, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurCacheContext.Provider, { value: cache, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AugurOptionsContext.Provider, { value: options, children }) }) }) }) });
|
|
81
|
+
}
|
|
82
|
+
function useAugurOptions() {
|
|
83
|
+
const options = _react.useContext.call(void 0, AugurOptionsContext);
|
|
84
|
+
if (!options) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
"useAugurOptions must be used within an <AugurHooksProvider> with an `api` prop. Wrap your app with <AugurHooksProvider api={apiInstance}>."
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return options;
|
|
73
90
|
}
|
|
74
91
|
function useAugurApiOptional() {
|
|
75
92
|
return _react.useContext.call(void 0, AugurApiContext);
|
|
@@ -189,7 +206,7 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
|
|
|
189
206
|
const auth = useAugurAuth();
|
|
190
207
|
const cache = useAugurCache();
|
|
191
208
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
|
|
192
|
-
const defaultOptions =
|
|
209
|
+
const defaultOptions = _chunk6MD7RJZ2cjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
|
|
193
210
|
const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
|
|
194
211
|
return _reactquery.useQuery.call(void 0, {
|
|
195
212
|
...defaultOptions,
|
|
@@ -205,7 +222,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
|
|
|
205
222
|
const api = useAugurApiOptional();
|
|
206
223
|
const callbacks = useAugurCallbacks();
|
|
207
224
|
const cache = useAugurCache();
|
|
208
|
-
const queryOpts =
|
|
225
|
+
const queryOpts = _chunk6MD7RJZ2cjs.getInvMastDocOptions.call(void 0,
|
|
209
226
|
api,
|
|
210
227
|
invMastUid,
|
|
211
228
|
itemId,
|
|
@@ -227,7 +244,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
|
|
|
227
244
|
const api = useAugurApiOptional();
|
|
228
245
|
const callbacks = useAugurCallbacks();
|
|
229
246
|
const cache = useAugurCache();
|
|
230
|
-
const queryOpts =
|
|
247
|
+
const queryOpts = _chunk6MD7RJZ2cjs.getItemCategoryOptions.call(void 0,
|
|
231
248
|
api,
|
|
232
249
|
itemCategoryUid,
|
|
233
250
|
options.apiOptions,
|
|
@@ -247,7 +264,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
|
|
|
247
264
|
const api = useAugurApiOptional();
|
|
248
265
|
const callbacks = useAugurCallbacks();
|
|
249
266
|
const cache = useAugurCache();
|
|
250
|
-
const queryOpts =
|
|
267
|
+
const queryOpts = _chunk6MD7RJZ2cjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
|
|
251
268
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
252
269
|
...queryOpts,
|
|
253
270
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
|
|
@@ -262,7 +279,7 @@ function useInvMastStock(invMastUid, options = {}) {
|
|
|
262
279
|
const api = useAugurApiOptional();
|
|
263
280
|
const callbacks = useAugurCallbacks();
|
|
264
281
|
const cache = useAugurCache();
|
|
265
|
-
const queryOpts =
|
|
282
|
+
const queryOpts = _chunk6MD7RJZ2cjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
|
|
266
283
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
267
284
|
...queryOpts,
|
|
268
285
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
|
|
@@ -287,7 +304,7 @@ function useBatchInvMastDoc(params, options = {}) {
|
|
|
287
304
|
const cache = useAugurCache();
|
|
288
305
|
const queryClient = _reactquery.useQueryClient.call(void 0, );
|
|
289
306
|
const includePricing = _nullishCoalesce(options.includePricing, () => ( "N"));
|
|
290
|
-
const batchOpts =
|
|
307
|
+
const batchOpts = _chunk6MD7RJZ2cjs.getBatchInvMastDocOptions.call(void 0, api, params, includePricing, cache);
|
|
291
308
|
const resolveFetchItems = (uncached) => {
|
|
292
309
|
if (options.queryFn) {
|
|
293
310
|
return options.queryFn(uncached, includePricing);
|
|
@@ -295,18 +312,18 @@ function useBatchInvMastDoc(params, options = {}) {
|
|
|
295
312
|
if (_optionalChain([callbacks, 'optionalAccess', _7 => _7.batchGetInvMastDocs])) {
|
|
296
313
|
return callbacks.batchGetInvMastDocs(uncached, includePricing);
|
|
297
314
|
}
|
|
298
|
-
const fallbackOpts =
|
|
315
|
+
const fallbackOpts = _chunk6MD7RJZ2cjs.getBatchInvMastDocOptions.call(void 0, api, uncached, includePricing, cache);
|
|
299
316
|
return fallbackOpts.queryFn();
|
|
300
317
|
};
|
|
301
318
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
302
319
|
queryKey: batchOpts.queryKey,
|
|
303
|
-
queryFn: () =>
|
|
320
|
+
queryFn: () => _chunk6MD7RJZ2cjs.executeBatchQuery.call(void 0, {
|
|
304
321
|
params,
|
|
305
322
|
queryClient,
|
|
306
|
-
getItemKey: (p) =>
|
|
323
|
+
getItemKey: (p) => _chunk6MD7RJZ2cjs.getInvMastDocKey.call(void 0, p.invMastUid, p.itemId, includePricing),
|
|
307
324
|
getResultKey: (p) => p.itemId.toUpperCase(),
|
|
308
325
|
fetchItems: resolveFetchItems,
|
|
309
|
-
getSeedKey: (_key, doc) =>
|
|
326
|
+
getSeedKey: (_key, doc) => _chunk6MD7RJZ2cjs.getInvMastDocKey.call(void 0, doc.invMastUid, doc.itemId, includePricing)
|
|
310
327
|
}),
|
|
311
328
|
staleTime: batchOpts.staleTime,
|
|
312
329
|
gcTime: batchOpts.gcTime,
|
|
@@ -329,8 +346,8 @@ function useProductCategory(itemCategoryUid, options = {}) {
|
|
|
329
346
|
const api = useAugurApiOptional();
|
|
330
347
|
const callbacks = useAugurCallbacks();
|
|
331
348
|
const cache = useAugurCache();
|
|
332
|
-
const baseOptions = itemCategoryUid ?
|
|
333
|
-
queryKey:
|
|
349
|
+
const baseOptions = itemCategoryUid ? _chunk6MD7RJZ2cjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
350
|
+
queryKey: _chunk6MD7RJZ2cjs.getProductCategoryKey.call(void 0, null),
|
|
334
351
|
/* v8 ignore next */
|
|
335
352
|
queryFn: () => Promise.reject()
|
|
336
353
|
};
|
|
@@ -358,8 +375,8 @@ function useItemDetails(itemId, options = {}) {
|
|
|
358
375
|
const callbacks = useAugurCallbacks();
|
|
359
376
|
const cache = useAugurCache();
|
|
360
377
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
361
|
-
...itemId ?
|
|
362
|
-
queryKey:
|
|
378
|
+
...itemId ? _chunk6MD7RJZ2cjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
|
|
379
|
+
queryKey: _chunk6MD7RJZ2cjs.getItemDetailsKey.call(void 0, ""),
|
|
363
380
|
/* v8 ignore next */
|
|
364
381
|
queryFn: () => Promise.reject()
|
|
365
382
|
},
|
|
@@ -386,8 +403,8 @@ function useItemAttributes(itemCategoryUid, options = {}) {
|
|
|
386
403
|
const callbacks = useAugurCallbacks();
|
|
387
404
|
const cache = useAugurCache();
|
|
388
405
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
389
|
-
...itemCategoryUid ?
|
|
390
|
-
queryKey:
|
|
406
|
+
...itemCategoryUid ? _chunk6MD7RJZ2cjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
|
|
407
|
+
queryKey: _chunk6MD7RJZ2cjs.getItemAttributesKey.call(void 0, null),
|
|
391
408
|
/* v8 ignore next */
|
|
392
409
|
queryFn: () => Promise.reject()
|
|
393
410
|
},
|
|
@@ -411,7 +428,7 @@ function useProductSearch(pageData, options = {}) {
|
|
|
411
428
|
const api = useAugurApiOptional();
|
|
412
429
|
const callbacks = useAugurCallbacks();
|
|
413
430
|
const cache = useAugurCache();
|
|
414
|
-
const defaultOptions =
|
|
431
|
+
const defaultOptions = _chunk6MD7RJZ2cjs.getProductSearchOptions.call(void 0, api, pageData, cache);
|
|
415
432
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
416
433
|
...defaultOptions,
|
|
417
434
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _17 => _17.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
|
|
@@ -437,7 +454,7 @@ function useSearchSuggestions(query, options = {}) {
|
|
|
437
454
|
const limit = _nullishCoalesce(options.limit, () => ( 10));
|
|
438
455
|
const offset = _nullishCoalesce(options.offset, () => ( 0));
|
|
439
456
|
const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
|
|
440
|
-
const defaultOptions =
|
|
457
|
+
const defaultOptions = _chunk6MD7RJZ2cjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
|
|
441
458
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
442
459
|
...defaultOptions,
|
|
443
460
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _20 => _20.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
|
|
@@ -748,12 +765,12 @@ function useCartPricing(options = {}) {
|
|
|
748
765
|
const priceQueries = _reactquery.useQueries.call(void 0, {
|
|
749
766
|
queries: cartLines.map((line) => {
|
|
750
767
|
const base = priceFn ? {
|
|
751
|
-
queryKey:
|
|
768
|
+
queryKey: _chunk6MD7RJZ2cjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
|
|
752
769
|
queryFn: () => priceFn(line.itemId, customerId, line.quantity),
|
|
753
770
|
refetchOnReconnect: true,
|
|
754
771
|
refetchOnWindowFocus: false,
|
|
755
772
|
meta: { persist: true }
|
|
756
|
-
} :
|
|
773
|
+
} : _chunk6MD7RJZ2cjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
|
|
757
774
|
return {
|
|
758
775
|
...base,
|
|
759
776
|
enabled: !!customerId && !!line.itemId
|
|
@@ -853,7 +870,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
|
|
|
853
870
|
const callbacks = useAugurCallbacks();
|
|
854
871
|
const cache = useAugurCache();
|
|
855
872
|
const { enabled = true } = options;
|
|
856
|
-
const defaultOptions =
|
|
873
|
+
const defaultOptions = _chunk6MD7RJZ2cjs.getCategoryItemsInfiniteOptions.call(void 0,
|
|
857
874
|
api,
|
|
858
875
|
itemCategoryUid,
|
|
859
876
|
itemsFilters,
|
|
@@ -880,7 +897,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
|
|
|
880
897
|
const callbacks = useAugurCallbacks();
|
|
881
898
|
const cache = useAugurCache();
|
|
882
899
|
const { enabled = true } = options;
|
|
883
|
-
const defaultOptions =
|
|
900
|
+
const defaultOptions = _chunk6MD7RJZ2cjs.getItemSearchInfiniteOptions.call(void 0,
|
|
884
901
|
api,
|
|
885
902
|
itemsFilters,
|
|
886
903
|
itemCategoryUid,
|
|
@@ -907,8 +924,8 @@ function useJoomlaContent(articleId, options = {}) {
|
|
|
907
924
|
const callbacks = useAugurCallbacks();
|
|
908
925
|
const cache = useAugurCache();
|
|
909
926
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
910
|
-
...articleId ?
|
|
911
|
-
queryKey:
|
|
927
|
+
...articleId ? _chunk6MD7RJZ2cjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
|
|
928
|
+
queryKey: _chunk6MD7RJZ2cjs.getJoomlaContentKey.call(void 0, ""),
|
|
912
929
|
/* v8 ignore next */
|
|
913
930
|
queryFn: () => Promise.reject()
|
|
914
931
|
},
|
|
@@ -929,8 +946,8 @@ function useJoomlaContentList(categoryId, options = {}) {
|
|
|
929
946
|
const callbacks = useAugurCallbacks();
|
|
930
947
|
const cache = useAugurCache();
|
|
931
948
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
932
|
-
...categoryId ?
|
|
933
|
-
queryKey:
|
|
949
|
+
...categoryId ? _chunk6MD7RJZ2cjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
|
|
950
|
+
queryKey: _chunk6MD7RJZ2cjs.getJoomlaContentListKey.call(void 0, ""),
|
|
934
951
|
/* v8 ignore next */
|
|
935
952
|
queryFn: () => Promise.reject()
|
|
936
953
|
},
|
|
@@ -953,7 +970,7 @@ function useJoomlaMenu(options = {}) {
|
|
|
953
970
|
const callbacks = useAugurCallbacks();
|
|
954
971
|
const cache = useAugurCache();
|
|
955
972
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
956
|
-
...
|
|
973
|
+
..._chunk6MD7RJZ2cjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
|
|
957
974
|
..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getJoomlaMenu]))) ? {
|
|
958
975
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
|
|
959
976
|
} : {},
|
|
@@ -973,8 +990,8 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
973
990
|
const callbacks = useAugurCallbacks();
|
|
974
991
|
const cache = useAugurCache();
|
|
975
992
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
976
|
-
...menuId ?
|
|
977
|
-
queryKey:
|
|
993
|
+
...menuId ? _chunk6MD7RJZ2cjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
|
|
994
|
+
queryKey: _chunk6MD7RJZ2cjs.getJoomlaMenuDocKey.call(void 0, ""),
|
|
978
995
|
/* v8 ignore next */
|
|
979
996
|
queryFn: () => Promise.reject()
|
|
980
997
|
},
|
|
@@ -995,7 +1012,7 @@ function useCustomerOrders(customerId, params, options = {}) {
|
|
|
995
1012
|
const auth = useAugurAuth();
|
|
996
1013
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _58 => _58.customerId])));
|
|
997
1014
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
998
|
-
queryKey:
|
|
1015
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerOrdersKey.call(void 0, effectiveCustomerId, params),
|
|
999
1016
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrders(effectiveCustomerId, params)))),
|
|
1000
1017
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _59 => _59.getCustomerOrders]))))
|
|
1001
1018
|
});
|
|
@@ -1011,7 +1028,7 @@ function useOrderDetail(customerId, orderId, options = {}) {
|
|
|
1011
1028
|
const auth = useAugurAuth();
|
|
1012
1029
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _62 => _62.customerId])));
|
|
1013
1030
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1014
|
-
queryKey:
|
|
1031
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerOrderDetailKey.call(void 0, effectiveCustomerId, orderId),
|
|
1015
1032
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)))),
|
|
1016
1033
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!orderId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _63 => _63.getCustomerOrderDetail]))))
|
|
1017
1034
|
});
|
|
@@ -1029,7 +1046,7 @@ function useCustomerInvoices(customerId, params, options = {}) {
|
|
|
1029
1046
|
const auth = useAugurAuth();
|
|
1030
1047
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _64 => _64.customerId])));
|
|
1031
1048
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1032
|
-
queryKey:
|
|
1049
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerInvoicesKey.call(void 0, effectiveCustomerId, params),
|
|
1033
1050
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)))),
|
|
1034
1051
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _65 => _65.getCustomerInvoices]))))
|
|
1035
1052
|
});
|
|
@@ -1045,7 +1062,7 @@ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
|
1045
1062
|
const auth = useAugurAuth();
|
|
1046
1063
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _68 => _68.customerId])));
|
|
1047
1064
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1048
|
-
queryKey:
|
|
1065
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerInvoiceDetailKey.call(void 0, effectiveCustomerId, invoiceNo),
|
|
1049
1066
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerInvoiceDetail(
|
|
1050
1067
|
effectiveCustomerId,
|
|
1051
1068
|
invoiceNo
|
|
@@ -1066,7 +1083,7 @@ function useCustomerQuotes(customerId, params, options = {}) {
|
|
|
1066
1083
|
const auth = useAugurAuth();
|
|
1067
1084
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _70 => _70.customerId])));
|
|
1068
1085
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1069
|
-
queryKey:
|
|
1086
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerQuotesKey.call(void 0, effectiveCustomerId, params),
|
|
1070
1087
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)))),
|
|
1071
1088
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _71 => _71.getCustomerQuotes]))))
|
|
1072
1089
|
});
|
|
@@ -1082,7 +1099,7 @@ function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
|
1082
1099
|
const auth = useAugurAuth();
|
|
1083
1100
|
const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _74 => _74.customerId])));
|
|
1084
1101
|
const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
|
|
1085
|
-
queryKey:
|
|
1102
|
+
queryKey: _chunk6MD7RJZ2cjs.getCustomerQuoteDetailKey.call(void 0, effectiveCustomerId, quoteNo),
|
|
1086
1103
|
queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)))),
|
|
1087
1104
|
enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!effectiveCustomerId && !!quoteNo && !!(_nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _75 => _75.getCustomerQuoteDetail]))))
|
|
1088
1105
|
});
|
|
@@ -1414,5 +1431,6 @@ function useAugurPersistence(config) {
|
|
|
1414
1431
|
|
|
1415
1432
|
|
|
1416
1433
|
|
|
1417
|
-
|
|
1434
|
+
|
|
1435
|
+
exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.executeBatchQuery = _chunk6MD7RJZ2cjs.executeBatchQuery; exports.getBatchInvMastDocKey = _chunk6MD7RJZ2cjs.getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = _chunk6MD7RJZ2cjs.getBatchInvMastDocOptions; exports.getCartPricingQueryOptions = _chunk6MD7RJZ2cjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunk6MD7RJZ2cjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunk6MD7RJZ2cjs.getCategoryItemsInfiniteOptions; exports.getCustomerInvoiceDetailKey = _chunk6MD7RJZ2cjs.getCustomerInvoiceDetailKey; exports.getCustomerInvoicesKey = _chunk6MD7RJZ2cjs.getCustomerInvoicesKey; exports.getCustomerOrderDetailKey = _chunk6MD7RJZ2cjs.getCustomerOrderDetailKey; exports.getCustomerOrdersKey = _chunk6MD7RJZ2cjs.getCustomerOrdersKey; exports.getCustomerQuoteDetailKey = _chunk6MD7RJZ2cjs.getCustomerQuoteDetailKey; exports.getCustomerQuotesKey = _chunk6MD7RJZ2cjs.getCustomerQuotesKey; exports.getInvMastDocKey = _chunk6MD7RJZ2cjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunk6MD7RJZ2cjs.getInvMastDocOptions; exports.getInvMastKey = _chunk6MD7RJZ2cjs.getInvMastKey; exports.getInvMastOptions = _chunk6MD7RJZ2cjs.getInvMastOptions; exports.getInvMastStockKey = _chunk6MD7RJZ2cjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunk6MD7RJZ2cjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunk6MD7RJZ2cjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunk6MD7RJZ2cjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunk6MD7RJZ2cjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunk6MD7RJZ2cjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunk6MD7RJZ2cjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunk6MD7RJZ2cjs.getItemDetailsOptions; exports.getItemPriceKey = _chunk6MD7RJZ2cjs.getItemPriceKey; exports.getItemPriceOptions = _chunk6MD7RJZ2cjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunk6MD7RJZ2cjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunk6MD7RJZ2cjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunk6MD7RJZ2cjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunk6MD7RJZ2cjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunk6MD7RJZ2cjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunk6MD7RJZ2cjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunk6MD7RJZ2cjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunk6MD7RJZ2cjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunk6MD7RJZ2cjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunk6MD7RJZ2cjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunk6MD7RJZ2cjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunk6MD7RJZ2cjs.getProductCategoryOptions; exports.getProductSearchKey = _chunk6MD7RJZ2cjs.getProductSearchKey; exports.getProductSearchOptions = _chunk6MD7RJZ2cjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunk6MD7RJZ2cjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunk6MD7RJZ2cjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurOptions = useAugurOptions; exports.useAugurPersistence = useAugurPersistence; exports.useBatchInvMastDoc = useBatchInvMastDoc; exports.useCartActions = useCartActions; exports.useCartHdrUid = useCartHdrUid; exports.useCartInitialization = useCartInitialization; exports.useCartLineCount = useCartLineCount; exports.useCartLines = useCartLines; exports.useCartPricing = useCartPricing; exports.useCartQuantityTotal = useCartQuantityTotal; exports.useCartStore = useCartStore; exports.useCategoryItemsInfinite = useCategoryItemsInfinite; exports.useClearCart = useClearCart; exports.useCustomerInvoices = useCustomerInvoices; exports.useCustomerOrders = useCustomerOrders; exports.useCustomerQuotes = useCustomerQuotes; exports.useDebounce = useDebounce; exports.useFormatPrice = useFormatPrice; exports.useInvMast = useInvMast; exports.useInvMastDoc = useInvMastDoc; exports.useInvMastStock = useInvMastStock; exports.useInvoiceDetail = useInvoiceDetail; exports.useItemAttributes = useItemAttributes; exports.useItemCategory = useItemCategory; exports.useItemDetails = useItemDetails; exports.useItemFiltersStore = useItemFiltersStore; exports.useItemPrice = useItemPrice; exports.useItemSearchInfinite = useItemSearchInfinite; exports.useJoomlaContent = useJoomlaContent; exports.useJoomlaContentList = useJoomlaContentList; exports.useJoomlaMenu = useJoomlaMenu; exports.useJoomlaMenuDoc = useJoomlaMenuDoc; exports.useOrderDetail = useOrderDetail; exports.usePaginationPrefetch = usePaginationPrefetch; exports.useProductCategory = useProductCategory; exports.useProductSearch = useProductSearch; exports.useQuoteDetail = useQuoteDetail; exports.useSearchSuggestions = useSearchSuggestions; exports.useSetCartHdrUid = useSetCartHdrUid; exports.useSetCartLines = useSetCartLines;
|
|
1418
1436
|
//# sourceMappingURL=index.cjs.map
|