@simpleapps-com/augur-hooks 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GetItemCategoryApiOptions, P as PageData, S as SearchSuggestionsResponse, a as SearchSuggestion, I as InfiniteScrollPage, A as AugurCallbacks, C as CacheConfig, b as AugurApiClient, c as AugurAuthContext, d as PersistenceConfig } from './joomla-menu-doc-C0Dcq1eO.js';
2
- export { e as AugurHooksProvider, f as CacheProvider, g as CacheTierConfig, h as getCartPricingQueryOptions, i as getCategoryItemsInfiniteKey, j as getCategoryItemsInfiniteOptions, k as getInvMastDocKey, l as getInvMastDocOptions, m as getInvMastKey, n as getInvMastOptions, o as getInvMastStockKey, p as getInvMastStockOptions, q as getItemAttributesKey, r as getItemAttributesOptions, s as getItemCategoryKey, t as getItemCategoryOptions, u as getItemDetailsKey, v as getItemDetailsOptions, w as getItemPriceKey, x as getItemPriceOptions, y as getItemSearchInfiniteKey, z as getItemSearchInfiniteOptions, B as getJoomlaContentKey, D as getJoomlaContentListKey, E as getJoomlaContentListOptions, F as getJoomlaContentOptions, H as getJoomlaMenuDocKey, J as getJoomlaMenuDocOptions, K as getJoomlaMenuKey, L as getJoomlaMenuOptions, M as getProductCategoryKey, N as getProductCategoryOptions, O as getProductSearchKey, Q as getProductSearchOptions, R as getSearchSuggestionsKey, T as getSearchSuggestionsOptions, U as useAugurApi, V as useAugurApiOptional, W as useAugurAuth, X as useAugurCache } from './joomla-menu-doc-C0Dcq1eO.js';
1
+ import { G as GetItemCategoryApiOptions, P as PageData, S as SearchSuggestionsResponse, a as SearchSuggestion, I as InfiniteScrollPage, A as AugurCallbacks, C as CacheConfig, b as AugurApiClient, c as AugurAuthContext, d as PersistenceConfig } from './customer-quotes-SdLKX_-8.js';
2
+ export { e as AugurHooksProvider, f as CacheProvider, g as CacheTierConfig, h as getCartPricingQueryOptions, i as getCategoryItemsInfiniteKey, j as getCategoryItemsInfiniteOptions, k as getCustomerInvoiceDetailKey, l as getCustomerInvoicesKey, m as getCustomerOrderDetailKey, n as getCustomerOrdersKey, o as getCustomerQuoteDetailKey, p as getCustomerQuotesKey, q as getInvMastDocKey, r as getInvMastDocOptions, s as getInvMastKey, t as getInvMastOptions, u as getInvMastStockKey, v as getInvMastStockOptions, w as getItemAttributesKey, x as getItemAttributesOptions, y as getItemCategoryKey, z as getItemCategoryOptions, B as getItemDetailsKey, D as getItemDetailsOptions, E as getItemPriceKey, F as getItemPriceOptions, H as getItemSearchInfiniteKey, J as getItemSearchInfiniteOptions, K as getJoomlaContentKey, L as getJoomlaContentListKey, M as getJoomlaContentListOptions, N as getJoomlaContentOptions, O as getJoomlaMenuDocKey, Q as getJoomlaMenuDocOptions, R as getJoomlaMenuKey, T as getJoomlaMenuOptions, U as getProductCategoryKey, V as getProductCategoryOptions, W as getProductSearchKey, X as getProductSearchOptions, Y as getSearchSuggestionsKey, Z as getSearchSuggestionsOptions, _ as useAugurApi, $ as useAugurApiOptional, a0 as useAugurAuth, a1 as useAugurCache } from './customer-quotes-SdLKX_-8.js';
3
3
  import * as zustand from 'zustand';
4
4
  import { TCartLine, TItemsFilters, TPriceData, TInvMastDoc, TCategory, TItemDetails, TAttribute, TJoomlaContent, TJoomlaContentFilters, MenuItem, TMenuFilters } from '@simpleapps-com/augur-utils';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
@@ -479,6 +479,78 @@ declare function useJoomlaMenuDoc(menuId: number | string | undefined, options?:
479
479
  error: Error | null;
480
480
  };
481
481
 
482
+ interface CustomerListResult$2 {
483
+ data: unknown[];
484
+ total: number;
485
+ }
486
+ interface UseCustomerOrdersOptions {
487
+ enabled?: boolean;
488
+ queryFn?: () => Promise<CustomerListResult$2>;
489
+ }
490
+ declare function useCustomerOrders(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerOrdersOptions): {
491
+ orders: unknown[];
492
+ total: number;
493
+ isLoading: boolean;
494
+ error: Error | null;
495
+ };
496
+ interface UseOrderDetailOptions {
497
+ enabled?: boolean;
498
+ queryFn?: () => Promise<unknown>;
499
+ }
500
+ declare function useOrderDetail(customerId: number | string | undefined, orderId: number | string | undefined, options?: UseOrderDetailOptions): {
501
+ order: {} | null;
502
+ isLoading: boolean;
503
+ error: Error | null;
504
+ };
505
+
506
+ interface CustomerListResult$1 {
507
+ data: unknown[];
508
+ total: number;
509
+ }
510
+ interface UseCustomerInvoicesOptions {
511
+ enabled?: boolean;
512
+ queryFn?: () => Promise<CustomerListResult$1>;
513
+ }
514
+ declare function useCustomerInvoices(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerInvoicesOptions): {
515
+ invoices: unknown[];
516
+ total: number;
517
+ isLoading: boolean;
518
+ error: Error | null;
519
+ };
520
+ interface UseInvoiceDetailOptions {
521
+ enabled?: boolean;
522
+ queryFn?: () => Promise<unknown>;
523
+ }
524
+ declare function useInvoiceDetail(customerId: number | string | undefined, invoiceNo: number | string | undefined, options?: UseInvoiceDetailOptions): {
525
+ invoice: {} | null;
526
+ isLoading: boolean;
527
+ error: Error | null;
528
+ };
529
+
530
+ interface CustomerListResult {
531
+ data: unknown[];
532
+ total: number;
533
+ }
534
+ interface UseCustomerQuotesOptions {
535
+ enabled?: boolean;
536
+ queryFn?: () => Promise<CustomerListResult>;
537
+ }
538
+ declare function useCustomerQuotes(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerQuotesOptions): {
539
+ quotes: unknown[];
540
+ total: number;
541
+ isLoading: boolean;
542
+ error: Error | null;
543
+ };
544
+ interface UseQuoteDetailOptions {
545
+ enabled?: boolean;
546
+ queryFn?: () => Promise<unknown>;
547
+ }
548
+ declare function useQuoteDetail(customerId: number | string | undefined, quoteNo: number | string | undefined, options?: UseQuoteDetailOptions): {
549
+ quote: {} | null;
550
+ isLoading: boolean;
551
+ error: Error | null;
552
+ };
553
+
482
554
  /**
483
555
  * Factory function that creates a pre-configured provider + hook bundle,
484
556
  * eliminating per-hook wrapper boilerplate in consumer sites.
@@ -541,6 +613,12 @@ interface SiteHooks {
541
613
  useJoomlaContentList: typeof useJoomlaContentList;
542
614
  useJoomlaMenu: typeof useJoomlaMenu;
543
615
  useJoomlaMenuDoc: typeof useJoomlaMenuDoc;
616
+ useCustomerOrders: typeof useCustomerOrders;
617
+ useOrderDetail: typeof useOrderDetail;
618
+ useCustomerInvoices: typeof useCustomerInvoices;
619
+ useInvoiceDetail: typeof useInvoiceDetail;
620
+ useCustomerQuotes: typeof useCustomerQuotes;
621
+ useQuoteDetail: typeof useQuoteDetail;
544
622
  useDebounce: typeof useDebounce;
545
623
  useFormatPrice: typeof useFormatPrice;
546
624
  }
@@ -603,4 +681,4 @@ declare function useAugurPersistence(config: PersistenceConfig): {
603
681
  };
604
682
  };
605
683
 
606
- export { AugurApiClient, AugurAuthContext, AugurCallbacks, CacheConfig, type CartActionCallbacks, type CartInitCallbacks, type CartPriceData, type CartPricingResult, type CartSessionInfo, type CreateSiteHooksConfig, GetItemCategoryApiOptions, InfiniteScrollPage, PageData, PersistenceConfig, SearchSuggestion, SearchSuggestionsResponse, createSiteHooks, useAugurPersistence, useCartActions, useCartHdrUid, useCartInitialization, useCartLineCount, useCartLines, useCartPricing, useCartQuantityTotal, useCartStore, useCategoryItemsInfinite, useClearCart, useDebounce, useFormatPrice, useInvMast, useInvMastDoc, useInvMastStock, useItemAttributes, useItemCategory, useItemDetails, useItemFiltersStore, useItemPrice, useItemSearchInfinite, useJoomlaContent, useJoomlaContentList, useJoomlaMenu, useJoomlaMenuDoc, usePaginationPrefetch, useProductCategory, useProductSearch, useSearchSuggestions, useSetCartHdrUid, useSetCartLines };
684
+ export { AugurApiClient, AugurAuthContext, AugurCallbacks, CacheConfig, type CartActionCallbacks, type CartInitCallbacks, type CartPriceData, type CartPricingResult, type CartSessionInfo, type CreateSiteHooksConfig, GetItemCategoryApiOptions, InfiniteScrollPage, PageData, PersistenceConfig, SearchSuggestion, SearchSuggestionsResponse, createSiteHooks, useAugurPersistence, useCartActions, useCartHdrUid, useCartInitialization, useCartLineCount, useCartLines, useCartPricing, useCartQuantityTotal, useCartStore, useCategoryItemsInfinite, useClearCart, useCustomerInvoices, useCustomerOrders, useCustomerQuotes, useDebounce, useFormatPrice, useInvMast, useInvMastDoc, useInvMastStock, useInvoiceDetail, useItemAttributes, useItemCategory, useItemDetails, useItemFiltersStore, useItemPrice, useItemSearchInfinite, useJoomlaContent, useJoomlaContentList, useJoomlaMenu, useJoomlaMenuDoc, useOrderDetail, usePaginationPrefetch, useProductCategory, useProductSearch, useQuoteDetail, useSearchSuggestions, useSetCartHdrUid, useSetCartLines };
package/dist/index.js CHANGED
@@ -2,6 +2,12 @@ import {
2
2
  getCartPricingQueryOptions,
3
3
  getCategoryItemsInfiniteKey,
4
4
  getCategoryItemsInfiniteOptions,
5
+ getCustomerInvoiceDetailKey,
6
+ getCustomerInvoicesKey,
7
+ getCustomerOrderDetailKey,
8
+ getCustomerOrdersKey,
9
+ getCustomerQuoteDetailKey,
10
+ getCustomerQuotesKey,
5
11
  getInvMastDocKey,
6
12
  getInvMastDocOptions,
7
13
  getInvMastKey,
@@ -32,7 +38,7 @@ import {
32
38
  getProductSearchOptions,
33
39
  getSearchSuggestionsKey,
34
40
  getSearchSuggestionsOptions
35
- } from "./chunk-LCWJOWAC.js";
41
+ } from "./chunk-CL3XM5B5.js";
36
42
 
37
43
  // src/provider.tsx
38
44
  import { createContext, useContext } from "react";
@@ -940,6 +946,111 @@ function useJoomlaMenuDoc(menuId, options = {}) {
940
946
  };
941
947
  }
942
948
 
949
+ // src/hooks/use-customer-orders.ts
950
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
951
+ function useCustomerOrders(customerId, params, options = {}) {
952
+ const callbacks = useAugurCallbacks();
953
+ const auth = useAugurAuth();
954
+ const effectiveCustomerId = customerId ?? auth?.customerId;
955
+ const { data, isLoading, error } = useQuery16({
956
+ queryKey: getCustomerOrdersKey(effectiveCustomerId, params),
957
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerOrders(effectiveCustomerId, params)),
958
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerOrders)
959
+ });
960
+ return {
961
+ orders: data?.data ?? [],
962
+ total: data?.total ?? 0,
963
+ isLoading,
964
+ error
965
+ };
966
+ }
967
+ function useOrderDetail(customerId, orderId, options = {}) {
968
+ const callbacks = useAugurCallbacks();
969
+ const auth = useAugurAuth();
970
+ const effectiveCustomerId = customerId ?? auth?.customerId;
971
+ const { data, isLoading, error } = useQuery16({
972
+ queryKey: getCustomerOrderDetailKey(effectiveCustomerId, orderId),
973
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)),
974
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!orderId && !!(options.queryFn ?? callbacks?.getCustomerOrderDetail)
975
+ });
976
+ return {
977
+ order: data ?? null,
978
+ isLoading,
979
+ error
980
+ };
981
+ }
982
+
983
+ // src/hooks/use-customer-invoices.ts
984
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
985
+ function useCustomerInvoices(customerId, params, options = {}) {
986
+ const callbacks = useAugurCallbacks();
987
+ const auth = useAugurAuth();
988
+ const effectiveCustomerId = customerId ?? auth?.customerId;
989
+ const { data, isLoading, error } = useQuery17({
990
+ queryKey: getCustomerInvoicesKey(effectiveCustomerId, params),
991
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)),
992
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerInvoices)
993
+ });
994
+ return {
995
+ invoices: data?.data ?? [],
996
+ total: data?.total ?? 0,
997
+ isLoading,
998
+ error
999
+ };
1000
+ }
1001
+ function useInvoiceDetail(customerId, invoiceNo, options = {}) {
1002
+ const callbacks = useAugurCallbacks();
1003
+ const auth = useAugurAuth();
1004
+ const effectiveCustomerId = customerId ?? auth?.customerId;
1005
+ const { data, isLoading, error } = useQuery17({
1006
+ queryKey: getCustomerInvoiceDetailKey(effectiveCustomerId, invoiceNo),
1007
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerInvoiceDetail(
1008
+ effectiveCustomerId,
1009
+ invoiceNo
1010
+ )),
1011
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!invoiceNo && !!(options.queryFn ?? callbacks?.getCustomerInvoiceDetail)
1012
+ });
1013
+ return {
1014
+ invoice: data ?? null,
1015
+ isLoading,
1016
+ error
1017
+ };
1018
+ }
1019
+
1020
+ // src/hooks/use-customer-quotes.ts
1021
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
1022
+ function useCustomerQuotes(customerId, params, options = {}) {
1023
+ const callbacks = useAugurCallbacks();
1024
+ const auth = useAugurAuth();
1025
+ const effectiveCustomerId = customerId ?? auth?.customerId;
1026
+ const { data, isLoading, error } = useQuery18({
1027
+ queryKey: getCustomerQuotesKey(effectiveCustomerId, params),
1028
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)),
1029
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerQuotes)
1030
+ });
1031
+ return {
1032
+ quotes: data?.data ?? [],
1033
+ total: data?.total ?? 0,
1034
+ isLoading,
1035
+ error
1036
+ };
1037
+ }
1038
+ function useQuoteDetail(customerId, quoteNo, options = {}) {
1039
+ const callbacks = useAugurCallbacks();
1040
+ const auth = useAugurAuth();
1041
+ const effectiveCustomerId = customerId ?? auth?.customerId;
1042
+ const { data, isLoading, error } = useQuery18({
1043
+ queryKey: getCustomerQuoteDetailKey(effectiveCustomerId, quoteNo),
1044
+ queryFn: options.queryFn ?? (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)),
1045
+ enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!quoteNo && !!(options.queryFn ?? callbacks?.getCustomerQuoteDetail)
1046
+ });
1047
+ return {
1048
+ quote: data ?? null,
1049
+ isLoading,
1050
+ error
1051
+ };
1052
+ }
1053
+
943
1054
  // src/create-site-hooks.ts
944
1055
  import { createElement } from "react";
945
1056
  function createSiteHooks(config = {}) {
@@ -989,6 +1100,13 @@ function createSiteHooks(config = {}) {
989
1100
  useJoomlaContentList,
990
1101
  useJoomlaMenu,
991
1102
  useJoomlaMenuDoc,
1103
+ // Hooks -- customer
1104
+ useCustomerOrders,
1105
+ useOrderDetail,
1106
+ useCustomerInvoices,
1107
+ useInvoiceDetail,
1108
+ useCustomerQuotes,
1109
+ useQuoteDetail,
992
1110
  // Hooks -- utilities
993
1111
  useDebounce,
994
1112
  useFormatPrice
@@ -1162,6 +1280,12 @@ export {
1162
1280
  getCartPricingQueryOptions,
1163
1281
  getCategoryItemsInfiniteKey,
1164
1282
  getCategoryItemsInfiniteOptions,
1283
+ getCustomerInvoiceDetailKey,
1284
+ getCustomerInvoicesKey,
1285
+ getCustomerOrderDetailKey,
1286
+ getCustomerOrdersKey,
1287
+ getCustomerQuoteDetailKey,
1288
+ getCustomerQuotesKey,
1165
1289
  getInvMastDocKey,
1166
1290
  getInvMastDocOptions,
1167
1291
  getInvMastKey,
@@ -1207,11 +1331,15 @@ export {
1207
1331
  useCartStore,
1208
1332
  useCategoryItemsInfinite,
1209
1333
  useClearCart,
1334
+ useCustomerInvoices,
1335
+ useCustomerOrders,
1336
+ useCustomerQuotes,
1210
1337
  useDebounce,
1211
1338
  useFormatPrice,
1212
1339
  useInvMast,
1213
1340
  useInvMastDoc,
1214
1341
  useInvMastStock,
1342
+ useInvoiceDetail,
1215
1343
  useItemAttributes,
1216
1344
  useItemCategory,
1217
1345
  useItemDetails,
@@ -1222,9 +1350,11 @@ export {
1222
1350
  useJoomlaContentList,
1223
1351
  useJoomlaMenu,
1224
1352
  useJoomlaMenuDoc,
1353
+ useOrderDetail,
1225
1354
  usePaginationPrefetch,
1226
1355
  useProductCategory,
1227
1356
  useProductSearch,
1357
+ useQuoteDetail,
1228
1358
  useSearchSuggestions,
1229
1359
  useSetCartHdrUid,
1230
1360
  useSetCartLines