@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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorins/pers-sdk-react-native",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12",
|
|
4
4
|
"description": "React Native SDK for PERS Platform - Tourism Loyalty System with Blockchain Transaction Signing and WebAuthn Authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
RedemptionRedeemIncludeRelation
|
|
12
12
|
} from '@explorins/pers-shared';
|
|
13
13
|
import type { RedemptionRedeemFilters } from '@explorins/pers-sdk/redemption';
|
|
14
|
+
import type { PaginationOptions } from '@explorins/pers-sdk';
|
|
14
15
|
|
|
15
16
|
// Re-export for consumers
|
|
16
17
|
export type { RedemptionRedeemFilters } from '@explorins/pers-sdk/redemption';
|
|
@@ -42,15 +43,20 @@ export const useRedemptions = () => {
|
|
|
42
43
|
}, [sdk, isInitialized]);
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
|
-
* Get user's redemption history with optional include relations
|
|
46
|
+
* Get user's redemption history with optional pagination and include relations
|
|
46
47
|
*
|
|
48
|
+
* @param options - Pagination options (page, limit, sortBy, sortOrder)
|
|
47
49
|
* @param include - Relations to include: 'redemption', 'user', 'business'
|
|
48
50
|
* @returns Promise resolving to paginated redemption history
|
|
49
51
|
*
|
|
50
52
|
* @example
|
|
51
53
|
* ```typescript
|
|
54
|
+
* // Get first page of user redemptions
|
|
55
|
+
* const { data: redeems, pagination } = await getUserRedemptions({ page: 1, limit: 10 });
|
|
56
|
+
* console.log(`Page ${pagination.page} of ${pagination.pages}`);
|
|
57
|
+
*
|
|
52
58
|
* // Get user redemptions with full redemption details
|
|
53
|
-
* const { data: redeems } = await getUserRedemptions(['redemption', 'business']);
|
|
59
|
+
* const { data: redeems } = await getUserRedemptions({}, ['redemption', 'business']);
|
|
54
60
|
* redeems.forEach(redeem => {
|
|
55
61
|
* console.log('Redemption:', redeem.included?.redemption?.title);
|
|
56
62
|
* console.log('Business:', redeem.included?.business?.displayName);
|
|
@@ -58,6 +64,7 @@ export const useRedemptions = () => {
|
|
|
58
64
|
* ```
|
|
59
65
|
*/
|
|
60
66
|
const getUserRedemptions = useCallback(async (
|
|
67
|
+
options?: PaginationOptions,
|
|
61
68
|
include?: RedemptionRedeemIncludeRelation[]
|
|
62
69
|
): Promise<PaginatedResponseDTO<RedemptionRedeemDTO>> => {
|
|
63
70
|
if (!isInitialized || !sdk) {
|
|
@@ -69,7 +76,7 @@ export const useRedemptions = () => {
|
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
try {
|
|
72
|
-
const result = await sdk.redemptions.getUserRedemptions(
|
|
79
|
+
const result = await sdk.redemptions.getUserRedemptions(options, include);
|
|
73
80
|
return result;
|
|
74
81
|
} catch (error) {
|
|
75
82
|
console.error('Failed to fetch user redemptions:', error);
|