@explorins/pers-sdk-react-native 2.1.11 → 2.1.12
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,12 +1,13 @@
|
|
|
1
1
|
import { OnStatusUpdateFn } from './useTransactionSigner';
|
|
2
2
|
import type { RedemptionCreateRequestDTO, RedemptionDTO, RedemptionRedeemDTO, RedemptionRedeemRequestResponseDTO, RedemptionTypeDTO, PaginatedResponseDTO, RedemptionRedeemIncludeRelation } from '@explorins/pers-shared';
|
|
3
3
|
import type { RedemptionRedeemFilters } from '@explorins/pers-sdk/redemption';
|
|
4
|
+
import type { PaginationOptions } from '@explorins/pers-sdk';
|
|
4
5
|
export type { RedemptionRedeemFilters } from '@explorins/pers-sdk/redemption';
|
|
5
6
|
export declare const useRedemptions: () => {
|
|
6
7
|
getRedemptions: (options?: {
|
|
7
8
|
active?: boolean;
|
|
8
9
|
}) => Promise<PaginatedResponseDTO<RedemptionDTO>>;
|
|
9
|
-
getUserRedemptions: (include?: RedemptionRedeemIncludeRelation[]) => Promise<PaginatedResponseDTO<RedemptionRedeemDTO>>;
|
|
10
|
+
getUserRedemptions: (options?: PaginationOptions, include?: RedemptionRedeemIncludeRelation[]) => Promise<PaginatedResponseDTO<RedemptionRedeemDTO>>;
|
|
10
11
|
redeem: (redemptionId: string, onStatusUpdate?: OnStatusUpdateFn) => Promise<RedemptionRedeemRequestResponseDTO>;
|
|
11
12
|
getRedemptionTypes: () => Promise<PaginatedResponseDTO<RedemptionTypeDTO>>;
|
|
12
13
|
getRedemptionRedeems: (filters?: RedemptionRedeemFilters, include?: RedemptionRedeemIncludeRelation[]) => Promise<PaginatedResponseDTO<RedemptionRedeemDTO>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedemptions.d.ts","sourceRoot":"","sources":["../../src/hooks/useRedemptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,gBAAgB,EAAE,MAAM,wBAAwB,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GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -26,22 +26,27 @@ export const useRedemptions = () => {
|
|
|
26
26
|
}
|
|
27
27
|
}, [sdk, isInitialized]);
|
|
28
28
|
/**
|
|
29
|
-
* Get user's redemption history with optional include relations
|
|
29
|
+
* Get user's redemption history with optional pagination and include relations
|
|
30
30
|
*
|
|
31
|
+
* @param options - Pagination options (page, limit, sortBy, sortOrder)
|
|
31
32
|
* @param include - Relations to include: 'redemption', 'user', 'business'
|
|
32
33
|
* @returns Promise resolving to paginated redemption history
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* ```typescript
|
|
37
|
+
* // Get first page of user redemptions
|
|
38
|
+
* const { data: redeems, pagination } = await getUserRedemptions({ page: 1, limit: 10 });
|
|
39
|
+
* console.log(`Page ${pagination.page} of ${pagination.pages}`);
|
|
40
|
+
*
|
|
36
41
|
* // Get user redemptions with full redemption details
|
|
37
|
-
* const { data: redeems } = await getUserRedemptions(['redemption', 'business']);
|
|
42
|
+
* const { data: redeems } = await getUserRedemptions({}, ['redemption', 'business']);
|
|
38
43
|
* redeems.forEach(redeem => {
|
|
39
44
|
* console.log('Redemption:', redeem.included?.redemption?.title);
|
|
40
45
|
* console.log('Business:', redeem.included?.business?.displayName);
|
|
41
46
|
* });
|
|
42
47
|
* ```
|
|
43
48
|
*/
|
|
44
|
-
const getUserRedemptions = useCallback(async (include) => {
|
|
49
|
+
const getUserRedemptions = useCallback(async (options, include) => {
|
|
45
50
|
if (!isInitialized || !sdk) {
|
|
46
51
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
47
52
|
}
|
|
@@ -50,7 +55,7 @@ export const useRedemptions = () => {
|
|
|
50
55
|
return { data: [], pagination: { page: 1, limit: 0, total: 0, pages: 0, hasNext: false, hasPrev: false } };
|
|
51
56
|
}
|
|
52
57
|
try {
|
|
53
|
-
const result = await sdk.redemptions.getUserRedemptions(
|
|
58
|
+
const result = await sdk.redemptions.getUserRedemptions(options, include);
|
|
54
59
|
return result;
|
|
55
60
|
}
|
|
56
61
|
catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -41692,22 +41692,27 @@ const useRedemptions = () => {
|
|
|
41692
41692
|
}
|
|
41693
41693
|
}, [sdk, isInitialized]);
|
|
41694
41694
|
/**
|
|
41695
|
-
* Get user's redemption history with optional include relations
|
|
41695
|
+
* Get user's redemption history with optional pagination and include relations
|
|
41696
41696
|
*
|
|
41697
|
+
* @param options - Pagination options (page, limit, sortBy, sortOrder)
|
|
41697
41698
|
* @param include - Relations to include: 'redemption', 'user', 'business'
|
|
41698
41699
|
* @returns Promise resolving to paginated redemption history
|
|
41699
41700
|
*
|
|
41700
41701
|
* @example
|
|
41701
41702
|
* ```typescript
|
|
41703
|
+
* // Get first page of user redemptions
|
|
41704
|
+
* const { data: redeems, pagination } = await getUserRedemptions({ page: 1, limit: 10 });
|
|
41705
|
+
* console.log(`Page ${pagination.page} of ${pagination.pages}`);
|
|
41706
|
+
*
|
|
41702
41707
|
* // Get user redemptions with full redemption details
|
|
41703
|
-
* const { data: redeems } = await getUserRedemptions(['redemption', 'business']);
|
|
41708
|
+
* const { data: redeems } = await getUserRedemptions({}, ['redemption', 'business']);
|
|
41704
41709
|
* redeems.forEach(redeem => {
|
|
41705
41710
|
* console.log('Redemption:', redeem.included?.redemption?.title);
|
|
41706
41711
|
* console.log('Business:', redeem.included?.business?.displayName);
|
|
41707
41712
|
* });
|
|
41708
41713
|
* ```
|
|
41709
41714
|
*/
|
|
41710
|
-
const getUserRedemptions = react.useCallback(async (include) => {
|
|
41715
|
+
const getUserRedemptions = react.useCallback(async (options, include) => {
|
|
41711
41716
|
if (!isInitialized || !sdk) {
|
|
41712
41717
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
41713
41718
|
}
|
|
@@ -41716,7 +41721,7 @@ const useRedemptions = () => {
|
|
|
41716
41721
|
return { data: [], pagination: { page: 1, limit: 0, total: 0, pages: 0, hasNext: false, hasPrev: false } };
|
|
41717
41722
|
}
|
|
41718
41723
|
try {
|
|
41719
|
-
const result = await sdk.redemptions.getUserRedemptions(
|
|
41724
|
+
const result = await sdk.redemptions.getUserRedemptions(options, include);
|
|
41720
41725
|
return result;
|
|
41721
41726
|
}
|
|
41722
41727
|
catch (error) {
|