@behio/storefront-sdk 0.2.0 → 0.3.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/README.md +67 -1340
- package/dist/{chunk-EFFPOXWL.mjs → chunk-45FTJKSW.mjs} +19 -0
- package/dist/{chunk-R7H7E5BX.js → chunk-ZEPWNT56.js} +19 -0
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +51 -2
- package/dist/react.d.ts +51 -2
- package/dist/react.js +92 -27
- package/dist/react.mjs +111 -46
- package/package.json +1 -1
|
@@ -107,6 +107,7 @@ var BehioStorefront = class {
|
|
|
107
107
|
this.returns = new ReturnsModule(this);
|
|
108
108
|
this.consent = new ConsentModule(this);
|
|
109
109
|
this.quotes = new QuotesModule(this);
|
|
110
|
+
this.addresses = new AddressModule(this);
|
|
110
111
|
}
|
|
111
112
|
// --- Public methods ---
|
|
112
113
|
/** Get basic shop info */
|
|
@@ -753,6 +754,24 @@ var QuotesModule = class {
|
|
|
753
754
|
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
754
755
|
}
|
|
755
756
|
};
|
|
757
|
+
var AddressModule = class {
|
|
758
|
+
constructor(client) {
|
|
759
|
+
this.client = client;
|
|
760
|
+
}
|
|
761
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
762
|
+
async autocomplete(query, country) {
|
|
763
|
+
if (!query || query.length < 2) return { suggestions: [] };
|
|
764
|
+
return this.client.request("GET", "/addresses/autocomplete", {
|
|
765
|
+
query: { q: query, country }
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/** Get full structured address from a suggestion's placeId */
|
|
769
|
+
async getDetail(placeId) {
|
|
770
|
+
return this.client.request("GET", "/addresses/place-detail", {
|
|
771
|
+
query: { placeId }
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
756
775
|
|
|
757
776
|
export {
|
|
758
777
|
ProductSort,
|
|
@@ -107,6 +107,7 @@ var BehioStorefront = class {
|
|
|
107
107
|
this.returns = new ReturnsModule(this);
|
|
108
108
|
this.consent = new ConsentModule(this);
|
|
109
109
|
this.quotes = new QuotesModule(this);
|
|
110
|
+
this.addresses = new AddressModule(this);
|
|
110
111
|
}
|
|
111
112
|
// --- Public methods ---
|
|
112
113
|
/** Get basic shop info */
|
|
@@ -753,6 +754,24 @@ var QuotesModule = class {
|
|
|
753
754
|
return this.client.request("GET", `/quotes/${quoteId}`);
|
|
754
755
|
}
|
|
755
756
|
};
|
|
757
|
+
var AddressModule = class {
|
|
758
|
+
constructor(client) {
|
|
759
|
+
this.client = client;
|
|
760
|
+
}
|
|
761
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
762
|
+
async autocomplete(query, country) {
|
|
763
|
+
if (!query || query.length < 2) return { suggestions: [] };
|
|
764
|
+
return this.client.request("GET", "/addresses/autocomplete", {
|
|
765
|
+
query: { q: query, country }
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/** Get full structured address from a suggestion's placeId */
|
|
769
|
+
async getDetail(placeId) {
|
|
770
|
+
return this.client.request("GET", "/addresses/place-detail", {
|
|
771
|
+
query: { placeId }
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
};
|
|
756
775
|
|
|
757
776
|
|
|
758
777
|
|
package/dist/index.d.mts
CHANGED
|
@@ -571,6 +571,7 @@ declare class BehioStorefront {
|
|
|
571
571
|
readonly returns: ReturnsModule;
|
|
572
572
|
readonly consent: ConsentModule;
|
|
573
573
|
readonly quotes: QuotesModule;
|
|
574
|
+
readonly addresses: AddressModule;
|
|
574
575
|
/** Get basic shop info */
|
|
575
576
|
getShopInfo(): Promise<ShopInfo>;
|
|
576
577
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -823,5 +824,35 @@ declare class QuotesModule {
|
|
|
823
824
|
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
824
825
|
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
825
826
|
}
|
|
827
|
+
interface AddressSuggestion {
|
|
828
|
+
placeId: string;
|
|
829
|
+
description: string;
|
|
830
|
+
street: string;
|
|
831
|
+
city: string;
|
|
832
|
+
zip: string;
|
|
833
|
+
country: string;
|
|
834
|
+
countryCode: string;
|
|
835
|
+
}
|
|
836
|
+
interface AddressDetail {
|
|
837
|
+
street: string;
|
|
838
|
+
streetNumber: string;
|
|
839
|
+
city: string;
|
|
840
|
+
zip: string;
|
|
841
|
+
country: string;
|
|
842
|
+
countryCode: string;
|
|
843
|
+
formattedAddress: string;
|
|
844
|
+
lat: number;
|
|
845
|
+
lng: number;
|
|
846
|
+
}
|
|
847
|
+
declare class AddressModule {
|
|
848
|
+
private client;
|
|
849
|
+
constructor(client: BehioStorefront);
|
|
850
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
851
|
+
autocomplete(query: string, country: string): Promise<{
|
|
852
|
+
suggestions: AddressSuggestion[];
|
|
853
|
+
}>;
|
|
854
|
+
/** Get full structured address from a suggestion's placeId */
|
|
855
|
+
getDetail(placeId: string): Promise<AddressDetail>;
|
|
856
|
+
}
|
|
826
857
|
|
|
827
|
-
export { type ActivePromotion, type AddToCartInput, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
|
858
|
+
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
package/dist/index.d.ts
CHANGED
|
@@ -571,6 +571,7 @@ declare class BehioStorefront {
|
|
|
571
571
|
readonly returns: ReturnsModule;
|
|
572
572
|
readonly consent: ConsentModule;
|
|
573
573
|
readonly quotes: QuotesModule;
|
|
574
|
+
readonly addresses: AddressModule;
|
|
574
575
|
/** Get basic shop info */
|
|
575
576
|
getShopInfo(): Promise<ShopInfo>;
|
|
576
577
|
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
@@ -823,5 +824,35 @@ declare class QuotesModule {
|
|
|
823
824
|
accept(quoteId: string, email: string): Promise<QuoteRequest>;
|
|
824
825
|
getStatus(quoteId: string): Promise<QuoteRequest>;
|
|
825
826
|
}
|
|
827
|
+
interface AddressSuggestion {
|
|
828
|
+
placeId: string;
|
|
829
|
+
description: string;
|
|
830
|
+
street: string;
|
|
831
|
+
city: string;
|
|
832
|
+
zip: string;
|
|
833
|
+
country: string;
|
|
834
|
+
countryCode: string;
|
|
835
|
+
}
|
|
836
|
+
interface AddressDetail {
|
|
837
|
+
street: string;
|
|
838
|
+
streetNumber: string;
|
|
839
|
+
city: string;
|
|
840
|
+
zip: string;
|
|
841
|
+
country: string;
|
|
842
|
+
countryCode: string;
|
|
843
|
+
formattedAddress: string;
|
|
844
|
+
lat: number;
|
|
845
|
+
lng: number;
|
|
846
|
+
}
|
|
847
|
+
declare class AddressModule {
|
|
848
|
+
private client;
|
|
849
|
+
constructor(client: BehioStorefront);
|
|
850
|
+
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
851
|
+
autocomplete(query: string, country: string): Promise<{
|
|
852
|
+
suggestions: AddressSuggestion[];
|
|
853
|
+
}>;
|
|
854
|
+
/** Get full structured address from a suggestion's placeId */
|
|
855
|
+
getDetail(placeId: string): Promise<AddressDetail>;
|
|
856
|
+
}
|
|
826
857
|
|
|
827
|
-
export { type ActivePromotion, type AddToCartInput, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
|
858
|
+
export { type ActivePromotion, type AddToCartInput, type AddressDetail, type AddressSuggestion, type AddressType, AddressTypes, type AuthTokens, BehioApiError, type BehioErrorCode, type BehioEventHandler, type BehioEventType, BehioNetworkError, BehioStorefront, type BehioStorefrontConfig, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type CartItemProduct, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, type CustomerAddress, type CustomerProfile, type DataGroupFieldType, type FilterField, type FulfillmentStatus, FulfillmentStatuses, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type OrderStatusHistory, OrderStatuses, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, PaymentStatuses, type ProductDetail, type ProductLabel, type ProductListItem, type ProductPrice, type ProductReview, type ProductReviewsResponse, ProductSort, type ProductSortValue, type ProductVariant, type ProductVolumePrice, type ProductsQuery, type QuoteRequest, type RegisterInput, type RequestInterceptor, type RequestInterceptorConfig, type ResponseInterceptor, type ResponseInterceptorData, type ReturnRequest, type ShopInfo, type ShopSeo, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type WishlistItem };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkZEPWNT56js = require('./chunk-ZEPWNT56.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,4 +17,4 @@ var _chunkR7H7E5BXjs = require('./chunk-R7H7E5BX.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.AddressTypes =
|
|
20
|
+
exports.AddressTypes = _chunkZEPWNT56js.AddressTypes; exports.BehioApiError = _chunkZEPWNT56js.BehioApiError; exports.BehioNetworkError = _chunkZEPWNT56js.BehioNetworkError; exports.BehioStorefront = _chunkZEPWNT56js.BehioStorefront; exports.FulfillmentStatuses = _chunkZEPWNT56js.FulfillmentStatuses; exports.OrderStatuses = _chunkZEPWNT56js.OrderStatuses; exports.PaymentStatuses = _chunkZEPWNT56js.PaymentStatuses; exports.ProductSort = _chunkZEPWNT56js.ProductSort;
|
package/dist/index.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
-
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput } from './index.mjs';
|
|
4
|
+
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput } from './index.mjs';
|
|
5
5
|
export { AddToCartInput, AuthTokens, BehioApiError, BundleItem, CartDiscount, CartItem, CheckoutAddress, FulfillmentStatus, LoginInput, MessageResponse, OrderItem, OrderStatus, PaymentStatus, ProductPrice, ProductReview, ProductVariant } from './index.mjs';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
|
|
@@ -196,6 +196,55 @@ declare function useAddresses(options?: UseAddressesOptions): {
|
|
|
196
196
|
isDeleting: boolean;
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
+
interface UseAddressAutocompleteOptions {
|
|
200
|
+
/** Country code (ISO 3166-1 alpha-2) — required */
|
|
201
|
+
country: string;
|
|
202
|
+
/** Debounce delay in ms (default: 300) */
|
|
203
|
+
debounce?: number;
|
|
204
|
+
/** Minimum characters before searching (default: 3) */
|
|
205
|
+
minChars?: number;
|
|
206
|
+
/** Disable the hook */
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
}
|
|
209
|
+
interface UseAddressAutocompleteReturn {
|
|
210
|
+
/** Current input value — bind to input's value */
|
|
211
|
+
query: string;
|
|
212
|
+
/** Update handler — bind to input's onChange */
|
|
213
|
+
setQuery: (value: string) => void;
|
|
214
|
+
/** Address suggestions from Google Places */
|
|
215
|
+
suggestions: AddressSuggestion[];
|
|
216
|
+
/** Loading state */
|
|
217
|
+
isLoading: boolean;
|
|
218
|
+
/** Select a suggestion — fetches full structured address */
|
|
219
|
+
select: (placeId: string) => Promise<AddressDetail>;
|
|
220
|
+
/** The selected structured address (after select()) */
|
|
221
|
+
selected: AddressDetail | null;
|
|
222
|
+
/** Whether a selection is being resolved */
|
|
223
|
+
isSelecting: boolean;
|
|
224
|
+
/** Clear suggestions and selected */
|
|
225
|
+
clear: () => void;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Debounced address autocomplete hook.
|
|
229
|
+
*
|
|
230
|
+
* Usage:
|
|
231
|
+
* ```tsx
|
|
232
|
+
* const { query, setQuery, suggestions, select, selected } = useAddressAutocomplete({
|
|
233
|
+
* country: 'CZ',
|
|
234
|
+
* debounce: 300,
|
|
235
|
+
* });
|
|
236
|
+
*
|
|
237
|
+
* <input value={query} onChange={e => setQuery(e.target.value)} />
|
|
238
|
+
* {suggestions.map(s => (
|
|
239
|
+
* <div key={s.placeId} onClick={() => select(s.placeId)}>
|
|
240
|
+
* {s.description}
|
|
241
|
+
* </div>
|
|
242
|
+
* ))}
|
|
243
|
+
* // After select: selected.street, selected.city, selected.zip
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
declare function useAddressAutocomplete(options: UseAddressAutocompleteOptions): UseAddressAutocompleteReturn;
|
|
247
|
+
|
|
199
248
|
interface UseOrdersOptions {
|
|
200
249
|
page?: number;
|
|
201
250
|
limit?: number;
|
|
@@ -802,4 +851,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
802
851
|
*/
|
|
803
852
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
804
853
|
|
|
805
|
-
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
854
|
+
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
-
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput } from './index.js';
|
|
4
|
+
import { BehioStorefront, ProductsQuery, PaginatedResponse, ProductListItem, ProductDetail, Category, CategoryDetail, ProductLabel, FilterField, Cart, CustomerProfile, RegisterInput, CustomerAddress, AddressSuggestion, AddressDetail, OrderListItem, OrderDetail, CheckoutInput, PageDetail, Page, ShopInfo, ShopSeo, Bundle, CrossSellItem, ActivePromotion, GiftCardBalance, WishlistItem, ProductReviewsResponse, SubmitReviewInput, ReturnRequest, SubmitReturnInput, CookieConsent, CookieConsentInput, QuoteRequest, SubmitQuoteInput } from './index.js';
|
|
5
5
|
export { AddToCartInput, AuthTokens, BehioApiError, BundleItem, CartDiscount, CartItem, CheckoutAddress, FulfillmentStatus, LoginInput, MessageResponse, OrderItem, OrderStatus, PaymentStatus, ProductPrice, ProductReview, ProductVariant } from './index.js';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
7
|
|
|
@@ -196,6 +196,55 @@ declare function useAddresses(options?: UseAddressesOptions): {
|
|
|
196
196
|
isDeleting: boolean;
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
+
interface UseAddressAutocompleteOptions {
|
|
200
|
+
/** Country code (ISO 3166-1 alpha-2) — required */
|
|
201
|
+
country: string;
|
|
202
|
+
/** Debounce delay in ms (default: 300) */
|
|
203
|
+
debounce?: number;
|
|
204
|
+
/** Minimum characters before searching (default: 3) */
|
|
205
|
+
minChars?: number;
|
|
206
|
+
/** Disable the hook */
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
}
|
|
209
|
+
interface UseAddressAutocompleteReturn {
|
|
210
|
+
/** Current input value — bind to input's value */
|
|
211
|
+
query: string;
|
|
212
|
+
/** Update handler — bind to input's onChange */
|
|
213
|
+
setQuery: (value: string) => void;
|
|
214
|
+
/** Address suggestions from Google Places */
|
|
215
|
+
suggestions: AddressSuggestion[];
|
|
216
|
+
/** Loading state */
|
|
217
|
+
isLoading: boolean;
|
|
218
|
+
/** Select a suggestion — fetches full structured address */
|
|
219
|
+
select: (placeId: string) => Promise<AddressDetail>;
|
|
220
|
+
/** The selected structured address (after select()) */
|
|
221
|
+
selected: AddressDetail | null;
|
|
222
|
+
/** Whether a selection is being resolved */
|
|
223
|
+
isSelecting: boolean;
|
|
224
|
+
/** Clear suggestions and selected */
|
|
225
|
+
clear: () => void;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Debounced address autocomplete hook.
|
|
229
|
+
*
|
|
230
|
+
* Usage:
|
|
231
|
+
* ```tsx
|
|
232
|
+
* const { query, setQuery, suggestions, select, selected } = useAddressAutocomplete({
|
|
233
|
+
* country: 'CZ',
|
|
234
|
+
* debounce: 300,
|
|
235
|
+
* });
|
|
236
|
+
*
|
|
237
|
+
* <input value={query} onChange={e => setQuery(e.target.value)} />
|
|
238
|
+
* {suggestions.map(s => (
|
|
239
|
+
* <div key={s.placeId} onClick={() => select(s.placeId)}>
|
|
240
|
+
* {s.description}
|
|
241
|
+
* </div>
|
|
242
|
+
* ))}
|
|
243
|
+
* // After select: selected.street, selected.city, selected.zip
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
declare function useAddressAutocomplete(options: UseAddressAutocompleteOptions): UseAddressAutocompleteReturn;
|
|
247
|
+
|
|
199
248
|
interface UseOrdersOptions {
|
|
200
249
|
page?: number;
|
|
201
250
|
limit?: number;
|
|
@@ -802,4 +851,4 @@ declare function useBehioClient(): BehioStorefront;
|
|
|
802
851
|
*/
|
|
803
852
|
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
804
853
|
|
|
805
|
-
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
854
|
+
export { ActivePromotion, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useOrder, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZEPWNT56js = require('./chunk-ZEPWNT56.js');
|
|
4
4
|
|
|
5
5
|
// src/react/provider.tsx
|
|
6
6
|
var _react = require('react');
|
|
@@ -114,7 +114,7 @@ function BehioProvider({
|
|
|
114
114
|
const storageAdapter = _react.useMemo.call(void 0, () => resolveStorage(storageOption), [storageOption]);
|
|
115
115
|
const clientRef = _react.useRef.call(void 0, null);
|
|
116
116
|
if (!clientRef.current) {
|
|
117
|
-
clientRef.current = new (0,
|
|
117
|
+
clientRef.current = new (0, _chunkZEPWNT56js.BehioStorefront)({
|
|
118
118
|
apiKey,
|
|
119
119
|
baseUrl,
|
|
120
120
|
locale,
|
|
@@ -720,6 +720,70 @@ function useAddresses(options) {
|
|
|
720
720
|
};
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
+
// src/react/hooks/use-address-autocomplete.ts
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
var AC_KEY = ["behio", "address-autocomplete"];
|
|
727
|
+
function useAddressAutocomplete(options) {
|
|
728
|
+
const { country, debounce = 300, minChars = 3, enabled = true } = options;
|
|
729
|
+
const { client } = useBehio();
|
|
730
|
+
const [query, setQuery] = _react.useState.call(void 0, "");
|
|
731
|
+
const [debouncedQuery, setDebouncedQuery] = _react.useState.call(void 0, "");
|
|
732
|
+
const [selected, setSelected] = _react.useState.call(void 0, null);
|
|
733
|
+
const [isSelecting, setIsSelecting] = _react.useState.call(void 0, false);
|
|
734
|
+
const timerRef = _react.useRef.call(void 0, void 0);
|
|
735
|
+
_react.useEffect.call(void 0, () => {
|
|
736
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
737
|
+
if (query.length < minChars) {
|
|
738
|
+
setDebouncedQuery("");
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
timerRef.current = setTimeout(() => {
|
|
742
|
+
setDebouncedQuery(query);
|
|
743
|
+
}, debounce);
|
|
744
|
+
return () => {
|
|
745
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
746
|
+
};
|
|
747
|
+
}, [query, debounce, minChars]);
|
|
748
|
+
const { data, isLoading } = _reactquery.useQuery.call(void 0, {
|
|
749
|
+
queryKey: [...AC_KEY, debouncedQuery, country],
|
|
750
|
+
queryFn: () => client.addresses.autocomplete(debouncedQuery, country),
|
|
751
|
+
enabled: enabled && debouncedQuery.length >= minChars,
|
|
752
|
+
staleTime: 6e4
|
|
753
|
+
// Cache suggestions for 1 min
|
|
754
|
+
});
|
|
755
|
+
const select = _react.useCallback.call(void 0,
|
|
756
|
+
async (placeId) => {
|
|
757
|
+
setIsSelecting(true);
|
|
758
|
+
try {
|
|
759
|
+
const detail = await client.addresses.getDetail(placeId);
|
|
760
|
+
setSelected(detail);
|
|
761
|
+
setQuery(detail.formattedAddress);
|
|
762
|
+
setDebouncedQuery("");
|
|
763
|
+
return detail;
|
|
764
|
+
} finally {
|
|
765
|
+
setIsSelecting(false);
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
[client]
|
|
769
|
+
);
|
|
770
|
+
const clear = _react.useCallback.call(void 0, () => {
|
|
771
|
+
setQuery("");
|
|
772
|
+
setDebouncedQuery("");
|
|
773
|
+
setSelected(null);
|
|
774
|
+
}, []);
|
|
775
|
+
return {
|
|
776
|
+
query,
|
|
777
|
+
setQuery,
|
|
778
|
+
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _46 => _46.suggestions]), () => ( [])),
|
|
779
|
+
isLoading: isLoading && debouncedQuery.length >= minChars,
|
|
780
|
+
select,
|
|
781
|
+
selected,
|
|
782
|
+
isSelecting,
|
|
783
|
+
clear
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
|
|
723
787
|
// src/react/hooks/use-orders.ts
|
|
724
788
|
|
|
725
789
|
|
|
@@ -736,10 +800,10 @@ function useOrders(options) {
|
|
|
736
800
|
enabled: enabled !== false && !!client.getAccessToken()
|
|
737
801
|
});
|
|
738
802
|
const items = _react.useMemo.call(void 0,
|
|
739
|
-
() => _nullishCoalesce(_optionalChain([infinite, 'access',
|
|
803
|
+
() => _nullishCoalesce(_optionalChain([infinite, 'access', _47 => _47.data, 'optionalAccess', _48 => _48.pages, 'access', _49 => _49.flatMap, 'call', _50 => _50((p) => p.items)]), () => ( [])),
|
|
740
804
|
[infinite.data]
|
|
741
805
|
);
|
|
742
|
-
const lastPage = _optionalChain([infinite, 'access',
|
|
806
|
+
const lastPage = _optionalChain([infinite, 'access', _51 => _51.data, 'optionalAccess', _52 => _52.pages, 'access', _53 => _53[infinite.data.pages.length - 1]]);
|
|
743
807
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
744
808
|
if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
|
|
745
809
|
return infinite.fetchNextPage();
|
|
@@ -752,10 +816,10 @@ function useOrders(options) {
|
|
|
752
816
|
return {
|
|
753
817
|
items,
|
|
754
818
|
data: infinite.data,
|
|
755
|
-
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
756
|
-
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
757
|
-
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
758
|
-
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
819
|
+
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _54 => _54.total]), () => ( 0)),
|
|
820
|
+
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _55 => _55.totalPages]), () => ( 0)),
|
|
821
|
+
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _56 => _56.page]), () => ( page)),
|
|
822
|
+
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _57 => _57.limit]), () => ( limit)), () => ( 20)),
|
|
759
823
|
page,
|
|
760
824
|
setPage: goToPage,
|
|
761
825
|
loadMore,
|
|
@@ -784,7 +848,7 @@ function useOrder(orderNumber, options) {
|
|
|
784
848
|
} = _reactquery.useQuery.call(void 0, {
|
|
785
849
|
queryKey: ["behio", "order", orderNumber],
|
|
786
850
|
queryFn: () => client.orders.get(orderNumber),
|
|
787
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
851
|
+
enabled: _optionalChain([options, 'optionalAccess', _58 => _58.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
|
|
788
852
|
});
|
|
789
853
|
const cancelMutation = _reactquery.useMutation.call(void 0, {
|
|
790
854
|
mutationFn: () => client.orders.cancel(orderNumber),
|
|
@@ -849,7 +913,7 @@ function usePages(locale, options) {
|
|
|
849
913
|
const result = await client.pages.list(locale);
|
|
850
914
|
return result.pages;
|
|
851
915
|
},
|
|
852
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
916
|
+
enabled: _optionalChain([options, 'optionalAccess', _59 => _59.enabled]) !== false
|
|
853
917
|
});
|
|
854
918
|
}
|
|
855
919
|
function usePage(slug, locale, options) {
|
|
@@ -857,7 +921,7 @@ function usePage(slug, locale, options) {
|
|
|
857
921
|
return _reactquery.useQuery.call(void 0, {
|
|
858
922
|
queryKey: ["behio", "page", slug, locale],
|
|
859
923
|
queryFn: () => client.pages.get(slug, locale),
|
|
860
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
924
|
+
enabled: _optionalChain([options, 'optionalAccess', _60 => _60.enabled]) !== false && !!slug
|
|
861
925
|
});
|
|
862
926
|
}
|
|
863
927
|
|
|
@@ -868,7 +932,7 @@ function useShopInfo(options) {
|
|
|
868
932
|
return _reactquery.useQuery.call(void 0, {
|
|
869
933
|
queryKey: ["behio", "shop-info"],
|
|
870
934
|
queryFn: () => client.getShopInfo(),
|
|
871
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
935
|
+
enabled: _optionalChain([options, 'optionalAccess', _61 => _61.enabled]) !== false
|
|
872
936
|
});
|
|
873
937
|
}
|
|
874
938
|
|
|
@@ -892,8 +956,8 @@ function useBundles(options) {
|
|
|
892
956
|
return _reactquery.useQuery.call(void 0, {
|
|
893
957
|
queryKey: ["behio", "bundles"],
|
|
894
958
|
queryFn: () => client.catalog.getBundles(),
|
|
895
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
896
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
959
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _62 => _62.enabled]), () => ( true)),
|
|
960
|
+
initialData: _optionalChain([options, 'optionalAccess', _63 => _63.initialData])
|
|
897
961
|
});
|
|
898
962
|
}
|
|
899
963
|
function useBundle(slug, options) {
|
|
@@ -901,8 +965,8 @@ function useBundle(slug, options) {
|
|
|
901
965
|
return _reactquery.useQuery.call(void 0, {
|
|
902
966
|
queryKey: ["behio", "bundle", slug],
|
|
903
967
|
queryFn: () => client.catalog.getBundle(slug),
|
|
904
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
905
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
968
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _64 => _64.enabled]), () => ( true))),
|
|
969
|
+
initialData: _optionalChain([options, 'optionalAccess', _65 => _65.initialData])
|
|
906
970
|
});
|
|
907
971
|
}
|
|
908
972
|
|
|
@@ -913,8 +977,8 @@ function useCrossSell(productSlug, options) {
|
|
|
913
977
|
return _reactquery.useQuery.call(void 0, {
|
|
914
978
|
queryKey: ["behio", "cross-sell", productSlug],
|
|
915
979
|
queryFn: () => client.catalog.getCrossSell(productSlug),
|
|
916
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
917
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
980
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _66 => _66.enabled]), () => ( true))),
|
|
981
|
+
initialData: _optionalChain([options, 'optionalAccess', _67 => _67.initialData])
|
|
918
982
|
});
|
|
919
983
|
}
|
|
920
984
|
|
|
@@ -925,8 +989,8 @@ function useProductPromotions(productSlug, options) {
|
|
|
925
989
|
return _reactquery.useQuery.call(void 0, {
|
|
926
990
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
927
991
|
queryFn: () => client.catalog.getProductPromotions(productSlug),
|
|
928
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
929
|
-
refetchInterval: _optionalChain([options, 'optionalAccess',
|
|
992
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.enabled]), () => ( true))),
|
|
993
|
+
refetchInterval: _optionalChain([options, 'optionalAccess', _69 => _69.refetchIntervalMs])
|
|
930
994
|
});
|
|
931
995
|
}
|
|
932
996
|
|
|
@@ -934,11 +998,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
934
998
|
|
|
935
999
|
function useGiftCardBalance(code, options) {
|
|
936
1000
|
const { client } = useBehio();
|
|
937
|
-
const trimmed = _optionalChain([code, 'optionalAccess',
|
|
1001
|
+
const trimmed = _optionalChain([code, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]);
|
|
938
1002
|
return _reactquery.useQuery.call(void 0, {
|
|
939
1003
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
940
1004
|
queryFn: () => client.catalog.checkGiftCard(trimmed),
|
|
941
|
-
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1005
|
+
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _72 => _72.enabled]), () => ( true)))
|
|
942
1006
|
});
|
|
943
1007
|
}
|
|
944
1008
|
|
|
@@ -950,7 +1014,7 @@ function useWishlist(options) {
|
|
|
950
1014
|
const query = _reactquery.useQuery.call(void 0, {
|
|
951
1015
|
queryKey: ["behio", "wishlist"],
|
|
952
1016
|
queryFn: () => client.wishlist.get(),
|
|
953
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1017
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _73 => _73.enabled]), () => ( true))
|
|
954
1018
|
});
|
|
955
1019
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
956
1020
|
mutationFn: (productId) => client.wishlist.add(productId),
|
|
@@ -982,9 +1046,9 @@ function useIsInWishlist(productId) {
|
|
|
982
1046
|
function useProductReviews(productId, options) {
|
|
983
1047
|
const { client } = useBehio();
|
|
984
1048
|
return _reactquery.useQuery.call(void 0, {
|
|
985
|
-
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
986
|
-
queryFn: () => client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess',
|
|
987
|
-
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1049
|
+
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _74 => _74.page]), () => ( 1))],
|
|
1050
|
+
queryFn: () => client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _75 => _75.page]), _optionalChain([options, 'optionalAccess', _76 => _76.limit])),
|
|
1051
|
+
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _77 => _77.enabled]), () => ( true)))
|
|
988
1052
|
});
|
|
989
1053
|
}
|
|
990
1054
|
function useSubmitReview() {
|
|
@@ -1118,4 +1182,5 @@ function formatPrice(amount, currency, locale) {
|
|
|
1118
1182
|
|
|
1119
1183
|
|
|
1120
1184
|
|
|
1121
|
-
|
|
1185
|
+
|
|
1186
|
+
exports.BehioProvider = BehioProvider; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.useAddressAutocomplete = useAddressAutocomplete; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useBundle = useBundle; exports.useBundles = useBundles; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCookieConsent = useCookieConsent; exports.useCrossSell = useCrossSell; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useGiftCardBalance = useGiftCardBalance; exports.useIsInWishlist = useIsInWishlist; exports.useLabels = useLabels; exports.useOrder = useOrder; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProductPromotions = useProductPromotions; exports.useProductReviews = useProductReviews; exports.useProducts = useProducts; exports.useQuoteStatus = useQuoteStatus; exports.useReturnStatus = useReturnStatus; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo; exports.useShopSeo = useShopSeo; exports.useSubmitQuote = useSubmitQuote; exports.useSubmitReturn = useSubmitReturn; exports.useSubmitReview = useSubmitReview; exports.useWishlist = useWishlist;
|