@viu/emporix-sdk-react 2.11.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.
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-SMJ5IQZJ.js → chunk-4YDWCA7A.js} +51 -6
- package/dist/chunk-4YDWCA7A.js.map +1 -0
- package/dist/{chunk-KLLY4YD7.js → chunk-RVLQH55K.js} +68 -60
- package/dist/chunk-RVLQH55K.js.map +1 -0
- package/dist/{chunk-FBQY2N7S.js → chunk-VMDBYVWG.js} +21 -2
- package/dist/chunk-VMDBYVWG.js.map +1 -0
- package/dist/hooks.cjs +65 -57
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +3 -3
- package/dist/index.cjs +132 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/{provider--y2yz3Jj.d.ts → provider-Bcb-tOpS.d.ts} +17 -2
- package/dist/{provider-CfgMAu8B.d.cts → provider-Ddo7aSOI.d.cts} +17 -2
- package/dist/provider.cjs +54 -3
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +2 -2
- package/dist/storage.cjs +19 -0
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.cts +3 -1
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +1 -1
- package/dist/{use-returns-vxGoBH1I.d.ts → use-returns-DletRcs5.d.ts} +1 -1
- package/dist/{use-returns-DDH_HnPS.d.cts → use-returns-cFZZl21v.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-FBQY2N7S.js.map +0 -1
- package/dist/chunk-KLLY4YD7.js.map +0 -1
- package/dist/chunk-SMJ5IQZJ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEmporix, EmporixSiteContext, useActiveCompany } from './chunk-
|
|
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(
|
|
@@ -1189,14 +1193,14 @@ function useCloudFunction(functionId, options, queryOptions) {
|
|
|
1189
1193
|
function useMyOrders(options = {}) {
|
|
1190
1194
|
const { client, storage } = useEmporix();
|
|
1191
1195
|
const { activeCompany } = useActiveCompany();
|
|
1192
|
-
const { siteCode } = useReadSite();
|
|
1196
|
+
const { siteCode, language } = useReadSite();
|
|
1193
1197
|
const token = storage.getCustomerToken();
|
|
1194
1198
|
const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
|
|
1195
1199
|
return useQuery({
|
|
1196
1200
|
queryKey: emporixKey(
|
|
1197
1201
|
"orders",
|
|
1198
1202
|
["mine", effectiveLE ?? null, options.status ?? null, options.pageNumber ?? 1, options.pageSize ?? null],
|
|
1199
|
-
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
|
|
1203
|
+
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
|
|
1200
1204
|
),
|
|
1201
1205
|
enabled: token !== null,
|
|
1202
1206
|
queryFn: () => client.orders.listMine(auth.customer(token), {
|
|
@@ -1212,14 +1216,14 @@ function useMyOrders(options = {}) {
|
|
|
1212
1216
|
function useMyOrdersInfinite(options = {}) {
|
|
1213
1217
|
const { client, storage } = useEmporix();
|
|
1214
1218
|
const { activeCompany } = useActiveCompany();
|
|
1215
|
-
const { siteCode } = useReadSite();
|
|
1219
|
+
const { siteCode, language } = useReadSite();
|
|
1216
1220
|
const token = storage.getCustomerToken();
|
|
1217
1221
|
const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
|
|
1218
1222
|
return useEmporixInfinite({
|
|
1219
1223
|
queryKey: emporixKey(
|
|
1220
1224
|
"orders",
|
|
1221
1225
|
["mine-infinite", effectiveLE ?? null, options.status ?? null, options.pageSize ?? null],
|
|
1222
|
-
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
|
|
1226
|
+
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
|
|
1223
1227
|
),
|
|
1224
1228
|
enabled: token !== null,
|
|
1225
1229
|
fetchPage: (pageNumber) => client.orders.listMine(auth.customer(token), {
|
|
@@ -1235,10 +1239,12 @@ function useMyOrdersInfinite(options = {}) {
|
|
|
1235
1239
|
function useOrder(orderId, options = {}) {
|
|
1236
1240
|
const { client, storage } = useEmporix();
|
|
1237
1241
|
const token = storage.getCustomerToken();
|
|
1242
|
+
const { language } = useReadSite();
|
|
1238
1243
|
return useQuery({
|
|
1239
1244
|
queryKey: emporixKey("orders", [orderId ?? null], {
|
|
1240
1245
|
tenant: client.tenant,
|
|
1241
|
-
authKind: token ? "customer" : "anonymous"
|
|
1246
|
+
authKind: token ? "customer" : "anonymous",
|
|
1247
|
+
language
|
|
1242
1248
|
}),
|
|
1243
1249
|
enabled: token !== null && orderId !== void 0,
|
|
1244
1250
|
queryFn: () => client.orders.get(
|
|
@@ -1346,10 +1352,12 @@ function useReorder() {
|
|
|
1346
1352
|
}
|
|
1347
1353
|
function useSalesOrder(orderId, authCtx) {
|
|
1348
1354
|
const { client } = useEmporix();
|
|
1355
|
+
const { language } = useReadSite();
|
|
1349
1356
|
return useQuery({
|
|
1350
1357
|
queryKey: emporixKey("salesorders", [orderId ?? null], {
|
|
1351
1358
|
tenant: client.tenant,
|
|
1352
|
-
authKind: authCtx?.kind ?? "anonymous"
|
|
1359
|
+
authKind: authCtx?.kind ?? "anonymous",
|
|
1360
|
+
language
|
|
1353
1361
|
}),
|
|
1354
1362
|
enabled: orderId !== void 0 && authCtx !== void 0,
|
|
1355
1363
|
queryFn: () => client.salesOrders.get(orderId, authCtx)
|
|
@@ -1548,5 +1556,5 @@ function useUpdateApproval() {
|
|
|
1548
1556
|
}
|
|
1549
1557
|
|
|
1550
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 };
|
|
1551
|
-
//# sourceMappingURL=chunk-
|
|
1552
|
-
//# sourceMappingURL=chunk-
|
|
1559
|
+
//# sourceMappingURL=chunk-RVLQH55K.js.map
|
|
1560
|
+
//# sourceMappingURL=chunk-RVLQH55K.js.map
|