@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/index.cjs
CHANGED
|
@@ -1907,6 +1907,91 @@ function useAvailabilities(productIds, siteCode, options = {}) {
|
|
|
1907
1907
|
staleTime: AVAILABILITY_STALE_TIME2
|
|
1908
1908
|
});
|
|
1909
1909
|
}
|
|
1910
|
+
var INVALIDATE_KEY2 = ["emporix", "coupons"];
|
|
1911
|
+
function useValidateCoupon() {
|
|
1912
|
+
const { client } = useEmporix();
|
|
1913
|
+
const { ctx } = useReadAuth();
|
|
1914
|
+
return reactQuery.useMutation({
|
|
1915
|
+
mutationFn: ({ code, redemption }) => client.coupons.validateCoupon(code, redemption, ctx)
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
function useRedeemCoupon() {
|
|
1919
|
+
const { client } = useEmporix();
|
|
1920
|
+
const { ctx } = useReadAuth();
|
|
1921
|
+
const qc = reactQuery.useQueryClient();
|
|
1922
|
+
return reactQuery.useMutation({
|
|
1923
|
+
mutationFn: ({ code, redemption }) => client.coupons.redeemCoupon(code, redemption, ctx),
|
|
1924
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY2 })
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
var STALE = 3e4;
|
|
1928
|
+
var INVALIDATE_KEY3 = ["emporix", "reward-points"];
|
|
1929
|
+
function useMyRewardPoints() {
|
|
1930
|
+
const { client } = useEmporix();
|
|
1931
|
+
const ctx = useCustomerOnlyCtx();
|
|
1932
|
+
return reactQuery.useQuery({
|
|
1933
|
+
queryKey: emporixKey("reward-points", ["mine"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1934
|
+
queryFn: () => client.rewardPoints.getMyPoints(ctx),
|
|
1935
|
+
staleTime: STALE
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
function useMyRewardPointsSummary() {
|
|
1939
|
+
const { client } = useEmporix();
|
|
1940
|
+
const ctx = useCustomerOnlyCtx();
|
|
1941
|
+
return reactQuery.useQuery({
|
|
1942
|
+
queryKey: emporixKey("reward-points", ["mine", "summary"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1943
|
+
queryFn: () => client.rewardPoints.getMySummary(ctx),
|
|
1944
|
+
staleTime: STALE
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
function useRedeemOptions() {
|
|
1948
|
+
const { client } = useEmporix();
|
|
1949
|
+
const { ctx } = useReadAuth();
|
|
1950
|
+
return reactQuery.useQuery({
|
|
1951
|
+
queryKey: emporixKey("reward-points", ["redeem-options"], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1952
|
+
queryFn: () => client.rewardPoints.listRedeemOptions(ctx),
|
|
1953
|
+
staleTime: STALE
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
function useRedeemRewardPoints() {
|
|
1957
|
+
const { client } = useEmporix();
|
|
1958
|
+
const ctx = useCustomerOnlyCtx();
|
|
1959
|
+
const qc = reactQuery.useQueryClient();
|
|
1960
|
+
return reactQuery.useMutation({
|
|
1961
|
+
mutationFn: (input) => client.rewardPoints.redeemMyPoints(input, ctx),
|
|
1962
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY3 })
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
var STALE2 = 3e4;
|
|
1966
|
+
var INVALIDATE_KEY4 = ["emporix", "returns"];
|
|
1967
|
+
function useMyReturns(opts = {}) {
|
|
1968
|
+
const { client } = useEmporix();
|
|
1969
|
+
const ctx = useCustomerOnlyCtx();
|
|
1970
|
+
return reactQuery.useQuery({
|
|
1971
|
+
queryKey: emporixKey("returns", [opts.query ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1972
|
+
queryFn: () => client.returns.listReturns(opts.query ?? {}, ctx),
|
|
1973
|
+
staleTime: STALE2
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
function useReturn(returnId) {
|
|
1977
|
+
const { client } = useEmporix();
|
|
1978
|
+
const ctx = useCustomerOnlyCtx();
|
|
1979
|
+
return reactQuery.useQuery({
|
|
1980
|
+
queryKey: emporixKey("returns", [returnId ?? null], { tenant: client.tenant, authKind: ctx.kind }),
|
|
1981
|
+
queryFn: () => client.returns.getReturn(returnId, ctx),
|
|
1982
|
+
enabled: Boolean(returnId),
|
|
1983
|
+
staleTime: STALE2
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
function useCreateReturn() {
|
|
1987
|
+
const { client } = useEmporix();
|
|
1988
|
+
const ctx = useCustomerOnlyCtx();
|
|
1989
|
+
const qc = reactQuery.useQueryClient();
|
|
1990
|
+
return reactQuery.useMutation({
|
|
1991
|
+
mutationFn: (input) => client.returns.createReturn(input, ctx),
|
|
1992
|
+
onSuccess: () => void qc.invalidateQueries({ queryKey: INVALIDATE_KEY4 })
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1910
1995
|
var EmporixErrorBoundary = class extends react.Component {
|
|
1911
1996
|
state = { error: null };
|
|
1912
1997
|
static getDerivedStateFromError(error) {
|
|
@@ -1979,6 +2064,7 @@ exports.useCompanySwitcher = useCompanySwitcher;
|
|
|
1979
2064
|
exports.useCreateCart = useCreateCart;
|
|
1980
2065
|
exports.useCreateCompany = useCreateCompany;
|
|
1981
2066
|
exports.useCreateLocation = useCreateLocation;
|
|
2067
|
+
exports.useCreateReturn = useCreateReturn;
|
|
1982
2068
|
exports.useCreateShoppingList = useCreateShoppingList;
|
|
1983
2069
|
exports.useCustomerAddresses = useCustomerAddresses;
|
|
1984
2070
|
exports.useCustomerSession = useCustomerSession;
|
|
@@ -1994,6 +2080,9 @@ exports.useMatchPricesChunked = useMatchPricesChunked;
|
|
|
1994
2080
|
exports.useMyCompanies = useMyCompanies;
|
|
1995
2081
|
exports.useMyOrders = useMyOrders;
|
|
1996
2082
|
exports.useMyOrdersInfinite = useMyOrdersInfinite;
|
|
2083
|
+
exports.useMyReturns = useMyReturns;
|
|
2084
|
+
exports.useMyRewardPoints = useMyRewardPoints;
|
|
2085
|
+
exports.useMyRewardPointsSummary = useMyRewardPointsSummary;
|
|
1997
2086
|
exports.useMySegmentCategories = useMySegmentCategories;
|
|
1998
2087
|
exports.useMySegmentCategoriesInfinite = useMySegmentCategoriesInfinite;
|
|
1999
2088
|
exports.useMySegmentCategoryTree = useMySegmentCategoryTree;
|
|
@@ -2014,8 +2103,12 @@ exports.useProductsByCodes = useProductsByCodes;
|
|
|
2014
2103
|
exports.useProductsInCategory = useProductsInCategory;
|
|
2015
2104
|
exports.useProductsInCategoryInfinite = useProductsInCategoryInfinite;
|
|
2016
2105
|
exports.useProductsInfinite = useProductsInfinite;
|
|
2106
|
+
exports.useRedeemCoupon = useRedeemCoupon;
|
|
2107
|
+
exports.useRedeemOptions = useRedeemOptions;
|
|
2108
|
+
exports.useRedeemRewardPoints = useRedeemRewardPoints;
|
|
2017
2109
|
exports.useRemoveFromShoppingList = useRemoveFromShoppingList;
|
|
2018
2110
|
exports.useReorder = useReorder;
|
|
2111
|
+
exports.useReturn = useReturn;
|
|
2019
2112
|
exports.useSalesOrder = useSalesOrder;
|
|
2020
2113
|
exports.useSetShoppingListItemQuantity = useSetShoppingListItemQuantity;
|
|
2021
2114
|
exports.useShoppingLists = useShoppingLists;
|
|
@@ -2027,6 +2120,7 @@ exports.useUpdateContactAssignment = useUpdateContactAssignment;
|
|
|
2027
2120
|
exports.useUpdateCustomer = useUpdateCustomer;
|
|
2028
2121
|
exports.useUpdateLocation = useUpdateLocation;
|
|
2029
2122
|
exports.useUpdateSalesOrder = useUpdateSalesOrder;
|
|
2123
|
+
exports.useValidateCoupon = useValidateCoupon;
|
|
2030
2124
|
exports.useVariantChildren = useVariantChildren;
|
|
2031
2125
|
//# sourceMappingURL=index.cjs.map
|
|
2032
2126
|
//# sourceMappingURL=index.cjs.map
|