@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
package/dist/hooks.cjs
CHANGED
|
@@ -293,7 +293,7 @@ function useCustomerOnlyCtx() {
|
|
|
293
293
|
}
|
|
294
294
|
function useReadSite() {
|
|
295
295
|
const ctx = react.useContext(EmporixSiteContext);
|
|
296
|
-
return { siteCode: ctx?.siteCode ?? null };
|
|
296
|
+
return { siteCode: ctx?.siteCode ?? null, language: ctx?.language ?? null };
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
// src/hooks/internal/query-keys.ts
|
|
@@ -305,6 +305,9 @@ function emporixKey(resource, args, context) {
|
|
|
305
305
|
if (context.siteCode !== void 0) {
|
|
306
306
|
meta.siteCode = context.siteCode;
|
|
307
307
|
}
|
|
308
|
+
if (context.language !== void 0) {
|
|
309
|
+
meta.language = context.language;
|
|
310
|
+
}
|
|
308
311
|
return ["emporix", resource, ...args, meta];
|
|
309
312
|
}
|
|
310
313
|
function useEmporixInfinite(opts) {
|
|
@@ -323,9 +326,9 @@ var PRODUCTS_STALE_TIME = 6e4;
|
|
|
323
326
|
function useProduct(productId, options = {}) {
|
|
324
327
|
const { client } = useEmporix();
|
|
325
328
|
const { ctx } = useReadAuth(options.auth);
|
|
326
|
-
const { siteCode } = useReadSite();
|
|
329
|
+
const { siteCode, language } = useReadSite();
|
|
327
330
|
return reactQuery.useQuery({
|
|
328
|
-
queryKey: emporixKey("product", [productId], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
331
|
+
queryKey: emporixKey("product", [productId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
329
332
|
queryFn: () => client.products.get(productId, void 0, ctx),
|
|
330
333
|
staleTime: PRODUCTS_STALE_TIME
|
|
331
334
|
});
|
|
@@ -333,9 +336,9 @@ function useProduct(productId, options = {}) {
|
|
|
333
336
|
function useProducts(params = {}, options = {}) {
|
|
334
337
|
const { client } = useEmporix();
|
|
335
338
|
const { ctx } = useReadAuth(options.auth);
|
|
336
|
-
const { siteCode } = useReadSite();
|
|
339
|
+
const { siteCode, language } = useReadSite();
|
|
337
340
|
return reactQuery.useQuery({
|
|
338
|
-
queryKey: emporixKey("products", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
341
|
+
queryKey: emporixKey("products", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
339
342
|
queryFn: () => client.products.list(params, ctx),
|
|
340
343
|
staleTime: PRODUCTS_STALE_TIME
|
|
341
344
|
});
|
|
@@ -343,9 +346,9 @@ function useProducts(params = {}, options = {}) {
|
|
|
343
346
|
function useProductsInfinite(params = {}, options = {}) {
|
|
344
347
|
const { client } = useEmporix();
|
|
345
348
|
const { ctx } = useReadAuth(options.auth);
|
|
346
|
-
const { siteCode } = useReadSite();
|
|
349
|
+
const { siteCode, language } = useReadSite();
|
|
347
350
|
return useEmporixInfinite({
|
|
348
|
-
queryKey: emporixKey("products-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
351
|
+
queryKey: emporixKey("products-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
349
352
|
fetchPage: (pageNumber) => client.products.list(
|
|
350
353
|
params.pageSize !== void 0 ? { pageNumber, pageSize: params.pageSize } : { pageNumber },
|
|
351
354
|
ctx
|
|
@@ -356,9 +359,9 @@ function useProductsInfinite(params = {}, options = {}) {
|
|
|
356
359
|
function useProductByCode(code, options = {}) {
|
|
357
360
|
const { client } = useEmporix();
|
|
358
361
|
const { ctx } = useReadAuth(options.auth);
|
|
359
|
-
const { siteCode } = useReadSite();
|
|
362
|
+
const { siteCode, language } = useReadSite();
|
|
360
363
|
return reactQuery.useQuery({
|
|
361
|
-
queryKey: emporixKey("product-by-code", [code], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
364
|
+
queryKey: emporixKey("product-by-code", [code], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
362
365
|
enabled: typeof code === "string" && code !== "",
|
|
363
366
|
queryFn: () => client.products.getByCode(code, ctx),
|
|
364
367
|
staleTime: PRODUCTS_STALE_TIME
|
|
@@ -367,9 +370,9 @@ function useProductByCode(code, options = {}) {
|
|
|
367
370
|
function useProductSearch(query, params = {}, options = {}) {
|
|
368
371
|
const { client } = useEmporix();
|
|
369
372
|
const { ctx } = useReadAuth(options.auth);
|
|
370
|
-
const { siteCode } = useReadSite();
|
|
373
|
+
const { siteCode, language } = useReadSite();
|
|
371
374
|
return reactQuery.useQuery({
|
|
372
|
-
queryKey: emporixKey("product-search", [query, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
375
|
+
queryKey: emporixKey("product-search", [query, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
373
376
|
enabled: typeof query === "string" && query.trim() !== "",
|
|
374
377
|
queryFn: () => client.products.search(query, params, ctx),
|
|
375
378
|
staleTime: PRODUCTS_STALE_TIME
|
|
@@ -378,9 +381,9 @@ function useProductSearch(query, params = {}, options = {}) {
|
|
|
378
381
|
function useProductNameSearch(term, params = {}, options = {}) {
|
|
379
382
|
const { client } = useEmporix();
|
|
380
383
|
const { ctx } = useReadAuth(options.auth);
|
|
381
|
-
const { siteCode } = useReadSite();
|
|
384
|
+
const { siteCode, language } = useReadSite();
|
|
382
385
|
return reactQuery.useQuery({
|
|
383
|
-
queryKey: emporixKey("product-name-search", [term, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
386
|
+
queryKey: emporixKey("product-name-search", [term, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
384
387
|
enabled: typeof term === "string" && term.trim() !== "",
|
|
385
388
|
queryFn: () => client.products.searchByName(term, params, ctx),
|
|
386
389
|
staleTime: PRODUCTS_STALE_TIME
|
|
@@ -389,12 +392,13 @@ function useProductNameSearch(term, params = {}, options = {}) {
|
|
|
389
392
|
function useProductsByCodes(codes, options = {}) {
|
|
390
393
|
const { client } = useEmporix();
|
|
391
394
|
const { ctx } = useReadAuth(options.auth);
|
|
392
|
-
const { siteCode } = useReadSite();
|
|
395
|
+
const { siteCode, language } = useReadSite();
|
|
393
396
|
return reactQuery.useQuery({
|
|
394
397
|
queryKey: emporixKey("products-by-codes", [codes, options.chunkSize], {
|
|
395
398
|
tenant: client.tenant,
|
|
396
399
|
authKind: ctx.kind,
|
|
397
|
-
siteCode
|
|
400
|
+
siteCode,
|
|
401
|
+
language
|
|
398
402
|
}),
|
|
399
403
|
enabled: codes.length > 0,
|
|
400
404
|
queryFn: () => client.products.searchByCodes(
|
|
@@ -410,9 +414,9 @@ var INVALIDATE_KEY = ["emporix", "shopping-lists"];
|
|
|
410
414
|
function useShoppingLists(opts = {}) {
|
|
411
415
|
const { client } = useEmporix();
|
|
412
416
|
const ctx = useCustomerOnlyCtx();
|
|
413
|
-
const { siteCode } = useReadSite();
|
|
417
|
+
const { siteCode, language } = useReadSite();
|
|
414
418
|
return reactQuery.useQuery({
|
|
415
|
-
queryKey: emporixKey("shopping-lists", [opts.name ?? null], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
419
|
+
queryKey: emporixKey("shopping-lists", [opts.name ?? null], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
416
420
|
queryFn: () => client.shoppingLists.list(ctx, opts),
|
|
417
421
|
staleTime: SHOPPING_LIST_STALE_TIME
|
|
418
422
|
});
|
|
@@ -466,12 +470,12 @@ var VARIANT_CHILDREN_STALE_TIME = 6e4;
|
|
|
466
470
|
function useVariantChildren(parentVariantId, options = {}) {
|
|
467
471
|
const { client } = useEmporix();
|
|
468
472
|
const { ctx } = useReadAuth(options.auth);
|
|
469
|
-
const { siteCode } = useReadSite();
|
|
473
|
+
const { siteCode, language } = useReadSite();
|
|
470
474
|
return reactQuery.useQuery({
|
|
471
475
|
queryKey: emporixKey(
|
|
472
476
|
"variant-children",
|
|
473
477
|
[parentVariantId, { pageSize: options.pageSize }],
|
|
474
|
-
{ tenant: client.tenant, authKind: ctx.kind, siteCode }
|
|
478
|
+
{ tenant: client.tenant, authKind: ctx.kind, siteCode, language }
|
|
475
479
|
),
|
|
476
480
|
enabled: typeof parentVariantId === "string" && parentVariantId !== "",
|
|
477
481
|
queryFn: () => client.products.listVariantChildren(
|
|
@@ -486,9 +490,9 @@ var CATEGORIES_STALE_TIME = 5 * 6e4;
|
|
|
486
490
|
function useCategory(categoryId, options = {}) {
|
|
487
491
|
const { client } = useEmporix();
|
|
488
492
|
const { ctx } = useReadAuth(options.auth);
|
|
489
|
-
const { siteCode } = useReadSite();
|
|
493
|
+
const { siteCode, language } = useReadSite();
|
|
490
494
|
return reactQuery.useQuery({
|
|
491
|
-
queryKey: emporixKey("category", [categoryId], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
495
|
+
queryKey: emporixKey("category", [categoryId], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
492
496
|
queryFn: () => client.categories.get(categoryId, ctx),
|
|
493
497
|
staleTime: CATEGORIES_STALE_TIME
|
|
494
498
|
});
|
|
@@ -496,9 +500,9 @@ function useCategory(categoryId, options = {}) {
|
|
|
496
500
|
function useSubcategories(categoryId, params = {}, options = {}) {
|
|
497
501
|
const { client } = useEmporix();
|
|
498
502
|
const { ctx } = useReadAuth(options.auth);
|
|
499
|
-
const { siteCode } = useReadSite();
|
|
503
|
+
const { siteCode, language } = useReadSite();
|
|
500
504
|
return reactQuery.useQuery({
|
|
501
|
-
queryKey: emporixKey("subcategories", [categoryId ?? null, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
505
|
+
queryKey: emporixKey("subcategories", [categoryId ?? null, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
502
506
|
enabled: typeof categoryId === "string" && categoryId !== "",
|
|
503
507
|
queryFn: () => client.categories.subcategories(categoryId, params, ctx),
|
|
504
508
|
staleTime: CATEGORIES_STALE_TIME
|
|
@@ -507,9 +511,9 @@ function useSubcategories(categoryId, params = {}, options = {}) {
|
|
|
507
511
|
function useCategories(params = {}, options = {}) {
|
|
508
512
|
const { client } = useEmporix();
|
|
509
513
|
const { ctx } = useReadAuth(options.auth);
|
|
510
|
-
const { siteCode } = useReadSite();
|
|
514
|
+
const { siteCode, language } = useReadSite();
|
|
511
515
|
return reactQuery.useQuery({
|
|
512
|
-
queryKey: emporixKey("categories", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
516
|
+
queryKey: emporixKey("categories", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
513
517
|
queryFn: () => client.categories.list(params, ctx),
|
|
514
518
|
staleTime: CATEGORIES_STALE_TIME
|
|
515
519
|
});
|
|
@@ -517,9 +521,9 @@ function useCategories(params = {}, options = {}) {
|
|
|
517
521
|
function useCategoriesInfinite(params = {}, options = {}) {
|
|
518
522
|
const { client } = useEmporix();
|
|
519
523
|
const { ctx } = useReadAuth(options.auth);
|
|
520
|
-
const { siteCode } = useReadSite();
|
|
524
|
+
const { siteCode, language } = useReadSite();
|
|
521
525
|
return useEmporixInfinite({
|
|
522
|
-
queryKey: emporixKey("categories-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
526
|
+
queryKey: emporixKey("categories-infinite", [params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
523
527
|
fetchPage: (pageNumber) => client.categories.list(
|
|
524
528
|
params.pageSize !== void 0 ? { pageNumber, pageSize: params.pageSize } : { pageNumber },
|
|
525
529
|
ctx
|
|
@@ -530,9 +534,9 @@ function useCategoriesInfinite(params = {}, options = {}) {
|
|
|
530
534
|
function useCategoryTree(options = {}) {
|
|
531
535
|
const { client } = useEmporix();
|
|
532
536
|
const { ctx } = useReadAuth(options.auth);
|
|
533
|
-
const { siteCode } = useReadSite();
|
|
537
|
+
const { siteCode, language } = useReadSite();
|
|
534
538
|
return reactQuery.useQuery({
|
|
535
|
-
queryKey: emporixKey("category-tree", [], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
539
|
+
queryKey: emporixKey("category-tree", [], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
536
540
|
queryFn: () => client.categories.tree(ctx),
|
|
537
541
|
staleTime: CATEGORIES_STALE_TIME
|
|
538
542
|
});
|
|
@@ -540,9 +544,9 @@ function useCategoryTree(options = {}) {
|
|
|
540
544
|
function useProductsInCategory(categoryId, params = {}, options = {}) {
|
|
541
545
|
const { client } = useEmporix();
|
|
542
546
|
const { ctx } = useReadAuth(options.auth);
|
|
543
|
-
const { siteCode } = useReadSite();
|
|
547
|
+
const { siteCode, language } = useReadSite();
|
|
544
548
|
return reactQuery.useQuery({
|
|
545
|
-
queryKey: emporixKey("products-in-category", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
549
|
+
queryKey: emporixKey("products-in-category", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
546
550
|
enabled: typeof categoryId === "string" && categoryId !== "",
|
|
547
551
|
queryFn: () => client.categories.productsIn(categoryId, params, ctx),
|
|
548
552
|
staleTime: CATEGORIES_STALE_TIME
|
|
@@ -551,9 +555,9 @@ function useProductsInCategory(categoryId, params = {}, options = {}) {
|
|
|
551
555
|
function useProductsInCategoryInfinite(categoryId, params = {}, options = {}) {
|
|
552
556
|
const { client } = useEmporix();
|
|
553
557
|
const { ctx } = useReadAuth(options.auth);
|
|
554
|
-
const { siteCode } = useReadSite();
|
|
558
|
+
const { siteCode, language } = useReadSite();
|
|
555
559
|
return useEmporixInfinite({
|
|
556
|
-
queryKey: emporixKey("products-in-category-infinite", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode }),
|
|
560
|
+
queryKey: emporixKey("products-in-category-infinite", [categoryId, params], { tenant: client.tenant, authKind: ctx.kind, siteCode, language }),
|
|
557
561
|
enabled: typeof categoryId === "string" && categoryId !== "",
|
|
558
562
|
fetchPage: (pageNumber) => client.categories.productsIn(
|
|
559
563
|
categoryId,
|
|
@@ -566,14 +570,14 @@ function useProductsInCategoryInfinite(categoryId, params = {}, options = {}) {
|
|
|
566
570
|
function useCart(cartId, options = {}) {
|
|
567
571
|
const { client, storage } = useEmporix();
|
|
568
572
|
const { ctx } = useReadAuth(options.auth);
|
|
569
|
-
const { siteCode } = useReadSite();
|
|
573
|
+
const { siteCode, language } = useReadSite();
|
|
570
574
|
const { activeCompany } = useActiveCompany();
|
|
571
575
|
const resolvedId = cartId ?? storage.getCartId() ?? void 0;
|
|
572
576
|
return reactQuery.useQuery({
|
|
573
577
|
queryKey: emporixKey(
|
|
574
578
|
"cart",
|
|
575
579
|
[resolvedId ?? null, activeCompany?.id ?? null],
|
|
576
|
-
{ tenant: client.tenant, authKind: ctx.kind, siteCode }
|
|
580
|
+
{ tenant: client.tenant, authKind: ctx.kind, siteCode, language }
|
|
577
581
|
),
|
|
578
582
|
enabled: resolvedId !== void 0,
|
|
579
583
|
queryFn: () => client.carts.get(resolvedId, ctx)
|
|
@@ -583,7 +587,7 @@ function useCartMutations(cartId) {
|
|
|
583
587
|
const { client, storage } = useEmporix();
|
|
584
588
|
const qc = reactQuery.useQueryClient();
|
|
585
589
|
const { ctx } = useReadAuth();
|
|
586
|
-
const { siteCode } = useReadSite();
|
|
590
|
+
const { siteCode, language } = useReadSite();
|
|
587
591
|
const { activeCompany } = useActiveCompany();
|
|
588
592
|
const resolveId = () => {
|
|
589
593
|
const id = cartId ?? storage.getCartId();
|
|
@@ -597,7 +601,7 @@ function useCartMutations(cartId) {
|
|
|
597
601
|
const keyFor = (id) => emporixKey(
|
|
598
602
|
"cart",
|
|
599
603
|
[id, activeCompany?.id ?? null],
|
|
600
|
-
{ tenant: client.tenant, authKind: ctx.kind, siteCode }
|
|
604
|
+
{ tenant: client.tenant, authKind: ctx.kind, siteCode, language }
|
|
601
605
|
);
|
|
602
606
|
function make(run, optimistic) {
|
|
603
607
|
return reactQuery.useMutation({
|
|
@@ -817,9 +821,9 @@ function customerCtx(token) {
|
|
|
817
821
|
function useMySegments(query = {}) {
|
|
818
822
|
const { client, storage } = useEmporix();
|
|
819
823
|
const token = storage.getCustomerToken();
|
|
820
|
-
const { siteCode } = useReadSite();
|
|
824
|
+
const { siteCode, language } = useReadSite();
|
|
821
825
|
return reactQuery.useQuery({
|
|
822
|
-
queryKey: ["emporix", "segment", "list", { tenant: client.tenant, query, siteCode }],
|
|
826
|
+
queryKey: ["emporix", "segment", "list", { tenant: client.tenant, query, siteCode, language }],
|
|
823
827
|
enabled: token !== null,
|
|
824
828
|
queryFn: () => client.segments.list(query, customerCtx(token)),
|
|
825
829
|
staleTime: SEGMENTS_STALE_TIME
|
|
@@ -828,9 +832,9 @@ function useMySegments(query = {}) {
|
|
|
828
832
|
function useMySegmentItems(query = {}) {
|
|
829
833
|
const { client, storage } = useEmporix();
|
|
830
834
|
const token = storage.getCustomerToken();
|
|
831
|
-
const { siteCode } = useReadSite();
|
|
835
|
+
const { siteCode, language } = useReadSite();
|
|
832
836
|
return reactQuery.useQuery({
|
|
833
|
-
queryKey: ["emporix", "segment", "items", { tenant: client.tenant, query, siteCode }],
|
|
837
|
+
queryKey: ["emporix", "segment", "items", { tenant: client.tenant, query, siteCode, language }],
|
|
834
838
|
enabled: token !== null,
|
|
835
839
|
queryFn: () => client.segments.listItems(query, customerCtx(token)),
|
|
836
840
|
staleTime: SEGMENTS_STALE_TIME
|
|
@@ -839,9 +843,9 @@ function useMySegmentItems(query = {}) {
|
|
|
839
843
|
function useMySegmentCategoryTree(query = {}) {
|
|
840
844
|
const { client, storage } = useEmporix();
|
|
841
845
|
const token = storage.getCustomerToken();
|
|
842
|
-
const { siteCode } = useReadSite();
|
|
846
|
+
const { siteCode, language } = useReadSite();
|
|
843
847
|
return reactQuery.useQuery({
|
|
844
|
-
queryKey: ["emporix", "segment", "categoryTree", { tenant: client.tenant, query, siteCode }],
|
|
848
|
+
queryKey: ["emporix", "segment", "categoryTree", { tenant: client.tenant, query, siteCode, language }],
|
|
845
849
|
enabled: token !== null,
|
|
846
850
|
queryFn: () => client.segments.getCategoryTree(query, customerCtx(token)),
|
|
847
851
|
staleTime: SEGMENTS_STALE_TIME
|
|
@@ -850,9 +854,9 @@ function useMySegmentCategoryTree(query = {}) {
|
|
|
850
854
|
function useMySegmentProducts(query = {}) {
|
|
851
855
|
const { client, storage } = useEmporix();
|
|
852
856
|
const token = storage.getCustomerToken();
|
|
853
|
-
const { siteCode } = useReadSite();
|
|
857
|
+
const { siteCode, language } = useReadSite();
|
|
854
858
|
return reactQuery.useQuery({
|
|
855
|
-
queryKey: ["emporix", "segment", "myProducts", { tenant: client.tenant, query, siteCode }],
|
|
859
|
+
queryKey: ["emporix", "segment", "myProducts", { tenant: client.tenant, query, siteCode, language }],
|
|
856
860
|
enabled: token !== null,
|
|
857
861
|
queryFn: () => client.segments.listMyProducts(query, customerCtx(token)),
|
|
858
862
|
staleTime: SEGMENTS_STALE_TIME
|
|
@@ -861,13 +865,13 @@ function useMySegmentProducts(query = {}) {
|
|
|
861
865
|
function useMySegmentProductsInfinite(query = {}) {
|
|
862
866
|
const { client, storage } = useEmporix();
|
|
863
867
|
const token = storage.getCustomerToken();
|
|
864
|
-
const { siteCode } = useReadSite();
|
|
868
|
+
const { siteCode, language } = useReadSite();
|
|
865
869
|
return useEmporixInfinite({
|
|
866
870
|
queryKey: [
|
|
867
871
|
"emporix",
|
|
868
872
|
"segment",
|
|
869
873
|
"myProductsInfinite",
|
|
870
|
-
{ tenant: client.tenant, query, siteCode }
|
|
874
|
+
{ tenant: client.tenant, query, siteCode, language }
|
|
871
875
|
],
|
|
872
876
|
enabled: token !== null,
|
|
873
877
|
fetchPage: (pageNumber) => client.segments.listMyProducts(
|
|
@@ -880,9 +884,9 @@ function useMySegmentProductsInfinite(query = {}) {
|
|
|
880
884
|
function useMySegmentCategories(query = {}) {
|
|
881
885
|
const { client, storage } = useEmporix();
|
|
882
886
|
const token = storage.getCustomerToken();
|
|
883
|
-
const { siteCode } = useReadSite();
|
|
887
|
+
const { siteCode, language } = useReadSite();
|
|
884
888
|
return reactQuery.useQuery({
|
|
885
|
-
queryKey: ["emporix", "segment", "myCategories", { tenant: client.tenant, query, siteCode }],
|
|
889
|
+
queryKey: ["emporix", "segment", "myCategories", { tenant: client.tenant, query, siteCode, language }],
|
|
886
890
|
enabled: token !== null,
|
|
887
891
|
queryFn: () => client.segments.listMyCategories(query, customerCtx(token)),
|
|
888
892
|
staleTime: SEGMENTS_STALE_TIME
|
|
@@ -891,13 +895,13 @@ function useMySegmentCategories(query = {}) {
|
|
|
891
895
|
function useMySegmentCategoriesInfinite(query = {}) {
|
|
892
896
|
const { client, storage } = useEmporix();
|
|
893
897
|
const token = storage.getCustomerToken();
|
|
894
|
-
const { siteCode } = useReadSite();
|
|
898
|
+
const { siteCode, language } = useReadSite();
|
|
895
899
|
return useEmporixInfinite({
|
|
896
900
|
queryKey: [
|
|
897
901
|
"emporix",
|
|
898
902
|
"segment",
|
|
899
903
|
"myCategoriesInfinite",
|
|
900
|
-
{ tenant: client.tenant, query, siteCode }
|
|
904
|
+
{ tenant: client.tenant, query, siteCode, language }
|
|
901
905
|
],
|
|
902
906
|
enabled: token !== null,
|
|
903
907
|
fetchPage: (pageNumber) => client.segments.listMyCategories(
|
|
@@ -1216,14 +1220,14 @@ function useCloudFunction(functionId, options, queryOptions) {
|
|
|
1216
1220
|
function useMyOrders(options = {}) {
|
|
1217
1221
|
const { client, storage } = useEmporix();
|
|
1218
1222
|
const { activeCompany } = useActiveCompany();
|
|
1219
|
-
const { siteCode } = useReadSite();
|
|
1223
|
+
const { siteCode, language } = useReadSite();
|
|
1220
1224
|
const token = storage.getCustomerToken();
|
|
1221
1225
|
const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
|
|
1222
1226
|
return reactQuery.useQuery({
|
|
1223
1227
|
queryKey: emporixKey(
|
|
1224
1228
|
"orders",
|
|
1225
1229
|
["mine", effectiveLE ?? null, options.status ?? null, options.pageNumber ?? 1, options.pageSize ?? null],
|
|
1226
|
-
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
|
|
1230
|
+
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
|
|
1227
1231
|
),
|
|
1228
1232
|
enabled: token !== null,
|
|
1229
1233
|
queryFn: () => client.orders.listMine(emporixSdk.auth.customer(token), {
|
|
@@ -1239,14 +1243,14 @@ function useMyOrders(options = {}) {
|
|
|
1239
1243
|
function useMyOrdersInfinite(options = {}) {
|
|
1240
1244
|
const { client, storage } = useEmporix();
|
|
1241
1245
|
const { activeCompany } = useActiveCompany();
|
|
1242
|
-
const { siteCode } = useReadSite();
|
|
1246
|
+
const { siteCode, language } = useReadSite();
|
|
1243
1247
|
const token = storage.getCustomerToken();
|
|
1244
1248
|
const effectiveLE = options.legalEntityId === null ? void 0 : options.legalEntityId ?? activeCompany?.id;
|
|
1245
1249
|
return useEmporixInfinite({
|
|
1246
1250
|
queryKey: emporixKey(
|
|
1247
1251
|
"orders",
|
|
1248
1252
|
["mine-infinite", effectiveLE ?? null, options.status ?? null, options.pageSize ?? null],
|
|
1249
|
-
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode }
|
|
1253
|
+
{ tenant: client.tenant, authKind: token ? "customer" : "anonymous", siteCode, language }
|
|
1250
1254
|
),
|
|
1251
1255
|
enabled: token !== null,
|
|
1252
1256
|
fetchPage: (pageNumber) => client.orders.listMine(emporixSdk.auth.customer(token), {
|
|
@@ -1262,10 +1266,12 @@ function useMyOrdersInfinite(options = {}) {
|
|
|
1262
1266
|
function useOrder(orderId, options = {}) {
|
|
1263
1267
|
const { client, storage } = useEmporix();
|
|
1264
1268
|
const token = storage.getCustomerToken();
|
|
1269
|
+
const { language } = useReadSite();
|
|
1265
1270
|
return reactQuery.useQuery({
|
|
1266
1271
|
queryKey: emporixKey("orders", [orderId ?? null], {
|
|
1267
1272
|
tenant: client.tenant,
|
|
1268
|
-
authKind: token ? "customer" : "anonymous"
|
|
1273
|
+
authKind: token ? "customer" : "anonymous",
|
|
1274
|
+
language
|
|
1269
1275
|
}),
|
|
1270
1276
|
enabled: token !== null && orderId !== void 0,
|
|
1271
1277
|
queryFn: () => client.orders.get(
|
|
@@ -1373,10 +1379,12 @@ function useReorder() {
|
|
|
1373
1379
|
}
|
|
1374
1380
|
function useSalesOrder(orderId, authCtx) {
|
|
1375
1381
|
const { client } = useEmporix();
|
|
1382
|
+
const { language } = useReadSite();
|
|
1376
1383
|
return reactQuery.useQuery({
|
|
1377
1384
|
queryKey: emporixKey("salesorders", [orderId ?? null], {
|
|
1378
1385
|
tenant: client.tenant,
|
|
1379
|
-
authKind: authCtx?.kind ?? "anonymous"
|
|
1386
|
+
authKind: authCtx?.kind ?? "anonymous",
|
|
1387
|
+
language
|
|
1380
1388
|
}),
|
|
1381
1389
|
enabled: orderId !== void 0 && authCtx !== void 0,
|
|
1382
1390
|
queryFn: () => client.salesOrders.get(orderId, authCtx)
|