@viu/emporix-sdk-react 2.3.0 → 2.5.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 +52 -0
- package/README.md +14 -5
- package/dist/{chunk-AZDCAJLL.js → chunk-QMBRDYLW.js} +127 -3
- package/dist/chunk-QMBRDYLW.js.map +1 -0
- package/dist/hooks.cjs +137 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +22 -612
- package/dist/hooks.d.ts +22 -612
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +94 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/use-returns-C1juSNfc.d.cts +649 -0
- package/dist/use-returns-Dspo-4xb.d.ts +649 -0
- package/package.json +3 -3
- package/dist/chunk-AZDCAJLL.js.map +0 -1
package/dist/hooks.cjs
CHANGED
|
@@ -1321,10 +1321,136 @@ function useAvailabilities(productIds, siteCode, options = {}) {
|
|
|
1321
1321
|
staleTime: AVAILABILITY_STALE_TIME2
|
|
1322
1322
|
});
|
|
1323
1323
|
}
|
|
1324
|
+
var INVALIDATE_KEY2 = ["emporix", "coupons"];
|
|
1325
|
+
function useValidateCoupon() {
|
|
1326
|
+
const { client } = useEmporix();
|
|
1327
|
+
const { ctx } = useReadAuth();
|
|
1328
|
+
return reactQuery.useMutation({
|
|
1329
|
+
mutationFn: ({ code, redemption }) => client.coupons.validateCoupon(code, redemption, ctx)
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
function useRedeemCoupon() {
|
|
1333
|
+
const { client } = useEmporix();
|
|
1334
|
+
const { ctx } = useReadAuth();
|
|
1335
|
+
const qc = reactQuery.useQueryClient();
|
|
1336
|
+
return reactQuery.useMutation({
|
|
1337
|
+
mutationFn: ({ code, redemption }) => client.coupons.redeemCoupon(code, redemption, ctx),
|
|
1338
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY2 })
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
var STALE = 3e4;
|
|
1342
|
+
var INVALIDATE_KEY3 = ["emporix", "reward-points"];
|
|
1343
|
+
function useMyRewardPoints() {
|
|
1344
|
+
const { client } = useEmporix();
|
|
1345
|
+
const ctx = useCustomerOnlyCtx();
|
|
1346
|
+
return reactQuery.useQuery({
|
|
1347
|
+
queryKey: emporixKey("reward-points", ["mine"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1348
|
+
queryFn: () => client.rewardPoints.getMyPoints(ctx),
|
|
1349
|
+
staleTime: STALE
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
function useMyRewardPointsSummary() {
|
|
1353
|
+
const { client } = useEmporix();
|
|
1354
|
+
const ctx = useCustomerOnlyCtx();
|
|
1355
|
+
return reactQuery.useQuery({
|
|
1356
|
+
queryKey: emporixKey("reward-points", ["mine", "summary"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1357
|
+
queryFn: () => client.rewardPoints.getMySummary(ctx),
|
|
1358
|
+
staleTime: STALE
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
function useRedeemOptions() {
|
|
1362
|
+
const { client } = useEmporix();
|
|
1363
|
+
const { ctx } = useReadAuth();
|
|
1364
|
+
return reactQuery.useQuery({
|
|
1365
|
+
queryKey: emporixKey("reward-points", ["redeem-options"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1366
|
+
queryFn: () => client.rewardPoints.listRedeemOptions(ctx),
|
|
1367
|
+
staleTime: STALE
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
function useRedeemRewardPoints() {
|
|
1371
|
+
const { client } = useEmporix();
|
|
1372
|
+
const ctx = useCustomerOnlyCtx();
|
|
1373
|
+
const qc = reactQuery.useQueryClient();
|
|
1374
|
+
return reactQuery.useMutation({
|
|
1375
|
+
mutationFn: (input) => client.rewardPoints.redeemMyPoints(input, ctx),
|
|
1376
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY3 })
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
var STALE2 = 3e4;
|
|
1380
|
+
var INVALIDATE_KEY4 = ["emporix", "returns"];
|
|
1381
|
+
function useMyReturns(opts = {}) {
|
|
1382
|
+
const { client } = useEmporix();
|
|
1383
|
+
const ctx = useCustomerOnlyCtx();
|
|
1384
|
+
return reactQuery.useQuery({
|
|
1385
|
+
queryKey: emporixKey("returns", [opts.query ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1386
|
+
queryFn: () => client.returns.listReturns(opts.query ?? {}, ctx),
|
|
1387
|
+
staleTime: STALE2
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
function useReturn(returnId) {
|
|
1391
|
+
const { client } = useEmporix();
|
|
1392
|
+
const ctx = useCustomerOnlyCtx();
|
|
1393
|
+
return reactQuery.useQuery({
|
|
1394
|
+
queryKey: emporixKey("returns", [returnId ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1395
|
+
queryFn: () => client.returns.getReturn(returnId, ctx),
|
|
1396
|
+
enabled: Boolean(returnId),
|
|
1397
|
+
staleTime: STALE2
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
function useCreateReturn() {
|
|
1401
|
+
const { client } = useEmporix();
|
|
1402
|
+
const ctx = useCustomerOnlyCtx();
|
|
1403
|
+
const qc = reactQuery.useQueryClient();
|
|
1404
|
+
return reactQuery.useMutation({
|
|
1405
|
+
mutationFn: (input) => client.returns.createReturn(input, ctx),
|
|
1406
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY4 })
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
var STALE3 = 3e4;
|
|
1410
|
+
var INVALIDATE_KEY5 = ["emporix", "approvals"];
|
|
1411
|
+
function useApprovals(opts = {}) {
|
|
1412
|
+
const { client } = useEmporix();
|
|
1413
|
+
const ctx = useCustomerOnlyCtx();
|
|
1414
|
+
return reactQuery.useQuery({
|
|
1415
|
+
queryKey: emporixKey("approvals", [opts.query ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1416
|
+
queryFn: () => client.approvals.listApprovals(opts.query ?? {}, ctx),
|
|
1417
|
+
staleTime: STALE3
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
function useApproval(approvalId) {
|
|
1421
|
+
const { client } = useEmporix();
|
|
1422
|
+
const ctx = useCustomerOnlyCtx();
|
|
1423
|
+
return reactQuery.useQuery({
|
|
1424
|
+
queryKey: emporixKey("approvals", [approvalId ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1425
|
+
queryFn: () => client.approvals.getApproval(approvalId, ctx),
|
|
1426
|
+
enabled: Boolean(approvalId),
|
|
1427
|
+
staleTime: STALE3
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
function useCreateApproval() {
|
|
1431
|
+
const { client } = useEmporix();
|
|
1432
|
+
const ctx = useCustomerOnlyCtx();
|
|
1433
|
+
const qc = reactQuery.useQueryClient();
|
|
1434
|
+
return reactQuery.useMutation({
|
|
1435
|
+
mutationFn: (input) => client.approvals.createApproval(input, ctx),
|
|
1436
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY5 })
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
function useUpdateApproval() {
|
|
1440
|
+
const { client } = useEmporix();
|
|
1441
|
+
const ctx = useCustomerOnlyCtx();
|
|
1442
|
+
const qc = reactQuery.useQueryClient();
|
|
1443
|
+
return reactQuery.useMutation({
|
|
1444
|
+
mutationFn: ({ approvalId, ops }) => client.approvals.updateApproval(approvalId, ops, ctx),
|
|
1445
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY5 })
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1324
1448
|
|
|
1325
1449
|
exports.useActiveCart = useActiveCart;
|
|
1326
1450
|
exports.useAddToShoppingList = useAddToShoppingList;
|
|
1327
1451
|
exports.useAddressMutations = useAddressMutations;
|
|
1452
|
+
exports.useApproval = useApproval;
|
|
1453
|
+
exports.useApprovals = useApprovals;
|
|
1328
1454
|
exports.useAssignContact = useAssignContact;
|
|
1329
1455
|
exports.useAvailabilities = useAvailabilities;
|
|
1330
1456
|
exports.useAvailability = useAvailability;
|
|
@@ -1342,9 +1468,11 @@ exports.useCompanyContacts = useCompanyContacts;
|
|
|
1342
1468
|
exports.useCompanyGroups = useCompanyGroups;
|
|
1343
1469
|
exports.useCompanyLocations = useCompanyLocations;
|
|
1344
1470
|
exports.useCompanySwitcher = useCompanySwitcher;
|
|
1471
|
+
exports.useCreateApproval = useCreateApproval;
|
|
1345
1472
|
exports.useCreateCart = useCreateCart;
|
|
1346
1473
|
exports.useCreateCompany = useCreateCompany;
|
|
1347
1474
|
exports.useCreateLocation = useCreateLocation;
|
|
1475
|
+
exports.useCreateReturn = useCreateReturn;
|
|
1348
1476
|
exports.useCreateShoppingList = useCreateShoppingList;
|
|
1349
1477
|
exports.useCustomerAddresses = useCustomerAddresses;
|
|
1350
1478
|
exports.useCustomerSession = useCustomerSession;
|
|
@@ -1357,6 +1485,9 @@ exports.useMatchPricesChunked = useMatchPricesChunked;
|
|
|
1357
1485
|
exports.useMyCompanies = useMyCompanies;
|
|
1358
1486
|
exports.useMyOrders = useMyOrders;
|
|
1359
1487
|
exports.useMyOrdersInfinite = useMyOrdersInfinite;
|
|
1488
|
+
exports.useMyReturns = useMyReturns;
|
|
1489
|
+
exports.useMyRewardPoints = useMyRewardPoints;
|
|
1490
|
+
exports.useMyRewardPointsSummary = useMyRewardPointsSummary;
|
|
1360
1491
|
exports.useMySegmentCategories = useMySegmentCategories;
|
|
1361
1492
|
exports.useMySegmentCategoriesInfinite = useMySegmentCategoriesInfinite;
|
|
1362
1493
|
exports.useMySegmentCategoryTree = useMySegmentCategoryTree;
|
|
@@ -1377,19 +1508,25 @@ exports.useProductsByCodes = useProductsByCodes;
|
|
|
1377
1508
|
exports.useProductsInCategory = useProductsInCategory;
|
|
1378
1509
|
exports.useProductsInCategoryInfinite = useProductsInCategoryInfinite;
|
|
1379
1510
|
exports.useProductsInfinite = useProductsInfinite;
|
|
1511
|
+
exports.useRedeemCoupon = useRedeemCoupon;
|
|
1512
|
+
exports.useRedeemOptions = useRedeemOptions;
|
|
1513
|
+
exports.useRedeemRewardPoints = useRedeemRewardPoints;
|
|
1380
1514
|
exports.useRemoveFromShoppingList = useRemoveFromShoppingList;
|
|
1381
1515
|
exports.useReorder = useReorder;
|
|
1516
|
+
exports.useReturn = useReturn;
|
|
1382
1517
|
exports.useSalesOrder = useSalesOrder;
|
|
1383
1518
|
exports.useSetShoppingListItemQuantity = useSetShoppingListItemQuantity;
|
|
1384
1519
|
exports.useShoppingLists = useShoppingLists;
|
|
1385
1520
|
exports.useSiteContext = useSiteContext;
|
|
1386
1521
|
exports.useSites = useSites;
|
|
1387
1522
|
exports.useUnassignContact = useUnassignContact;
|
|
1523
|
+
exports.useUpdateApproval = useUpdateApproval;
|
|
1388
1524
|
exports.useUpdateCompany = useUpdateCompany;
|
|
1389
1525
|
exports.useUpdateContactAssignment = useUpdateContactAssignment;
|
|
1390
1526
|
exports.useUpdateCustomer = useUpdateCustomer;
|
|
1391
1527
|
exports.useUpdateLocation = useUpdateLocation;
|
|
1392
1528
|
exports.useUpdateSalesOrder = useUpdateSalesOrder;
|
|
1529
|
+
exports.useValidateCoupon = useValidateCoupon;
|
|
1393
1530
|
exports.useVariantChildren = useVariantChildren;
|
|
1394
1531
|
//# sourceMappingURL=hooks.cjs.map
|
|
1395
1532
|
//# sourceMappingURL=hooks.cjs.map
|