@explorins/pers-sdk-react-native 1.5.36 → 2.0.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/README.md +329 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useBusiness.d.ts +5 -5
- package/dist/hooks/useBusiness.d.ts.map +1 -1
- package/dist/hooks/useCampaigns.d.ts +8 -8
- package/dist/hooks/useCampaigns.d.ts.map +1 -1
- package/dist/hooks/useCampaigns.js +3 -3
- package/dist/hooks/useDonations.d.ts +2 -2
- package/dist/hooks/useDonations.d.ts.map +1 -1
- package/dist/hooks/useEvents.d.ts +178 -0
- package/dist/hooks/useEvents.d.ts.map +1 -0
- package/dist/hooks/useEvents.js +312 -0
- package/dist/hooks/usePurchases.d.ts +3 -3
- package/dist/hooks/usePurchases.d.ts.map +1 -1
- package/dist/hooks/useRedemptions.d.ts +6 -5
- package/dist/hooks/useRedemptions.d.ts.map +1 -1
- package/dist/hooks/useRedemptions.js +13 -19
- package/dist/hooks/useTenants.d.ts +2 -2
- package/dist/hooks/useTenants.d.ts.map +1 -1
- package/dist/hooks/useTokens.d.ts +4 -4
- package/dist/hooks/useTokens.d.ts.map +1 -1
- package/dist/hooks/useTransactionSigner.d.ts +2 -0
- package/dist/hooks/useTransactionSigner.d.ts.map +1 -1
- package/dist/hooks/useTransactionSigner.js +68 -0
- package/dist/hooks/useTransactions.d.ts +3 -3
- package/dist/hooks/useTransactions.d.ts.map +1 -1
- package/dist/hooks/useUserStatus.d.ts +3 -3
- package/dist/hooks/useUserStatus.d.ts.map +1 -1
- package/dist/hooks/useUsers.d.ts +3 -3
- package/dist/hooks/useUsers.d.ts.map +1 -1
- package/dist/index.d.ts +83 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2979 -652
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/index.ts +3 -1
- package/src/hooks/useBusiness.ts +5 -5
- package/src/hooks/useCampaigns.ts +12 -11
- package/src/hooks/useDonations.ts +2 -2
- package/src/hooks/useEvents.ts +360 -0
- package/src/hooks/usePurchases.ts +3 -3
- package/src/hooks/useRedemptions.ts +16 -22
- package/src/hooks/useTenants.ts +2 -2
- package/src/hooks/useTokens.ts +4 -4
- package/src/hooks/useTransactionSigner.ts +73 -0
- package/src/hooks/useTransactions.ts +4 -3
- package/src/hooks/useUserStatus.ts +3 -3
- package/src/hooks/useUsers.ts +3 -3
- package/src/index.ts +105 -2
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { usePersSDK } from '../providers/PersSDKProvider';
|
|
3
|
+
/**
|
|
4
|
+
* React Native hook for PERS SDK event system
|
|
5
|
+
*
|
|
6
|
+
* This hook provides access to the platform-agnostic event system for subscribing to
|
|
7
|
+
* transaction, authentication, campaign, and system events. All events include a
|
|
8
|
+
* `userMessage` field ready for display to end users.
|
|
9
|
+
*
|
|
10
|
+
* **Event Domains:**
|
|
11
|
+
* - `auth` - Authentication events (login, logout, token refresh)
|
|
12
|
+
* - `user` - User profile events (update, create)
|
|
13
|
+
* - `transaction` - Transaction events (created, completed, failed)
|
|
14
|
+
* - `campaign` - Campaign events (claimed, activated)
|
|
15
|
+
* - `redemption` - Redemption events (redeemed, expired)
|
|
16
|
+
* - `business` - Business events (created, updated, membership)
|
|
17
|
+
* - `api` - API error events (network, validation, server errors)
|
|
18
|
+
*
|
|
19
|
+
* **Notification Levels:**
|
|
20
|
+
* - `success` - Operation completed successfully
|
|
21
|
+
* - `error` - Operation failed
|
|
22
|
+
* - `warning` - Operation completed with warnings
|
|
23
|
+
* - `info` - Informational event
|
|
24
|
+
*
|
|
25
|
+
* **Cleanup:**
|
|
26
|
+
* All subscriptions created through this hook are automatically cleaned up when
|
|
27
|
+
* the component unmounts, preventing memory leaks and stale event handlers.
|
|
28
|
+
*
|
|
29
|
+
* @returns {EventsHook} Hook interface with event subscription methods
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* **Basic Usage - Show All Notifications**
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { useEvents } from '@explorins/pers-sdk-react-native';
|
|
35
|
+
*
|
|
36
|
+
* function NotificationComponent() {
|
|
37
|
+
* const { subscribe, isAvailable } = useEvents();
|
|
38
|
+
*
|
|
39
|
+
* useEffect(() => {
|
|
40
|
+
* if (!isAvailable) return;
|
|
41
|
+
*
|
|
42
|
+
* const unsubscribe = subscribe((event) => {
|
|
43
|
+
* // userMessage is always present and UI-ready
|
|
44
|
+
* showNotification(event.userMessage, event.level);
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* return () => unsubscribe();
|
|
48
|
+
* }, [subscribe, isAvailable]);
|
|
49
|
+
*
|
|
50
|
+
* return <View />;
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* **Filter by Domain and Level**
|
|
56
|
+
* ```typescript
|
|
57
|
+
* function TransactionListener() {
|
|
58
|
+
* const { subscribe, isAvailable } = useEvents();
|
|
59
|
+
*
|
|
60
|
+
* useEffect(() => {
|
|
61
|
+
* if (!isAvailable) return;
|
|
62
|
+
*
|
|
63
|
+
* // Only listen to successful transactions
|
|
64
|
+
* const unsubscribe = subscribe(
|
|
65
|
+
* (event) => {
|
|
66
|
+
* if (event.level === 'success') {
|
|
67
|
+
* playSuccessSound();
|
|
68
|
+
* showConfetti();
|
|
69
|
+
* }
|
|
70
|
+
* },
|
|
71
|
+
* { domain: 'transaction' } // Filter
|
|
72
|
+
* );
|
|
73
|
+
*
|
|
74
|
+
* return () => unsubscribe();
|
|
75
|
+
* }, [subscribe, isAvailable]);
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* **Filter Errors for Logging**
|
|
81
|
+
* ```typescript
|
|
82
|
+
* function ErrorLogger() {
|
|
83
|
+
* const { subscribe, isAvailable } = useEvents();
|
|
84
|
+
*
|
|
85
|
+
* useEffect(() => {
|
|
86
|
+
* if (!isAvailable) return;
|
|
87
|
+
*
|
|
88
|
+
* const unsubscribe = subscribe(
|
|
89
|
+
* (event) => {
|
|
90
|
+
* // Log errors to crash reporting
|
|
91
|
+
* logToSentry({
|
|
92
|
+
* message: event.userMessage,
|
|
93
|
+
* domain: event.domain,
|
|
94
|
+
* type: event.type,
|
|
95
|
+
* });
|
|
96
|
+
* },
|
|
97
|
+
* { level: 'error' } // Only errors
|
|
98
|
+
* );
|
|
99
|
+
*
|
|
100
|
+
* return () => unsubscribe();
|
|
101
|
+
* }, [subscribe, isAvailable]);
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* **One-time Event**
|
|
107
|
+
* ```typescript
|
|
108
|
+
* function FirstTransactionHandler() {
|
|
109
|
+
* const { once, isAvailable } = useEvents();
|
|
110
|
+
*
|
|
111
|
+
* useEffect(() => {
|
|
112
|
+
* if (!isAvailable) return;
|
|
113
|
+
*
|
|
114
|
+
* // Auto-unsubscribe after first transaction event
|
|
115
|
+
* const unsubscribe = once(
|
|
116
|
+
* (event) => {
|
|
117
|
+
* console.log('First transaction event:', event.type);
|
|
118
|
+
* showOnboardingComplete();
|
|
119
|
+
* },
|
|
120
|
+
* { domain: 'transaction', level: 'success' }
|
|
121
|
+
* );
|
|
122
|
+
*
|
|
123
|
+
* return () => unsubscribe();
|
|
124
|
+
* }, [once, isAvailable]);
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* **Combined Domain and Level Filter**
|
|
130
|
+
* ```typescript
|
|
131
|
+
* function AuthErrorHandler() {
|
|
132
|
+
* const { subscribe, isAvailable } = useEvents();
|
|
133
|
+
*
|
|
134
|
+
* useEffect(() => {
|
|
135
|
+
* if (!isAvailable) return;
|
|
136
|
+
*
|
|
137
|
+
* const unsubscribe = subscribe(
|
|
138
|
+
* (event) => {
|
|
139
|
+
* Alert.alert('Authentication Error', event.userMessage);
|
|
140
|
+
* navigation.navigate('Login');
|
|
141
|
+
* },
|
|
142
|
+
* { domain: 'auth', level: 'error' }
|
|
143
|
+
* );
|
|
144
|
+
*
|
|
145
|
+
* return () => unsubscribe();
|
|
146
|
+
* }, [subscribe, isAvailable]);
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @see {@link PersEvent} for event structure
|
|
151
|
+
* @see {@link EventFilter} for filtering options
|
|
152
|
+
* @see {@link EventHandler} for handler function type
|
|
153
|
+
*
|
|
154
|
+
* @since 1.6.49
|
|
155
|
+
*/
|
|
156
|
+
export const useEvents = () => {
|
|
157
|
+
const { sdk, isInitialized } = usePersSDK();
|
|
158
|
+
// Track subscriptions for cleanup
|
|
159
|
+
const subscriptionsRef = useRef([]);
|
|
160
|
+
// Cleanup all subscriptions on unmount
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
return () => {
|
|
163
|
+
subscriptionsRef.current.forEach(unsubscribe => {
|
|
164
|
+
try {
|
|
165
|
+
unsubscribe();
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
// Ignore cleanup errors
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
subscriptionsRef.current = [];
|
|
172
|
+
};
|
|
173
|
+
}, []);
|
|
174
|
+
/**
|
|
175
|
+
* Subscribe to SDK events with optional filtering
|
|
176
|
+
*
|
|
177
|
+
* Creates a subscription that will be called for every matching event.
|
|
178
|
+
* The subscription is automatically tracked for cleanup when the component unmounts.
|
|
179
|
+
*
|
|
180
|
+
* @param handler - Callback function invoked for each matching event
|
|
181
|
+
* @param filter - Optional filter to limit events (by domain, level, or both)
|
|
182
|
+
* @returns Unsubscribe function to manually cancel the subscription
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* const unsubscribe = subscribe((event) => {
|
|
187
|
+
* console.log('Event:', event.type, event.userMessage);
|
|
188
|
+
* });
|
|
189
|
+
*
|
|
190
|
+
* // Later: manual cleanup
|
|
191
|
+
* unsubscribe();
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
const subscribe = useCallback((handler, filter) => {
|
|
195
|
+
if (!isInitialized || !sdk) {
|
|
196
|
+
console.warn('[useEvents] SDK not initialized. Cannot subscribe to events.');
|
|
197
|
+
return () => { }; // Return no-op unsubscribe
|
|
198
|
+
}
|
|
199
|
+
const unsubscribe = sdk.events.subscribe(handler, filter);
|
|
200
|
+
// Track for cleanup
|
|
201
|
+
subscriptionsRef.current.push(unsubscribe);
|
|
202
|
+
// Return wrapped unsubscribe that also removes from tracking
|
|
203
|
+
return () => {
|
|
204
|
+
unsubscribe();
|
|
205
|
+
const index = subscriptionsRef.current.indexOf(unsubscribe);
|
|
206
|
+
if (index > -1) {
|
|
207
|
+
subscriptionsRef.current.splice(index, 1);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}, [sdk, isInitialized]);
|
|
211
|
+
/**
|
|
212
|
+
* Subscribe to a single event (auto-unsubscribes after first match)
|
|
213
|
+
*
|
|
214
|
+
* Useful for one-time event handling, like waiting for a specific action to complete.
|
|
215
|
+
*
|
|
216
|
+
* @param handler - Callback function invoked for the first matching event
|
|
217
|
+
* @param filter - Optional filter to limit events (by domain, level, or both)
|
|
218
|
+
* @returns Unsubscribe function to manually cancel before event fires
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* once((event) => {
|
|
223
|
+
* console.log('First event:', event.type);
|
|
224
|
+
* }, { domain: 'transaction', level: 'success' });
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
const once = useCallback((handler, filter) => {
|
|
228
|
+
if (!isInitialized || !sdk) {
|
|
229
|
+
console.warn('[useEvents] SDK not initialized. Cannot subscribe to events.');
|
|
230
|
+
return () => { };
|
|
231
|
+
}
|
|
232
|
+
const unsubscribe = sdk.events.once(handler, filter);
|
|
233
|
+
// Track for cleanup
|
|
234
|
+
subscriptionsRef.current.push(unsubscribe);
|
|
235
|
+
return () => {
|
|
236
|
+
unsubscribe();
|
|
237
|
+
const index = subscriptionsRef.current.indexOf(unsubscribe);
|
|
238
|
+
if (index > -1) {
|
|
239
|
+
subscriptionsRef.current.splice(index, 1);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}, [sdk, isInitialized]);
|
|
243
|
+
/**
|
|
244
|
+
* Clear all event subscriptions from this hook instance
|
|
245
|
+
*
|
|
246
|
+
* Useful when you want to reset all event listeners without unmounting the component.
|
|
247
|
+
* Note: This only clears subscriptions created through this hook instance.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const { clear, subscribe } = useEvents();
|
|
252
|
+
*
|
|
253
|
+
* // Create some subscriptions
|
|
254
|
+
* subscribe((event) => console.log(event));
|
|
255
|
+
* subscribe((event) => logToServer(event));
|
|
256
|
+
*
|
|
257
|
+
* // Later: clear all subscriptions from this hook
|
|
258
|
+
* clear();
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
const clear = useCallback(() => {
|
|
262
|
+
subscriptionsRef.current.forEach(unsubscribe => {
|
|
263
|
+
try {
|
|
264
|
+
unsubscribe();
|
|
265
|
+
}
|
|
266
|
+
catch (e) {
|
|
267
|
+
// Ignore cleanup errors
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
subscriptionsRef.current = [];
|
|
271
|
+
}, []);
|
|
272
|
+
/**
|
|
273
|
+
* Get current subscriber count from the event emitter
|
|
274
|
+
*
|
|
275
|
+
* Useful for debugging or showing active listener count in dev tools.
|
|
276
|
+
*/
|
|
277
|
+
const subscriberCount = sdk?.events?.subscriberCount ?? 0;
|
|
278
|
+
return {
|
|
279
|
+
/**
|
|
280
|
+
* Subscribe to SDK events with optional filtering
|
|
281
|
+
*
|
|
282
|
+
* @param handler - Callback function for each matching event
|
|
283
|
+
* @param filter - Optional filter by domain and/or level
|
|
284
|
+
* @returns Unsubscribe function
|
|
285
|
+
*/
|
|
286
|
+
subscribe,
|
|
287
|
+
/**
|
|
288
|
+
* Subscribe to a single event (auto-unsubscribes after first match)
|
|
289
|
+
*
|
|
290
|
+
* @param handler - Callback function for the first matching event
|
|
291
|
+
* @param filter - Optional filter by domain and/or level
|
|
292
|
+
* @returns Unsubscribe function
|
|
293
|
+
*/
|
|
294
|
+
once,
|
|
295
|
+
/**
|
|
296
|
+
* Clear all subscriptions created through this hook instance
|
|
297
|
+
*/
|
|
298
|
+
clear,
|
|
299
|
+
/**
|
|
300
|
+
* Whether the event system is available
|
|
301
|
+
*
|
|
302
|
+
* Returns `true` when SDK is initialized and events can be subscribed to.
|
|
303
|
+
*/
|
|
304
|
+
isAvailable: isInitialized && !!sdk?.events,
|
|
305
|
+
/**
|
|
306
|
+
* Current number of active subscribers across all components
|
|
307
|
+
*
|
|
308
|
+
* Useful for debugging event system usage.
|
|
309
|
+
*/
|
|
310
|
+
subscriberCount,
|
|
311
|
+
};
|
|
312
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PurchaseTokenDTO, PurchaseDTO } from '@explorins/pers-shared';
|
|
1
|
+
import type { PurchaseTokenDTO, PurchaseDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
2
2
|
export declare const usePurchases: () => {
|
|
3
3
|
createPaymentIntent: (amount: number, currency: string, receiptEmail: string, description: string) => Promise<import("@explorins/pers-shared").PaymentIntentDTO>;
|
|
4
|
-
getActivePurchaseTokens: () => Promise<PurchaseTokenDTO
|
|
5
|
-
getAllUserPurchases: () => Promise<PurchaseDTO
|
|
4
|
+
getActivePurchaseTokens: () => Promise<PaginatedResponseDTO<PurchaseTokenDTO>>;
|
|
5
|
+
getAllUserPurchases: () => Promise<PaginatedResponseDTO<PurchaseDTO>>;
|
|
6
6
|
isAvailable: boolean;
|
|
7
7
|
};
|
|
8
8
|
export type PurchaseHook = ReturnType<typeof usePurchases>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePurchases.d.ts","sourceRoot":"","sources":["../../src/hooks/usePurchases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"usePurchases.d.ts","sourceRoot":"","sources":["../../src/hooks/usePurchases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAElG,eAAO,MAAM,YAAY;kCAIb,MAAM,YACJ,MAAM,gBACF,MAAM,eACP,MAAM;mCAeiC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;+BAcnD,QAAQ,qBAAqB,WAAW,CAAC,CAAC;;CAuB7F,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { OnStatusUpdateFn } from './useTransactionSigner';
|
|
2
|
-
import type { RedemptionCreateRequestDTO, RedemptionDTO, RedemptionRedeemDTO, RedemptionRedeemRequestResponseDTO, RedemptionTypeDTO } from '@explorins/pers-shared';
|
|
2
|
+
import type { RedemptionCreateRequestDTO, RedemptionDTO, RedemptionRedeemDTO, RedemptionRedeemRequestResponseDTO, RedemptionTypeDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
3
3
|
export declare const useRedemptions: () => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
getRedemptions: (options?: {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
}) => Promise<PaginatedResponseDTO<RedemptionDTO>>;
|
|
7
|
+
getUserRedemptions: () => Promise<PaginatedResponseDTO<RedemptionRedeemDTO>>;
|
|
6
8
|
redeem: (redemptionId: string, onStatusUpdate?: OnStatusUpdateFn) => Promise<RedemptionRedeemRequestResponseDTO>;
|
|
7
|
-
getRedemptionTypes: () => Promise<RedemptionTypeDTO
|
|
9
|
+
getRedemptionTypes: () => Promise<PaginatedResponseDTO<RedemptionTypeDTO>>;
|
|
8
10
|
createRedemption: (redemptionData: RedemptionCreateRequestDTO) => Promise<RedemptionDTO>;
|
|
9
|
-
getAllRedemptions: (active?: boolean) => Promise<RedemptionDTO[]>;
|
|
10
11
|
updateRedemption: (redemptionId: string, redemptionData: RedemptionCreateRequestDTO) => Promise<RedemptionDTO>;
|
|
11
12
|
toggleRedemptionStatus: (redemptionId: string) => Promise<RedemptionDTO>;
|
|
12
13
|
isAvailable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedemptions.d.ts","sourceRoot":"","sources":["../../src/hooks/useRedemptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,kCAAkC,EAClC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useRedemptions.d.ts","sourceRoot":"","sources":["../../src/hooks/useRedemptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,kCAAkC,EAClC,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,cAAc;+BAY2B;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAG,QAAQ,qBAAqB,aAAa,CAAC,CAAC;8BActE,QAAQ,qBAAqB,mBAAmB,CAAC,CAAC;2BAkBnD,MAAM,mBAAmB,gBAAgB,KAAG,QAAQ,kCAAkC,CAAC;8BA4DtF,QAAQ,qBAAqB,iBAAiB,CAAC,CAAC;uCAdrC,0BAA0B,KAAG,QAAQ,aAAa,CAAC;qCA4BrD,MAAM,kBAAkB,0BAA0B,KAAG,QAAQ,aAAa,CAAC;2CAcrE,MAAM,KAAG,QAAQ,aAAa,CAAC;;;;CA2BhG,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -4,16 +4,24 @@ import { useTransactionSigner } from './useTransactionSigner';
|
|
|
4
4
|
export const useRedemptions = () => {
|
|
5
5
|
const { sdk, isInitialized, isAuthenticated } = usePersSDK();
|
|
6
6
|
const { signAndSubmitTransactionWithJWT, isSignerAvailable, currentStatus, statusMessage } = useTransactionSigner();
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Get redemption offers based on user permissions
|
|
9
|
+
*
|
|
10
|
+
* **Regular Users:** Automatically see only active redemptions available for purchase
|
|
11
|
+
* **Administrators:** Can see all redemptions and filter by active/inactive status
|
|
12
|
+
*
|
|
13
|
+
* The backend enforces permission-based filtering automatically.
|
|
14
|
+
*/
|
|
15
|
+
const getRedemptions = useCallback(async (options) => {
|
|
8
16
|
if (!isInitialized || !sdk) {
|
|
9
17
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
10
18
|
}
|
|
11
19
|
try {
|
|
12
|
-
const result = await sdk.redemptions.
|
|
20
|
+
const result = await sdk.redemptions.getRedemptions(options);
|
|
13
21
|
return result;
|
|
14
22
|
}
|
|
15
23
|
catch (error) {
|
|
16
|
-
console.error('Failed to fetch
|
|
24
|
+
console.error('Failed to fetch redemptions:', error);
|
|
17
25
|
throw error;
|
|
18
26
|
}
|
|
19
27
|
}, [sdk, isInitialized]);
|
|
@@ -23,7 +31,7 @@ export const useRedemptions = () => {
|
|
|
23
31
|
}
|
|
24
32
|
if (!isAuthenticated) {
|
|
25
33
|
console.warn('SDK not authenticated. getUserRedemptions requires authentication.');
|
|
26
|
-
return [];
|
|
34
|
+
return { data: [], pagination: { page: 1, limit: 0, total: 0, pages: 0, hasNext: false, hasPrev: false } };
|
|
27
35
|
}
|
|
28
36
|
try {
|
|
29
37
|
const result = await sdk.redemptions.getUserRedemptions();
|
|
@@ -93,19 +101,6 @@ export const useRedemptions = () => {
|
|
|
93
101
|
throw error;
|
|
94
102
|
}
|
|
95
103
|
}, [sdk, isInitialized]);
|
|
96
|
-
const getAllRedemptions = useCallback(async (active) => {
|
|
97
|
-
if (!isInitialized || !sdk) {
|
|
98
|
-
throw new Error('SDK not initialized. Call initialize() first.');
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
const result = await sdk.redemptions.getAllRedemptions(active);
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
console.error('Failed to fetch all redemptions:', error);
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
108
|
-
}, [sdk, isInitialized]);
|
|
109
104
|
const getRedemptionTypes = useCallback(async () => {
|
|
110
105
|
if (!isInitialized || !sdk) {
|
|
111
106
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
@@ -146,12 +141,11 @@ export const useRedemptions = () => {
|
|
|
146
141
|
}
|
|
147
142
|
}, [sdk, isInitialized]);
|
|
148
143
|
return {
|
|
149
|
-
|
|
144
|
+
getRedemptions,
|
|
150
145
|
getUserRedemptions,
|
|
151
146
|
redeem,
|
|
152
147
|
getRedemptionTypes,
|
|
153
148
|
createRedemption,
|
|
154
|
-
getAllRedemptions,
|
|
155
149
|
updateRedemption,
|
|
156
150
|
toggleRedemptionStatus,
|
|
157
151
|
isAvailable: isInitialized && !!sdk?.redemptions,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { TenantPublicDTO, TenantClientConfigDTO, AdminDTO } from '@explorins/pers-shared';
|
|
1
|
+
import type { TenantPublicDTO, TenantClientConfigDTO, AdminDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
2
2
|
export declare const useTenants: () => {
|
|
3
3
|
getTenantInfo: () => Promise<TenantPublicDTO>;
|
|
4
4
|
getClientConfig: () => Promise<TenantClientConfigDTO>;
|
|
5
5
|
getLoginToken: () => Promise<string>;
|
|
6
|
-
getAdmins: () => Promise<AdminDTO
|
|
6
|
+
getAdmins: () => Promise<PaginatedResponseDTO<AdminDTO>>;
|
|
7
7
|
isAvailable: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type TenantHook = ReturnType<typeof useTenants>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTenants.d.ts","sourceRoot":"","sources":["../../src/hooks/useTenants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTenants.d.ts","sourceRoot":"","sources":["../../src/hooks/useTenants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAErH,eAAO,MAAM,UAAU;yBAGuB,QAAQ,eAAe,CAAC;2BActB,QAAQ,qBAAqB,CAAC;yBAchC,QAAQ,MAAM,CAAC;qBAcnB,QAAQ,qBAAqB,QAAQ,CAAC,CAAC;;CAqBhF,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TokenDTO } from '@explorins/pers-shared';
|
|
1
|
+
import type { TokenDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
2
2
|
/**
|
|
3
3
|
* React hook for token operations in the PERS SDK
|
|
4
4
|
*
|
|
@@ -28,11 +28,11 @@ import type { TokenDTO } from '@explorins/pers-shared';
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export declare const useTokens: () => {
|
|
31
|
-
getTokens: () => Promise<TokenDTO
|
|
31
|
+
getTokens: () => Promise<PaginatedResponseDTO<TokenDTO>>;
|
|
32
32
|
getActiveCreditToken: () => Promise<TokenDTO>;
|
|
33
|
-
getRewardTokens: () => Promise<TokenDTO
|
|
33
|
+
getRewardTokens: () => Promise<PaginatedResponseDTO<TokenDTO>>;
|
|
34
34
|
getTokenTypes: () => Promise<any>;
|
|
35
|
-
getStatusTokens: () => Promise<TokenDTO
|
|
35
|
+
getStatusTokens: () => Promise<PaginatedResponseDTO<TokenDTO>>;
|
|
36
36
|
getTokenByContract: (contractAddress: string, contractTokenId?: string | null) => Promise<TokenDTO>;
|
|
37
37
|
isAvailable: boolean;
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTokens.d.ts","sourceRoot":"","sources":["../../src/hooks/useTokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useTokens.d.ts","sourceRoot":"","sources":["../../src/hooks/useTokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,SAAS;qBAoBoB,QAAQ,qBAAqB,QAAQ,CAAC,CAAC;gCA2B5B,QAAQ,QAAQ,CAAC;2BA2BtB,QAAQ,qBAAqB,QAAQ,CAAC,CAAC;yBA2BzC,QAAQ,GAAG,CAAC;2BA2BV,QAAQ,qBAAqB,QAAQ,CAAC,CAAC;0CA6BtB,MAAM,oBAAoB,MAAM,GAAG,IAAI,KAAG,QAAQ,QAAQ,CAAC;;CAuB3H,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -17,6 +17,7 @@ export type OnStatusUpdateFn = (status: SigningStatus, message: string, data?: S
|
|
|
17
17
|
*
|
|
18
18
|
* @interface TransactionSignerHook
|
|
19
19
|
* @property {Function} signAndSubmitTransactionWithJWT - Main method to sign and submit transactions
|
|
20
|
+
* @property {Function} signPersTransaction - Sign transaction without submitting (for POS flows)
|
|
20
21
|
* @property {boolean} isSignerInitialized - Whether the signer SDK has been initialized
|
|
21
22
|
* @property {boolean} isSignerAvailable - Whether signing functionality is fully available
|
|
22
23
|
* @property {SigningStatus | null} currentStatus - Current signing status for UI feedback
|
|
@@ -24,6 +25,7 @@ export type OnStatusUpdateFn = (status: SigningStatus, message: string, data?: S
|
|
|
24
25
|
*/
|
|
25
26
|
export interface TransactionSignerHook {
|
|
26
27
|
signAndSubmitTransactionWithJWT: (jwt: string, onStatusUpdate?: OnStatusUpdateFn) => Promise<SubmissionResult>;
|
|
28
|
+
signPersTransaction: (jwt: string, onStatusUpdate?: OnStatusUpdateFn) => Promise<TransactionSigningResult>;
|
|
27
29
|
isSignerInitialized: boolean;
|
|
28
30
|
isSignerAvailable: boolean;
|
|
29
31
|
currentStatus: SigningStatus | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,aAAa,EAAkB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI3G,KAAK,gBAAgB,GAAG,OAAO,qCAAqC,EAAE,gBAAgB,CAAC;AACvF,KAAK,iBAAiB,GAAG,OAAO,qCAAqC,EAAE,iBAAiB,CAAC;AACzF,KAAK,wBAAwB,GAAG,OAAO,qCAAqC,EAAE,wBAAwB,CAAC;AAGvG,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAczG
|
|
1
|
+
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,aAAa,EAAkB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI3G,KAAK,gBAAgB,GAAG,OAAO,qCAAqC,EAAE,gBAAgB,CAAC;AACvF,KAAK,iBAAiB,GAAG,OAAO,qCAAqC,EAAE,iBAAiB,CAAC;AACzF,KAAK,wBAAwB,GAAG,OAAO,qCAAqC,EAAE,wBAAwB,CAAC;AAGvG,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAczG;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/G,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3G,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgLG;AACH,eAAO,MAAM,oBAAoB,QAAO,qBA2TvC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -338,6 +338,63 @@ export const useTransactionSigner = () => {
|
|
|
338
338
|
throw error; // Re-throw to maintain error handling upstream
|
|
339
339
|
}
|
|
340
340
|
}, [isSignerInitialized]);
|
|
341
|
+
/**
|
|
342
|
+
* Sign a PERS transaction without submitting (for POS flows with QR codes)
|
|
343
|
+
*
|
|
344
|
+
* This method signs the transaction but does NOT submit it to the blockchain.
|
|
345
|
+
* Instead, it returns the signature which can be displayed as a QR code for
|
|
346
|
+
* the business to scan and submit.
|
|
347
|
+
*
|
|
348
|
+
* **Use Case:** Point-of-Sale (POS) flows where:
|
|
349
|
+
* 1. User signs the transaction
|
|
350
|
+
* 2. App generates QR code with signature
|
|
351
|
+
* 3. Business scans QR code
|
|
352
|
+
* 4. Business submits transaction to blockchain
|
|
353
|
+
*
|
|
354
|
+
* @param {string} jwt - JWT token with transaction and user data
|
|
355
|
+
* @param {StatusCallback} [onStatusUpdate] - Optional callback for status updates
|
|
356
|
+
* @returns {Promise<TransactionSigningResult>} Signing result with signature for QR code
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* const { signPersTransaction } = useTransactionSigner();
|
|
361
|
+
*
|
|
362
|
+
* const result = await signPersTransaction(jwtToken);
|
|
363
|
+
* if (result.success) {
|
|
364
|
+
* const qrData = {
|
|
365
|
+
* transactionId: result.transactionId,
|
|
366
|
+
* signature: result.signature,
|
|
367
|
+
* transactionFormat: result.signingData.format,
|
|
368
|
+
* txType: 'PENDING_SUBMISSION'
|
|
369
|
+
* };
|
|
370
|
+
* // Display QR code with qrData
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
const signPersTransaction = useCallback(async (jwt, onStatusUpdate) => {
|
|
375
|
+
if (!isSignerInitialized || !signerSDKRef.current) {
|
|
376
|
+
throw new Error('Signer SDK not initialized');
|
|
377
|
+
}
|
|
378
|
+
// Create status callback wrapper
|
|
379
|
+
const statusCallback = {
|
|
380
|
+
onStatusUpdate: (status, message, data) => {
|
|
381
|
+
setCurrentStatus(status);
|
|
382
|
+
setStatusMessage(message);
|
|
383
|
+
onStatusUpdate?.(status, message, data);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
try {
|
|
387
|
+
// Use the SDK's sign-only method
|
|
388
|
+
const signingResult = await signerSDKRef.current.signPersTransaction(jwt, statusCallback);
|
|
389
|
+
return signingResult;
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
console.error('[useTransactionSigner] Sign-only transaction failed:', error);
|
|
393
|
+
setCurrentStatus(SigningStatus.ERROR);
|
|
394
|
+
setStatusMessage(error instanceof Error ? error.message : 'Signing failed');
|
|
395
|
+
throw error;
|
|
396
|
+
}
|
|
397
|
+
}, [isSignerInitialized]);
|
|
341
398
|
return {
|
|
342
399
|
/**
|
|
343
400
|
* Sign and submit a blockchain transaction using JWT token
|
|
@@ -350,6 +407,17 @@ export const useTransactionSigner = () => {
|
|
|
350
407
|
* @returns {Promise<SubmissionResult>} Transaction result with hash and status
|
|
351
408
|
*/
|
|
352
409
|
signAndSubmitTransactionWithJWT,
|
|
410
|
+
/**
|
|
411
|
+
* Sign a transaction without submitting (for POS flows)
|
|
412
|
+
*
|
|
413
|
+
* Signs the transaction and returns the signature without submitting to blockchain.
|
|
414
|
+
* Use this for Point-of-Sale flows where the business scans a QR code and submits.
|
|
415
|
+
*
|
|
416
|
+
* @param {string} jwt - JWT token with transaction and user data
|
|
417
|
+
* @param {StatusCallback} [onStatusUpdate] - Optional callback for status updates
|
|
418
|
+
* @returns {Promise<TransactionSigningResult>} Signing result with signature for QR code
|
|
419
|
+
*/
|
|
420
|
+
signPersTransaction,
|
|
353
421
|
/**
|
|
354
422
|
* Whether the transaction signer SDK has been successfully initialized
|
|
355
423
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnStatusUpdateFn } from './useTransactionSigner';
|
|
2
|
-
import type { TransactionRequestDTO, TransactionRequestResponseDTO, TransactionDTO, TransactionRole, TransactionPaginationRequestDTO } from '@explorins/pers-shared';
|
|
2
|
+
import type { TransactionRequestDTO, TransactionRequestResponseDTO, TransactionDTO, TransactionRole, TransactionPaginationRequestDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
3
3
|
/**
|
|
4
4
|
* React hook for transaction operations in the PERS SDK
|
|
5
5
|
*
|
|
@@ -39,8 +39,8 @@ import type { TransactionRequestDTO, TransactionRequestResponseDTO, TransactionD
|
|
|
39
39
|
export declare const useTransactions: () => {
|
|
40
40
|
createTransaction: (request: TransactionRequestDTO, onStatusUpdate?: OnStatusUpdateFn) => Promise<TransactionRequestResponseDTO>;
|
|
41
41
|
getTransactionById: (transactionId: string) => Promise<TransactionDTO | null>;
|
|
42
|
-
getUserTransactionHistory: (role?: TransactionRole) => Promise<TransactionDTO
|
|
43
|
-
getTenantTransactions: () => Promise<TransactionDTO
|
|
42
|
+
getUserTransactionHistory: (role?: TransactionRole) => Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
43
|
+
getTenantTransactions: () => Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
44
44
|
getPaginatedTransactions: (params: TransactionPaginationRequestDTO) => Promise<any>;
|
|
45
45
|
exportTransactionsCSV: () => Promise<Blob>;
|
|
46
46
|
isAvailable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactions.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,+BAA+B,
|
|
1
|
+
{"version":3,"file":"useTransactions.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,+BAA+B,EAC/B,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,eAAe;iCAgC4B,qBAAqB,mBAAmB,gBAAgB,KAAG,QAAQ,6BAA6B,CAAC;wCA2D1F,MAAM,KAAG,QAAQ,cAAc,GAAG,IAAI,CAAC;uCA4BxC,eAAe,KAAG,QAAQ,qBAAqB,cAAc,CAAC,CAAC;iCAevE,QAAQ,qBAAqB,cAAc,CAAC,CAAC;uCAcrC,+BAA+B,KAAG,QAAQ,GAAG,CAAC;iCActD,QAAQ,IAAI,CAAC;;;;CA0BlE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { UserStatusTypeDTO } from '@explorins/pers-shared';
|
|
1
|
+
import type { UserStatusTypeDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
2
2
|
export declare const useUserStatus: () => {
|
|
3
|
-
getUserStatusTypes: () => Promise<UserStatusTypeDTO
|
|
4
|
-
getEarnedUserStatus: () => Promise<UserStatusTypeDTO
|
|
3
|
+
getUserStatusTypes: () => Promise<PaginatedResponseDTO<UserStatusTypeDTO>>;
|
|
4
|
+
getEarnedUserStatus: () => Promise<PaginatedResponseDTO<UserStatusTypeDTO>>;
|
|
5
5
|
createUserStatusType: (userStatusType: UserStatusTypeDTO) => Promise<UserStatusTypeDTO>;
|
|
6
6
|
isAvailable: boolean;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useUserStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useUserStatus.d.ts","sourceRoot":"","sources":["../../src/hooks/useUserStatus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,eAAO,MAAM,aAAa;8BAGyB,QAAQ,qBAAqB,iBAAiB,CAAC,CAAC;+BAc/C,QAAQ,qBAAqB,iBAAiB,CAAC,CAAC;2CAkBlC,iBAAiB,KAAG,QAAQ,iBAAiB,CAAC;;CAoB/G,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/hooks/useUsers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserDTO, UserCreateRequestDTO } from '@explorins/pers-shared';
|
|
1
|
+
import type { UserDTO, UserCreateRequestDTO, PaginatedResponseDTO } from '@explorins/pers-shared';
|
|
2
2
|
import type { UserPublicProfileDTO } from '@explorins/pers-sdk/user';
|
|
3
3
|
export declare const useUsers: () => {
|
|
4
4
|
getCurrentUser: () => Promise<UserDTO>;
|
|
@@ -7,8 +7,8 @@ export declare const useUsers: () => {
|
|
|
7
7
|
getAllUsersPublic: (filter?: {
|
|
8
8
|
key: string;
|
|
9
9
|
value: string;
|
|
10
|
-
}) => Promise<UserPublicProfileDTO
|
|
11
|
-
getAllUsers: () => Promise<UserDTO
|
|
10
|
+
}) => Promise<PaginatedResponseDTO<UserPublicProfileDTO>>;
|
|
11
|
+
getAllUsers: () => Promise<PaginatedResponseDTO<UserDTO>>;
|
|
12
12
|
updateUser: (userId: string, userData: UserCreateRequestDTO) => Promise<UserDTO>;
|
|
13
13
|
toggleUserStatus: (user: UserDTO) => Promise<UserDTO>;
|
|
14
14
|
isAvailable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUsers.d.ts","sourceRoot":"","sources":["../../src/hooks/useUsers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useUsers.d.ts","sourceRoot":"","sources":["../../src/hooks/useUsers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,eAAO,MAAM,QAAQ;0BAG0B,QAAQ,OAAO,CAAC;kCAiBN,oBAAoB,KAAG,QAAQ,OAAO,CAAC;0BAiB/C,MAAM,KAAG,QAAQ,OAAO,CAAC;iCAclB;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAG,QAAQ,qBAAqB,oBAAoB,CAAC,CAAC;uBAehG,QAAQ,qBAAqB,OAAO,CAAC,CAAC;yBAclC,MAAM,YAAY,oBAAoB,KAAG,QAAQ,OAAO,CAAC;6BAcrD,OAAO,KAAG,QAAQ,OAAO,CAAC;;CAwB7E,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|