@viu/emporix-sdk-react 2.10.0 → 2.12.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,4 +1,4 @@
1
- import { useEmporix, EmporixSiteContext, useActiveCompany } from './chunk-SMJ5IQZJ.js';
1
+ import { useEmporix, EmporixSiteContext, useActiveCompany } from './chunk-4YDWCA7A.js';
2
2
  import { useContext, useMemo, useSyncExternalStore, useEffect, useCallback, useState } from 'react';
3
3
  import { useQueryClient, useQuery, useMutation, useInfiniteQuery } from '@tanstack/react-query';
4
4
  import { auth, EmporixError } from '@viu/emporix-sdk';
@@ -266,7 +266,7 @@ function useCustomerOnlyCtx() {
266
266
  }
267
267
  function useReadSite() {
268
268
  const ctx = useContext(EmporixSiteContext);
269
- return { siteCode: ctx?.siteCode ?? null };
269
+ return { siteCode: ctx?.siteCode ?? null, language: ctx?.language ?? null };
270
270
  }
271
271
 
272
272
  // src/hooks/internal/query-keys.ts
@@ -278,6 +278,9 @@ function emporixKey(resource, args, context) {
278
278
  if (context.siteCode !== void 0) {
279
279
  meta.siteCode = context.siteCode;
280
280
  }
281
+ if (context.language !== void 0) {
282
+ meta.language = context.language;
283
+ }
281
284
  return ["emporix", resource, ...args, meta];
282
285
  }
283
286
  function useEmporixInfinite(opts) {
@@ -296,9 +299,9 @@ var PRODUCTS_STALE_TIME = 6e4;
296
299
  function useProduct(productId, options = {}) {
297
300
  const { client } = useEmporix();
298
301
  const { ctx } = useReadAuth(options.auth);
299
- const { siteCode } = useReadSite();
302
+ const { siteCode, language } = useReadSite();
300
303
  return useQuery({
301
- queryKey: emporixKey("product", [productId], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
304
+ queryKey: emporixKey("product", [productId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
302
305
  queryFn: () => client.products.get(productId, void 0, ctx),
303
306
  staleTime: PRODUCTS_STALE_TIME
304
307
  });
@@ -306,9 +309,9 @@ function useProduct(productId, options = {}) {
306
309
  function useProducts(params = {}, options = {}) {
307
310
  const { client } = useEmporix();
308
311
  const { ctx } = useReadAuth(options.auth);
309
- const { siteCode } = useReadSite();
312
+ const { siteCode, language } = useReadSite();
310
313
  return useQuery({
311
- queryKey: emporixKey("products", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
314
+ queryKey: emporixKey("products", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
312
315
  queryFn: () => client.products.list(params, ctx),
313
316
  staleTime: PRODUCTS_STALE_TIME
314
317
  });
@@ -316,9 +319,9 @@ function useProducts(params = {}, options = {}) {
316
319
  function useProductsInfinite(params = {}, options = {}) {
317
320
  const { client } = useEmporix();
318
321
  const { ctx } = useReadAuth(options.auth);
319
- const { siteCode } = useReadSite();
322
+ const { siteCode, language } = useReadSite();
320
323
  return useEmporixInfinite({
321
- queryKey: emporixKey("products-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
324
+ queryKey: emporixKey("products-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
322
325
  fetchPage: (pageNumber) => client.products.list(
323
326
  params.pageSize !== void 0 ? { pageNumber, pageSize: params.pageSize } : { pageNumber },
324
327
  ctx
@@ -329,9 +332,9 @@ function useProductsInfinite(params = {}, options = {}) {
329
332
  function useProductByCode(code, options = {}) {
330
333
  const { client } = useEmporix();
331
334
  const { ctx } = useReadAuth(options.auth);
332
- const { siteCode } = useReadSite();
335
+ const { siteCode, language } = useReadSite();
333
336
  return useQuery({
334
- queryKey: emporixKey("product-by-code", [code], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
337
+ queryKey: emporixKey("product-by-code", [code], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
335
338
  enabled: typeof code === "string" && code !== "",
336
339
  queryFn: () => client.products.getByCode(code, ctx),
337
340
  staleTime: PRODUCTS_STALE_TIME
@@ -340,9 +343,9 @@ function useProductByCode(code, options = {}) {
340
343
  function useProductSearch(query, params = {}, options = {}) {
341
344
  const { client } = useEmporix();
342
345
  const { ctx } = useReadAuth(options.auth);
343
- const { siteCode } = useReadSite();
346
+ const { siteCode, language } = useReadSite();
344
347
  return useQuery({
345
- queryKey: emporixKey("product-search", [query, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
348
+ queryKey: emporixKey("product-search", [query, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
346
349
  enabled: typeof query === "string" && query.trim() !== "",
347
350
  queryFn: () => client.products.search(query, params, ctx),
348
351
  staleTime: PRODUCTS_STALE_TIME
@@ -351,9 +354,9 @@ function useProductSearch(query, params = {}, options = {}) {
351
354
  function useProductNameSearch(term, params = {}, options = {}) {
352
355
  const { client } = useEmporix();
353
356
  const { ctx } = useReadAuth(options.auth);
354
- const { siteCode } = useReadSite();
357
+ const { siteCode, language } = useReadSite();
355
358
  return useQuery({
356
- queryKey: emporixKey("product-name-search", [term, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
359
+ queryKey: emporixKey("product-name-search", [term, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
357
360
  enabled: typeof term === "string" && term.trim() !== "",
358
361
  queryFn: () => client.products.searchByName(term, params, ctx),
359
362
  staleTime: PRODUCTS_STALE_TIME
@@ -362,12 +365,13 @@ function useProductNameSearch(term, params = {}, options = {}) {
362
365
  function useProductsByCodes(codes, options = {}) {
363
366
  const { client } = useEmporix();
364
367
  const { ctx } = useReadAuth(options.auth);
365
- const { siteCode } = useReadSite();
368
+ const { siteCode, language } = useReadSite();
366
369
  return useQuery({
367
370
  queryKey: emporixKey("products-by-codes", [codes, options.chunkSize], {
368
371
  tenant: client.tenant,
369
372
  authKind: ctx.kind,
370
- siteCode
373
+ siteCode,
374
+ language
371
375
  }),
372
376
  enabled: codes.length > 0,
373
377
  queryFn: () => client.products.searchByCodes(
@@ -383,9 +387,9 @@ var INVALIDATE_KEY = ["emporix", "shopping-lists"];
383
387
  function useShoppingLists(opts = {}) {
384
388
  const { client } = useEmporix();
385
389
  const ctx = useCustomerOnlyCtx();
386
- const { siteCode } = useReadSite();
390
+ const { siteCode, language } = useReadSite();
387
391
  return useQuery({
388
- queryKey: emporixKey("shopping-lists", [opts.name ?? null], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
392
+ queryKey: emporixKey("shopping-lists", [opts.name ?? null], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
389
393
  queryFn: () => client.shoppingLists.list(ctx, opts),
390
394
  staleTime: SHOPPING_LIST_STALE_TIME
391
395
  });
@@ -439,12 +443,12 @@ var VARIANT_CHILDREN_STALE_TIME = 6e4;
439
443
  function useVariantChildren(parentVariantId, options = {}) {
440
444
  const { client } = useEmporix();
441
445
  const { ctx } = useReadAuth(options.auth);
442
- const { siteCode } = useReadSite();
446
+ const { siteCode, language } = useReadSite();
443
447
  return useQuery({
444
448
  queryKey: emporixKey(
445
449
  "variant-children",
446
450
  [parentVariantId, { pageSize: options.pageSize }],
447
- { tenant: client.tenant, authKind: ctx.kind, siteCode }
451
+ { tenant: client.tenant, authKind: ctx.kind, siteCode, language }
448
452
  ),
449
453
  enabled: typeof parentVariantId === "string" && parentVariantId !== "",
450
454
  queryFn: () => client.products.listVariantChildren(
@@ -459,9 +463,9 @@ var CATEGORIES_STALE_TIME = 5 * 6e4;
459
463
  function useCategory(categoryId, options = {}) {
460
464
  const { client } = useEmporix();
461
465
  const { ctx } = useReadAuth(options.auth);
462
- const { siteCode } = useReadSite();
466
+ const { siteCode, language } = useReadSite();
463
467
  return useQuery({
464
- queryKey: emporixKey("category", [categoryId], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
468
+ queryKey: emporixKey("category", [categoryId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
465
469
  queryFn: () => client.categories.get(categoryId, ctx),
466
470
  staleTime: CATEGORIES_STALE_TIME
467
471
  });
@@ -469,9 +473,9 @@ function useCategory(categoryId, options = {}) {
469
473
  function useSubcategories(categoryId, params = {}, options = {}) {
470
474
  const { client } = useEmporix();
471
475
  const { ctx } = useReadAuth(options.auth);
472
- const { siteCode } = useReadSite();
476
+ const { siteCode, language } = useReadSite();
473
477
  return useQuery({
474
- queryKey: emporixKey("subcategories", [categoryId ?? null, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
478
+ queryKey: emporixKey("subcategories", [categoryId ?? null, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
475
479
  enabled: typeof categoryId === "string" && categoryId !== "",
476
480
  queryFn: () => client.categories.subcategories(categoryId, params, ctx),
477
481
  staleTime: CATEGORIES_STALE_TIME
@@ -480,9 +484,9 @@ function useSubcategories(categoryId, params = {}, options = {}) {
480
484
  function useCategories(params = {}, options = {}) {
481
485
  const { client } = useEmporix();
482
486
  const { ctx } = useReadAuth(options.auth);
483
- const { siteCode } = useReadSite();
487
+ const { siteCode, language } = useReadSite();
484
488
  return useQuery({
485
- queryKey: emporixKey("categories", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
489
+ queryKey: emporixKey("categories", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
486
490
  queryFn: () => client.categories.list(params, ctx),
487
491
  staleTime: CATEGORIES_STALE_TIME
488
492
  });
@@ -490,9 +494,9 @@ function useCategories(params = {}, options = {}) {
490
494
  function useCategoriesInfinite(params = {}, options = {}) {
491
495
  const { client } = useEmporix();
492
496
  const { ctx } = useReadAuth(options.auth);
493
- const { siteCode } = useReadSite();
497
+ const { siteCode, language } = useReadSite();
494
498
  return useEmporixInfinite({
495
- queryKey: emporixKey("categories-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
499
+ queryKey: emporixKey("categories-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
496
500
  fetchPage: (pageNumber) => client.categories.list(
497
501
  params.pageSize !== void 0 ? { pageNumber, pageSize: params.pageSize } : { pageNumber },
498
502
  ctx
@@ -503,9 +507,9 @@ function useCategoriesInfinite(params = {}, options = {}) {
503
507
  function useCategoryTree(options = {}) {
504
508
  const { client } = useEmporix();
505
509
  const { ctx } = useReadAuth(options.auth);
506
- const { siteCode } = useReadSite();
510
+ const { siteCode, language } = useReadSite();
507
511
  return useQuery({
508
- queryKey: emporixKey("category-tree", [], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
512
+ queryKey: emporixKey("category-tree", [], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
509
513
  queryFn: () => client.categories.tree(ctx),
510
514
  staleTime: CATEGORIES_STALE_TIME
511
515
  });
@@ -513,9 +517,9 @@ function useCategoryTree(options = {}) {
513
517
  function useProductsInCategory(categoryId, params = {}, options = {}) {
514
518
  const { client } = useEmporix();
515
519
  const { ctx } = useReadAuth(options.auth);
516
- const { siteCode } = useReadSite();
520
+ const { siteCode, language } = useReadSite();
517
521
  return useQuery({
518
- queryKey: emporixKey("products-in-category", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
522
+ queryKey: emporixKey("products-in-category", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
519
523
  enabled: typeof categoryId === "string" && categoryId !== "",
520
524
  queryFn: () => client.categories.productsIn(categoryId, params, ctx),
521
525
  staleTime: CATEGORIES_STALE_TIME
@@ -524,9 +528,9 @@ function useProductsInCategory(categoryId, params = {}, options = {}) {
524
528
  function useProductsInCategoryInfinite(categoryId, params = {}, options = {}) {
525
529
  const { client } = useEmporix();
526
530
  const { ctx } = useReadAuth(options.auth);
527
- const { siteCode } = useReadSite();
531
+ const { siteCode, language } = useReadSite();
528
532
  return useEmporixInfinite({
529
- queryKey: emporixKey("products-in-category-infinite", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
533
+ queryKey: emporixKey("products-in-category-infinite", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
530
534
  enabled: typeof categoryId === "string" && categoryId !== "",
531
535
  fetchPage: (pageNumber) => client.categories.productsIn(
532
536
  categoryId,
@@ -539,14 +543,14 @@ function useProductsInCategoryInfinite(categoryId, params = {}, options = {}) {
539
543
  function useCart(cartId, options = {}) {
540
544
  const { client, storage } = useEmporix();
541
545
  const { ctx } = useReadAuth(options.auth);
542
- const { siteCode } = useReadSite();
546
+ const { siteCode, language } = useReadSite();
543
547
  const { activeCompany } = useActiveCompany();
544
548
  const resolvedId = cartId ?? storage.getCartId() ?? void 0;
545
549
  return useQuery({
546
550
  queryKey: emporixKey(
547
551
  "cart",
548
552
  [resolvedId ?? null, activeCompany?.id ?? null],
549
- { tenant: client.tenant, authKind: ctx.kind, siteCode }
553
+ { tenant: client.tenant, authKind: ctx.kind, siteCode, language }
550
554
  ),
551
555
  enabled: resolvedId !== void 0,
552
556
  queryFn: () => client.carts.get(resolvedId, ctx)
@@ -556,7 +560,7 @@ function useCartMutations(cartId) {
556
560
  const { client, storage } = useEmporix();
557
561
  const qc = useQueryClient();
558
562
  const { ctx } = useReadAuth();
559
- const { siteCode } = useReadSite();
563
+ const { siteCode, language } = useReadSite();
560
564
  const { activeCompany } = useActiveCompany();
561
565
  const resolveId = () => {
562
566
  const id = cartId ?? storage.getCartId();
@@ -570,7 +574,7 @@ function useCartMutations(cartId) {
570
574
  const keyFor = (id) => emporixKey(
571
575
  "cart",
572
576
  [id, activeCompany?.id ?? null],
573
- { tenant: client.tenant, authKind: ctx.kind, siteCode }
577
+ { tenant: client.tenant, authKind: ctx.kind, siteCode, language }
574
578
  );
575
579
  function make(run, optimistic) {
576
580
  return useMutation({
@@ -790,9 +794,9 @@ function customerCtx(token) {
790
794
  function useMySegments(query = {}) {
791
795
  const { client, storage } = useEmporix();
792
796
  const token = storage.getCustomerToken();
793
- const { siteCode } = useReadSite();
797
+ const { siteCode, language } = useReadSite();
794
798
  return useQuery({
795
- queryKey: ["emporix", "segment", "list", { tenant: client.tenant, query, siteCode }],
799
+ queryKey: ["emporix", "segment", "list", { tenant: client.tenant, query, siteCode, language }],
796
800
  enabled: token !== null,
797
801
  queryFn: () => client.segments.list(query, customerCtx(token)),
798
802
  staleTime: SEGMENTS_STALE_TIME
@@ -801,9 +805,9 @@ function useMySegments(query = {}) {
801
805
  function useMySegmentItems(query = {}) {
802
806
  const { client, storage } = useEmporix();
803
807
  const token = storage.getCustomerToken();
804
- const { siteCode } = useReadSite();
808
+ const { siteCode, language } = useReadSite();
805
809
  return useQuery({
806
- queryKey: ["emporix", "segment", "items", { tenant: client.tenant, query, siteCode }],
810
+ queryKey: ["emporix", "segment", "items", { tenant: client.tenant, query, siteCode, language }],
807
811
  enabled: token !== null,
808
812
  queryFn: () => client.segments.listItems(query, customerCtx(token)),
809
813
  staleTime: SEGMENTS_STALE_TIME
@@ -812,9 +816,9 @@ function useMySegmentItems(query = {}) {
812
816
  function useMySegmentCategoryTree(query = {}) {
813
817
  const { client, storage } = useEmporix();
814
818
  const token = storage.getCustomerToken();
815
- const { siteCode } = useReadSite();
819
+ const { siteCode, language } = useReadSite();
816
820
  return useQuery({
817
- queryKey: ["emporix", "segment", "categoryTree", { tenant: client.tenant, query, siteCode }],
821
+ queryKey: ["emporix", "segment", "categoryTree", { tenant: client.tenant, query, siteCode, language }],
818
822
  enabled: token !== null,
819
823
  queryFn: () => client.segments.getCategoryTree(query, customerCtx(token)),
820
824
  staleTime: SEGMENTS_STALE_TIME
@@ -823,9 +827,9 @@ function useMySegmentCategoryTree(query = {}) {
823
827
  function useMySegmentProducts(query = {}) {
824
828
  const { client, storage } = useEmporix();
825
829
  const token = storage.getCustomerToken();
826
- const { siteCode } = useReadSite();
830
+ const { siteCode, language } = useReadSite();
827
831
  return useQuery({
828
- queryKey: ["emporix", "segment", "myProducts", { tenant: client.tenant, query, siteCode }],
832
+ queryKey: ["emporix", "segment", "myProducts", { tenant: client.tenant, query, siteCode, language }],
829
833
  enabled: token !== null,
830
834
  queryFn: () => client.segments.listMyProducts(query, customerCtx(token)),
831
835
  staleTime: SEGMENTS_STALE_TIME
@@ -834,13 +838,13 @@ function useMySegmentProducts(query = {}) {
834
838
  function useMySegmentProductsInfinite(query = {}) {
835
839
  const { client, storage } = useEmporix();
836
840
  const token = storage.getCustomerToken();
837
- const { siteCode } = useReadSite();
841
+ const { siteCode, language } = useReadSite();
838
842
  return useEmporixInfinite({
839
843
  queryKey: [
840
844
  "emporix",
841
845
  "segment",
842
846
  "myProductsInfinite",
843
- { tenant: client.tenant, query, siteCode }
847
+ { tenant: client.tenant, query, siteCode, language }
844
848
  ],
845
849
  enabled: token !== null,
846
850
  fetchPage: (pageNumber) => client.segments.listMyProducts(
@@ -853,9 +857,9 @@ function useMySegmentProductsInfinite(query = {}) {
853
857
  function useMySegmentCategories(query = {}) {
854
858
  const { client, storage } = useEmporix();
855
859
  const token = storage.getCustomerToken();
856
- const { siteCode } = useReadSite();
860
+ const { siteCode, language } = useReadSite();
857
861
  return useQuery({
858
- queryKey: ["emporix", "segment", "myCategories", { tenant: client.tenant, query, siteCode }],
862
+ queryKey: ["emporix", "segment", "myCategories", { tenant: client.tenant, query, siteCode, language }],
859
863
  enabled: token !== null,
860
864
  queryFn: () => client.segments.listMyCategories(query, customerCtx(token)),
861
865
  staleTime: SEGMENTS_STALE_TIME
@@ -864,13 +868,13 @@ function useMySegmentCategories(query = {}) {
864
868
  function useMySegmentCategoriesInfinite(query = {}) {
865
869
  const { client, storage } = useEmporix();
866
870
  const token = storage.getCustomerToken();
867
- const { siteCode } = useReadSite();
871
+ const { siteCode, language } = useReadSite();
868
872
  return useEmporixInfinite({
869
873
  queryKey: [
870
874
  "emporix",
871
875
  "segment",
872
876
  "myCategoriesInfinite",
873
- { tenant: client.tenant, query, siteCode }
877
+ { tenant: client.tenant, query, siteCode, language }
874
878
  ],
875
879
  enabled: token !== null,
876
880
  fetchPage: (pageNumber) => client.segments.listMyCategories(
@@ -1155,17 +1159,48 @@ function useCompanySwitcher() {
1155
1159
  clear: clearFn
1156
1160
  };
1157
1161
  }
1162
+ function useInvokeCloudFunction() {
1163
+ const { client, storage } = useEmporix();
1164
+ return useMutation({
1165
+ mutationFn: (vars) => {
1166
+ const { functionId, auth: authOverride, ...options } = vars;
1167
+ const token = storage.getCustomerToken();
1168
+ const authCtx = authOverride ?? (token ? auth.customer(token) : auth.anonymous());
1169
+ return client.cloudFunctions.invoke(functionId, options, authCtx);
1170
+ }
1171
+ });
1172
+ }
1173
+ function useCloudFunction(functionId, options, queryOptions) {
1174
+ const { client, storage } = useEmporix();
1175
+ const token = storage.getCustomerToken();
1176
+ const { auth: authOverride, ...invokeOptions } = options ?? {};
1177
+ const authCtx = authOverride ?? (token ? auth.customer(token) : auth.anonymous());
1178
+ return useQuery({
1179
+ queryKey: emporixKey(
1180
+ "cloud-function",
1181
+ [functionId ?? null, invokeOptions.path ?? null, invokeOptions.query ?? null],
1182
+ { tenant: client.tenant, authKind: token ? "customer" : "anonymous" }
1183
+ ),
1184
+ enabled: (queryOptions?.enabled ?? true) && functionId !== void 0,
1185
+ ...queryOptions?.staleTime !== void 0 ? { staleTime: queryOptions.staleTime } : {},
1186
+ queryFn: () => client.cloudFunctions.invoke(
1187
+ functionId,
1188
+ { method: "GET", ...invokeOptions },
1189
+ authCtx
1190
+ )
1191
+ });
1192
+ }
1158
1193
  function useMyOrders(options = {}) {
1159
1194
  const { client, storage } = useEmporix();
1160
1195
  const { activeCompany } = useActiveCompany();
1161
- const { siteCode } = useReadSite();
1196
+ const { siteCode, language } = useReadSite();
1162
1197
  const token = storage.getCustomerToken();
1163
1198
  const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
1164
1199
  return useQuery({
1165
1200
  queryKey: emporixKey(
1166
1201
  "orders",
1167
1202
  ["mine", effectiveLE ?? null, options.status ?? null, options.pageNumber ?? 1, options.pageSize ?? null],
1168
- { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
1203
+ { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
1169
1204
  ),
1170
1205
  enabled: token !== null,
1171
1206
  queryFn: () => client.orders.listMine(auth.customer(token), {
@@ -1181,14 +1216,14 @@ function useMyOrders(options = {}) {
1181
1216
  function useMyOrdersInfinite(options = {}) {
1182
1217
  const { client, storage } = useEmporix();
1183
1218
  const { activeCompany } = useActiveCompany();
1184
- const { siteCode } = useReadSite();
1219
+ const { siteCode, language } = useReadSite();
1185
1220
  const token = storage.getCustomerToken();
1186
1221
  const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
1187
1222
  return useEmporixInfinite({
1188
1223
  queryKey: emporixKey(
1189
1224
  "orders",
1190
1225
  ["mine-infinite", effectiveLE ?? null, options.status ?? null, options.pageSize ?? null],
1191
- { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
1226
+ { tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
1192
1227
  ),
1193
1228
  enabled: token !== null,
1194
1229
  fetchPage: (pageNumber) => client.orders.listMine(auth.customer(token), {
@@ -1204,10 +1239,12 @@ function useMyOrdersInfinite(options = {}) {
1204
1239
  function useOrder(orderId, options = {}) {
1205
1240
  const { client, storage } = useEmporix();
1206
1241
  const token = storage.getCustomerToken();
1242
+ const { language } = useReadSite();
1207
1243
  return useQuery({
1208
1244
  queryKey: emporixKey("orders", [orderId ?? null], {
1209
1245
  tenant: client.tenant,
1210
- authKind: token ? "customer" : "anonymous"
1246
+ authKind: token ? "customer" : "anonymous",
1247
+ language
1211
1248
  }),
1212
1249
  enabled: token !== null && orderId !== void 0,
1213
1250
  queryFn: () => client.orders.get(
@@ -1315,10 +1352,12 @@ function useReorder() {
1315
1352
  }
1316
1353
  function useSalesOrder(orderId, authCtx) {
1317
1354
  const { client } = useEmporix();
1355
+ const { language } = useReadSite();
1318
1356
  return useQuery({
1319
1357
  queryKey: emporixKey("salesorders", [orderId ?? null], {
1320
1358
  tenant: client.tenant,
1321
- authKind: authCtx?.kind ?? "anonymous"
1359
+ authKind: authCtx?.kind ?? "anonymous",
1360
+ language
1322
1361
  }),
1323
1362
  enabled: orderId !== void 0 && authCtx !== void 0,
1324
1363
  queryFn: () => client.salesOrders.get(orderId, authCtx)
@@ -1329,12 +1368,12 @@ function useUpdateSalesOrder() {
1329
1368
  const qc = useQueryClient();
1330
1369
  return useMutation({
1331
1370
  mutationKey: ["emporix", "salesorders", "update"],
1332
- mutationFn: async ({ orderId, patch, auth: auth23, recalculate }) => {
1333
- if (!auth23) throw new Error("useUpdateSalesOrder: requires an auth context");
1371
+ mutationFn: async ({ orderId, patch, auth: auth24, recalculate }) => {
1372
+ if (!auth24) throw new Error("useUpdateSalesOrder: requires an auth context");
1334
1373
  return client.salesOrders.update(
1335
1374
  orderId,
1336
1375
  patch,
1337
- auth23,
1376
+ auth24,
1338
1377
  recalculate !== void 0 ? { recalculate } : {}
1339
1378
  );
1340
1379
  },
@@ -1516,6 +1555,6 @@ function useUpdateApproval() {
1516
1555
  });
1517
1556
  }
1518
1557
 
1519
- export { useActiveCart, useAddGroupMember, useAddToShoppingList, useAddressMutations, useApproval, useApprovals, useAssignContact, useAvailabilities, useAvailability, useCancelOrder, useCart, useCartMutations, useCategories, useCategoriesInfinite, useCategory, useCategoryTree, useChangePassword, useCheckout, useCompany, useCompanyContacts, useCompanyGroups, useCompanyLocations, useCompanySwitcher, useCreateApproval, useCreateCart, useCreateCompany, useCreateLocation, useCreateReturn, useCreateShoppingList, useCustomerAddresses, useCustomerSession, useDefaultSite, useDeleteCompany, useDeleteLocation, useDeleteShoppingList, 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 };
1520
- //# sourceMappingURL=chunk-V4AV2OX6.js.map
1521
- //# sourceMappingURL=chunk-V4AV2OX6.js.map
1558
+ export { useActiveCart, 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 };
1559
+ //# sourceMappingURL=chunk-RVLQH55K.js.map
1560
+ //# sourceMappingURL=chunk-RVLQH55K.js.map