@viu/emporix-sdk-react 2.13.0 → 2.14.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.
@@ -1,7 +1,14 @@
1
- import { useEmporix, EmporixSiteContext, useActiveCompany } from './chunk-4YDWCA7A.js';
2
- import { useContext, useMemo, useSyncExternalStore, useEffect, useCallback, useState } from 'react';
3
- import { useQueryClient, useQuery, useMutation, useInfiniteQuery } from '@tanstack/react-query';
4
- import { auth, EmporixError } from '@viu/emporix-sdk';
1
+ "use client";
2
+ import {
3
+ EmporixSiteContext,
4
+ useActiveCompany,
5
+ useEmporix
6
+ } from "./chunk-CZDVH3WH.js";
7
+
8
+ // src/hooks/use-customer-session.ts
9
+ import { useCallback, useContext, useMemo, useSyncExternalStore } from "react";
10
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
11
+ import { auth } from "@viu/emporix-sdk";
5
12
 
6
13
  // src/hooks/internal/bootstrap-cart.ts
7
14
  async function bootstrapCart(opts) {
@@ -55,6 +62,9 @@ function getCustomerSessionStore(storage) {
55
62
  };
56
63
  }
57
64
  };
65
+ storage.subscribe?.((t) => {
66
+ store.setState((s) => s.token === t ? s : { ...s, token: t });
67
+ });
58
68
  stores.set(storage, store);
59
69
  return store;
60
70
  }
@@ -72,9 +82,6 @@ function useCustomerSession() {
72
82
  const store = useMemo(() => getCustomerSessionStore(storage), [storage]);
73
83
  const session = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
74
84
  const setSession = store.setState;
75
- useEffect(() => {
76
- return storage.subscribe?.((t) => setSession((s) => ({ ...s, token: t })));
77
- }, [storage, setSession]);
78
85
  const meQuery = useQuery({
79
86
  queryKey: ["emporix", "customer", "me", { tenant: client.tenant, hasToken: session.token !== null }],
80
87
  enabled: session.token !== null,
@@ -88,6 +95,7 @@ function useCustomerSession() {
88
95
  const result = await client.customers.login(input);
89
96
  storage.setCustomerToken(result.customerToken);
90
97
  storage.setRefreshToken(result.refreshToken || null);
98
+ storage.setAnonymousSession(null);
91
99
  setSession({
92
100
  token: result.customerToken,
93
101
  refreshToken: result.refreshToken || null,
@@ -120,6 +128,7 @@ function useCustomerSession() {
120
128
  async (incoming) => {
121
129
  storage.setCustomerToken(incoming.customerToken);
122
130
  storage.setRefreshToken(incoming.refreshToken || null);
131
+ storage.setAnonymousSession(null);
123
132
  setSession({
124
133
  token: incoming.customerToken,
125
134
  refreshToken: incoming.refreshToken || null,
@@ -166,8 +175,7 @@ function useCustomerSession() {
166
175
  storage.setActiveLegalEntityId(null);
167
176
  storage.setCartId(null);
168
177
  setSession(EMPTY_SESSION);
169
- qc.removeQueries({ queryKey: ["emporix", "customer"] });
170
- qc.removeQueries({ queryKey: ["emporix", "cart"] });
178
+ qc.removeQueries({ queryKey: ["emporix"] });
171
179
  }, [client, session.token, storage, qc, setSession]);
172
180
  const refresh = useCallback(async () => {
173
181
  await meQuery.refetch();
@@ -250,22 +258,55 @@ async function onboardCustomerCart(opts) {
250
258
  } catch {
251
259
  }
252
260
  }
253
- function useReadAuth(override) {
261
+
262
+ // src/hooks/use-products.ts
263
+ import {
264
+ useQuery as useQuery2
265
+ } from "@tanstack/react-query";
266
+ import "@viu/emporix-sdk";
267
+
268
+ // src/hooks/internal/use-read-auth.ts
269
+ import { auth as auth2 } from "@viu/emporix-sdk";
270
+
271
+ // src/hooks/internal/use-storage-snapshot.ts
272
+ import { useCallback as useCallback2, useMemo as useMemo2, useSyncExternalStore as useSyncExternalStore2 } from "react";
273
+ function useCustomerToken() {
274
+ const { storage } = useEmporix();
275
+ const store = useMemo2(() => getCustomerSessionStore(storage), [storage]);
276
+ const getToken = useCallback2(() => store.getSnapshot().token, [store]);
277
+ return useSyncExternalStore2(store.subscribe, getToken, getToken);
278
+ }
279
+ function useCartId() {
254
280
  const { storage } = useEmporix();
281
+ const subscribe = useCallback2(
282
+ (onChange) => storage.subscribeAll?.((key) => {
283
+ if (key === "cartId") onChange();
284
+ }) ?? (() => {
285
+ }),
286
+ [storage]
287
+ );
288
+ const getCartId = useCallback2(() => storage.getCartId(), [storage]);
289
+ return useSyncExternalStore2(subscribe, getCartId, getCartId);
290
+ }
291
+
292
+ // src/hooks/internal/use-read-auth.ts
293
+ function useReadAuth(override) {
294
+ const token = useCustomerToken();
255
295
  if (override) return { ctx: override };
256
- const token = storage.getCustomerToken();
257
- return token ? { ctx: auth.customer(token) } : { ctx: auth.anonymous() };
296
+ return token ? { ctx: auth2.customer(token) } : { ctx: auth2.anonymous() };
258
297
  }
259
298
  function useCustomerOnlyCtx() {
260
- const { storage } = useEmporix();
261
- const token = storage.getCustomerToken();
299
+ const token = useCustomerToken();
262
300
  if (!token) {
263
301
  throw new Error("Requires a logged-in customer (no token in storage)");
264
302
  }
265
- return auth.customer(token);
303
+ return auth2.customer(token);
266
304
  }
305
+
306
+ // src/hooks/internal/use-read-site.ts
307
+ import { useContext as useContext2 } from "react";
267
308
  function useReadSite() {
268
- const ctx = useContext(EmporixSiteContext);
309
+ const ctx = useContext2(EmporixSiteContext);
269
310
  return { siteCode: ctx?.siteCode ?? null, language: ctx?.language ?? null };
270
311
  }
271
312
 
@@ -283,6 +324,11 @@ function emporixKey(resource, args, context) {
283
324
  }
284
325
  return ["emporix", resource, ...args, meta];
285
326
  }
327
+
328
+ // src/hooks/internal/use-emporix-infinite.ts
329
+ import {
330
+ useInfiniteQuery
331
+ } from "@tanstack/react-query";
286
332
  function useEmporixInfinite(opts) {
287
333
  return useInfiniteQuery({
288
334
  queryKey: opts.queryKey,
@@ -300,7 +346,7 @@ function useProduct(productId, options = {}) {
300
346
  const { client } = useEmporix();
301
347
  const { ctx } = useReadAuth(options.auth);
302
348
  const { siteCode, language } = useReadSite();
303
- return useQuery({
349
+ return useQuery2({
304
350
  queryKey: emporixKey("product", [productId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
305
351
  queryFn: () => client.products.get(productId, void 0, ctx),
306
352
  staleTime: PRODUCTS_STALE_TIME
@@ -310,7 +356,7 @@ function useProducts(params = {}, options = {}) {
310
356
  const { client } = useEmporix();
311
357
  const { ctx } = useReadAuth(options.auth);
312
358
  const { siteCode, language } = useReadSite();
313
- return useQuery({
359
+ return useQuery2({
314
360
  queryKey: emporixKey("products", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
315
361
  queryFn: () => client.products.list(params, ctx),
316
362
  staleTime: PRODUCTS_STALE_TIME
@@ -333,7 +379,7 @@ function useProductByCode(code, options = {}) {
333
379
  const { client } = useEmporix();
334
380
  const { ctx } = useReadAuth(options.auth);
335
381
  const { siteCode, language } = useReadSite();
336
- return useQuery({
382
+ return useQuery2({
337
383
  queryKey: emporixKey("product-by-code", [code], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
338
384
  enabled: typeof code === "string" && code !== "",
339
385
  queryFn: () => client.products.getByCode(code, ctx),
@@ -344,7 +390,7 @@ function useProductSearch(query, params = {}, options = {}) {
344
390
  const { client } = useEmporix();
345
391
  const { ctx } = useReadAuth(options.auth);
346
392
  const { siteCode, language } = useReadSite();
347
- return useQuery({
393
+ return useQuery2({
348
394
  queryKey: emporixKey("product-search", [query, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
349
395
  enabled: typeof query === "string" && query.trim() !== "",
350
396
  queryFn: () => client.products.search(query, params, ctx),
@@ -355,7 +401,7 @@ function useProductNameSearch(term, params = {}, options = {}) {
355
401
  const { client } = useEmporix();
356
402
  const { ctx } = useReadAuth(options.auth);
357
403
  const { siteCode, language } = useReadSite();
358
- return useQuery({
404
+ return useQuery2({
359
405
  queryKey: emporixKey("product-name-search", [term, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
360
406
  enabled: typeof term === "string" && term.trim() !== "",
361
407
  queryFn: () => client.products.searchByName(term, params, ctx),
@@ -366,7 +412,7 @@ function useProductsByCodes(codes, options = {}) {
366
412
  const { client } = useEmporix();
367
413
  const { ctx } = useReadAuth(options.auth);
368
414
  const { siteCode, language } = useReadSite();
369
- return useQuery({
415
+ return useQuery2({
370
416
  queryKey: emporixKey("products-by-codes", [codes, options.chunkSize], {
371
417
  tenant: client.tenant,
372
418
  authKind: ctx.kind,
@@ -382,13 +428,21 @@ function useProductsByCodes(codes, options = {}) {
382
428
  staleTime: 3e4
383
429
  });
384
430
  }
431
+
432
+ // src/hooks/use-shopping-lists.ts
433
+ import {
434
+ useQuery as useQuery3,
435
+ useMutation,
436
+ useQueryClient as useQueryClient2
437
+ } from "@tanstack/react-query";
438
+ import "@viu/emporix-sdk";
385
439
  var SHOPPING_LIST_STALE_TIME = 3e4;
386
440
  var INVALIDATE_KEY = ["emporix", "shopping-lists"];
387
441
  function useShoppingLists(opts = {}) {
388
442
  const { client } = useEmporix();
389
443
  const ctx = useCustomerOnlyCtx();
390
444
  const { siteCode, language } = useReadSite();
391
- return useQuery({
445
+ return useQuery3({
392
446
  queryKey: emporixKey("shopping-lists", [opts.name ?? null], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
393
447
  queryFn: () => client.shoppingLists.list(ctx, opts),
394
448
  staleTime: SHOPPING_LIST_STALE_TIME
@@ -397,7 +451,7 @@ function useShoppingLists(opts = {}) {
397
451
  function useCreateShoppingList() {
398
452
  const { client } = useEmporix();
399
453
  const ctx = useCustomerOnlyCtx();
400
- const qc = useQueryClient();
454
+ const qc = useQueryClient2();
401
455
  return useMutation({
402
456
  mutationFn: (draft) => client.shoppingLists.create(draft, ctx),
403
457
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY })
@@ -406,7 +460,7 @@ function useCreateShoppingList() {
406
460
  function useDeleteShoppingList() {
407
461
  const { client } = useEmporix();
408
462
  const ctx = useCustomerOnlyCtx();
409
- const qc = useQueryClient();
463
+ const qc = useQueryClient2();
410
464
  return useMutation({
411
465
  mutationFn: ({ customerId, name }) => client.shoppingLists.delete(customerId, ctx, name !== void 0 ? { name } : {}),
412
466
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY })
@@ -415,7 +469,7 @@ function useDeleteShoppingList() {
415
469
  function useAddToShoppingList() {
416
470
  const { client } = useEmporix();
417
471
  const ctx = useCustomerOnlyCtx();
418
- const qc = useQueryClient();
472
+ const qc = useQueryClient2();
419
473
  return useMutation({
420
474
  mutationFn: ({ customerId, listName, item }) => client.shoppingLists.addItem(customerId, listName, item, ctx),
421
475
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY })
@@ -424,7 +478,7 @@ function useAddToShoppingList() {
424
478
  function useRemoveFromShoppingList() {
425
479
  const { client } = useEmporix();
426
480
  const ctx = useCustomerOnlyCtx();
427
- const qc = useQueryClient();
481
+ const qc = useQueryClient2();
428
482
  return useMutation({
429
483
  mutationFn: ({ customerId, listName, productId }) => client.shoppingLists.removeItem(customerId, listName, productId, ctx),
430
484
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY })
@@ -433,18 +487,22 @@ function useRemoveFromShoppingList() {
433
487
  function useSetShoppingListItemQuantity() {
434
488
  const { client } = useEmporix();
435
489
  const ctx = useCustomerOnlyCtx();
436
- const qc = useQueryClient();
490
+ const qc = useQueryClient2();
437
491
  return useMutation({
438
492
  mutationFn: ({ customerId, listName, productId, quantity }) => client.shoppingLists.setItemQuantity(customerId, listName, productId, quantity, ctx),
439
493
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY })
440
494
  });
441
495
  }
496
+
497
+ // src/hooks/use-variant-children.ts
498
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
499
+ import "@viu/emporix-sdk";
442
500
  var VARIANT_CHILDREN_STALE_TIME = 6e4;
443
501
  function useVariantChildren(parentVariantId, options = {}) {
444
502
  const { client } = useEmporix();
445
503
  const { ctx } = useReadAuth(options.auth);
446
504
  const { siteCode, language } = useReadSite();
447
- return useQuery({
505
+ return useQuery4({
448
506
  queryKey: emporixKey(
449
507
  "variant-children",
450
508
  [parentVariantId, { pageSize: options.pageSize }],
@@ -459,12 +517,18 @@ function useVariantChildren(parentVariantId, options = {}) {
459
517
  staleTime: VARIANT_CHILDREN_STALE_TIME
460
518
  });
461
519
  }
520
+
521
+ // src/hooks/use-categories.ts
522
+ import {
523
+ useQuery as useQuery5
524
+ } from "@tanstack/react-query";
525
+ import "@viu/emporix-sdk";
462
526
  var CATEGORIES_STALE_TIME = 5 * 6e4;
463
527
  function useCategory(categoryId, options = {}) {
464
528
  const { client } = useEmporix();
465
529
  const { ctx } = useReadAuth(options.auth);
466
530
  const { siteCode, language } = useReadSite();
467
- return useQuery({
531
+ return useQuery5({
468
532
  queryKey: emporixKey("category", [categoryId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
469
533
  queryFn: () => client.categories.get(categoryId, ctx),
470
534
  staleTime: CATEGORIES_STALE_TIME
@@ -474,7 +538,7 @@ function useSubcategories(categoryId, params = {}, options = {}) {
474
538
  const { client } = useEmporix();
475
539
  const { ctx } = useReadAuth(options.auth);
476
540
  const { siteCode, language } = useReadSite();
477
- return useQuery({
541
+ return useQuery5({
478
542
  queryKey: emporixKey("subcategories", [categoryId ?? null, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
479
543
  enabled: typeof categoryId === "string" && categoryId !== "",
480
544
  queryFn: () => client.categories.subcategories(categoryId, params, ctx),
@@ -485,7 +549,7 @@ function useCategories(params = {}, options = {}) {
485
549
  const { client } = useEmporix();
486
550
  const { ctx } = useReadAuth(options.auth);
487
551
  const { siteCode, language } = useReadSite();
488
- return useQuery({
552
+ return useQuery5({
489
553
  queryKey: emporixKey("categories", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
490
554
  queryFn: () => client.categories.list(params, ctx),
491
555
  staleTime: CATEGORIES_STALE_TIME
@@ -508,7 +572,7 @@ function useCategoryTree(options = {}) {
508
572
  const { client } = useEmporix();
509
573
  const { ctx } = useReadAuth(options.auth);
510
574
  const { siteCode, language } = useReadSite();
511
- return useQuery({
575
+ return useQuery5({
512
576
  queryKey: emporixKey("category-tree", [], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
513
577
  queryFn: () => client.categories.tree(ctx),
514
578
  staleTime: CATEGORIES_STALE_TIME
@@ -518,7 +582,7 @@ function useProductsInCategory(categoryId, params = {}, options = {}) {
518
582
  const { client } = useEmporix();
519
583
  const { ctx } = useReadAuth(options.auth);
520
584
  const { siteCode, language } = useReadSite();
521
- return useQuery({
585
+ return useQuery5({
522
586
  queryKey: emporixKey("products-in-category", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
523
587
  enabled: typeof categoryId === "string" && categoryId !== "",
524
588
  queryFn: () => client.categories.productsIn(categoryId, params, ctx),
@@ -540,13 +604,25 @@ function useProductsInCategoryInfinite(categoryId, params = {}, options = {}) {
540
604
  staleTime: CATEGORIES_STALE_TIME
541
605
  });
542
606
  }
607
+
608
+ // src/hooks/use-cart.ts
609
+ import { useEffect } from "react";
610
+ import {
611
+ useMutation as useMutation2,
612
+ useQuery as useQuery6,
613
+ useQueryClient as useQueryClient3
614
+ } from "@tanstack/react-query";
615
+ import {
616
+ EmporixError
617
+ } from "@viu/emporix-sdk";
543
618
  function useCart(cartId, options = {}) {
544
- const { client, storage } = useEmporix();
619
+ const { client } = useEmporix();
545
620
  const { ctx } = useReadAuth(options.auth);
546
621
  const { siteCode, language } = useReadSite();
547
622
  const { activeCompany } = useActiveCompany();
548
- const resolvedId = cartId ?? storage.getCartId() ?? void 0;
549
- return useQuery({
623
+ const storedCartId = useCartId();
624
+ const resolvedId = cartId ?? storedCartId ?? void 0;
625
+ return useQuery6({
550
626
  queryKey: emporixKey(
551
627
  "cart",
552
628
  [resolvedId ?? null, activeCompany?.id ?? null],
@@ -558,7 +634,7 @@ function useCart(cartId, options = {}) {
558
634
  }
559
635
  function useCartMutations(cartId) {
560
636
  const { client, storage } = useEmporix();
561
- const qc = useQueryClient();
637
+ const qc = useQueryClient3();
562
638
  const { ctx } = useReadAuth();
563
639
  const { siteCode, language } = useReadSite();
564
640
  const { activeCompany } = useActiveCompany();
@@ -577,7 +653,7 @@ function useCartMutations(cartId) {
577
653
  { tenant: client.tenant, authKind: ctx.kind, siteCode, language }
578
654
  );
579
655
  function make(run, optimistic) {
580
- return useMutation({
656
+ return useMutation2({
581
657
  mutationFn: async (vars) => run(resolveId(), vars),
582
658
  onMutate: async (vars) => {
583
659
  const id = resolveId();
@@ -634,9 +710,9 @@ function useCartMutations(cartId) {
634
710
  }
635
711
  function useCreateCart() {
636
712
  const { client, storage } = useEmporix();
637
- const qc = useQueryClient();
713
+ const qc = useQueryClient3();
638
714
  const { ctx } = useReadAuth();
639
- return useMutation({
715
+ return useMutation2({
640
716
  mutationFn: (input) => client.carts.create(input, ctx),
641
717
  onSuccess: async (cart) => {
642
718
  if (cart.cartId) storage.setCartId(cart.cartId);
@@ -646,20 +722,12 @@ function useCreateCart() {
646
722
  }
647
723
  function useActiveCart(opts) {
648
724
  const { client, storage } = useEmporix();
649
- const qc = useQueryClient();
725
+ const qc = useQueryClient3();
650
726
  const { ctx } = useReadAuth(opts?.auth);
651
727
  const { siteCode: activeSite } = useReadSite();
652
728
  const { activeCompany } = useActiveCompany();
653
- const [cartId, setCartId] = useState(() => storage.getCartId());
729
+ const cartId = useCartId();
654
730
  const effectiveLegalEntityId = opts?.legalEntityId ?? activeCompany?.id;
655
- useEffect(() => {
656
- if (!storage.subscribeAll) return;
657
- return storage.subscribeAll((key) => {
658
- if (key !== "cartId") return;
659
- const next = storage.getCartId();
660
- setCartId((prev) => prev === next ? prev : next);
661
- });
662
- }, [storage]);
663
731
  useEffect(() => {
664
732
  if (cartId !== null) return;
665
733
  if (!opts?.create) return;
@@ -677,7 +745,6 @@ function useActiveCart(opts) {
677
745
  if (cancelled) return;
678
746
  if (cart?.id) {
679
747
  storage.setCartId(cart.id);
680
- setCartId(cart.id);
681
748
  }
682
749
  }).catch(() => {
683
750
  });
@@ -689,10 +756,19 @@ function useActiveCart(opts) {
689
756
  const data = cartId === null ? null : inner.data;
690
757
  return { ...inner, data };
691
758
  }
759
+
760
+ // src/hooks/use-checkout.ts
761
+ import {
762
+ useMutation as useMutation3,
763
+ useQuery as useQuery7
764
+ } from "@tanstack/react-query";
765
+ import {
766
+ auth as auth3
767
+ } from "@viu/emporix-sdk";
692
768
  var PAYMENT_MODES_STALE_TIME = 10 * 6e4;
693
769
  function customerOnlyCtx(token) {
694
770
  if (!token) throw new Error("usePaymentModes requires a logged-in customer token");
695
- return auth.customer(token);
771
+ return auth3.customer(token);
696
772
  }
697
773
  function useCheckout() {
698
774
  const { client } = useEmporix();
@@ -703,13 +779,13 @@ function useCheckout() {
703
779
  if ("legalEntityId" in input) return input;
704
780
  return { ...input, legalEntityId: activeCompany.id };
705
781
  };
706
- const placeOrder = useMutation({
782
+ const placeOrder = useMutation3({
707
783
  mutationFn: (v) => client.checkout.placeOrder(withLE(v.input), ctx, {
708
784
  ...v.saasToken !== void 0 ? { saasToken: v.saasToken } : {},
709
785
  ...v.siteCode !== void 0 ? { siteCode: v.siteCode } : {}
710
786
  })
711
787
  });
712
- const placeOrderFromQuote = useMutation({
788
+ const placeOrderFromQuote = useMutation3({
713
789
  mutationFn: (v) => client.checkout.placeOrderFromQuote(withLE(v.input), ctx, {
714
790
  ...v.saasToken !== void 0 ? { saasToken: v.saasToken } : {},
715
791
  ...v.siteCode !== void 0 ? { siteCode: v.siteCode } : {}
@@ -718,11 +794,11 @@ function useCheckout() {
718
794
  return { placeOrder, placeOrderFromQuote };
719
795
  }
720
796
  function usePaymentModes(options = {}) {
721
- const { client, storage } = useEmporix();
722
- const token = storage.getCustomerToken();
797
+ const { client } = useEmporix();
798
+ const token = useCustomerToken();
723
799
  const { siteCode } = useReadSite();
724
800
  const { activeCompany } = useActiveCompany();
725
- return useQuery({
801
+ return useQuery7({
726
802
  queryKey: emporixKey(
727
803
  "payment-modes",
728
804
  [activeCompany?.id ?? null],
@@ -733,12 +809,18 @@ function usePaymentModes(options = {}) {
733
809
  staleTime: PAYMENT_MODES_STALE_TIME
734
810
  });
735
811
  }
812
+
813
+ // src/hooks/use-match-prices.ts
814
+ import { useQuery as useQuery8 } from "@tanstack/react-query";
815
+ import {
816
+ auth as auth4
817
+ } from "@viu/emporix-sdk";
736
818
  var PRICES_STALE_TIME = 6e4;
737
819
  function useMatchPrices(input, options = {}) {
738
820
  const { client } = useEmporix();
739
821
  const { siteCode } = useReadSite();
740
- const ctx = options.customerToken ? auth.customer(options.customerToken) : auth.anonymous();
741
- return useQuery({
822
+ const ctx = options.customerToken ? auth4.customer(options.customerToken) : auth4.anonymous();
823
+ return useQuery8({
742
824
  queryKey: [
743
825
  "emporix",
744
826
  "match-prices",
@@ -749,12 +831,18 @@ function useMatchPrices(input, options = {}) {
749
831
  staleTime: PRICES_STALE_TIME
750
832
  });
751
833
  }
834
+
835
+ // src/hooks/use-match-prices-chunked.ts
836
+ import { useQuery as useQuery9 } from "@tanstack/react-query";
837
+ import {
838
+ auth as auth5
839
+ } from "@viu/emporix-sdk";
752
840
  var PRICES_STALE_TIME2 = 6e4;
753
841
  function useMatchPricesChunked(input, options = {}) {
754
842
  const { client } = useEmporix();
755
843
  const { siteCode } = useReadSite();
756
- const ctx = options.customerToken ? auth.customer(options.customerToken) : auth.anonymous();
757
- return useQuery({
844
+ const ctx = options.customerToken ? auth5.customer(options.customerToken) : auth5.anonymous();
845
+ return useQuery9({
758
846
  queryKey: [
759
847
  "emporix",
760
848
  "match-prices-chunked",
@@ -786,16 +874,24 @@ function useProductMedia(productId) {
786
874
  const data = q.data?.productMedia;
787
875
  return { data, isLoading: q.isLoading, error: q.error };
788
876
  }
877
+
878
+ // src/hooks/use-my-segments.ts
879
+ import {
880
+ useQuery as useQuery10
881
+ } from "@tanstack/react-query";
882
+ import {
883
+ auth as auth6
884
+ } from "@viu/emporix-sdk";
789
885
  var SEGMENTS_STALE_TIME = 5 * 6e4;
790
886
  function customerCtx(token) {
791
887
  if (!token) throw new Error("requires a customer token in storage");
792
- return auth.customer(token);
888
+ return auth6.customer(token);
793
889
  }
794
890
  function useMySegments(query = {}) {
795
- const { client, storage } = useEmporix();
796
- const token = storage.getCustomerToken();
891
+ const { client } = useEmporix();
892
+ const token = useCustomerToken();
797
893
  const { siteCode, language } = useReadSite();
798
- return useQuery({
894
+ return useQuery10({
799
895
  queryKey: ["emporix", "segment", "list", { tenant: client.tenant, query, siteCode, language }],
800
896
  enabled: token !== null,
801
897
  queryFn: () => client.segments.list(query, customerCtx(token)),
@@ -803,10 +899,10 @@ function useMySegments(query = {}) {
803
899
  });
804
900
  }
805
901
  function useMySegmentItems(query = {}) {
806
- const { client, storage } = useEmporix();
807
- const token = storage.getCustomerToken();
902
+ const { client } = useEmporix();
903
+ const token = useCustomerToken();
808
904
  const { siteCode, language } = useReadSite();
809
- return useQuery({
905
+ return useQuery10({
810
906
  queryKey: ["emporix", "segment", "items", { tenant: client.tenant, query, siteCode, language }],
811
907
  enabled: token !== null,
812
908
  queryFn: () => client.segments.listItems(query, customerCtx(token)),
@@ -814,10 +910,10 @@ function useMySegmentItems(query = {}) {
814
910
  });
815
911
  }
816
912
  function useMySegmentCategoryTree(query = {}) {
817
- const { client, storage } = useEmporix();
818
- const token = storage.getCustomerToken();
913
+ const { client } = useEmporix();
914
+ const token = useCustomerToken();
819
915
  const { siteCode, language } = useReadSite();
820
- return useQuery({
916
+ return useQuery10({
821
917
  queryKey: ["emporix", "segment", "categoryTree", { tenant: client.tenant, query, siteCode, language }],
822
918
  enabled: token !== null,
823
919
  queryFn: () => client.segments.getCategoryTree(query, customerCtx(token)),
@@ -825,10 +921,10 @@ function useMySegmentCategoryTree(query = {}) {
825
921
  });
826
922
  }
827
923
  function useMySegmentProducts(query = {}) {
828
- const { client, storage } = useEmporix();
829
- const token = storage.getCustomerToken();
924
+ const { client } = useEmporix();
925
+ const token = useCustomerToken();
830
926
  const { siteCode, language } = useReadSite();
831
- return useQuery({
927
+ return useQuery10({
832
928
  queryKey: ["emporix", "segment", "myProducts", { tenant: client.tenant, query, siteCode, language }],
833
929
  enabled: token !== null,
834
930
  queryFn: () => client.segments.listMyProducts(query, customerCtx(token)),
@@ -836,8 +932,8 @@ function useMySegmentProducts(query = {}) {
836
932
  });
837
933
  }
838
934
  function useMySegmentProductsInfinite(query = {}) {
839
- const { client, storage } = useEmporix();
840
- const token = storage.getCustomerToken();
935
+ const { client } = useEmporix();
936
+ const token = useCustomerToken();
841
937
  const { siteCode, language } = useReadSite();
842
938
  return useEmporixInfinite({
843
939
  queryKey: [
@@ -855,10 +951,10 @@ function useMySegmentProductsInfinite(query = {}) {
855
951
  });
856
952
  }
857
953
  function useMySegmentCategories(query = {}) {
858
- const { client, storage } = useEmporix();
859
- const token = storage.getCustomerToken();
954
+ const { client } = useEmporix();
955
+ const token = useCustomerToken();
860
956
  const { siteCode, language } = useReadSite();
861
- return useQuery({
957
+ return useQuery10({
862
958
  queryKey: ["emporix", "segment", "myCategories", { tenant: client.tenant, query, siteCode, language }],
863
959
  enabled: token !== null,
864
960
  queryFn: () => client.segments.listMyCategories(query, customerCtx(token)),
@@ -866,8 +962,8 @@ function useMySegmentCategories(query = {}) {
866
962
  });
867
963
  }
868
964
  function useMySegmentCategoriesInfinite(query = {}) {
869
- const { client, storage } = useEmporix();
870
- const token = storage.getCustomerToken();
965
+ const { client } = useEmporix();
966
+ const token = useCustomerToken();
871
967
  const { siteCode, language } = useReadSite();
872
968
  return useEmporixInfinite({
873
969
  queryKey: [
@@ -884,11 +980,15 @@ function useMySegmentCategoriesInfinite(query = {}) {
884
980
  staleTime: SEGMENTS_STALE_TIME
885
981
  });
886
982
  }
983
+
984
+ // src/hooks/use-customer-profile.ts
985
+ import { useMutation as useMutation4, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
986
+ import "@viu/emporix-sdk";
887
987
  function useUpdateCustomer() {
888
988
  const { client } = useEmporix();
889
989
  const ctx = useCustomerOnlyCtx();
890
- const qc = useQueryClient();
891
- return useMutation({
990
+ const qc = useQueryClient4();
991
+ return useMutation4({
892
992
  mutationFn: (patch) => client.customers.update(patch, ctx),
893
993
  onSuccess: () => {
894
994
  void qc.invalidateQueries({ queryKey: ["emporix", "customer", "me"] });
@@ -898,17 +998,27 @@ function useUpdateCustomer() {
898
998
  function useChangePassword() {
899
999
  const { client } = useEmporix();
900
1000
  const ctx = useCustomerOnlyCtx();
901
- return useMutation({
1001
+ return useMutation4({
902
1002
  mutationFn: (input) => client.customers.changePassword(input, ctx)
903
1003
  });
904
1004
  }
1005
+
1006
+ // src/hooks/use-customer-addresses.ts
1007
+ import {
1008
+ useMutation as useMutation5,
1009
+ useQuery as useQuery11,
1010
+ useQueryClient as useQueryClient5
1011
+ } from "@tanstack/react-query";
1012
+ import {
1013
+ auth as auth7
1014
+ } from "@viu/emporix-sdk";
905
1015
  var ADDRESSES_KEY = ["emporix", "customer", "addresses"];
906
1016
  function useCustomerAddresses(options = {}) {
907
- const { client, storage } = useEmporix();
908
- const token = storage.getCustomerToken();
1017
+ const { client } = useEmporix();
1018
+ const token = useCustomerToken();
909
1019
  const { activeCompany } = useActiveCompany();
910
- const ctx = options.auth ?? (token ? auth.customer(token) : null);
911
- return useQuery({
1020
+ const ctx = options.auth ?? (token ? auth7.customer(token) : null);
1021
+ return useQuery11({
912
1022
  queryKey: [
913
1023
  ...ADDRESSES_KEY,
914
1024
  { tenant: client.tenant, hasToken: token !== null, legalEntityId: activeCompany?.id ?? null }
@@ -920,39 +1030,51 @@ function useCustomerAddresses(options = {}) {
920
1030
  function useAddressMutations() {
921
1031
  const { client } = useEmporix();
922
1032
  const ctx = useCustomerOnlyCtx();
923
- const qc = useQueryClient();
1033
+ const qc = useQueryClient5();
924
1034
  const invalidate = () => {
925
1035
  void qc.invalidateQueries({ queryKey: ADDRESSES_KEY });
926
1036
  };
927
1037
  return {
928
- add: useMutation({
1038
+ add: useMutation5({
929
1039
  mutationFn: (input) => client.customers.addresses.add(input, ctx),
930
1040
  onSuccess: invalidate
931
1041
  }),
932
- update: useMutation({
1042
+ update: useMutation5({
933
1043
  mutationFn: ({ id, patch }) => client.customers.addresses.update(id, patch, ctx),
934
1044
  onSuccess: invalidate
935
1045
  }),
936
- remove: useMutation({
1046
+ remove: useMutation5({
937
1047
  mutationFn: ({ id }) => client.customers.addresses.remove(id, ctx),
938
1048
  onSuccess: invalidate
939
1049
  })
940
1050
  };
941
1051
  }
1052
+
1053
+ // src/hooks/use-password-reset.ts
1054
+ import { useMutation as useMutation6 } from "@tanstack/react-query";
1055
+ import {
1056
+ auth as auth8
1057
+ } from "@viu/emporix-sdk";
942
1058
  function usePasswordReset() {
943
1059
  const { client } = useEmporix();
944
- const anonCtx = auth.anonymous();
1060
+ const anonCtx = auth8.anonymous();
945
1061
  return {
946
- request: useMutation({
1062
+ request: useMutation6({
947
1063
  mutationFn: (input) => client.customers.requestPasswordReset(input, anonCtx)
948
1064
  }),
949
- confirm: useMutation({
1065
+ confirm: useMutation6({
950
1066
  mutationFn: (input) => client.customers.confirmPasswordReset(input, anonCtx)
951
1067
  })
952
1068
  };
953
1069
  }
1070
+
1071
+ // src/hooks/use-sites.ts
1072
+ import { useQuery as useQuery12 } from "@tanstack/react-query";
1073
+
1074
+ // src/hooks/use-site-context.ts
1075
+ import { useContext as useContext3 } from "react";
954
1076
  function useSiteContext() {
955
- const ctx = useContext(EmporixSiteContext);
1077
+ const ctx = useContext3(EmporixSiteContext);
956
1078
  if (!ctx) {
957
1079
  throw new Error("useSiteContext must be used within an EmporixProvider");
958
1080
  }
@@ -964,7 +1086,7 @@ var SITES_STALE_TIME = 10 * 6e4;
964
1086
  function useSites(options = {}) {
965
1087
  const { client } = useEmporix();
966
1088
  const { ctx } = useReadAuth(options.auth);
967
- return useQuery({
1089
+ return useQuery12({
968
1090
  queryKey: emporixKey("sites", [], { tenant: client.tenant, authKind: ctx.kind }),
969
1091
  queryFn: () => client.sites.list(ctx),
970
1092
  staleTime: SITES_STALE_TIME
@@ -973,7 +1095,7 @@ function useSites(options = {}) {
973
1095
  function useDefaultSite(options = {}) {
974
1096
  const { client } = useEmporix();
975
1097
  const { ctx } = useReadAuth(options.auth);
976
- return useQuery({
1098
+ return useQuery12({
977
1099
  queryKey: emporixKey("site-default", [], { tenant: client.tenant, authKind: ctx.kind }),
978
1100
  queryFn: () => client.sites.current(ctx),
979
1101
  staleTime: SITES_STALE_TIME
@@ -984,79 +1106,108 @@ function useActiveSite(options = {}) {
984
1106
  const { data: sites } = useSites(options);
985
1107
  return siteCode ? sites?.find((s) => s.code === siteCode) : void 0;
986
1108
  }
1109
+
1110
+ // src/hooks/use-my-companies.ts
1111
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
1112
+ import { auth as auth9 } from "@viu/emporix-sdk";
987
1113
  function useMyCompanies() {
988
- const { client, storage } = useEmporix();
989
- const token = storage.getCustomerToken();
990
- return useQuery({
1114
+ const { client } = useEmporix();
1115
+ const token = useCustomerToken();
1116
+ return useQuery13({
991
1117
  queryKey: emporixKey("companies", ["mine"], {
992
1118
  tenant: client.tenant,
993
1119
  authKind: token ? "customer" : "anonymous"
994
1120
  }),
995
1121
  enabled: token !== null,
996
- queryFn: () => client.companies.listMine(auth.customer(token))
1122
+ queryFn: () => client.companies.listMine(auth9.customer(token))
997
1123
  });
998
1124
  }
1125
+
1126
+ // src/hooks/use-company.ts
1127
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
1128
+ import { auth as auth10 } from "@viu/emporix-sdk";
999
1129
  function useCompany(legalEntityId) {
1000
- const { client, storage } = useEmporix();
1001
- const token = storage.getCustomerToken();
1002
- return useQuery({
1130
+ const { client } = useEmporix();
1131
+ const token = useCustomerToken();
1132
+ return useQuery14({
1003
1133
  queryKey: emporixKey("companies", [legalEntityId ?? null], {
1004
1134
  tenant: client.tenant,
1005
1135
  authKind: token ? "customer" : "anonymous"
1006
1136
  }),
1007
1137
  enabled: token !== null && legalEntityId !== void 0,
1008
- queryFn: () => client.companies.get(legalEntityId, auth.customer(token))
1138
+ queryFn: () => client.companies.get(legalEntityId, auth10.customer(token))
1009
1139
  });
1010
1140
  }
1141
+
1142
+ // src/hooks/use-company-contacts.ts
1143
+ import { useQuery as useQuery15 } from "@tanstack/react-query";
1144
+ import { auth as auth11 } from "@viu/emporix-sdk";
1011
1145
  function useCompanyContacts(legalEntityId) {
1012
1146
  const { client, storage } = useEmporix();
1013
1147
  const token = storage.getCustomerToken();
1014
- return useQuery({
1148
+ return useQuery15({
1015
1149
  queryKey: emporixKey("companies", ["contacts", legalEntityId ?? null], {
1016
1150
  tenant: client.tenant,
1017
1151
  authKind: token ? "customer" : "anonymous"
1018
1152
  }),
1019
1153
  enabled: token !== null && legalEntityId !== void 0,
1020
- queryFn: () => client.contacts.listForCompany(legalEntityId, auth.customer(token))
1154
+ queryFn: () => client.contacts.listForCompany(legalEntityId, auth11.customer(token))
1021
1155
  });
1022
1156
  }
1157
+
1158
+ // src/hooks/use-company-locations.ts
1159
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
1160
+ import { auth as auth12 } from "@viu/emporix-sdk";
1023
1161
  function useCompanyLocations(legalEntityId) {
1024
- const { client, storage } = useEmporix();
1025
- const token = storage.getCustomerToken();
1026
- return useQuery({
1162
+ const { client } = useEmporix();
1163
+ const token = useCustomerToken();
1164
+ return useQuery16({
1027
1165
  queryKey: emporixKey("companies", ["locations", legalEntityId ?? null], {
1028
1166
  tenant: client.tenant,
1029
1167
  authKind: token ? "customer" : "anonymous"
1030
1168
  }),
1031
1169
  enabled: token !== null && legalEntityId !== void 0,
1032
- queryFn: () => client.locations.listForCompany(legalEntityId, auth.customer(token))
1170
+ queryFn: () => client.locations.listForCompany(legalEntityId, auth12.customer(token))
1033
1171
  });
1034
1172
  }
1173
+
1174
+ // src/hooks/use-company-groups.ts
1175
+ import { useQuery as useQuery17 } from "@tanstack/react-query";
1176
+ import { auth as auth13 } from "@viu/emporix-sdk";
1035
1177
  function useCompanyGroups(legalEntityId) {
1036
- const { client, storage } = useEmporix();
1037
- const token = storage.getCustomerToken();
1038
- return useQuery({
1178
+ const { client } = useEmporix();
1179
+ const token = useCustomerToken();
1180
+ return useQuery17({
1039
1181
  queryKey: emporixKey("companies", ["groups", legalEntityId ?? null], {
1040
1182
  tenant: client.tenant,
1041
1183
  authKind: token ? "customer" : "anonymous"
1042
1184
  }),
1043
1185
  enabled: token !== null && legalEntityId !== void 0,
1044
- queryFn: () => client.customerGroups.listForCompany(legalEntityId, auth.customer(token))
1186
+ queryFn: () => client.customerGroups.listForCompany(legalEntityId, auth13.customer(token))
1045
1187
  });
1046
1188
  }
1189
+
1190
+ // src/hooks/use-company-mutations.ts
1191
+ import {
1192
+ useMutation as useMutation7,
1193
+ useQueryClient as useQueryClient6
1194
+ } from "@tanstack/react-query";
1195
+ import {
1196
+ auth as auth14
1197
+ } from "@viu/emporix-sdk";
1047
1198
  function useCustomerAuthResolver() {
1048
1199
  const { storage } = useEmporix();
1049
1200
  return () => {
1050
1201
  const token = storage.getCustomerToken();
1051
1202
  if (!token) throw new Error("Mutation requires a logged-in customer token");
1052
- return auth.customer(token);
1203
+ return auth14.customer(token);
1053
1204
  };
1054
1205
  }
1055
1206
  function useCreateCompany() {
1056
1207
  const { client } = useEmporix();
1057
1208
  const resolveAuth = useCustomerAuthResolver();
1058
- const qc = useQueryClient();
1059
- return useMutation({
1209
+ const qc = useQueryClient6();
1210
+ return useMutation7({
1060
1211
  mutationFn: (input) => client.companies.create(input, resolveAuth()),
1061
1212
  onSuccess: () => qc.invalidateQueries({ queryKey: ["emporix", "companies", "mine"] })
1062
1213
  });
@@ -1064,8 +1215,8 @@ function useCreateCompany() {
1064
1215
  function useUpdateCompany() {
1065
1216
  const { client } = useEmporix();
1066
1217
  const resolveAuth = useCustomerAuthResolver();
1067
- const qc = useQueryClient();
1068
- return useMutation({
1218
+ const qc = useQueryClient6();
1219
+ return useMutation7({
1069
1220
  mutationFn: ({ id, patch }) => client.companies.update(id, patch, resolveAuth()),
1070
1221
  onSuccess: () => qc.invalidateQueries({ queryKey: ["emporix", "companies"] })
1071
1222
  });
@@ -1073,8 +1224,8 @@ function useUpdateCompany() {
1073
1224
  function useDeleteCompany() {
1074
1225
  const { client } = useEmporix();
1075
1226
  const resolveAuth = useCustomerAuthResolver();
1076
- const qc = useQueryClient();
1077
- return useMutation({
1227
+ const qc = useQueryClient6();
1228
+ return useMutation7({
1078
1229
  mutationFn: (id) => client.companies.delete(id, resolveAuth()),
1079
1230
  onSuccess: () => qc.invalidateQueries({ queryKey: ["emporix", "companies"] })
1080
1231
  });
@@ -1082,8 +1233,8 @@ function useDeleteCompany() {
1082
1233
  function useAssignContact() {
1083
1234
  const { client } = useEmporix();
1084
1235
  const resolveAuth = useCustomerAuthResolver();
1085
- const qc = useQueryClient();
1086
- return useMutation({
1236
+ const qc = useQueryClient6();
1237
+ return useMutation7({
1087
1238
  mutationFn: (input) => client.contacts.assign(input, resolveAuth()),
1088
1239
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("contacts") })
1089
1240
  });
@@ -1091,8 +1242,8 @@ function useAssignContact() {
1091
1242
  function useUpdateContactAssignment() {
1092
1243
  const { client } = useEmporix();
1093
1244
  const resolveAuth = useCustomerAuthResolver();
1094
- const qc = useQueryClient();
1095
- return useMutation({
1245
+ const qc = useQueryClient6();
1246
+ return useMutation7({
1096
1247
  mutationFn: ({ id, patch }) => client.contacts.update(id, patch, resolveAuth()),
1097
1248
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("contacts") })
1098
1249
  });
@@ -1100,8 +1251,8 @@ function useUpdateContactAssignment() {
1100
1251
  function useUnassignContact() {
1101
1252
  const { client } = useEmporix();
1102
1253
  const resolveAuth = useCustomerAuthResolver();
1103
- const qc = useQueryClient();
1104
- return useMutation({
1254
+ const qc = useQueryClient6();
1255
+ return useMutation7({
1105
1256
  mutationFn: (id) => client.contacts.unassign(id, resolveAuth()),
1106
1257
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("contacts") })
1107
1258
  });
@@ -1109,8 +1260,8 @@ function useUnassignContact() {
1109
1260
  function useCreateLocation() {
1110
1261
  const { client } = useEmporix();
1111
1262
  const resolveAuth = useCustomerAuthResolver();
1112
- const qc = useQueryClient();
1113
- return useMutation({
1263
+ const qc = useQueryClient6();
1264
+ return useMutation7({
1114
1265
  mutationFn: (input) => client.locations.create(input, resolveAuth()),
1115
1266
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("locations") })
1116
1267
  });
@@ -1118,8 +1269,8 @@ function useCreateLocation() {
1118
1269
  function useUpdateLocation() {
1119
1270
  const { client } = useEmporix();
1120
1271
  const resolveAuth = useCustomerAuthResolver();
1121
- const qc = useQueryClient();
1122
- return useMutation({
1272
+ const qc = useQueryClient6();
1273
+ return useMutation7({
1123
1274
  mutationFn: ({ id, patch }) => client.locations.update(id, patch, resolveAuth()),
1124
1275
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("locations") })
1125
1276
  });
@@ -1127,8 +1278,8 @@ function useUpdateLocation() {
1127
1278
  function useDeleteLocation() {
1128
1279
  const { client } = useEmporix();
1129
1280
  const resolveAuth = useCustomerAuthResolver();
1130
- const qc = useQueryClient();
1131
- return useMutation({
1281
+ const qc = useQueryClient6();
1282
+ return useMutation7({
1132
1283
  mutationFn: (id) => client.locations.delete(id, resolveAuth()),
1133
1284
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("locations") })
1134
1285
  });
@@ -1136,8 +1287,8 @@ function useDeleteLocation() {
1136
1287
  function useAddGroupMember() {
1137
1288
  const { client } = useEmporix();
1138
1289
  const resolveAuth = useCustomerAuthResolver();
1139
- const qc = useQueryClient();
1140
- return useMutation({
1290
+ const qc = useQueryClient6();
1291
+ return useMutation7({
1141
1292
  mutationFn: ({ groupId, member }) => client.customerGroups.addMember(groupId, member, resolveAuth()),
1142
1293
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("groups") })
1143
1294
  });
@@ -1145,19 +1296,22 @@ function useAddGroupMember() {
1145
1296
  function useRemoveGroupMember() {
1146
1297
  const { client } = useEmporix();
1147
1298
  const resolveAuth = useCustomerAuthResolver();
1148
- const qc = useQueryClient();
1149
- return useMutation({
1299
+ const qc = useQueryClient6();
1300
+ return useMutation7({
1150
1301
  mutationFn: ({ groupId, userId }) => client.customerGroups.removeMember(groupId, userId, resolveAuth()),
1151
1302
  onSuccess: () => qc.invalidateQueries({ predicate: (q) => q.queryKey.includes("groups") })
1152
1303
  });
1153
1304
  }
1305
+
1306
+ // src/hooks/use-company-switcher.ts
1307
+ import { useCallback as useCallback3 } from "react";
1154
1308
  function useCompanySwitcher() {
1155
1309
  const ctx = useActiveCompany();
1156
- const switchFn = useCallback(
1310
+ const switchFn = useCallback3(
1157
1311
  (legalEntityId) => ctx.setActiveCompany(legalEntityId),
1158
1312
  [ctx]
1159
1313
  );
1160
- const clearFn = useCallback(() => ctx.setActiveCompany(null), [ctx]);
1314
+ const clearFn = useCallback3(() => ctx.setActiveCompany(null), [ctx]);
1161
1315
  return {
1162
1316
  companies: ctx.myCompanies,
1163
1317
  active: ctx.activeCompany,
@@ -1166,23 +1320,32 @@ function useCompanySwitcher() {
1166
1320
  clear: clearFn
1167
1321
  };
1168
1322
  }
1323
+
1324
+ // src/hooks/use-cloud-functions.ts
1325
+ import {
1326
+ useMutation as useMutation8,
1327
+ useQuery as useQuery18
1328
+ } from "@tanstack/react-query";
1329
+ import {
1330
+ auth as auth15
1331
+ } from "@viu/emporix-sdk";
1169
1332
  function useInvokeCloudFunction() {
1170
1333
  const { client, storage } = useEmporix();
1171
- return useMutation({
1334
+ return useMutation8({
1172
1335
  mutationFn: (vars) => {
1173
1336
  const { functionId, auth: authOverride, ...options } = vars;
1174
1337
  const token = storage.getCustomerToken();
1175
- const authCtx = authOverride ?? (token ? auth.customer(token) : auth.anonymous());
1338
+ const authCtx = authOverride ?? (token ? auth15.customer(token) : auth15.anonymous());
1176
1339
  return client.cloudFunctions.invoke(functionId, options, authCtx);
1177
1340
  }
1178
1341
  });
1179
1342
  }
1180
1343
  function useCloudFunction(functionId, options, queryOptions) {
1181
- const { client, storage } = useEmporix();
1182
- const token = storage.getCustomerToken();
1344
+ const { client } = useEmporix();
1345
+ const token = useCustomerToken();
1183
1346
  const { auth: authOverride, ...invokeOptions } = options ?? {};
1184
- const authCtx = authOverride ?? (token ? auth.customer(token) : auth.anonymous());
1185
- return useQuery({
1347
+ const authCtx = authOverride ?? (token ? auth15.customer(token) : auth15.anonymous());
1348
+ return useQuery18({
1186
1349
  queryKey: emporixKey(
1187
1350
  "cloud-function",
1188
1351
  [functionId ?? null, invokeOptions.path ?? null, invokeOptions.query ?? null],
@@ -1197,20 +1360,24 @@ function useCloudFunction(functionId, options, queryOptions) {
1197
1360
  )
1198
1361
  });
1199
1362
  }
1363
+
1364
+ // src/hooks/use-my-orders.ts
1365
+ import { useQuery as useQuery19 } from "@tanstack/react-query";
1366
+ import { auth as auth16 } from "@viu/emporix-sdk";
1200
1367
  function useMyOrders(options = {}) {
1201
- const { client, storage } = useEmporix();
1368
+ const { client } = useEmporix();
1202
1369
  const { activeCompany } = useActiveCompany();
1203
1370
  const { siteCode, language } = useReadSite();
1204
- const token = storage.getCustomerToken();
1371
+ const token = useCustomerToken();
1205
1372
  const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
1206
- return useQuery({
1373
+ return useQuery19({
1207
1374
  queryKey: emporixKey(
1208
1375
  "orders",
1209
1376
  ["mine", effectiveLE ?? null, options.status ?? null, options.pageNumber ?? 1, options.pageSize ?? null],
1210
1377
  { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
1211
1378
  ),
1212
1379
  enabled: token !== null,
1213
- queryFn: () => client.orders.listMine(auth.customer(token), {
1380
+ queryFn: () => client.orders.listMine(auth16.customer(token), {
1214
1381
  ...options.pageNumber !== void 0 ? { pageNumber: options.pageNumber } : {},
1215
1382
  ...options.pageSize !== void 0 ? { pageSize: options.pageSize } : {},
1216
1383
  ...options.status !== void 0 ? { status: options.status } : {},
@@ -1220,11 +1387,14 @@ function useMyOrders(options = {}) {
1220
1387
  })
1221
1388
  });
1222
1389
  }
1390
+
1391
+ // src/hooks/use-my-orders-infinite.ts
1392
+ import { auth as auth17 } from "@viu/emporix-sdk";
1223
1393
  function useMyOrdersInfinite(options = {}) {
1224
- const { client, storage } = useEmporix();
1394
+ const { client } = useEmporix();
1225
1395
  const { activeCompany } = useActiveCompany();
1226
1396
  const { siteCode, language } = useReadSite();
1227
- const token = storage.getCustomerToken();
1397
+ const token = useCustomerToken();
1228
1398
  const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
1229
1399
  return useEmporixInfinite({
1230
1400
  queryKey: emporixKey(
@@ -1233,7 +1403,7 @@ function useMyOrdersInfinite(options = {}) {
1233
1403
  { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
1234
1404
  ),
1235
1405
  enabled: token !== null,
1236
- fetchPage: (pageNumber) => client.orders.listMine(auth.customer(token), {
1406
+ fetchPage: (pageNumber) => client.orders.listMine(auth17.customer(token), {
1237
1407
  pageNumber,
1238
1408
  ...options.pageSize !== void 0 ? { pageSize: options.pageSize } : {},
1239
1409
  ...options.status !== void 0 ? { status: options.status } : {},
@@ -1243,11 +1413,15 @@ function useMyOrdersInfinite(options = {}) {
1243
1413
  })
1244
1414
  });
1245
1415
  }
1416
+
1417
+ // src/hooks/use-order.ts
1418
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
1419
+ import { auth as auth18 } from "@viu/emporix-sdk";
1246
1420
  function useOrder(orderId, options = {}) {
1247
- const { client, storage } = useEmporix();
1248
- const token = storage.getCustomerToken();
1421
+ const { client } = useEmporix();
1422
+ const token = useCustomerToken();
1249
1423
  const { language } = useReadSite();
1250
- return useQuery({
1424
+ return useQuery20({
1251
1425
  queryKey: emporixKey("orders", [orderId ?? null], {
1252
1426
  tenant: client.tenant,
1253
1427
  authKind: token ? "customer" : "anonymous",
@@ -1256,15 +1430,19 @@ function useOrder(orderId, options = {}) {
1256
1430
  enabled: token !== null && orderId !== void 0,
1257
1431
  queryFn: () => client.orders.get(
1258
1432
  orderId,
1259
- auth.customer(token),
1433
+ auth18.customer(token),
1260
1434
  options.saasToken ? { saasToken: options.saasToken } : {}
1261
1435
  )
1262
1436
  });
1263
1437
  }
1438
+
1439
+ // src/hooks/use-cancel-order.ts
1440
+ import { useMutation as useMutation9, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
1441
+ import { auth as auth19 } from "@viu/emporix-sdk";
1264
1442
  function useCancelOrder() {
1265
1443
  const { client, storage } = useEmporix();
1266
- const qc = useQueryClient();
1267
- return useMutation({
1444
+ const qc = useQueryClient7();
1445
+ return useMutation9({
1268
1446
  mutationKey: ["emporix", "orders", "cancel"],
1269
1447
  mutationFn: async (input) => {
1270
1448
  const token = storage.getCustomerToken();
@@ -1272,7 +1450,7 @@ function useCancelOrder() {
1272
1450
  const { orderId, saasToken } = typeof input === "string" ? { orderId: input, saasToken: void 0 } : input;
1273
1451
  await client.orders.cancel(
1274
1452
  orderId,
1275
- auth.customer(token),
1453
+ auth19.customer(token),
1276
1454
  saasToken ? { saasToken } : {}
1277
1455
  );
1278
1456
  },
@@ -1281,10 +1459,14 @@ function useCancelOrder() {
1281
1459
  })
1282
1460
  });
1283
1461
  }
1462
+
1463
+ // src/hooks/use-order-transition.ts
1464
+ import { useMutation as useMutation10, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
1465
+ import { auth as auth20 } from "@viu/emporix-sdk";
1284
1466
  function useOrderTransition() {
1285
1467
  const { client, storage } = useEmporix();
1286
- const qc = useQueryClient();
1287
- return useMutation({
1468
+ const qc = useQueryClient8();
1469
+ return useMutation10({
1288
1470
  mutationKey: ["emporix", "orders", "transition"],
1289
1471
  mutationFn: async ({ orderId, status, comment, saasToken }) => {
1290
1472
  const token = storage.getCustomerToken();
@@ -1292,7 +1474,7 @@ function useOrderTransition() {
1292
1474
  await client.orders.transition(
1293
1475
  orderId,
1294
1476
  status,
1295
- auth.customer(token),
1477
+ auth20.customer(token),
1296
1478
  {
1297
1479
  ...comment !== void 0 ? { comment } : {},
1298
1480
  ...saasToken !== void 0 ? { saasToken } : {}
@@ -1304,15 +1486,19 @@ function useOrderTransition() {
1304
1486
  })
1305
1487
  });
1306
1488
  }
1489
+
1490
+ // src/hooks/use-reorder.ts
1491
+ import { useMutation as useMutation11, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
1492
+ import { auth as auth21 } from "@viu/emporix-sdk";
1307
1493
  function useReorder() {
1308
1494
  const { client, storage } = useEmporix();
1309
- const qc = useQueryClient();
1310
- return useMutation({
1495
+ const qc = useQueryClient9();
1496
+ return useMutation11({
1311
1497
  mutationKey: ["emporix", "orders", "reorder"],
1312
1498
  mutationFn: async ({ orderId, saasToken }) => {
1313
1499
  const token = storage.getCustomerToken();
1314
1500
  if (!token) throw new Error("useReorder: requires a logged-in customer");
1315
- const ctx = auth.customer(token);
1501
+ const ctx = auth21.customer(token);
1316
1502
  const order = await qc.fetchQuery({
1317
1503
  queryKey: emporixKey("orders", [orderId], { tenant: client.tenant, authKind: ctx.kind }),
1318
1504
  queryFn: () => client.orders.get(orderId, ctx, saasToken ? { saasToken } : {})
@@ -1357,10 +1543,14 @@ function useReorder() {
1357
1543
  }
1358
1544
  });
1359
1545
  }
1546
+
1547
+ // src/hooks/use-sales-order.ts
1548
+ import { useQuery as useQuery21 } from "@tanstack/react-query";
1549
+ import "@viu/emporix-sdk";
1360
1550
  function useSalesOrder(orderId, authCtx) {
1361
1551
  const { client } = useEmporix();
1362
1552
  const { language } = useReadSite();
1363
- return useQuery({
1553
+ return useQuery21({
1364
1554
  queryKey: emporixKey("salesorders", [orderId ?? null], {
1365
1555
  tenant: client.tenant,
1366
1556
  authKind: authCtx?.kind ?? "anonymous",
@@ -1370,10 +1560,14 @@ function useSalesOrder(orderId, authCtx) {
1370
1560
  queryFn: () => client.salesOrders.get(orderId, authCtx)
1371
1561
  });
1372
1562
  }
1563
+
1564
+ // src/hooks/use-update-sales-order.ts
1565
+ import { useMutation as useMutation12, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
1566
+ import "@viu/emporix-sdk";
1373
1567
  function useUpdateSalesOrder() {
1374
1568
  const { client } = useEmporix();
1375
- const qc = useQueryClient();
1376
- return useMutation({
1569
+ const qc = useQueryClient10();
1570
+ return useMutation12({
1377
1571
  mutationKey: ["emporix", "salesorders", "update"],
1378
1572
  mutationFn: async ({ orderId, patch, auth: auth24, recalculate }) => {
1379
1573
  if (!auth24) throw new Error("useUpdateSalesOrder: requires an auth context");
@@ -1391,11 +1585,15 @@ function useUpdateSalesOrder() {
1391
1585
  }
1392
1586
  });
1393
1587
  }
1588
+
1589
+ // src/hooks/use-availability.ts
1590
+ import { useQuery as useQuery22 } from "@tanstack/react-query";
1591
+ import { auth as auth22 } from "@viu/emporix-sdk";
1394
1592
  var AVAILABILITY_STALE_TIME = 3e4;
1395
1593
  function useAvailability(productId, siteCode, options = {}) {
1396
1594
  const { client } = useEmporix();
1397
- const ctx = options.customerToken ? auth.customer(options.customerToken) : auth.anonymous();
1398
- return useQuery({
1595
+ const ctx = options.customerToken ? auth22.customer(options.customerToken) : auth22.anonymous();
1596
+ return useQuery22({
1399
1597
  queryKey: [
1400
1598
  "emporix",
1401
1599
  "availability",
@@ -1414,11 +1612,15 @@ function useAvailability(productId, siteCode, options = {}) {
1414
1612
  staleTime: AVAILABILITY_STALE_TIME
1415
1613
  });
1416
1614
  }
1615
+
1616
+ // src/hooks/use-availabilities.ts
1617
+ import { useQuery as useQuery23 } from "@tanstack/react-query";
1618
+ import { auth as auth23 } from "@viu/emporix-sdk";
1417
1619
  var AVAILABILITY_STALE_TIME2 = 3e4;
1418
1620
  function useAvailabilities(productIds, siteCode, options = {}) {
1419
1621
  const { client } = useEmporix();
1420
- const ctx = options.customerToken ? auth.customer(options.customerToken) : auth.anonymous();
1421
- return useQuery({
1622
+ const ctx = options.customerToken ? auth23.customer(options.customerToken) : auth23.anonymous();
1623
+ return useQuery23({
1422
1624
  queryKey: [
1423
1625
  "emporix",
1424
1626
  "availabilities",
@@ -1437,29 +1639,39 @@ function useAvailabilities(productIds, siteCode, options = {}) {
1437
1639
  staleTime: AVAILABILITY_STALE_TIME2
1438
1640
  });
1439
1641
  }
1642
+
1643
+ // src/hooks/use-coupons.ts
1644
+ import { useMutation as useMutation13, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
1440
1645
  var INVALIDATE_KEY2 = ["emporix", "coupons"];
1441
1646
  function useValidateCoupon() {
1442
1647
  const { client } = useEmporix();
1443
1648
  const { ctx } = useReadAuth();
1444
- return useMutation({
1649
+ return useMutation13({
1445
1650
  mutationFn: ({ code, redemption }) => client.coupons.validateCoupon(code, redemption, ctx)
1446
1651
  });
1447
1652
  }
1448
1653
  function useRedeemCoupon() {
1449
1654
  const { client } = useEmporix();
1450
1655
  const { ctx } = useReadAuth();
1451
- const qc = useQueryClient();
1452
- return useMutation({
1656
+ const qc = useQueryClient11();
1657
+ return useMutation13({
1453
1658
  mutationFn: ({ code, redemption }) => client.coupons.redeemCoupon(code, redemption, ctx),
1454
1659
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY2 })
1455
1660
  });
1456
1661
  }
1662
+
1663
+ // src/hooks/use-reward-points.ts
1664
+ import {
1665
+ useQuery as useQuery24,
1666
+ useMutation as useMutation14,
1667
+ useQueryClient as useQueryClient12
1668
+ } from "@tanstack/react-query";
1457
1669
  var STALE = 3e4;
1458
1670
  var INVALIDATE_KEY3 = ["emporix", "reward-points"];
1459
1671
  function useMyRewardPoints() {
1460
1672
  const { client } = useEmporix();
1461
1673
  const ctx = useCustomerOnlyCtx();
1462
- return useQuery({
1674
+ return useQuery24({
1463
1675
  queryKey: emporixKey("reward-points", ["mine"], { tenant: client.tenant, authKind: ctx.kind }),
1464
1676
  queryFn: () => client.rewardPoints.getMyPoints(ctx),
1465
1677
  staleTime: STALE
@@ -1468,7 +1680,7 @@ function useMyRewardPoints() {
1468
1680
  function useMyRewardPointsSummary() {
1469
1681
  const { client } = useEmporix();
1470
1682
  const ctx = useCustomerOnlyCtx();
1471
- return useQuery({
1683
+ return useQuery24({
1472
1684
  queryKey: emporixKey("reward-points", ["mine", "summary"], { tenant: client.tenant, authKind: ctx.kind }),
1473
1685
  queryFn: () => client.rewardPoints.getMySummary(ctx),
1474
1686
  staleTime: STALE
@@ -1477,7 +1689,7 @@ function useMyRewardPointsSummary() {
1477
1689
  function useRedeemOptions() {
1478
1690
  const { client } = useEmporix();
1479
1691
  const { ctx } = useReadAuth();
1480
- return useQuery({
1692
+ return useQuery24({
1481
1693
  queryKey: emporixKey("reward-points", ["redeem-options"], { tenant: client.tenant, authKind: ctx.kind }),
1482
1694
  queryFn: () => client.rewardPoints.listRedeemOptions(ctx),
1483
1695
  staleTime: STALE
@@ -1486,18 +1698,25 @@ function useRedeemOptions() {
1486
1698
  function useRedeemRewardPoints() {
1487
1699
  const { client } = useEmporix();
1488
1700
  const ctx = useCustomerOnlyCtx();
1489
- const qc = useQueryClient();
1490
- return useMutation({
1701
+ const qc = useQueryClient12();
1702
+ return useMutation14({
1491
1703
  mutationFn: (input) => client.rewardPoints.redeemMyPoints(input, ctx),
1492
1704
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY3 })
1493
1705
  });
1494
1706
  }
1707
+
1708
+ // src/hooks/use-returns.ts
1709
+ import {
1710
+ useQuery as useQuery25,
1711
+ useMutation as useMutation15,
1712
+ useQueryClient as useQueryClient13
1713
+ } from "@tanstack/react-query";
1495
1714
  var STALE2 = 3e4;
1496
1715
  var INVALIDATE_KEY4 = ["emporix", "returns"];
1497
1716
  function useMyReturns(opts = {}) {
1498
1717
  const { client } = useEmporix();
1499
1718
  const ctx = useCustomerOnlyCtx();
1500
- return useQuery({
1719
+ return useQuery25({
1501
1720
  queryKey: emporixKey("returns", [opts.query ?? null], { tenant: client.tenant, authKind: ctx.kind }),
1502
1721
  queryFn: () => client.returns.listReturns(opts.query ?? {}, ctx),
1503
1722
  staleTime: STALE2
@@ -1506,7 +1725,7 @@ function useMyReturns(opts = {}) {
1506
1725
  function useReturn(returnId) {
1507
1726
  const { client } = useEmporix();
1508
1727
  const ctx = useCustomerOnlyCtx();
1509
- return useQuery({
1728
+ return useQuery25({
1510
1729
  queryKey: emporixKey("returns", [returnId ?? null], { tenant: client.tenant, authKind: ctx.kind }),
1511
1730
  queryFn: () => client.returns.getReturn(returnId, ctx),
1512
1731
  enabled: Boolean(returnId),
@@ -1516,18 +1735,25 @@ function useReturn(returnId) {
1516
1735
  function useCreateReturn() {
1517
1736
  const { client } = useEmporix();
1518
1737
  const ctx = useCustomerOnlyCtx();
1519
- const qc = useQueryClient();
1520
- return useMutation({
1738
+ const qc = useQueryClient13();
1739
+ return useMutation15({
1521
1740
  mutationFn: (input) => client.returns.createReturn(input, ctx),
1522
1741
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY4 })
1523
1742
  });
1524
1743
  }
1744
+
1745
+ // src/hooks/use-approvals.ts
1746
+ import {
1747
+ useQuery as useQuery26,
1748
+ useMutation as useMutation16,
1749
+ useQueryClient as useQueryClient14
1750
+ } from "@tanstack/react-query";
1525
1751
  var STALE3 = 3e4;
1526
1752
  var INVALIDATE_KEY5 = ["emporix", "approvals"];
1527
1753
  function useApprovals(opts = {}) {
1528
1754
  const { client } = useEmporix();
1529
1755
  const ctx = useCustomerOnlyCtx();
1530
- return useQuery({
1756
+ return useQuery26({
1531
1757
  queryKey: emporixKey("approvals", [opts.query ?? null], { tenant: client.tenant, authKind: ctx.kind }),
1532
1758
  queryFn: () => client.approvals.listApprovals(opts.query ?? {}, ctx),
1533
1759
  staleTime: STALE3
@@ -1536,7 +1762,7 @@ function useApprovals(opts = {}) {
1536
1762
  function useApproval(approvalId) {
1537
1763
  const { client } = useEmporix();
1538
1764
  const ctx = useCustomerOnlyCtx();
1539
- return useQuery({
1765
+ return useQuery26({
1540
1766
  queryKey: emporixKey("approvals", [approvalId ?? null], { tenant: client.tenant, authKind: ctx.kind }),
1541
1767
  queryFn: () => client.approvals.getApproval(approvalId, ctx),
1542
1768
  enabled: Boolean(approvalId),
@@ -1546,8 +1772,8 @@ function useApproval(approvalId) {
1546
1772
  function useCreateApproval() {
1547
1773
  const { client } = useEmporix();
1548
1774
  const ctx = useCustomerOnlyCtx();
1549
- const qc = useQueryClient();
1550
- return useMutation({
1775
+ const qc = useQueryClient14();
1776
+ return useMutation16({
1551
1777
  mutationFn: (input) => client.approvals.createApproval(input, ctx),
1552
1778
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY5 })
1553
1779
  });
@@ -1555,13 +1781,103 @@ function useCreateApproval() {
1555
1781
  function useUpdateApproval() {
1556
1782
  const { client } = useEmporix();
1557
1783
  const ctx = useCustomerOnlyCtx();
1558
- const qc = useQueryClient();
1559
- return useMutation({
1784
+ const qc = useQueryClient14();
1785
+ return useMutation16({
1560
1786
  mutationFn: ({ approvalId, ops }) => client.approvals.updateApproval(approvalId, ops, ctx),
1561
1787
  onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY5 })
1562
1788
  });
1563
1789
  }
1564
1790
 
1565
- export { useActiveCart, useActiveSite, useAddGroupMember, useAddToShoppingList, useAddressMutations, useApproval, useApprovals, useAssignContact, useAvailabilities, useAvailability, useCancelOrder, useCart, useCartMutations, useCategories, useCategoriesInfinite, useCategory, useCategoryTree, useChangePassword, useCheckout, useCloudFunction, useCompany, useCompanyContacts, useCompanyGroups, useCompanyLocations, useCompanySwitcher, useCreateApproval, useCreateCart, useCreateCompany, useCreateLocation, useCreateReturn, useCreateShoppingList, useCustomerAddresses, useCustomerSession, useDefaultSite, useDeleteCompany, useDeleteLocation, useDeleteShoppingList, useInvokeCloudFunction, useMatchPrices, useMatchPricesChunked, useMyCompanies, useMyOrders, useMyOrdersInfinite, useMyReturns, useMyRewardPoints, useMyRewardPointsSummary, useMySegmentCategories, useMySegmentCategoriesInfinite, useMySegmentCategoryTree, useMySegmentItems, useMySegmentProducts, useMySegmentProductsInfinite, useMySegments, useOrder, useOrderTransition, usePasswordReset, usePaymentModes, useProduct, useProductByCode, useProductMedia, useProductNameSearch, useProductSearch, useProducts, useProductsByCodes, useProductsInCategory, useProductsInCategoryInfinite, useProductsInfinite, useRedeemCoupon, useRedeemOptions, useRedeemRewardPoints, useRemoveFromShoppingList, useRemoveGroupMember, useReorder, useReturn, useSalesOrder, useSetShoppingListItemQuantity, useShoppingLists, useSiteContext, useSites, useSubcategories, useUnassignContact, useUpdateApproval, useUpdateCompany, useUpdateContactAssignment, useUpdateCustomer, useUpdateLocation, useUpdateSalesOrder, useValidateCoupon, useVariantChildren };
1566
- //# sourceMappingURL=chunk-KOVOQJ5F.js.map
1567
- //# sourceMappingURL=chunk-KOVOQJ5F.js.map
1791
+ export {
1792
+ useCustomerSession,
1793
+ emporixKey,
1794
+ useProduct,
1795
+ useProducts,
1796
+ useProductsInfinite,
1797
+ useProductByCode,
1798
+ useProductSearch,
1799
+ useProductNameSearch,
1800
+ useProductsByCodes,
1801
+ useShoppingLists,
1802
+ useCreateShoppingList,
1803
+ useDeleteShoppingList,
1804
+ useAddToShoppingList,
1805
+ useRemoveFromShoppingList,
1806
+ useSetShoppingListItemQuantity,
1807
+ useVariantChildren,
1808
+ useCategory,
1809
+ useSubcategories,
1810
+ useCategories,
1811
+ useCategoriesInfinite,
1812
+ useCategoryTree,
1813
+ useProductsInCategory,
1814
+ useProductsInCategoryInfinite,
1815
+ useCart,
1816
+ useCartMutations,
1817
+ useCreateCart,
1818
+ useActiveCart,
1819
+ useCheckout,
1820
+ usePaymentModes,
1821
+ useMatchPrices,
1822
+ useMatchPricesChunked,
1823
+ useProductMedia,
1824
+ useMySegments,
1825
+ useMySegmentItems,
1826
+ useMySegmentCategoryTree,
1827
+ useMySegmentProducts,
1828
+ useMySegmentProductsInfinite,
1829
+ useMySegmentCategories,
1830
+ useMySegmentCategoriesInfinite,
1831
+ useUpdateCustomer,
1832
+ useChangePassword,
1833
+ useCustomerAddresses,
1834
+ useAddressMutations,
1835
+ usePasswordReset,
1836
+ useSiteContext,
1837
+ useSites,
1838
+ useDefaultSite,
1839
+ useActiveSite,
1840
+ useMyCompanies,
1841
+ useCompany,
1842
+ useCompanyContacts,
1843
+ useCompanyLocations,
1844
+ useCompanyGroups,
1845
+ useCreateCompany,
1846
+ useUpdateCompany,
1847
+ useDeleteCompany,
1848
+ useAssignContact,
1849
+ useUpdateContactAssignment,
1850
+ useUnassignContact,
1851
+ useCreateLocation,
1852
+ useUpdateLocation,
1853
+ useDeleteLocation,
1854
+ useAddGroupMember,
1855
+ useRemoveGroupMember,
1856
+ useCompanySwitcher,
1857
+ useInvokeCloudFunction,
1858
+ useCloudFunction,
1859
+ useMyOrders,
1860
+ useMyOrdersInfinite,
1861
+ useOrder,
1862
+ useCancelOrder,
1863
+ useOrderTransition,
1864
+ useReorder,
1865
+ useSalesOrder,
1866
+ useUpdateSalesOrder,
1867
+ useAvailability,
1868
+ useAvailabilities,
1869
+ useValidateCoupon,
1870
+ useRedeemCoupon,
1871
+ useMyRewardPoints,
1872
+ useMyRewardPointsSummary,
1873
+ useRedeemOptions,
1874
+ useRedeemRewardPoints,
1875
+ useMyReturns,
1876
+ useReturn,
1877
+ useCreateReturn,
1878
+ useApprovals,
1879
+ useApproval,
1880
+ useCreateApproval,
1881
+ useUpdateApproval
1882
+ };
1883
+ //# sourceMappingURL=chunk-7F5EB5XY.js.map