@behio/storefront-sdk 0.1.3 → 0.1.5

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/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 _chunkSNODOM7Ljs = require('./chunk-SNODOM7L.js');
3
+ var _chunkGGAO5T5Pjs = require('./chunk-GGAO5T5P.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, _chunkSNODOM7Ljs.BehioStorefront)({
117
+ clientRef.current = new (0, _chunkGGAO5T5Pjs.BehioStorefront)({
118
118
  apiKey,
119
119
  baseUrl,
120
120
  locale,
@@ -157,16 +157,69 @@ function BehioProvider({
157
157
 
158
158
  // src/react/hooks/use-products.ts
159
159
 
160
+
160
161
  function useProducts(query) {
161
162
  const { client } = useBehio();
162
- const { initialData, enabled, ...productsQuery } = _nullishCoalesce(query, () => ( {}));
163
- const serializedQuery = JSON.stringify(productsQuery);
164
- return _reactquery.useQuery.call(void 0, {
165
- queryKey: ["behio", "products", serializedQuery],
166
- queryFn: () => client.catalog.getProducts(productsQuery),
167
- initialData,
168
- enabled
169
- });
163
+ const { initialData, enabled, page: initialPage, limit, ...filters } = _nullishCoalesce(query, () => ( {}));
164
+ const [page, setPage] = _react.useState.call(void 0, _nullishCoalesce(initialPage, () => ( 1)));
165
+ const serializedFilters = _react.useMemo.call(void 0, () => JSON.stringify({ ...filters, limit }), [filters, limit]);
166
+ const infinite = _reactquery.useInfiniteQuery.call(void 0, {
167
+ queryKey: ["behio", "products", serializedFilters, page],
168
+ queryFn: ({ pageParam }) => client.catalog.getProducts({ ...filters, limit, page: pageParam }),
169
+ initialPageParam: page,
170
+ getNextPageParam: (lastPage2) => lastPage2.page < lastPage2.totalPages ? lastPage2.page + 1 : void 0,
171
+ getPreviousPageParam: (firstPage2) => firstPage2.page > 1 ? firstPage2.page - 1 : void 0,
172
+ initialData: initialData ? { pages: [initialData], pageParams: [initialData.page] } : void 0,
173
+ enabled: enabled !== false
174
+ });
175
+ const items = _react.useMemo.call(void 0,
176
+ () => _nullishCoalesce(_optionalChain([infinite, 'access', _ => _.data, 'optionalAccess', _2 => _2.pages, 'access', _3 => _3.flatMap, 'call', _4 => _4((p) => p.items)]), () => ( [])),
177
+ [infinite.data]
178
+ );
179
+ const lastPage = _optionalChain([infinite, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.pages, 'access', _7 => _7[infinite.data.pages.length - 1]]);
180
+ const firstPage = _optionalChain([infinite, 'access', _8 => _8.data, 'optionalAccess', _9 => _9.pages, 'access', _10 => _10[0]]);
181
+ const loadMore = _react.useCallback.call(void 0, () => {
182
+ if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
183
+ return infinite.fetchNextPage();
184
+ }
185
+ return Promise.resolve();
186
+ }, [infinite]);
187
+ const goToPage = _react.useCallback.call(void 0, (newPage) => {
188
+ setPage(newPage);
189
+ }, []);
190
+ return {
191
+ // --- Data ---
192
+ /** All items from all loaded pages (flat array) — for infinite scroll */
193
+ items,
194
+ /** Raw React Query data with all pages */
195
+ data: infinite.data,
196
+ /** Last loaded page meta */
197
+ total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _11 => _11.total]), () => ( 0)),
198
+ totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _12 => _12.totalPages]), () => ( 0)),
199
+ currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _13 => _13.page]), () => ( page)),
200
+ limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _14 => _14.limit]), () => ( limit)), () => ( 20)),
201
+ // --- Pagination controls ---
202
+ /** Current page (manual pagination) */
203
+ page,
204
+ /** Change page (traditional pagination — replaces items) */
205
+ setPage: goToPage,
206
+ /** Load next page (append to items — for infinite scroll / load more button) */
207
+ loadMore,
208
+ /** Fetch previous page */
209
+ loadPrevious: infinite.fetchPreviousPage,
210
+ /** Can load more? */
211
+ hasMore: _nullishCoalesce(infinite.hasNextPage, () => ( false)),
212
+ hasPrevious: _nullishCoalesce(infinite.hasPreviousPage, () => ( false)),
213
+ // --- States ---
214
+ isLoading: infinite.isLoading,
215
+ isFetching: infinite.isFetching,
216
+ isLoadingMore: infinite.isFetchingNextPage,
217
+ error: infinite.error,
218
+ isError: infinite.isError,
219
+ // --- Manual control ---
220
+ /** Force refetch all loaded pages */
221
+ refetch: infinite.refetch
222
+ };
170
223
  }
171
224
 
172
225
  // src/react/hooks/use-product.ts
@@ -176,37 +229,47 @@ function useProduct(slug, options) {
176
229
  return _reactquery.useQuery.call(void 0, {
177
230
  queryKey: ["behio", "product", slug],
178
231
  queryFn: () => client.catalog.getProduct(slug, {
179
- locale: _optionalChain([options, 'optionalAccess', _ => _.locale]),
180
- currency: _optionalChain([options, 'optionalAccess', _2 => _2.currency])
232
+ locale: _optionalChain([options, 'optionalAccess', _15 => _15.locale]),
233
+ currency: _optionalChain([options, 'optionalAccess', _16 => _16.currency])
181
234
  }),
182
- initialData: _optionalChain([options, 'optionalAccess', _3 => _3.initialData]),
183
- enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _4 => _4.enabled]), () => ( !!slug))
235
+ initialData: _optionalChain([options, 'optionalAccess', _17 => _17.initialData]),
236
+ enabled: _optionalChain([options, 'optionalAccess', _18 => _18.enabled]) !== false && !!slug
184
237
  });
185
238
  }
186
239
 
187
240
  // src/react/hooks/use-categories.ts
188
241
 
189
- function useCategories(locale) {
242
+ function useCategories(locale, options) {
190
243
  const { client } = useBehio();
191
244
  return _reactquery.useQuery.call(void 0, {
192
245
  queryKey: ["behio", "categories", locale],
193
246
  queryFn: async () => {
194
247
  const result = await client.catalog.getCategories(locale);
195
248
  return result.categories;
196
- }
249
+ },
250
+ enabled: _optionalChain([options, 'optionalAccess', _19 => _19.enabled]) !== false
251
+ });
252
+ }
253
+ function useCategory(slug, options) {
254
+ const { client } = useBehio();
255
+ return _reactquery.useQuery.call(void 0, {
256
+ queryKey: ["behio", "category", slug, _optionalChain([options, 'optionalAccess', _20 => _20.locale])],
257
+ queryFn: () => client.catalog.getCategory(slug, _optionalChain([options, 'optionalAccess', _21 => _21.locale])),
258
+ enabled: _optionalChain([options, 'optionalAccess', _22 => _22.enabled]) !== false && !!slug
197
259
  });
198
260
  }
199
261
 
200
262
  // src/react/hooks/use-labels.ts
201
263
 
202
- function useLabels(locale) {
264
+ function useLabels(locale, options) {
203
265
  const { client } = useBehio();
204
266
  return _reactquery.useQuery.call(void 0, {
205
267
  queryKey: ["behio", "labels", locale],
206
268
  queryFn: async () => {
207
269
  const result = await client.catalog.getLabels(locale);
208
270
  return result.labels;
209
- }
271
+ },
272
+ enabled: _optionalChain([options, 'optionalAccess', _23 => _23.enabled]) !== false
210
273
  });
211
274
  }
212
275
 
@@ -215,26 +278,27 @@ function useLabels(locale) {
215
278
  function useFeatured(options) {
216
279
  const { client } = useBehio();
217
280
  return _reactquery.useQuery.call(void 0, {
218
- queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess', _5 => _5.locale]), _optionalChain([options, 'optionalAccess', _6 => _6.currency])],
281
+ queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess', _24 => _24.locale]), _optionalChain([options, 'optionalAccess', _25 => _25.currency])],
219
282
  queryFn: () => client.catalog.getFeatured({
220
- locale: _optionalChain([options, 'optionalAccess', _7 => _7.locale]),
221
- currency: _optionalChain([options, 'optionalAccess', _8 => _8.currency])
283
+ locale: _optionalChain([options, 'optionalAccess', _26 => _26.locale]),
284
+ currency: _optionalChain([options, 'optionalAccess', _27 => _27.currency])
222
285
  }),
223
- initialData: _optionalChain([options, 'optionalAccess', _9 => _9.initialData]),
224
- enabled: _optionalChain([options, 'optionalAccess', _10 => _10.enabled])
286
+ initialData: _optionalChain([options, 'optionalAccess', _28 => _28.initialData]),
287
+ enabled: _optionalChain([options, 'optionalAccess', _29 => _29.enabled]) !== false
225
288
  });
226
289
  }
227
290
 
228
291
  // src/react/hooks/use-filters.ts
229
292
 
230
- function useFilters() {
293
+ function useFilters(options) {
231
294
  const { client } = useBehio();
232
295
  return _reactquery.useQuery.call(void 0, {
233
296
  queryKey: ["behio", "filters"],
234
297
  queryFn: async () => {
235
298
  const result = await client.catalog.getFilters();
236
299
  return result.filters;
237
- }
300
+ },
301
+ enabled: _optionalChain([options, 'optionalAccess', _30 => _30.enabled]) !== false
238
302
  });
239
303
  }
240
304
 
@@ -243,7 +307,7 @@ function useFilters() {
243
307
 
244
308
  function useSearch(query, options) {
245
309
  const { client } = useBehio();
246
- const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _11 => _11.debounceMs]), () => ( 300));
310
+ const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _31 => _31.debounceMs]), () => ( 300));
247
311
  const [debouncedQuery, setDebouncedQuery] = _react.useState.call(void 0, query);
248
312
  _react.useEffect.call(void 0, () => {
249
313
  if (debounceMs <= 0) {
@@ -254,12 +318,12 @@ function useSearch(query, options) {
254
318
  return () => clearTimeout(timer);
255
319
  }, [query, debounceMs]);
256
320
  return _reactquery.useQuery.call(void 0, {
257
- queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess', _12 => _12.page]), _optionalChain([options, 'optionalAccess', _13 => _13.limit])],
321
+ queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess', _32 => _32.page]), _optionalChain([options, 'optionalAccess', _33 => _33.limit])],
258
322
  queryFn: () => client.catalog.search(debouncedQuery, {
259
- page: _optionalChain([options, 'optionalAccess', _14 => _14.page]),
260
- limit: _optionalChain([options, 'optionalAccess', _15 => _15.limit])
323
+ page: _optionalChain([options, 'optionalAccess', _34 => _34.page]),
324
+ limit: _optionalChain([options, 'optionalAccess', _35 => _35.limit])
261
325
  }),
262
- enabled: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _16 => _16.enabled]), () => ( true))) && debouncedQuery.length > 0
326
+ enabled: _optionalChain([options, 'optionalAccess', _36 => _36.enabled]) !== false && debouncedQuery.length > 0
263
327
  });
264
328
  }
265
329
 
@@ -267,7 +331,7 @@ function useSearch(query, options) {
267
331
 
268
332
 
269
333
  var CART_KEY = ["behio", "cart"];
270
- function useCart() {
334
+ function useCart(options) {
271
335
  const { client, storage } = useBehio();
272
336
  const queryClient = _reactquery.useQueryClient.call(void 0, );
273
337
  const {
@@ -278,7 +342,7 @@ function useCart() {
278
342
  queryKey: [...CART_KEY],
279
343
  queryFn: () => client.cart.get(),
280
344
  // Only fetch if we have a cart session or are logged in
281
- enabled: !!client.getCartSession() || !!client.getAccessToken()
345
+ enabled: _optionalChain([options, 'optionalAccess', _37 => _37.enabled]) !== false && (!!client.getCartSession() || !!client.getAccessToken())
282
346
  });
283
347
  const addMutation = _reactquery.useMutation.call(void 0, {
284
348
  mutationFn: async ({ productId, quantity }) => {
@@ -311,7 +375,7 @@ function useCart() {
311
375
  return { previous };
312
376
  },
313
377
  onError: (_err, _vars, context) => {
314
- if (_optionalChain([context, 'optionalAccess', _17 => _17.previous])) {
378
+ if (_optionalChain([context, 'optionalAccess', _38 => _38.previous])) {
315
379
  queryClient.setQueryData([...CART_KEY], context.previous);
316
380
  }
317
381
  },
@@ -337,7 +401,7 @@ function useCart() {
337
401
  return { previous };
338
402
  },
339
403
  onError: (_err, _vars, context) => {
340
- if (_optionalChain([context, 'optionalAccess', _18 => _18.previous])) {
404
+ if (_optionalChain([context, 'optionalAccess', _39 => _39.previous])) {
341
405
  queryClient.setQueryData([...CART_KEY], context.previous);
342
406
  }
343
407
  },
@@ -414,7 +478,7 @@ function useCart() {
414
478
  removeDiscount,
415
479
  merge,
416
480
  // Computed
417
- itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _19 => _19.itemCount]), () => ( 0)),
481
+ itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _40 => _40.itemCount]), () => ( 0)),
418
482
  isEmpty: !cart || cart.items.length === 0,
419
483
  // Mutation states
420
484
  isAdding: addMutation.isPending,
@@ -426,17 +490,17 @@ function useCart() {
426
490
  // src/react/hooks/use-cart-count.ts
427
491
 
428
492
  var CART_KEY2 = ["behio", "cart"];
429
- function useCartCount() {
493
+ function useCartCount(options) {
430
494
  const { client } = useBehio();
431
495
  const queryClient = _reactquery.useQueryClient.call(void 0, );
432
496
  const cachedCart = queryClient.getQueryData([...CART_KEY2]);
433
497
  const { data } = _reactquery.useQuery.call(void 0, {
434
498
  queryKey: [...CART_KEY2],
435
499
  queryFn: () => client.cart.get(),
436
- enabled: !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
500
+ enabled: _optionalChain([options, 'optionalAccess', _41 => _41.enabled]) !== false && !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
437
501
  });
438
502
  const cart = _nullishCoalesce(cachedCart, () => ( data));
439
- return _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _20 => _20.itemCount]), () => ( 0));
503
+ return _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _42 => _42.itemCount]), () => ( 0));
440
504
  }
441
505
 
442
506
  // src/react/hooks/use-auth.ts
@@ -564,7 +628,7 @@ function useAuth() {
564
628
 
565
629
 
566
630
  var CUSTOMER_KEY2 = ["behio", "customer"];
567
- function useCustomer() {
631
+ function useCustomer(options) {
568
632
  const { client } = useBehio();
569
633
  const queryClient = _reactquery.useQueryClient.call(void 0, );
570
634
  const {
@@ -574,7 +638,7 @@ function useCustomer() {
574
638
  } = _reactquery.useQuery.call(void 0, {
575
639
  queryKey: [...CUSTOMER_KEY2],
576
640
  queryFn: () => client.customer.getProfile(),
577
- enabled: !!client.getAccessToken()
641
+ enabled: _optionalChain([options, 'optionalAccess', _43 => _43.enabled]) !== false && !!client.getAccessToken()
578
642
  });
579
643
  const updateMutation = _reactquery.useMutation.call(void 0, {
580
644
  mutationFn: (data2) => client.customer.updateProfile(data2),
@@ -599,7 +663,7 @@ function useCustomer() {
599
663
 
600
664
 
601
665
  var ADDRESSES_KEY = ["behio", "addresses"];
602
- function useAddresses() {
666
+ function useAddresses(options) {
603
667
  const { client } = useBehio();
604
668
  const queryClient = _reactquery.useQueryClient.call(void 0, );
605
669
  const {
@@ -612,7 +676,7 @@ function useAddresses() {
612
676
  const result = await client.customer.getAddresses();
613
677
  return result.items;
614
678
  },
615
- enabled: !!client.getAccessToken()
679
+ enabled: _optionalChain([options, 'optionalAccess', _44 => _44.enabled]) !== false && !!client.getAccessToken()
616
680
  });
617
681
  const createMutation = _reactquery.useMutation.call(void 0, {
618
682
  mutationFn: (address) => client.customer.createAddress(address),
@@ -658,22 +722,59 @@ function useAddresses() {
658
722
 
659
723
  // src/react/hooks/use-orders.ts
660
724
 
725
+
661
726
  function useOrders(options) {
662
727
  const { client } = useBehio();
663
- return _reactquery.useQuery.call(void 0, {
664
- queryKey: ["behio", "orders", _optionalChain([options, 'optionalAccess', _21 => _21.page]), _optionalChain([options, 'optionalAccess', _22 => _22.limit])],
665
- queryFn: () => client.orders.list({
666
- page: _optionalChain([options, 'optionalAccess', _23 => _23.page]),
667
- limit: _optionalChain([options, 'optionalAccess', _24 => _24.limit])
668
- }),
669
- enabled: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _25 => _25.enabled]), () => ( true))) && !!client.getAccessToken()
670
- });
728
+ const { page: initialPage, limit, enabled } = _nullishCoalesce(options, () => ( {}));
729
+ const [page, setPage] = _react.useState.call(void 0, _nullishCoalesce(initialPage, () => ( 1)));
730
+ const infinite = _reactquery.useInfiniteQuery.call(void 0, {
731
+ queryKey: ["behio", "orders", limit, page],
732
+ queryFn: ({ pageParam }) => client.orders.list({ limit, page: pageParam }),
733
+ initialPageParam: page,
734
+ getNextPageParam: (lastPage2) => lastPage2.page < lastPage2.totalPages ? lastPage2.page + 1 : void 0,
735
+ getPreviousPageParam: (firstPage) => firstPage.page > 1 ? firstPage.page - 1 : void 0,
736
+ enabled: enabled !== false && !!client.getAccessToken()
737
+ });
738
+ const items = _react.useMemo.call(void 0,
739
+ () => _nullishCoalesce(_optionalChain([infinite, 'access', _45 => _45.data, 'optionalAccess', _46 => _46.pages, 'access', _47 => _47.flatMap, 'call', _48 => _48((p) => p.items)]), () => ( [])),
740
+ [infinite.data]
741
+ );
742
+ const lastPage = _optionalChain([infinite, 'access', _49 => _49.data, 'optionalAccess', _50 => _50.pages, 'access', _51 => _51[infinite.data.pages.length - 1]]);
743
+ const loadMore = _react.useCallback.call(void 0, () => {
744
+ if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
745
+ return infinite.fetchNextPage();
746
+ }
747
+ return Promise.resolve();
748
+ }, [infinite]);
749
+ const goToPage = _react.useCallback.call(void 0, (newPage) => {
750
+ setPage(newPage);
751
+ }, []);
752
+ return {
753
+ items,
754
+ data: infinite.data,
755
+ total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _52 => _52.total]), () => ( 0)),
756
+ totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _53 => _53.totalPages]), () => ( 0)),
757
+ currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _54 => _54.page]), () => ( page)),
758
+ limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _55 => _55.limit]), () => ( limit)), () => ( 20)),
759
+ page,
760
+ setPage: goToPage,
761
+ loadMore,
762
+ loadPrevious: infinite.fetchPreviousPage,
763
+ hasMore: _nullishCoalesce(infinite.hasNextPage, () => ( false)),
764
+ hasPrevious: _nullishCoalesce(infinite.hasPreviousPage, () => ( false)),
765
+ isLoading: infinite.isLoading,
766
+ isFetching: infinite.isFetching,
767
+ isLoadingMore: infinite.isFetchingNextPage,
768
+ error: infinite.error,
769
+ isError: infinite.isError,
770
+ refetch: infinite.refetch
771
+ };
671
772
  }
672
773
 
673
774
  // src/react/hooks/use-order.ts
674
775
 
675
776
 
676
- function useOrder(orderNumber) {
777
+ function useOrder(orderNumber, options) {
677
778
  const { client } = useBehio();
678
779
  const queryClient = _reactquery.useQueryClient.call(void 0, );
679
780
  const {
@@ -683,7 +784,7 @@ function useOrder(orderNumber) {
683
784
  } = _reactquery.useQuery.call(void 0, {
684
785
  queryKey: ["behio", "order", orderNumber],
685
786
  queryFn: () => client.orders.get(orderNumber),
686
- enabled: !!orderNumber && !!client.getAccessToken()
787
+ enabled: _optionalChain([options, 'optionalAccess', _56 => _56.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
687
788
  });
688
789
  const cancelMutation = _reactquery.useMutation.call(void 0, {
689
790
  mutationFn: () => client.orders.cancel(orderNumber),
@@ -740,35 +841,42 @@ function useCheckout() {
740
841
 
741
842
  // src/react/hooks/use-pages.ts
742
843
 
743
- function usePages(locale) {
844
+ function usePages(locale, options) {
744
845
  const { client } = useBehio();
745
846
  return _reactquery.useQuery.call(void 0, {
746
847
  queryKey: ["behio", "pages", locale],
747
848
  queryFn: async () => {
748
849
  const result = await client.pages.list(locale);
749
850
  return result.pages;
750
- }
851
+ },
852
+ enabled: _optionalChain([options, 'optionalAccess', _57 => _57.enabled]) !== false
751
853
  });
752
854
  }
753
- function usePage(slug, locale) {
855
+ function usePage(slug, locale, options) {
754
856
  const { client } = useBehio();
755
857
  return _reactquery.useQuery.call(void 0, {
756
858
  queryKey: ["behio", "page", slug, locale],
757
859
  queryFn: () => client.pages.get(slug, locale),
758
- enabled: !!slug
860
+ enabled: _optionalChain([options, 'optionalAccess', _58 => _58.enabled]) !== false && !!slug
759
861
  });
760
862
  }
761
863
 
762
864
  // src/react/hooks/use-shop-info.ts
763
865
 
764
- function useShopInfo() {
866
+ function useShopInfo(options) {
765
867
  const { client } = useBehio();
766
868
  return _reactquery.useQuery.call(void 0, {
767
869
  queryKey: ["behio", "shop-info"],
768
- queryFn: () => client.getShopInfo()
870
+ queryFn: () => client.getShopInfo(),
871
+ enabled: _optionalChain([options, 'optionalAccess', _59 => _59.enabled]) !== false
769
872
  });
770
873
  }
771
874
 
875
+ // src/react/hooks/use-behio-client.ts
876
+ function useBehioClient() {
877
+ return useBehio().client;
878
+ }
879
+
772
880
  // src/react/utils/format-price.ts
773
881
  function formatPrice(amount, currency, locale) {
774
882
  const resolvedLocale = _nullishCoalesce(locale, () => ( "cs"));
@@ -810,4 +918,6 @@ function formatPrice(amount, currency, locale) {
810
918
 
811
919
 
812
920
 
813
- exports.BehioProvider = BehioProvider; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCheckout = useCheckout; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useLabels = useLabels; exports.useOrder = useOrder; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProducts = useProducts; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo;
921
+
922
+
923
+ exports.BehioProvider = BehioProvider; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useLabels = useLabels; exports.useOrder = useOrder; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProducts = useProducts; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo;