@simpleapps-com/augur-hooks 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-AXCNTEAB.cjs +44 -0
- package/dist/chunk-AXCNTEAB.cjs.map +1 -0
- package/dist/{chunk-LCWJOWAC.js → chunk-CL3XM5B5.js} +33 -3
- package/dist/chunk-CL3XM5B5.js.map +1 -0
- package/dist/{chunk-QXDTBGFO.cjs → chunk-I3JHJMQ6.cjs} +32 -2
- package/dist/chunk-I3JHJMQ6.cjs.map +1 -0
- package/dist/chunk-LTBEP4MC.js +44 -0
- package/dist/chunk-LTBEP4MC.js.map +1 -0
- package/dist/{joomla-menu-doc-C0Dcq1eO.d.cts → customer-quotes-SdLKX_-8.d.cts} +31 -1
- package/dist/{joomla-menu-doc-C0Dcq1eO.d.ts → customer-quotes-SdLKX_-8.d.ts} +31 -1
- package/dist/index.cjs +177 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -4
- package/dist/index.d.ts +86 -4
- package/dist/index.js +145 -3
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +14 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +13 -1
- package/dist/use-image-with-fallback-DgmtrGZU.d.cts +17 -0
- package/dist/use-image-with-fallback-DgmtrGZU.d.ts +17 -0
- package/dist/web.cjs +7 -2
- package/dist/web.cjs.map +1 -1
- package/dist/web.d.cts +2 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.js +5 -0
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-LCWJOWAC.js.map +0 -1
- package/dist/chunk-QXDTBGFO.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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 './
|
|
2
|
-
export { e as AugurHooksProvider, f as CacheProvider, g as CacheTierConfig, h as getCartPricingQueryOptions, i as getCategoryItemsInfiniteKey, j as getCategoryItemsInfiniteOptions, k as
|
|
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.cjs';
|
|
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.cjs';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
|
-
import { TCartLine, TItemsFilters, TPriceData, TInvMastDoc, TCategory, TItemDetails, TAttribute, TJoomlaContent, TJoomlaContentFilters, MenuItem, TMenuFilters } from '@simpleapps-com/augur-utils';
|
|
4
|
+
import { TCartLine, TItemsFilters, TPriceData, TInvMastDoc, TCategory, TItemDetails, TAttribute, TJoomlaContent, TJoomlaContentFilters, MenuItem, TMenuFilters, ImageConfig, ImageUrlOptions } from '@simpleapps-com/augur-utils';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { QueryKey } from '@tanstack/react-query';
|
|
7
7
|
import { ReactNode, createElement } from 'react';
|
|
8
|
+
import { u as useImageWithFallback } from './use-image-with-fallback-DgmtrGZU.cjs';
|
|
8
9
|
import * as _tanstack_react_query_persist_client from '@tanstack/react-query-persist-client';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -479,6 +480,78 @@ declare function useJoomlaMenuDoc(menuId: number | string | undefined, options?:
|
|
|
479
480
|
error: Error | null;
|
|
480
481
|
};
|
|
481
482
|
|
|
483
|
+
interface CustomerListResult$2 {
|
|
484
|
+
data: unknown[];
|
|
485
|
+
total: number;
|
|
486
|
+
}
|
|
487
|
+
interface UseCustomerOrdersOptions {
|
|
488
|
+
enabled?: boolean;
|
|
489
|
+
queryFn?: () => Promise<CustomerListResult$2>;
|
|
490
|
+
}
|
|
491
|
+
declare function useCustomerOrders(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerOrdersOptions): {
|
|
492
|
+
orders: unknown[];
|
|
493
|
+
total: number;
|
|
494
|
+
isLoading: boolean;
|
|
495
|
+
error: Error | null;
|
|
496
|
+
};
|
|
497
|
+
interface UseOrderDetailOptions {
|
|
498
|
+
enabled?: boolean;
|
|
499
|
+
queryFn?: () => Promise<unknown>;
|
|
500
|
+
}
|
|
501
|
+
declare function useOrderDetail(customerId: number | string | undefined, orderId: number | string | undefined, options?: UseOrderDetailOptions): {
|
|
502
|
+
order: {} | null;
|
|
503
|
+
isLoading: boolean;
|
|
504
|
+
error: Error | null;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
interface CustomerListResult$1 {
|
|
508
|
+
data: unknown[];
|
|
509
|
+
total: number;
|
|
510
|
+
}
|
|
511
|
+
interface UseCustomerInvoicesOptions {
|
|
512
|
+
enabled?: boolean;
|
|
513
|
+
queryFn?: () => Promise<CustomerListResult$1>;
|
|
514
|
+
}
|
|
515
|
+
declare function useCustomerInvoices(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerInvoicesOptions): {
|
|
516
|
+
invoices: unknown[];
|
|
517
|
+
total: number;
|
|
518
|
+
isLoading: boolean;
|
|
519
|
+
error: Error | null;
|
|
520
|
+
};
|
|
521
|
+
interface UseInvoiceDetailOptions {
|
|
522
|
+
enabled?: boolean;
|
|
523
|
+
queryFn?: () => Promise<unknown>;
|
|
524
|
+
}
|
|
525
|
+
declare function useInvoiceDetail(customerId: number | string | undefined, invoiceNo: number | string | undefined, options?: UseInvoiceDetailOptions): {
|
|
526
|
+
invoice: {} | null;
|
|
527
|
+
isLoading: boolean;
|
|
528
|
+
error: Error | null;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
interface CustomerListResult {
|
|
532
|
+
data: unknown[];
|
|
533
|
+
total: number;
|
|
534
|
+
}
|
|
535
|
+
interface UseCustomerQuotesOptions {
|
|
536
|
+
enabled?: boolean;
|
|
537
|
+
queryFn?: () => Promise<CustomerListResult>;
|
|
538
|
+
}
|
|
539
|
+
declare function useCustomerQuotes(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerQuotesOptions): {
|
|
540
|
+
quotes: unknown[];
|
|
541
|
+
total: number;
|
|
542
|
+
isLoading: boolean;
|
|
543
|
+
error: Error | null;
|
|
544
|
+
};
|
|
545
|
+
interface UseQuoteDetailOptions {
|
|
546
|
+
enabled?: boolean;
|
|
547
|
+
queryFn?: () => Promise<unknown>;
|
|
548
|
+
}
|
|
549
|
+
declare function useQuoteDetail(customerId: number | string | undefined, quoteNo: number | string | undefined, options?: UseQuoteDetailOptions): {
|
|
550
|
+
quote: {} | null;
|
|
551
|
+
isLoading: boolean;
|
|
552
|
+
error: Error | null;
|
|
553
|
+
};
|
|
554
|
+
|
|
482
555
|
/**
|
|
483
556
|
* Factory function that creates a pre-configured provider + hook bundle,
|
|
484
557
|
* eliminating per-hook wrapper boilerplate in consumer sites.
|
|
@@ -511,6 +584,8 @@ interface CreateSiteHooksConfig {
|
|
|
511
584
|
defaultCustomerId?: string | number;
|
|
512
585
|
/** Cache configuration — controls edge and Redis caching per tier. */
|
|
513
586
|
cache?: CacheConfig;
|
|
587
|
+
/** Image CDN configuration for agr.media URL generation. */
|
|
588
|
+
imageConfig?: ImageConfig;
|
|
514
589
|
}
|
|
515
590
|
interface SiteHooksProviderProps {
|
|
516
591
|
/** SDK client instance. Optional when all data fetching is routed through callbacks. */
|
|
@@ -541,8 +616,15 @@ interface SiteHooks {
|
|
|
541
616
|
useJoomlaContentList: typeof useJoomlaContentList;
|
|
542
617
|
useJoomlaMenu: typeof useJoomlaMenu;
|
|
543
618
|
useJoomlaMenuDoc: typeof useJoomlaMenuDoc;
|
|
619
|
+
useCustomerOrders: typeof useCustomerOrders;
|
|
620
|
+
useOrderDetail: typeof useOrderDetail;
|
|
621
|
+
useCustomerInvoices: typeof useCustomerInvoices;
|
|
622
|
+
useInvoiceDetail: typeof useInvoiceDetail;
|
|
623
|
+
useCustomerQuotes: typeof useCustomerQuotes;
|
|
624
|
+
useQuoteDetail: typeof useQuoteDetail;
|
|
544
625
|
useDebounce: typeof useDebounce;
|
|
545
626
|
useFormatPrice: typeof useFormatPrice;
|
|
627
|
+
useImageWithFallback: (imagePath: string | undefined, options?: ImageUrlOptions) => ReturnType<typeof useImageWithFallback>;
|
|
546
628
|
}
|
|
547
629
|
/**
|
|
548
630
|
* Creates a pre-configured provider component and re-exports all hooks.
|
|
@@ -603,4 +685,4 @@ declare function useAugurPersistence(config: PersistenceConfig): {
|
|
|
603
685
|
};
|
|
604
686
|
};
|
|
605
687
|
|
|
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 };
|
|
688
|
+
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.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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 './
|
|
2
|
-
export { e as AugurHooksProvider, f as CacheProvider, g as CacheTierConfig, h as getCartPricingQueryOptions, i as getCategoryItemsInfiniteKey, j as getCategoryItemsInfiniteOptions, k as
|
|
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
|
-
import { TCartLine, TItemsFilters, TPriceData, TInvMastDoc, TCategory, TItemDetails, TAttribute, TJoomlaContent, TJoomlaContentFilters, MenuItem, TMenuFilters } from '@simpleapps-com/augur-utils';
|
|
4
|
+
import { TCartLine, TItemsFilters, TPriceData, TInvMastDoc, TCategory, TItemDetails, TAttribute, TJoomlaContent, TJoomlaContentFilters, MenuItem, TMenuFilters, ImageConfig, ImageUrlOptions } from '@simpleapps-com/augur-utils';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { QueryKey } from '@tanstack/react-query';
|
|
7
7
|
import { ReactNode, createElement } from 'react';
|
|
8
|
+
import { u as useImageWithFallback } from './use-image-with-fallback-DgmtrGZU.js';
|
|
8
9
|
import * as _tanstack_react_query_persist_client from '@tanstack/react-query-persist-client';
|
|
9
10
|
import 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -479,6 +480,78 @@ declare function useJoomlaMenuDoc(menuId: number | string | undefined, options?:
|
|
|
479
480
|
error: Error | null;
|
|
480
481
|
};
|
|
481
482
|
|
|
483
|
+
interface CustomerListResult$2 {
|
|
484
|
+
data: unknown[];
|
|
485
|
+
total: number;
|
|
486
|
+
}
|
|
487
|
+
interface UseCustomerOrdersOptions {
|
|
488
|
+
enabled?: boolean;
|
|
489
|
+
queryFn?: () => Promise<CustomerListResult$2>;
|
|
490
|
+
}
|
|
491
|
+
declare function useCustomerOrders(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerOrdersOptions): {
|
|
492
|
+
orders: unknown[];
|
|
493
|
+
total: number;
|
|
494
|
+
isLoading: boolean;
|
|
495
|
+
error: Error | null;
|
|
496
|
+
};
|
|
497
|
+
interface UseOrderDetailOptions {
|
|
498
|
+
enabled?: boolean;
|
|
499
|
+
queryFn?: () => Promise<unknown>;
|
|
500
|
+
}
|
|
501
|
+
declare function useOrderDetail(customerId: number | string | undefined, orderId: number | string | undefined, options?: UseOrderDetailOptions): {
|
|
502
|
+
order: {} | null;
|
|
503
|
+
isLoading: boolean;
|
|
504
|
+
error: Error | null;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
interface CustomerListResult$1 {
|
|
508
|
+
data: unknown[];
|
|
509
|
+
total: number;
|
|
510
|
+
}
|
|
511
|
+
interface UseCustomerInvoicesOptions {
|
|
512
|
+
enabled?: boolean;
|
|
513
|
+
queryFn?: () => Promise<CustomerListResult$1>;
|
|
514
|
+
}
|
|
515
|
+
declare function useCustomerInvoices(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerInvoicesOptions): {
|
|
516
|
+
invoices: unknown[];
|
|
517
|
+
total: number;
|
|
518
|
+
isLoading: boolean;
|
|
519
|
+
error: Error | null;
|
|
520
|
+
};
|
|
521
|
+
interface UseInvoiceDetailOptions {
|
|
522
|
+
enabled?: boolean;
|
|
523
|
+
queryFn?: () => Promise<unknown>;
|
|
524
|
+
}
|
|
525
|
+
declare function useInvoiceDetail(customerId: number | string | undefined, invoiceNo: number | string | undefined, options?: UseInvoiceDetailOptions): {
|
|
526
|
+
invoice: {} | null;
|
|
527
|
+
isLoading: boolean;
|
|
528
|
+
error: Error | null;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
interface CustomerListResult {
|
|
532
|
+
data: unknown[];
|
|
533
|
+
total: number;
|
|
534
|
+
}
|
|
535
|
+
interface UseCustomerQuotesOptions {
|
|
536
|
+
enabled?: boolean;
|
|
537
|
+
queryFn?: () => Promise<CustomerListResult>;
|
|
538
|
+
}
|
|
539
|
+
declare function useCustomerQuotes(customerId: number | string | undefined, params?: Record<string, unknown>, options?: UseCustomerQuotesOptions): {
|
|
540
|
+
quotes: unknown[];
|
|
541
|
+
total: number;
|
|
542
|
+
isLoading: boolean;
|
|
543
|
+
error: Error | null;
|
|
544
|
+
};
|
|
545
|
+
interface UseQuoteDetailOptions {
|
|
546
|
+
enabled?: boolean;
|
|
547
|
+
queryFn?: () => Promise<unknown>;
|
|
548
|
+
}
|
|
549
|
+
declare function useQuoteDetail(customerId: number | string | undefined, quoteNo: number | string | undefined, options?: UseQuoteDetailOptions): {
|
|
550
|
+
quote: {} | null;
|
|
551
|
+
isLoading: boolean;
|
|
552
|
+
error: Error | null;
|
|
553
|
+
};
|
|
554
|
+
|
|
482
555
|
/**
|
|
483
556
|
* Factory function that creates a pre-configured provider + hook bundle,
|
|
484
557
|
* eliminating per-hook wrapper boilerplate in consumer sites.
|
|
@@ -511,6 +584,8 @@ interface CreateSiteHooksConfig {
|
|
|
511
584
|
defaultCustomerId?: string | number;
|
|
512
585
|
/** Cache configuration — controls edge and Redis caching per tier. */
|
|
513
586
|
cache?: CacheConfig;
|
|
587
|
+
/** Image CDN configuration for agr.media URL generation. */
|
|
588
|
+
imageConfig?: ImageConfig;
|
|
514
589
|
}
|
|
515
590
|
interface SiteHooksProviderProps {
|
|
516
591
|
/** SDK client instance. Optional when all data fetching is routed through callbacks. */
|
|
@@ -541,8 +616,15 @@ interface SiteHooks {
|
|
|
541
616
|
useJoomlaContentList: typeof useJoomlaContentList;
|
|
542
617
|
useJoomlaMenu: typeof useJoomlaMenu;
|
|
543
618
|
useJoomlaMenuDoc: typeof useJoomlaMenuDoc;
|
|
619
|
+
useCustomerOrders: typeof useCustomerOrders;
|
|
620
|
+
useOrderDetail: typeof useOrderDetail;
|
|
621
|
+
useCustomerInvoices: typeof useCustomerInvoices;
|
|
622
|
+
useInvoiceDetail: typeof useInvoiceDetail;
|
|
623
|
+
useCustomerQuotes: typeof useCustomerQuotes;
|
|
624
|
+
useQuoteDetail: typeof useQuoteDetail;
|
|
544
625
|
useDebounce: typeof useDebounce;
|
|
545
626
|
useFormatPrice: typeof useFormatPrice;
|
|
627
|
+
useImageWithFallback: (imagePath: string | undefined, options?: ImageUrlOptions) => ReturnType<typeof useImageWithFallback>;
|
|
546
628
|
}
|
|
547
629
|
/**
|
|
548
630
|
* Creates a pre-configured provider component and re-exports all hooks.
|
|
@@ -603,4 +685,4 @@ declare function useAugurPersistence(config: PersistenceConfig): {
|
|
|
603
685
|
};
|
|
604
686
|
};
|
|
605
687
|
|
|
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 };
|
|
688
|
+
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,10 @@ import {
|
|
|
32
38
|
getProductSearchOptions,
|
|
33
39
|
getSearchSuggestionsKey,
|
|
34
40
|
getSearchSuggestionsOptions
|
|
35
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-CL3XM5B5.js";
|
|
42
|
+
import {
|
|
43
|
+
useImageWithFallback
|
|
44
|
+
} from "./chunk-LTBEP4MC.js";
|
|
36
45
|
|
|
37
46
|
// src/provider.tsx
|
|
38
47
|
import { createContext, useContext } from "react";
|
|
@@ -940,10 +949,115 @@ function useJoomlaMenuDoc(menuId, options = {}) {
|
|
|
940
949
|
};
|
|
941
950
|
}
|
|
942
951
|
|
|
952
|
+
// src/hooks/use-customer-orders.ts
|
|
953
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
954
|
+
function useCustomerOrders(customerId, params, options = {}) {
|
|
955
|
+
const callbacks = useAugurCallbacks();
|
|
956
|
+
const auth = useAugurAuth();
|
|
957
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
958
|
+
const { data, isLoading, error } = useQuery16({
|
|
959
|
+
queryKey: getCustomerOrdersKey(effectiveCustomerId, params),
|
|
960
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerOrders(effectiveCustomerId, params)),
|
|
961
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerOrders)
|
|
962
|
+
});
|
|
963
|
+
return {
|
|
964
|
+
orders: data?.data ?? [],
|
|
965
|
+
total: data?.total ?? 0,
|
|
966
|
+
isLoading,
|
|
967
|
+
error
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function useOrderDetail(customerId, orderId, options = {}) {
|
|
971
|
+
const callbacks = useAugurCallbacks();
|
|
972
|
+
const auth = useAugurAuth();
|
|
973
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
974
|
+
const { data, isLoading, error } = useQuery16({
|
|
975
|
+
queryKey: getCustomerOrderDetailKey(effectiveCustomerId, orderId),
|
|
976
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerOrderDetail(effectiveCustomerId, orderId)),
|
|
977
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!orderId && !!(options.queryFn ?? callbacks?.getCustomerOrderDetail)
|
|
978
|
+
});
|
|
979
|
+
return {
|
|
980
|
+
order: data ?? null,
|
|
981
|
+
isLoading,
|
|
982
|
+
error
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// src/hooks/use-customer-invoices.ts
|
|
987
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
988
|
+
function useCustomerInvoices(customerId, params, options = {}) {
|
|
989
|
+
const callbacks = useAugurCallbacks();
|
|
990
|
+
const auth = useAugurAuth();
|
|
991
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
992
|
+
const { data, isLoading, error } = useQuery17({
|
|
993
|
+
queryKey: getCustomerInvoicesKey(effectiveCustomerId, params),
|
|
994
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerInvoices(effectiveCustomerId, params)),
|
|
995
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerInvoices)
|
|
996
|
+
});
|
|
997
|
+
return {
|
|
998
|
+
invoices: data?.data ?? [],
|
|
999
|
+
total: data?.total ?? 0,
|
|
1000
|
+
isLoading,
|
|
1001
|
+
error
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function useInvoiceDetail(customerId, invoiceNo, options = {}) {
|
|
1005
|
+
const callbacks = useAugurCallbacks();
|
|
1006
|
+
const auth = useAugurAuth();
|
|
1007
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
1008
|
+
const { data, isLoading, error } = useQuery17({
|
|
1009
|
+
queryKey: getCustomerInvoiceDetailKey(effectiveCustomerId, invoiceNo),
|
|
1010
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerInvoiceDetail(
|
|
1011
|
+
effectiveCustomerId,
|
|
1012
|
+
invoiceNo
|
|
1013
|
+
)),
|
|
1014
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!invoiceNo && !!(options.queryFn ?? callbacks?.getCustomerInvoiceDetail)
|
|
1015
|
+
});
|
|
1016
|
+
return {
|
|
1017
|
+
invoice: data ?? null,
|
|
1018
|
+
isLoading,
|
|
1019
|
+
error
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// src/hooks/use-customer-quotes.ts
|
|
1024
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
1025
|
+
function useCustomerQuotes(customerId, params, options = {}) {
|
|
1026
|
+
const callbacks = useAugurCallbacks();
|
|
1027
|
+
const auth = useAugurAuth();
|
|
1028
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
1029
|
+
const { data, isLoading, error } = useQuery18({
|
|
1030
|
+
queryKey: getCustomerQuotesKey(effectiveCustomerId, params),
|
|
1031
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerQuotes(effectiveCustomerId, params)),
|
|
1032
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!(options.queryFn ?? callbacks?.getCustomerQuotes)
|
|
1033
|
+
});
|
|
1034
|
+
return {
|
|
1035
|
+
quotes: data?.data ?? [],
|
|
1036
|
+
total: data?.total ?? 0,
|
|
1037
|
+
isLoading,
|
|
1038
|
+
error
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function useQuoteDetail(customerId, quoteNo, options = {}) {
|
|
1042
|
+
const callbacks = useAugurCallbacks();
|
|
1043
|
+
const auth = useAugurAuth();
|
|
1044
|
+
const effectiveCustomerId = customerId ?? auth?.customerId;
|
|
1045
|
+
const { data, isLoading, error } = useQuery18({
|
|
1046
|
+
queryKey: getCustomerQuoteDetailKey(effectiveCustomerId, quoteNo),
|
|
1047
|
+
queryFn: options.queryFn ?? (() => callbacks.getCustomerQuoteDetail(effectiveCustomerId, quoteNo)),
|
|
1048
|
+
enabled: (options.enabled ?? true) && !!effectiveCustomerId && !!quoteNo && !!(options.queryFn ?? callbacks?.getCustomerQuoteDetail)
|
|
1049
|
+
});
|
|
1050
|
+
return {
|
|
1051
|
+
quote: data ?? null,
|
|
1052
|
+
isLoading,
|
|
1053
|
+
error
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
|
|
943
1057
|
// src/create-site-hooks.ts
|
|
944
1058
|
import { createElement } from "react";
|
|
945
1059
|
function createSiteHooks(config = {}) {
|
|
946
|
-
const { callbacks, defaultCustomerId, cache } = config;
|
|
1060
|
+
const { callbacks, defaultCustomerId, cache, imageConfig } = config;
|
|
947
1061
|
function Provider({ api, auth, children }) {
|
|
948
1062
|
const mergedAuth = {
|
|
949
1063
|
status: auth?.status ?? "unauthenticated",
|
|
@@ -989,9 +1103,25 @@ function createSiteHooks(config = {}) {
|
|
|
989
1103
|
useJoomlaContentList,
|
|
990
1104
|
useJoomlaMenu,
|
|
991
1105
|
useJoomlaMenuDoc,
|
|
1106
|
+
// Hooks -- customer
|
|
1107
|
+
useCustomerOrders,
|
|
1108
|
+
useOrderDetail,
|
|
1109
|
+
useCustomerInvoices,
|
|
1110
|
+
useInvoiceDetail,
|
|
1111
|
+
useCustomerQuotes,
|
|
1112
|
+
useQuoteDetail,
|
|
992
1113
|
// Hooks -- utilities
|
|
993
1114
|
useDebounce,
|
|
994
|
-
useFormatPrice
|
|
1115
|
+
useFormatPrice,
|
|
1116
|
+
// Hooks -- images
|
|
1117
|
+
useImageWithFallback: (imagePath, options) => {
|
|
1118
|
+
if (!imageConfig) {
|
|
1119
|
+
throw new Error(
|
|
1120
|
+
"useImageWithFallback requires imageConfig in createSiteHooks config"
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
return useImageWithFallback(imageConfig, imagePath, options);
|
|
1124
|
+
}
|
|
995
1125
|
};
|
|
996
1126
|
}
|
|
997
1127
|
|
|
@@ -1162,6 +1292,12 @@ export {
|
|
|
1162
1292
|
getCartPricingQueryOptions,
|
|
1163
1293
|
getCategoryItemsInfiniteKey,
|
|
1164
1294
|
getCategoryItemsInfiniteOptions,
|
|
1295
|
+
getCustomerInvoiceDetailKey,
|
|
1296
|
+
getCustomerInvoicesKey,
|
|
1297
|
+
getCustomerOrderDetailKey,
|
|
1298
|
+
getCustomerOrdersKey,
|
|
1299
|
+
getCustomerQuoteDetailKey,
|
|
1300
|
+
getCustomerQuotesKey,
|
|
1165
1301
|
getInvMastDocKey,
|
|
1166
1302
|
getInvMastDocOptions,
|
|
1167
1303
|
getInvMastKey,
|
|
@@ -1207,11 +1343,15 @@ export {
|
|
|
1207
1343
|
useCartStore,
|
|
1208
1344
|
useCategoryItemsInfinite,
|
|
1209
1345
|
useClearCart,
|
|
1346
|
+
useCustomerInvoices,
|
|
1347
|
+
useCustomerOrders,
|
|
1348
|
+
useCustomerQuotes,
|
|
1210
1349
|
useDebounce,
|
|
1211
1350
|
useFormatPrice,
|
|
1212
1351
|
useInvMast,
|
|
1213
1352
|
useInvMastDoc,
|
|
1214
1353
|
useInvMastStock,
|
|
1354
|
+
useInvoiceDetail,
|
|
1215
1355
|
useItemAttributes,
|
|
1216
1356
|
useItemCategory,
|
|
1217
1357
|
useItemDetails,
|
|
@@ -1222,9 +1362,11 @@ export {
|
|
|
1222
1362
|
useJoomlaContentList,
|
|
1223
1363
|
useJoomlaMenu,
|
|
1224
1364
|
useJoomlaMenuDoc,
|
|
1365
|
+
useOrderDetail,
|
|
1225
1366
|
usePaginationPrefetch,
|
|
1226
1367
|
useProductCategory,
|
|
1227
1368
|
useProductSearch,
|
|
1369
|
+
useQuoteDetail,
|
|
1228
1370
|
useSearchSuggestions,
|
|
1229
1371
|
useSetCartHdrUid,
|
|
1230
1372
|
useSetCartLines
|