@simpleapps-com/augur-hooks 0.3.0 → 0.3.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.
@@ -540,6 +540,64 @@ var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
540
540
  };
541
541
  };
542
542
 
543
+ // src/queries/joomla-menu.ts
544
+ var getJoomlaMenuKey = (filters) => {
545
+ return ["joomlaMenu", filters];
546
+ };
547
+ var getJoomlaMenuOptions = (api, filters, cache) => {
548
+ const tier = cache?.semiStatic;
549
+ return {
550
+ queryKey: getJoomlaMenuKey(filters),
551
+ queryFn: async () => {
552
+ const edgeCache = tier?.edgeCache;
553
+ return withCache(
554
+ cache?.provider,
555
+ tier,
556
+ "joomla.menu.list",
557
+ async () => {
558
+ const response = await api.joomla.menu.list({
559
+ ...filters,
560
+ ...edgeCache != null ? { edgeCache } : {}
561
+ });
562
+ return response.data ?? [];
563
+ },
564
+ filters
565
+ );
566
+ },
567
+ staleTime: tier?.staleTime,
568
+ gcTime: tier?.gcTime
569
+ };
570
+ };
571
+
572
+ // src/queries/joomla-menu-doc.ts
573
+ var getJoomlaMenuDocKey = (menuId) => {
574
+ return ["joomlaMenuDoc", menuId];
575
+ };
576
+ var getJoomlaMenuDocOptions = (api, menuId, cache) => {
577
+ const tier = cache?.static;
578
+ return {
579
+ queryKey: getJoomlaMenuDocKey(menuId),
580
+ queryFn: async () => {
581
+ const edgeCache = tier?.edgeCache;
582
+ return withCache(
583
+ cache?.provider,
584
+ tier,
585
+ "joomla.menu.doc.get",
586
+ async () => {
587
+ const response = await api.joomla.menu.doc.get(menuId, {
588
+ ...edgeCache != null ? { edgeCache } : {}
589
+ });
590
+ if (!response.data) throw new Error("Menu item not found");
591
+ return response.data;
592
+ },
593
+ menuId
594
+ );
595
+ },
596
+ staleTime: tier?.staleTime,
597
+ gcTime: tier?.gcTime
598
+ };
599
+ };
600
+
543
601
  export {
544
602
  stableStringify,
545
603
  getItemPriceKey,
@@ -570,6 +628,10 @@ export {
570
628
  getJoomlaContentKey,
571
629
  getJoomlaContentOptions,
572
630
  getJoomlaContentListKey,
573
- getJoomlaContentListOptions
631
+ getJoomlaContentListOptions,
632
+ getJoomlaMenuKey,
633
+ getJoomlaMenuOptions,
634
+ getJoomlaMenuDocKey,
635
+ getJoomlaMenuDocOptions
574
636
  };
575
- //# sourceMappingURL=chunk-XPZVNYPR.js.map
637
+ //# sourceMappingURL=chunk-LCWJOWAC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/queries/stable-stringify.ts","../src/queries/cache-helper.ts","../src/queries/item-price.ts","../src/queries/inv-mast-doc.ts","../src/queries/item-category.ts","../src/queries/inv-mast.ts","../src/queries/inv-mast-stock.ts","../src/queries/product-category.ts","../src/queries/item-details.ts","../src/queries/item-attributes.ts","../src/queries/product-search.ts","../src/queries/search-suggestions.ts","../src/queries/cart-pricing.ts","../src/queries/category-items-infinite.ts","../src/queries/item-search-infinite.ts","../src/queries/joomla-content.ts","../src/queries/joomla-content-list.ts","../src/queries/joomla-menu.ts","../src/queries/joomla-menu-doc.ts"],"sourcesContent":["/**\n * JSON.stringify with sorted object keys for deterministic cache keys.\n * Ensures { a: 1, b: 2 } and { b: 2, a: 1 } produce the same string.\n */\nexport function stableStringify(value: unknown): string {\n if (value === null || value === undefined) return JSON.stringify(value);\n if (typeof value !== \"object\") return JSON.stringify(value);\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n const obj = value as Record<string, unknown>;\n const keys = Object.keys(obj).sort();\n const entries = keys.map(\n (key) => `${JSON.stringify(key)}:${stableStringify(obj[key])}`,\n );\n return `{${entries.join(\",\")}}`;\n}\n","import type { CacheProvider, CacheTierConfig } from \"../types\";\nimport { stableStringify } from \"./stable-stringify\";\n\n/**\n * FNV-1a 32-bit hash. Fast, cross-platform (no Node crypto needed).\n */\nfunction fnv1a(str: string): string {\n let h = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return (h >>> 0).toString(16).padStart(8, \"0\");\n}\n\n/**\n * Wraps an async function with optional Redis caching.\n *\n * - When `provider` and `tier.redis` are both set, checks Redis before\n * calling `fn`, then caches the result on miss.\n * - When either is missing, calls `fn` directly (no-op passthrough).\n *\n * @param provider Redis-compatible get/set + prefix. Undefined = skip Redis.\n * @param tier Cache tier config. Undefined or missing `redis` = skip Redis.\n * @param methodPath Dot-separated SDK method path (used as cache key segment).\n * @param fn The async function to cache (typically the SDK call).\n * @param keyArgs Values to hash for the cache key (e.g. query params).\n */\nexport async function withCache<T>(\n provider: CacheProvider | undefined,\n tier: CacheTierConfig | undefined,\n methodPath: string,\n fn: () => Promise<T>,\n ...keyArgs: unknown[]\n): Promise<T> {\n const redisTtl = tier?.redis;\n if (!provider || !redisTtl) return fn();\n\n const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(stableStringify(keyArgs))}`;\n\n try {\n const cached = await provider.get(key);\n if (cached != null) return JSON.parse(cached) as T;\n } catch {\n /* Redis read error — fall through to SDK call */\n }\n\n const result = await fn();\n\n try {\n provider.set(key, JSON.stringify(result), redisTtl).catch(() => {});\n } catch {\n /* Non-serializable or write error — skip caching */\n }\n\n return result;\n}\n","import type { TPriceData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for item price queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemPriceKey = (\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n) => {\n return [\"price\", itemId?.toUpperCase() || \"\", customerId, quantity] as const;\n};\n\n/**\n * Query options for item price. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemPriceOptions = (\n api: AugurApiClient,\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemPriceKey(itemId, customerId, quantity),\n queryFn: async (): Promise<TPriceData> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"pricing.priceEngine.get\",\n async () => {\n const response = await api.pricing.priceEngine.get({\n itemId: itemId?.toUpperCase() || \"\",\n customerId: Number(customerId),\n quantity,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemId, customerId, quantity,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n refetchOnReconnect: true,\n refetchOnWindowFocus: false,\n meta: { persist: true },\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for inv mast doc queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getInvMastDocKey = (\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n) => {\n return [\n \"invMastDoc\",\n invMastUid,\n itemId.toUpperCase(),\n includePricing,\n ] as const;\n};\n\n/**\n * Query options for inv mast doc. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getInvMastDocOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),\n queryFn: async (): Promise<TInvMastDoc> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(invMastUid, {\n itemId: itemId.toUpperCase(),\n includePricing,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n itemId,\n includePricing,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, GetItemCategoryApiOptions } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ItemCategoryQueryKey = readonly [\n \"itemCategory\",\n number,\n GetItemCategoryApiOptions | undefined,\n];\n\n/**\n * Generates a consistent query key for item category queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemCategoryKey = (\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n): ItemCategoryQueryKey => {\n return [\"itemCategory\", itemCategoryUid, apiOptions] as const;\n};\n\n/**\n * Query options for item category. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),\n queryFn: async (): Promise<TCategory> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(\n itemCategoryUid,\n { ...apiOptions, ...(edgeCache != null ? { edgeCache } : {}) },\n );\n if (!response.data) throw new Error(\"Item category not found\");\n return response.data;\n },\n itemCategoryUid,\n apiOptions,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastKey = (invMastUid: number, itemId: string) => {\n return [\"invMast\", invMastUid, itemId.toUpperCase()] as const;\n};\n\nexport const getInvMastOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastKey(invMastUid, itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.get\",\n async () => {\n const response = await api.items.invMast.get(invMastUid, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TStockData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastStockKey = (invMastUid: number | string) => {\n return [\"invMastStock\", invMastUid] as const;\n};\n\nexport const getInvMastStockOptions = (\n api: AugurApiClient,\n invMastUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getInvMastStockKey(invMastUid),\n queryFn: async (): Promise<number> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.stock.list\",\n async () => {\n const response = await api.items.invMast.stock.list(Number(invMastUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const stockData: TStockData[] = response.data?.stockData ?? [];\n return stockData.reduce(\n (qty: number, stock: TStockData) => qty + stock.qtyOnHand,\n 0,\n );\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductCategoryResponse = {\n itemCategoryDesc: string;\n childrenTotal: number;\n children: TProductCategory[];\n categoryImage: string | null;\n};\n\nexport const getProductCategoryKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"productCategory\", itemCategoryUid] as const;\n};\n\nexport const getProductCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getProductCategoryKey(itemCategoryUid),\n queryFn: async (): Promise<ProductCategoryResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(Number(itemCategoryUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemDetailsKey = (itemId: number | string) => {\n const normalizedId = typeof itemId === \"string\" ? itemId.toUpperCase() : itemId;\n return [\"itemDetails\", normalizedId] as const;\n};\n\nexport const getItemDetailsOptions = (\n api: AugurApiClient,\n itemId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemDetailsKey(itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(Number(itemId), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n itemId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemAttributesKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"itemAttributes\", itemCategoryUid] as const;\n};\n\nexport const getItemAttributesOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemAttributesKey(itemCategoryUid),\n queryFn: async () => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.attributes.list\",\n async () => {\n const response = await api.openSearch.itemSearch.attributes.list({\n q: \"\",\n searchType: \"query\",\n classId5List: String(itemCategoryUid),\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, PageData } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductSearchResponse = {\n items: TProductItem[];\n totalResults: number;\n};\n\n/**\n * Generates a consistent query key for product search queries.\n */\nexport const getProductSearchKey = (pageData: PageData) => {\n return [\n \"productSearch\",\n pageData.q,\n pageData.limit,\n pageData.offset,\n pageData.sortBy,\n pageData.itemCategoryUid,\n ] as const;\n};\n\n/**\n * Query options for product search. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getProductSearchOptions = (\n api: AugurApiClient,\n pageData: PageData,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getProductSearchKey(pageData),\n queryFn: async (): Promise<ProductSearchResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: pageData.q,\n searchType: \"query\",\n size: pageData.limit,\n from: pageData.offset,\n classId5List: pageData.itemCategoryUid\n ? String(pageData.itemCategoryUid)\n : undefined,\n filters: pageData.filters\n ? JSON.stringify(pageData.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n pageData,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, SearchSuggestionsResponse } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for search suggestion queries.\n */\nexport const getSearchSuggestionsKey = (\n query: string,\n limit: number,\n offset: number,\n) => {\n return [\"searchSuggestions\", query, limit, offset] as const;\n};\n\n/**\n * Query options for search suggestions. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getSearchSuggestionsOptions = (\n api: AugurApiClient,\n query: string,\n limit: number = 10,\n offset: number = 0,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getSearchSuggestionsKey(query, limit, offset),\n queryFn: async (): Promise<SearchSuggestionsResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.suggestions.suggest.list\",\n async () => {\n const response = await api.openSearch.suggestions.suggest.list({\n q: query,\n size: limit,\n from: offset,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n query,\n limit,\n offset,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getItemPriceOptions } from \"./item-price\";\n\n/**\n * Get cart pricing query options for prefetching or parent components.\n */\nexport function getCartPricingQueryOptions(\n api: AugurApiClient,\n cartLines: Array<{ itemId: string; quantity: number }>,\n customerId: string | number | undefined,\n cache?: CacheConfig,\n) {\n return cartLines.map((line) => ({\n ...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),\n enabled: !!customerId && !!line.itemId,\n }));\n}\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getCategoryItemsInfiniteKey = (\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n) => {\n return [\n \"categoryItemsInfinite\",\n itemCategoryUid,\n stableStringify(itemsFilters),\n ] as const;\n};\n\n/**\n * Full infinite query options for category items.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getCategoryItemsInfiniteOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q || \"\",\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: String(itemCategoryUid),\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemCategoryUid, itemsFilters, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getItemSearchInfiniteKey = (\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n) => {\n return [\n \"itemSearchInfinite\",\n stableStringify(itemsFilters),\n itemCategoryUid,\n ] as const;\n};\n\n/**\n * Full infinite query options for item search.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getItemSearchInfiniteOptions = (\n api: AugurApiClient,\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q,\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: itemCategoryUid ? String(itemCategoryUid) : undefined,\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemsFilters, itemCategoryUid, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n meta: { persist: true },\n };\n};\n","import type { TJoomlaContent } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentKey = (articleId: number | string) => {\n return [\"joomlaContent\", articleId] as const;\n};\n\nexport const getJoomlaContentOptions = (\n api: AugurApiClient,\n articleId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaContentKey(articleId),\n queryFn: async (): Promise<TJoomlaContent> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.doc.get\",\n async () => {\n const response = await api.joomla.content.doc.get(articleId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Article not found\");\n return response.data;\n },\n articleId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TJoomlaContent,\n type TJoomlaContentFilters,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentListKey = (\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n) => {\n return [\"joomlaContentList\", categoryId, filters] as const;\n};\n\nexport const getJoomlaContentListOptions = (\n api: AugurApiClient,\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaContentListKey(categoryId, filters),\n queryFn: async (): Promise<TJoomlaContent[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.list\",\n async () => {\n const response = await api.joomla.content.list({\n catid: categoryId,\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n categoryId, filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem, TMenuFilters } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuKey = (\n filters?: Partial<TMenuFilters>,\n) => {\n return [\"joomlaMenu\", filters] as const;\n};\n\nexport const getJoomlaMenuOptions = (\n api: AugurApiClient,\n filters?: Partial<TMenuFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaMenuKey(filters),\n queryFn: async (): Promise<MenuItem[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.list\",\n async () => {\n const response = await api.joomla.menu.list({\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuDocKey = (menuId: number | string) => {\n return [\"joomlaMenuDoc\", menuId] as const;\n};\n\nexport const getJoomlaMenuDocOptions = (\n api: AugurApiClient,\n menuId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaMenuDocKey(menuId),\n queryFn: async (): Promise<MenuItem> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.doc.get\",\n async () => {\n const response = await api.joomla.menu.doc.get(menuId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Menu item not found\");\n return response.data;\n },\n menuId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n"],"mappings":";AAIO,SAAS,gBAAgB,OAAwB;AACtD,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO,KAAK,UAAU,KAAK;AACtE,MAAI,OAAO,UAAU,SAAU,QAAO,KAAK,UAAU,KAAK;AAC1D,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,IAAI,MAAM,IAAI,eAAe,EAAE,KAAK,GAAG,CAAC;AAAA,EACjD;AACA,QAAM,MAAM;AACZ,QAAM,OAAO,OAAO,KAAK,GAAG,EAAE,KAAK;AACnC,QAAM,UAAU,KAAK;AAAA,IACnB,CAAC,QAAQ,GAAG,KAAK,UAA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;AAAA,IACpC,SAAS,YAA+B;AACtC,YAAM,YAAY,MAAM;AACxB,aAAO;AAAA,QACL,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA,YAAY;AACV,gBAAM,WAAW,MAAM,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ;AAAA,YACrD,GAAI,aAAa,OAAO,EAAE,UAAU,IAAI,CAAC;AAAA,UAC3C,CAAC;AACD,cAAI,CAAC,SAAS,KAAM,OAAM,IAAI,MAAM,qBAAqB;AACzD,iBAAO,SAAS;AAAA,QAClB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,WAAW,MAAM;AAAA,IACjB,QAAQ,MAAM;AAAA,EAChB;AACF;","names":[]}
@@ -540,6 +540,68 @@ var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
540
540
  };
541
541
  };
542
542
 
543
+ // src/queries/joomla-menu.ts
544
+ var getJoomlaMenuKey = (filters) => {
545
+ return ["joomlaMenu", filters];
546
+ };
547
+ var getJoomlaMenuOptions = (api, filters, cache) => {
548
+ const tier = _optionalChain([cache, 'optionalAccess', _90 => _90.semiStatic]);
549
+ return {
550
+ queryKey: getJoomlaMenuKey(filters),
551
+ queryFn: async () => {
552
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _91 => _91.edgeCache]);
553
+ return withCache(
554
+ _optionalChain([cache, 'optionalAccess', _92 => _92.provider]),
555
+ tier,
556
+ "joomla.menu.list",
557
+ async () => {
558
+ const response = await api.joomla.menu.list({
559
+ ...filters,
560
+ ...edgeCache != null ? { edgeCache } : {}
561
+ });
562
+ return _nullishCoalesce(response.data, () => ( []));
563
+ },
564
+ filters
565
+ );
566
+ },
567
+ staleTime: _optionalChain([tier, 'optionalAccess', _93 => _93.staleTime]),
568
+ gcTime: _optionalChain([tier, 'optionalAccess', _94 => _94.gcTime])
569
+ };
570
+ };
571
+
572
+ // src/queries/joomla-menu-doc.ts
573
+ var getJoomlaMenuDocKey = (menuId) => {
574
+ return ["joomlaMenuDoc", menuId];
575
+ };
576
+ var getJoomlaMenuDocOptions = (api, menuId, cache) => {
577
+ const tier = _optionalChain([cache, 'optionalAccess', _95 => _95.static]);
578
+ return {
579
+ queryKey: getJoomlaMenuDocKey(menuId),
580
+ queryFn: async () => {
581
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _96 => _96.edgeCache]);
582
+ return withCache(
583
+ _optionalChain([cache, 'optionalAccess', _97 => _97.provider]),
584
+ tier,
585
+ "joomla.menu.doc.get",
586
+ async () => {
587
+ const response = await api.joomla.menu.doc.get(menuId, {
588
+ ...edgeCache != null ? { edgeCache } : {}
589
+ });
590
+ if (!response.data) throw new Error("Menu item not found");
591
+ return response.data;
592
+ },
593
+ menuId
594
+ );
595
+ },
596
+ staleTime: _optionalChain([tier, 'optionalAccess', _98 => _98.staleTime]),
597
+ gcTime: _optionalChain([tier, 'optionalAccess', _99 => _99.gcTime])
598
+ };
599
+ };
600
+
601
+
602
+
603
+
604
+
543
605
 
544
606
 
545
607
 
@@ -571,5 +633,5 @@ var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
571
633
 
572
634
 
573
635
 
574
- exports.stableStringify = stableStringify; exports.getItemPriceKey = getItemPriceKey; exports.getItemPriceOptions = getItemPriceOptions; exports.getInvMastDocKey = getInvMastDocKey; exports.getInvMastDocOptions = getInvMastDocOptions; exports.getItemCategoryKey = getItemCategoryKey; exports.getItemCategoryOptions = getItemCategoryOptions; exports.getInvMastKey = getInvMastKey; exports.getInvMastOptions = getInvMastOptions; exports.getInvMastStockKey = getInvMastStockKey; exports.getInvMastStockOptions = getInvMastStockOptions; exports.getProductCategoryKey = getProductCategoryKey; exports.getProductCategoryOptions = getProductCategoryOptions; exports.getItemDetailsKey = getItemDetailsKey; exports.getItemDetailsOptions = getItemDetailsOptions; exports.getItemAttributesKey = getItemAttributesKey; exports.getItemAttributesOptions = getItemAttributesOptions; exports.getProductSearchKey = getProductSearchKey; exports.getProductSearchOptions = getProductSearchOptions; exports.getSearchSuggestionsKey = getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = getSearchSuggestionsOptions; exports.getCartPricingQueryOptions = getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = getCategoryItemsInfiniteOptions; exports.getItemSearchInfiniteKey = getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = getItemSearchInfiniteOptions; exports.getJoomlaContentKey = getJoomlaContentKey; exports.getJoomlaContentOptions = getJoomlaContentOptions; exports.getJoomlaContentListKey = getJoomlaContentListKey; exports.getJoomlaContentListOptions = getJoomlaContentListOptions;
575
- //# sourceMappingURL=chunk-IYEN7NGC.cjs.map
636
+ exports.stableStringify = stableStringify; exports.getItemPriceKey = getItemPriceKey; exports.getItemPriceOptions = getItemPriceOptions; exports.getInvMastDocKey = getInvMastDocKey; exports.getInvMastDocOptions = getInvMastDocOptions; exports.getItemCategoryKey = getItemCategoryKey; exports.getItemCategoryOptions = getItemCategoryOptions; exports.getInvMastKey = getInvMastKey; exports.getInvMastOptions = getInvMastOptions; exports.getInvMastStockKey = getInvMastStockKey; exports.getInvMastStockOptions = getInvMastStockOptions; exports.getProductCategoryKey = getProductCategoryKey; exports.getProductCategoryOptions = getProductCategoryOptions; exports.getItemDetailsKey = getItemDetailsKey; exports.getItemDetailsOptions = getItemDetailsOptions; exports.getItemAttributesKey = getItemAttributesKey; exports.getItemAttributesOptions = getItemAttributesOptions; exports.getProductSearchKey = getProductSearchKey; exports.getProductSearchOptions = getProductSearchOptions; exports.getSearchSuggestionsKey = getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = getSearchSuggestionsOptions; exports.getCartPricingQueryOptions = getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = getCategoryItemsInfiniteOptions; exports.getItemSearchInfiniteKey = getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = getItemSearchInfiniteOptions; exports.getJoomlaContentKey = getJoomlaContentKey; exports.getJoomlaContentOptions = getJoomlaContentOptions; exports.getJoomlaContentListKey = getJoomlaContentListKey; exports.getJoomlaContentListOptions = getJoomlaContentListOptions; exports.getJoomlaMenuKey = getJoomlaMenuKey; exports.getJoomlaMenuOptions = getJoomlaMenuOptions; exports.getJoomlaMenuDocKey = getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = getJoomlaMenuDocOptions;
637
+ //# sourceMappingURL=chunk-QXDTBGFO.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-QXDTBGFO.cjs","../src/queries/stable-stringify.ts","../src/queries/cache-helper.ts","../src/queries/item-price.ts","../src/queries/inv-mast-doc.ts","../src/queries/item-category.ts","../src/queries/inv-mast.ts","../src/queries/inv-mast-stock.ts","../src/queries/product-category.ts","../src/queries/item-details.ts","../src/queries/item-attributes.ts","../src/queries/product-search.ts","../src/queries/search-suggestions.ts","../src/queries/cart-pricing.ts","../src/queries/category-items-infinite.ts","../src/queries/item-search-infinite.ts","../src/queries/joomla-content.ts","../src/queries/joomla-content-list.ts","../src/queries/joomla-menu.ts","../src/queries/joomla-menu-doc.ts"],"names":[],"mappings":"AAAA;ACIO,SAAS,eAAA,CAAgB,KAAA,EAAwB;AACtD,EAAA,GAAA,CAAI,MAAA,IAAU,KAAA,GAAQ,MAAA,IAAU,KAAA,CAAA,EAAW,OAAO,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA;AACtE,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA;AAC1D,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,CAAA,CAAA,EAAI,KAAA,CAAM,GAAA,CAAI,eAAe,CAAA,CAAE,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,CAAA;AAAA,EACjD;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IAAA;AACV,EAAA;AACF;AnBmjBc;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-QXDTBGFO.cjs","sourcesContent":[null,"/**\n * JSON.stringify with sorted object keys for deterministic cache keys.\n * Ensures { a: 1, b: 2 } and { b: 2, a: 1 } produce the same string.\n */\nexport function stableStringify(value: unknown): string {\n if (value === null || value === undefined) return JSON.stringify(value);\n if (typeof value !== \"object\") return JSON.stringify(value);\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n const obj = value as Record<string, unknown>;\n const keys = Object.keys(obj).sort();\n const entries = keys.map(\n (key) => `${JSON.stringify(key)}:${stableStringify(obj[key])}`,\n );\n return `{${entries.join(\",\")}}`;\n}\n","import type { CacheProvider, CacheTierConfig } from \"../types\";\nimport { stableStringify } from \"./stable-stringify\";\n\n/**\n * FNV-1a 32-bit hash. Fast, cross-platform (no Node crypto needed).\n */\nfunction fnv1a(str: string): string {\n let h = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return (h >>> 0).toString(16).padStart(8, \"0\");\n}\n\n/**\n * Wraps an async function with optional Redis caching.\n *\n * - When `provider` and `tier.redis` are both set, checks Redis before\n * calling `fn`, then caches the result on miss.\n * - When either is missing, calls `fn` directly (no-op passthrough).\n *\n * @param provider Redis-compatible get/set + prefix. Undefined = skip Redis.\n * @param tier Cache tier config. Undefined or missing `redis` = skip Redis.\n * @param methodPath Dot-separated SDK method path (used as cache key segment).\n * @param fn The async function to cache (typically the SDK call).\n * @param keyArgs Values to hash for the cache key (e.g. query params).\n */\nexport async function withCache<T>(\n provider: CacheProvider | undefined,\n tier: CacheTierConfig | undefined,\n methodPath: string,\n fn: () => Promise<T>,\n ...keyArgs: unknown[]\n): Promise<T> {\n const redisTtl = tier?.redis;\n if (!provider || !redisTtl) return fn();\n\n const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(stableStringify(keyArgs))}`;\n\n try {\n const cached = await provider.get(key);\n if (cached != null) return JSON.parse(cached) as T;\n } catch {\n /* Redis read error — fall through to SDK call */\n }\n\n const result = await fn();\n\n try {\n provider.set(key, JSON.stringify(result), redisTtl).catch(() => {});\n } catch {\n /* Non-serializable or write error — skip caching */\n }\n\n return result;\n}\n","import type { TPriceData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for item price queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemPriceKey = (\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n) => {\n return [\"price\", itemId?.toUpperCase() || \"\", customerId, quantity] as const;\n};\n\n/**\n * Query options for item price. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemPriceOptions = (\n api: AugurApiClient,\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemPriceKey(itemId, customerId, quantity),\n queryFn: async (): Promise<TPriceData> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"pricing.priceEngine.get\",\n async () => {\n const response = await api.pricing.priceEngine.get({\n itemId: itemId?.toUpperCase() || \"\",\n customerId: Number(customerId),\n quantity,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemId, customerId, quantity,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n refetchOnReconnect: true,\n refetchOnWindowFocus: false,\n meta: { persist: true },\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for inv mast doc queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getInvMastDocKey = (\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n) => {\n return [\n \"invMastDoc\",\n invMastUid,\n itemId.toUpperCase(),\n includePricing,\n ] as const;\n};\n\n/**\n * Query options for inv mast doc. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getInvMastDocOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),\n queryFn: async (): Promise<TInvMastDoc> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(invMastUid, {\n itemId: itemId.toUpperCase(),\n includePricing,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n itemId,\n includePricing,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, GetItemCategoryApiOptions } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ItemCategoryQueryKey = readonly [\n \"itemCategory\",\n number,\n GetItemCategoryApiOptions | undefined,\n];\n\n/**\n * Generates a consistent query key for item category queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemCategoryKey = (\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n): ItemCategoryQueryKey => {\n return [\"itemCategory\", itemCategoryUid, apiOptions] as const;\n};\n\n/**\n * Query options for item category. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),\n queryFn: async (): Promise<TCategory> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(\n itemCategoryUid,\n { ...apiOptions, ...(edgeCache != null ? { edgeCache } : {}) },\n );\n if (!response.data) throw new Error(\"Item category not found\");\n return response.data;\n },\n itemCategoryUid,\n apiOptions,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastKey = (invMastUid: number, itemId: string) => {\n return [\"invMast\", invMastUid, itemId.toUpperCase()] as const;\n};\n\nexport const getInvMastOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastKey(invMastUid, itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.get\",\n async () => {\n const response = await api.items.invMast.get(invMastUid, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TStockData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastStockKey = (invMastUid: number | string) => {\n return [\"invMastStock\", invMastUid] as const;\n};\n\nexport const getInvMastStockOptions = (\n api: AugurApiClient,\n invMastUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getInvMastStockKey(invMastUid),\n queryFn: async (): Promise<number> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.stock.list\",\n async () => {\n const response = await api.items.invMast.stock.list(Number(invMastUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const stockData: TStockData[] = response.data?.stockData ?? [];\n return stockData.reduce(\n (qty: number, stock: TStockData) => qty + stock.qtyOnHand,\n 0,\n );\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductCategoryResponse = {\n itemCategoryDesc: string;\n childrenTotal: number;\n children: TProductCategory[];\n categoryImage: string | null;\n};\n\nexport const getProductCategoryKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"productCategory\", itemCategoryUid] as const;\n};\n\nexport const getProductCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getProductCategoryKey(itemCategoryUid),\n queryFn: async (): Promise<ProductCategoryResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(Number(itemCategoryUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemDetailsKey = (itemId: number | string) => {\n const normalizedId = typeof itemId === \"string\" ? itemId.toUpperCase() : itemId;\n return [\"itemDetails\", normalizedId] as const;\n};\n\nexport const getItemDetailsOptions = (\n api: AugurApiClient,\n itemId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemDetailsKey(itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(Number(itemId), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n itemId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemAttributesKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"itemAttributes\", itemCategoryUid] as const;\n};\n\nexport const getItemAttributesOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemAttributesKey(itemCategoryUid),\n queryFn: async () => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.attributes.list\",\n async () => {\n const response = await api.openSearch.itemSearch.attributes.list({\n q: \"\",\n searchType: \"query\",\n classId5List: String(itemCategoryUid),\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, PageData } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductSearchResponse = {\n items: TProductItem[];\n totalResults: number;\n};\n\n/**\n * Generates a consistent query key for product search queries.\n */\nexport const getProductSearchKey = (pageData: PageData) => {\n return [\n \"productSearch\",\n pageData.q,\n pageData.limit,\n pageData.offset,\n pageData.sortBy,\n pageData.itemCategoryUid,\n ] as const;\n};\n\n/**\n * Query options for product search. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getProductSearchOptions = (\n api: AugurApiClient,\n pageData: PageData,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getProductSearchKey(pageData),\n queryFn: async (): Promise<ProductSearchResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: pageData.q,\n searchType: \"query\",\n size: pageData.limit,\n from: pageData.offset,\n classId5List: pageData.itemCategoryUid\n ? String(pageData.itemCategoryUid)\n : undefined,\n filters: pageData.filters\n ? JSON.stringify(pageData.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n pageData,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, SearchSuggestionsResponse } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for search suggestion queries.\n */\nexport const getSearchSuggestionsKey = (\n query: string,\n limit: number,\n offset: number,\n) => {\n return [\"searchSuggestions\", query, limit, offset] as const;\n};\n\n/**\n * Query options for search suggestions. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getSearchSuggestionsOptions = (\n api: AugurApiClient,\n query: string,\n limit: number = 10,\n offset: number = 0,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getSearchSuggestionsKey(query, limit, offset),\n queryFn: async (): Promise<SearchSuggestionsResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.suggestions.suggest.list\",\n async () => {\n const response = await api.openSearch.suggestions.suggest.list({\n q: query,\n size: limit,\n from: offset,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n query,\n limit,\n offset,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getItemPriceOptions } from \"./item-price\";\n\n/**\n * Get cart pricing query options for prefetching or parent components.\n */\nexport function getCartPricingQueryOptions(\n api: AugurApiClient,\n cartLines: Array<{ itemId: string; quantity: number }>,\n customerId: string | number | undefined,\n cache?: CacheConfig,\n) {\n return cartLines.map((line) => ({\n ...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),\n enabled: !!customerId && !!line.itemId,\n }));\n}\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getCategoryItemsInfiniteKey = (\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n) => {\n return [\n \"categoryItemsInfinite\",\n itemCategoryUid,\n stableStringify(itemsFilters),\n ] as const;\n};\n\n/**\n * Full infinite query options for category items.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getCategoryItemsInfiniteOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q || \"\",\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: String(itemCategoryUid),\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemCategoryUid, itemsFilters, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getItemSearchInfiniteKey = (\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n) => {\n return [\n \"itemSearchInfinite\",\n stableStringify(itemsFilters),\n itemCategoryUid,\n ] as const;\n};\n\n/**\n * Full infinite query options for item search.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getItemSearchInfiniteOptions = (\n api: AugurApiClient,\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q,\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: itemCategoryUid ? String(itemCategoryUid) : undefined,\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemsFilters, itemCategoryUid, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n meta: { persist: true },\n };\n};\n","import type { TJoomlaContent } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentKey = (articleId: number | string) => {\n return [\"joomlaContent\", articleId] as const;\n};\n\nexport const getJoomlaContentOptions = (\n api: AugurApiClient,\n articleId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaContentKey(articleId),\n queryFn: async (): Promise<TJoomlaContent> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.doc.get\",\n async () => {\n const response = await api.joomla.content.doc.get(articleId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Article not found\");\n return response.data;\n },\n articleId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TJoomlaContent,\n type TJoomlaContentFilters,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentListKey = (\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n) => {\n return [\"joomlaContentList\", categoryId, filters] as const;\n};\n\nexport const getJoomlaContentListOptions = (\n api: AugurApiClient,\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaContentListKey(categoryId, filters),\n queryFn: async (): Promise<TJoomlaContent[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.list\",\n async () => {\n const response = await api.joomla.content.list({\n catid: categoryId,\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n categoryId, filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem, TMenuFilters } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuKey = (\n filters?: Partial<TMenuFilters>,\n) => {\n return [\"joomlaMenu\", filters] as const;\n};\n\nexport const getJoomlaMenuOptions = (\n api: AugurApiClient,\n filters?: Partial<TMenuFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaMenuKey(filters),\n queryFn: async (): Promise<MenuItem[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.list\",\n async () => {\n const response = await api.joomla.menu.list({\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuDocKey = (menuId: number | string) => {\n return [\"joomlaMenuDoc\", menuId] as const;\n};\n\nexport const getJoomlaMenuDocOptions = (\n api: AugurApiClient,\n menuId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaMenuDocKey(menuId),\n queryFn: async (): Promise<MenuItem> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.doc.get\",\n async () => {\n const response = await api.joomla.menu.doc.get(menuId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Menu item not found\");\n return response.data;\n },\n menuId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n"]}
package/dist/index.cjs CHANGED
@@ -28,7 +28,11 @@
28
28
 
29
29
 
30
30
 
31
- var _chunkIYEN7NGCcjs = require('./chunk-IYEN7NGC.cjs');
31
+
32
+
33
+
34
+
35
+ var _chunkQXDTBGFOcjs = require('./chunk-QXDTBGFO.cjs');
32
36
 
33
37
  // src/provider.tsx
34
38
  var _react = require('react');
@@ -173,7 +177,7 @@ function useItemPrice(itemId, customerId, quantity = 1, options = {}) {
173
177
  const auth = useAugurAuth();
174
178
  const cache = useAugurCache();
175
179
  const effectiveCustomerId = _nullishCoalesce(customerId, () => ( _optionalChain([auth, 'optionalAccess', _ => _.customerId])));
176
- const defaultOptions = _chunkIYEN7NGCcjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
180
+ const defaultOptions = _chunkQXDTBGFOcjs.getItemPriceOptions.call(void 0, api, itemId, effectiveCustomerId, quantity, cache);
177
181
  const resolvedQueryFn = _nullishCoalesce(options.queryFn, () => ( (_optionalChain([callbacks, 'optionalAccess', _2 => _2.getItemPrice]) ? () => callbacks.getItemPrice(itemId, effectiveCustomerId, quantity) : void 0)));
178
182
  return _reactquery.useQuery.call(void 0, {
179
183
  ...defaultOptions,
@@ -189,7 +193,7 @@ function useInvMastDoc(invMastUid, itemId, options = {}) {
189
193
  const api = useAugurApiOptional();
190
194
  const callbacks = useAugurCallbacks();
191
195
  const cache = useAugurCache();
192
- const queryOpts = _chunkIYEN7NGCcjs.getInvMastDocOptions.call(void 0,
196
+ const queryOpts = _chunkQXDTBGFOcjs.getInvMastDocOptions.call(void 0,
193
197
  api,
194
198
  invMastUid,
195
199
  itemId,
@@ -211,7 +215,7 @@ function useItemCategory(itemCategoryUid, options = {}) {
211
215
  const api = useAugurApiOptional();
212
216
  const callbacks = useAugurCallbacks();
213
217
  const cache = useAugurCache();
214
- const queryOpts = _chunkIYEN7NGCcjs.getItemCategoryOptions.call(void 0,
218
+ const queryOpts = _chunkQXDTBGFOcjs.getItemCategoryOptions.call(void 0,
215
219
  api,
216
220
  itemCategoryUid,
217
221
  options.apiOptions,
@@ -231,7 +235,7 @@ function useInvMast(invMastUid, itemId, options = {}) {
231
235
  const api = useAugurApiOptional();
232
236
  const callbacks = useAugurCallbacks();
233
237
  const cache = useAugurCache();
234
- const queryOpts = _chunkIYEN7NGCcjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
238
+ const queryOpts = _chunkQXDTBGFOcjs.getInvMastOptions.call(void 0, api, invMastUid, itemId, cache);
235
239
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
236
240
  ...queryOpts,
237
241
  ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _5 => _5.getInvMast]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMast(invMastUid, itemId)))) } : {},
@@ -246,7 +250,7 @@ function useInvMastStock(invMastUid, options = {}) {
246
250
  const api = useAugurApiOptional();
247
251
  const callbacks = useAugurCallbacks();
248
252
  const cache = useAugurCache();
249
- const queryOpts = _chunkIYEN7NGCcjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
253
+ const queryOpts = _chunkQXDTBGFOcjs.getInvMastStockOptions.call(void 0, api, invMastUid, cache);
250
254
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
251
255
  ...queryOpts,
252
256
  ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _6 => _6.getInvMastStock]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getInvMastStock(invMastUid)))) } : {},
@@ -277,8 +281,8 @@ function useProductCategory(itemCategoryUid, options = {}) {
277
281
  const api = useAugurApiOptional();
278
282
  const callbacks = useAugurCallbacks();
279
283
  const cache = useAugurCache();
280
- const baseOptions = itemCategoryUid ? _chunkIYEN7NGCcjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
281
- queryKey: _chunkIYEN7NGCcjs.getProductCategoryKey.call(void 0, null),
284
+ const baseOptions = itemCategoryUid ? _chunkQXDTBGFOcjs.getProductCategoryOptions.call(void 0, api, itemCategoryUid, cache) : {
285
+ queryKey: _chunkQXDTBGFOcjs.getProductCategoryKey.call(void 0, null),
282
286
  /* v8 ignore next */
283
287
  queryFn: () => Promise.reject()
284
288
  };
@@ -306,8 +310,8 @@ function useItemDetails(itemId, options = {}) {
306
310
  const callbacks = useAugurCallbacks();
307
311
  const cache = useAugurCache();
308
312
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
309
- ...itemId ? _chunkIYEN7NGCcjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
310
- queryKey: _chunkIYEN7NGCcjs.getItemDetailsKey.call(void 0, ""),
313
+ ...itemId ? _chunkQXDTBGFOcjs.getItemDetailsOptions.call(void 0, api, itemId, cache) : {
314
+ queryKey: _chunkQXDTBGFOcjs.getItemDetailsKey.call(void 0, ""),
311
315
  /* v8 ignore next */
312
316
  queryFn: () => Promise.reject()
313
317
  },
@@ -334,8 +338,8 @@ function useItemAttributes(itemCategoryUid, options = {}) {
334
338
  const callbacks = useAugurCallbacks();
335
339
  const cache = useAugurCache();
336
340
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
337
- ...itemCategoryUid ? _chunkIYEN7NGCcjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
338
- queryKey: _chunkIYEN7NGCcjs.getItemAttributesKey.call(void 0, null),
341
+ ...itemCategoryUid ? _chunkQXDTBGFOcjs.getItemAttributesOptions.call(void 0, api, itemCategoryUid, cache) : {
342
+ queryKey: _chunkQXDTBGFOcjs.getItemAttributesKey.call(void 0, null),
339
343
  /* v8 ignore next */
340
344
  queryFn: () => Promise.reject()
341
345
  },
@@ -359,7 +363,7 @@ function useProductSearch(pageData, options = {}) {
359
363
  const api = useAugurApiOptional();
360
364
  const callbacks = useAugurCallbacks();
361
365
  const cache = useAugurCache();
362
- const defaultOptions = _chunkIYEN7NGCcjs.getProductSearchOptions.call(void 0, api, pageData, cache);
366
+ const defaultOptions = _chunkQXDTBGFOcjs.getProductSearchOptions.call(void 0, api, pageData, cache);
363
367
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
364
368
  ...defaultOptions,
365
369
  ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _16 => _16.getProductSearch]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getProductSearch(pageData)))) } : {},
@@ -385,7 +389,7 @@ function useSearchSuggestions(query, options = {}) {
385
389
  const limit = _nullishCoalesce(options.limit, () => ( 10));
386
390
  const offset = _nullishCoalesce(options.offset, () => ( 0));
387
391
  const enabled = (_nullishCoalesce(options.enabled, () => ( true))) && query.trim().length > 0;
388
- const defaultOptions = _chunkIYEN7NGCcjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
392
+ const defaultOptions = _chunkQXDTBGFOcjs.getSearchSuggestionsOptions.call(void 0, api, query, limit, offset, cache);
389
393
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
390
394
  ...defaultOptions,
391
395
  ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _19 => _19.getSearchSuggestions]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getSearchSuggestions(query, limit, offset)))) } : {},
@@ -696,12 +700,12 @@ function useCartPricing(options = {}) {
696
700
  const priceQueries = _reactquery.useQueries.call(void 0, {
697
701
  queries: cartLines.map((line) => {
698
702
  const base = priceFn ? {
699
- queryKey: _chunkIYEN7NGCcjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
703
+ queryKey: _chunkQXDTBGFOcjs.getItemPriceKey.call(void 0, line.itemId, customerId, line.quantity),
700
704
  queryFn: () => priceFn(line.itemId, customerId, line.quantity),
701
705
  refetchOnReconnect: true,
702
706
  refetchOnWindowFocus: false,
703
707
  meta: { persist: true }
704
- } : _chunkIYEN7NGCcjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
708
+ } : _chunkQXDTBGFOcjs.getItemPriceOptions.call(void 0, api, line.itemId, customerId, line.quantity, cache);
705
709
  return {
706
710
  ...base,
707
711
  enabled: !!customerId && !!line.itemId
@@ -801,7 +805,7 @@ function useCategoryItemsInfinite(itemCategoryUid, itemsFilters, options = {}) {
801
805
  const callbacks = useAugurCallbacks();
802
806
  const cache = useAugurCache();
803
807
  const { enabled = true } = options;
804
- const defaultOptions = _chunkIYEN7NGCcjs.getCategoryItemsInfiniteOptions.call(void 0,
808
+ const defaultOptions = _chunkQXDTBGFOcjs.getCategoryItemsInfiniteOptions.call(void 0,
805
809
  api,
806
810
  itemCategoryUid,
807
811
  itemsFilters,
@@ -828,7 +832,7 @@ function useItemSearchInfinite(itemsFilters, itemCategoryUid, options = {}) {
828
832
  const callbacks = useAugurCallbacks();
829
833
  const cache = useAugurCache();
830
834
  const { enabled = true } = options;
831
- const defaultOptions = _chunkIYEN7NGCcjs.getItemSearchInfiniteOptions.call(void 0,
835
+ const defaultOptions = _chunkQXDTBGFOcjs.getItemSearchInfiniteOptions.call(void 0,
832
836
  api,
833
837
  itemsFilters,
834
838
  itemCategoryUid,
@@ -855,8 +859,8 @@ function useJoomlaContent(articleId, options = {}) {
855
859
  const callbacks = useAugurCallbacks();
856
860
  const cache = useAugurCache();
857
861
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
858
- ...articleId ? _chunkIYEN7NGCcjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
859
- queryKey: _chunkIYEN7NGCcjs.getJoomlaContentKey.call(void 0, ""),
862
+ ...articleId ? _chunkQXDTBGFOcjs.getJoomlaContentOptions.call(void 0, api, articleId, cache) : {
863
+ queryKey: _chunkQXDTBGFOcjs.getJoomlaContentKey.call(void 0, ""),
860
864
  /* v8 ignore next */
861
865
  queryFn: () => Promise.reject()
862
866
  },
@@ -877,8 +881,8 @@ function useJoomlaContentList(categoryId, options = {}) {
877
881
  const callbacks = useAugurCallbacks();
878
882
  const cache = useAugurCache();
879
883
  const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
880
- ...categoryId ? _chunkIYEN7NGCcjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
881
- queryKey: _chunkIYEN7NGCcjs.getJoomlaContentListKey.call(void 0, ""),
884
+ ...categoryId ? _chunkQXDTBGFOcjs.getJoomlaContentListOptions.call(void 0, api, categoryId, options.filters, cache) : {
885
+ queryKey: _chunkQXDTBGFOcjs.getJoomlaContentListKey.call(void 0, ""),
882
886
  /* v8 ignore next */
883
887
  queryFn: () => Promise.reject()
884
888
  },
@@ -894,16 +898,58 @@ function useJoomlaContentList(categoryId, options = {}) {
894
898
  };
895
899
  }
896
900
 
901
+ // src/hooks/use-joomla-menu.ts
902
+
903
+ function useJoomlaMenu(options = {}) {
904
+ const api = useAugurApiOptional();
905
+ const callbacks = useAugurCallbacks();
906
+ const cache = useAugurCache();
907
+ const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
908
+ ..._chunkQXDTBGFOcjs.getJoomlaMenuOptions.call(void 0, api, options.filters, cache),
909
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _55 => _55.getJoomlaMenu]))) ? {
910
+ queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenu(options.filters))))
911
+ } : {},
912
+ enabled: _nullishCoalesce(options.enabled, () => ( true))
913
+ });
914
+ return {
915
+ menuItems: _nullishCoalesce(data, () => ( [])),
916
+ isLoading,
917
+ error
918
+ };
919
+ }
920
+
921
+ // src/hooks/use-joomla-menu-doc.ts
922
+
923
+ function useJoomlaMenuDoc(menuId, options = {}) {
924
+ const api = useAugurApiOptional();
925
+ const callbacks = useAugurCallbacks();
926
+ const cache = useAugurCache();
927
+ const { data, isLoading, error } = _reactquery.useQuery.call(void 0, {
928
+ ...menuId ? _chunkQXDTBGFOcjs.getJoomlaMenuDocOptions.call(void 0, api, menuId, cache) : {
929
+ queryKey: _chunkQXDTBGFOcjs.getJoomlaMenuDocKey.call(void 0, ""),
930
+ /* v8 ignore next */
931
+ queryFn: () => Promise.reject()
932
+ },
933
+ ..._nullishCoalesce(options.queryFn, () => ( _optionalChain([callbacks, 'optionalAccess', _56 => _56.getJoomlaMenuDoc]))) ? { queryFn: _nullishCoalesce(options.queryFn, () => ( (() => callbacks.getJoomlaMenuDoc(menuId)))) } : {},
934
+ enabled: (_nullishCoalesce(options.enabled, () => ( true))) && !!menuId
935
+ });
936
+ return {
937
+ menuItem: _nullishCoalesce(data, () => ( null)),
938
+ isLoading,
939
+ error
940
+ };
941
+ }
942
+
897
943
  // src/create-site-hooks.ts
898
944
 
899
945
  function createSiteHooks(config = {}) {
900
946
  const { callbacks, defaultCustomerId, cache } = config;
901
947
  function Provider({ api, auth, children }) {
902
948
  const mergedAuth = {
903
- status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _55 => _55.status]), () => ( "unauthenticated")),
904
- customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _56 => _56.customerId]), () => ( defaultCustomerId)),
905
- userId: _optionalChain([auth, 'optionalAccess', _57 => _57.userId]),
906
- cartHdrUid: _optionalChain([auth, 'optionalAccess', _58 => _58.cartHdrUid])
949
+ status: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _57 => _57.status]), () => ( "unauthenticated")),
950
+ customerId: _nullishCoalesce(_optionalChain([auth, 'optionalAccess', _58 => _58.customerId]), () => ( defaultCustomerId)),
951
+ userId: _optionalChain([auth, 'optionalAccess', _59 => _59.userId]),
952
+ cartHdrUid: _optionalChain([auth, 'optionalAccess', _60 => _60.cartHdrUid])
907
953
  };
908
954
  return _react.createElement.call(void 0, AugurHooksProvider, {
909
955
  api,
@@ -941,6 +987,8 @@ function createSiteHooks(config = {}) {
941
987
  // Hooks -- Joomla
942
988
  useJoomlaContent,
943
989
  useJoomlaContentList,
990
+ useJoomlaMenu,
991
+ useJoomlaMenuDoc,
944
992
  // Hooks -- utilities
945
993
  useDebounce,
946
994
  useFormatPrice
@@ -963,7 +1011,7 @@ function deserialize(data) {
963
1011
 
964
1012
  // src/persistence/apply-limits.ts
965
1013
  function applyLimits(data, limits) {
966
- const queries = _optionalChain([data, 'access', _59 => _59.clientState, 'optionalAccess', _60 => _60.queries]);
1014
+ const queries = _optionalChain([data, 'access', _61 => _61.clientState, 'optionalAccess', _62 => _62.queries]);
967
1015
  if (!queries || Object.keys(limits).length === 0) return data;
968
1016
  const entries = queries;
969
1017
  const unlimited = [];
@@ -1064,7 +1112,7 @@ function useStorageMonitor(config) {
1064
1112
  const raw = storage.getItem(key);
1065
1113
  if (!raw) return;
1066
1114
  const parsed = JSON.parse(raw);
1067
- if (!_optionalChain([parsed, 'access', _61 => _61.clientState, 'optionalAccess', _62 => _62.queries])) return;
1115
+ if (!_optionalChain([parsed, 'access', _63 => _63.clientState, 'optionalAccess', _64 => _64.queries])) return;
1068
1116
  parsed.clientState.queries = parsed.clientState.queries.filter(
1069
1117
  (q) => {
1070
1118
  if (!Array.isArray(q.queryKey)) return true;
@@ -1091,7 +1139,7 @@ function useAugurPersistence(config) {
1091
1139
  setIsMounted(true);
1092
1140
  }, []);
1093
1141
  useStorageMonitor(config);
1094
- const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _63 => _63.env, 'optionalAccess', _64 => _64.NODE_ENV]) === "development";
1142
+ const isDev = typeof process !== "undefined" && _optionalChain([process, 'access', _65 => _65.env, 'optionalAccess', _66 => _66.NODE_ENV]) === "development";
1095
1143
  const { persistableKeys } = config;
1096
1144
  const dehydrateOptions = _react.useMemo.call(void 0, () => ({
1097
1145
  shouldDehydrateQuery: (query) => {
@@ -1174,5 +1222,11 @@ function useAugurPersistence(config) {
1174
1222
 
1175
1223
 
1176
1224
 
1177
- exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.getCartPricingQueryOptions = _chunkIYEN7NGCcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkIYEN7NGCcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkIYEN7NGCcjs.getCategoryItemsInfiniteOptions; exports.getInvMastDocKey = _chunkIYEN7NGCcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkIYEN7NGCcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkIYEN7NGCcjs.getInvMastKey; exports.getInvMastOptions = _chunkIYEN7NGCcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkIYEN7NGCcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkIYEN7NGCcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkIYEN7NGCcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkIYEN7NGCcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkIYEN7NGCcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkIYEN7NGCcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkIYEN7NGCcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkIYEN7NGCcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkIYEN7NGCcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkIYEN7NGCcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkIYEN7NGCcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkIYEN7NGCcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkIYEN7NGCcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkIYEN7NGCcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkIYEN7NGCcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkIYEN7NGCcjs.getJoomlaContentOptions; exports.getProductCategoryKey = _chunkIYEN7NGCcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkIYEN7NGCcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkIYEN7NGCcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkIYEN7NGCcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkIYEN7NGCcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkIYEN7NGCcjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurPersistence = useAugurPersistence; 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.useDebounce = useDebounce; exports.useFormatPrice = useFormatPrice; exports.useInvMast = useInvMast; exports.useInvMastDoc = useInvMastDoc; exports.useInvMastStock = useInvMastStock; 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.usePaginationPrefetch = usePaginationPrefetch; exports.useProductCategory = useProductCategory; exports.useProductSearch = useProductSearch; exports.useSearchSuggestions = useSearchSuggestions; exports.useSetCartHdrUid = useSetCartHdrUid; exports.useSetCartLines = useSetCartLines;
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+ exports.AugurHooksProvider = AugurHooksProvider; exports.createSiteHooks = createSiteHooks; exports.getCartPricingQueryOptions = _chunkQXDTBGFOcjs.getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = _chunkQXDTBGFOcjs.getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = _chunkQXDTBGFOcjs.getCategoryItemsInfiniteOptions; exports.getInvMastDocKey = _chunkQXDTBGFOcjs.getInvMastDocKey; exports.getInvMastDocOptions = _chunkQXDTBGFOcjs.getInvMastDocOptions; exports.getInvMastKey = _chunkQXDTBGFOcjs.getInvMastKey; exports.getInvMastOptions = _chunkQXDTBGFOcjs.getInvMastOptions; exports.getInvMastStockKey = _chunkQXDTBGFOcjs.getInvMastStockKey; exports.getInvMastStockOptions = _chunkQXDTBGFOcjs.getInvMastStockOptions; exports.getItemAttributesKey = _chunkQXDTBGFOcjs.getItemAttributesKey; exports.getItemAttributesOptions = _chunkQXDTBGFOcjs.getItemAttributesOptions; exports.getItemCategoryKey = _chunkQXDTBGFOcjs.getItemCategoryKey; exports.getItemCategoryOptions = _chunkQXDTBGFOcjs.getItemCategoryOptions; exports.getItemDetailsKey = _chunkQXDTBGFOcjs.getItemDetailsKey; exports.getItemDetailsOptions = _chunkQXDTBGFOcjs.getItemDetailsOptions; exports.getItemPriceKey = _chunkQXDTBGFOcjs.getItemPriceKey; exports.getItemPriceOptions = _chunkQXDTBGFOcjs.getItemPriceOptions; exports.getItemSearchInfiniteKey = _chunkQXDTBGFOcjs.getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = _chunkQXDTBGFOcjs.getItemSearchInfiniteOptions; exports.getJoomlaContentKey = _chunkQXDTBGFOcjs.getJoomlaContentKey; exports.getJoomlaContentListKey = _chunkQXDTBGFOcjs.getJoomlaContentListKey; exports.getJoomlaContentListOptions = _chunkQXDTBGFOcjs.getJoomlaContentListOptions; exports.getJoomlaContentOptions = _chunkQXDTBGFOcjs.getJoomlaContentOptions; exports.getJoomlaMenuDocKey = _chunkQXDTBGFOcjs.getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = _chunkQXDTBGFOcjs.getJoomlaMenuDocOptions; exports.getJoomlaMenuKey = _chunkQXDTBGFOcjs.getJoomlaMenuKey; exports.getJoomlaMenuOptions = _chunkQXDTBGFOcjs.getJoomlaMenuOptions; exports.getProductCategoryKey = _chunkQXDTBGFOcjs.getProductCategoryKey; exports.getProductCategoryOptions = _chunkQXDTBGFOcjs.getProductCategoryOptions; exports.getProductSearchKey = _chunkQXDTBGFOcjs.getProductSearchKey; exports.getProductSearchOptions = _chunkQXDTBGFOcjs.getProductSearchOptions; exports.getSearchSuggestionsKey = _chunkQXDTBGFOcjs.getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = _chunkQXDTBGFOcjs.getSearchSuggestionsOptions; exports.useAugurApi = useAugurApi; exports.useAugurApiOptional = useAugurApiOptional; exports.useAugurAuth = useAugurAuth; exports.useAugurCache = useAugurCache; exports.useAugurPersistence = useAugurPersistence; 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.useDebounce = useDebounce; exports.useFormatPrice = useFormatPrice; exports.useInvMast = useInvMast; exports.useInvMastDoc = useInvMastDoc; exports.useInvMastStock = useInvMastStock; 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.usePaginationPrefetch = usePaginationPrefetch; exports.useProductCategory = useProductCategory; exports.useProductSearch = useProductSearch; exports.useSearchSuggestions = useSearchSuggestions; exports.useSetCartHdrUid = useSetCartHdrUid; exports.useSetCartLines = useSetCartLines;
1178
1232
  //# sourceMappingURL=index.cjs.map