@explorins/pers-sdk-react-native 1.5.22 → 1.5.25
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.
|
@@ -2,7 +2,7 @@ import type { RedemptionCreateRequestDTO, RedemptionDTO, RedemptionRedeemDTO, Re
|
|
|
2
2
|
export declare const useRedemptions: () => {
|
|
3
3
|
getActiveRedemptions: () => Promise<RedemptionDTO[]>;
|
|
4
4
|
getUserRedemptions: () => Promise<RedemptionRedeemDTO[]>;
|
|
5
|
-
|
|
5
|
+
redeem: (redemptionId: string) => Promise<RedemptionRedeemRequestResponseDTO>;
|
|
6
6
|
getRedemptionTypes: () => Promise<RedemptionTypeDTO[]>;
|
|
7
7
|
createRedemption: (redemptionData: RedemptionCreateRequestDTO) => Promise<RedemptionDTO>;
|
|
8
8
|
getAllRedemptions: (active?: boolean) => Promise<RedemptionDTO[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRedemptions.d.ts","sourceRoot":"","sources":["../../src/hooks/useRedemptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,kCAAkC,EAClC,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,cAAc;gCAI0B,QAAQ,aAAa,EAAE,CAAC;8BAe1B,QAAQ,mBAAmB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"useRedemptions.d.ts","sourceRoot":"","sources":["../../src/hooks/useRedemptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,kCAAkC,EAClC,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,cAAc;gCAI0B,QAAQ,aAAa,EAAE,CAAC;8BAe1B,QAAQ,mBAAmB,EAAE,CAAC;2BAmB/B,MAAM,KAAG,QAAQ,kCAAkC,CAAC;8BAsFnD,QAAQ,iBAAiB,EAAE,CAAC;uCA/BjB,0BAA0B,KAAG,QAAQ,aAAa,CAAC;iCAgBzD,OAAO,KAAG,QAAQ,aAAa,EAAE,CAAC;qCA8B9B,MAAM,kBAAkB,0BAA0B,KAAG,QAAQ,aAAa,CAAC;2CAerE,MAAM,KAAG,QAAQ,aAAa,CAAC;;CA0BhG,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -36,16 +36,16 @@ export const useRedemptions = () => {
|
|
|
36
36
|
throw error;
|
|
37
37
|
}
|
|
38
38
|
}, [sdk, isInitialized, isAuthenticated]);
|
|
39
|
-
const
|
|
39
|
+
const redeem = useCallback(async (redemptionId) => {
|
|
40
40
|
if (!isInitialized || !sdk) {
|
|
41
41
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
42
42
|
}
|
|
43
43
|
if (!isAuthenticated) {
|
|
44
|
-
throw new Error('SDK not authenticated.
|
|
44
|
+
throw new Error('SDK not authenticated. redeem requires authentication.');
|
|
45
45
|
}
|
|
46
46
|
try {
|
|
47
47
|
console.log('Redeeming redemption:', redemptionId);
|
|
48
|
-
const result = await sdk.redemptions.
|
|
48
|
+
const result = await sdk.redemptions.redeem(redemptionId);
|
|
49
49
|
// Check if result has signing fields and sign transaction if required and signer is available
|
|
50
50
|
console.log('Redemption processed successfully:', result);
|
|
51
51
|
const txToken = result.senderTransaction?.actionable?.authToken;
|
|
@@ -162,7 +162,7 @@ export const useRedemptions = () => {
|
|
|
162
162
|
return {
|
|
163
163
|
getActiveRedemptions,
|
|
164
164
|
getUserRedemptions,
|
|
165
|
-
|
|
165
|
+
redeem,
|
|
166
166
|
getRedemptionTypes,
|
|
167
167
|
createRedemption,
|
|
168
168
|
getAllRedemptions,
|
package/dist/index.js
CHANGED
|
@@ -28585,7 +28585,7 @@ class CampaignManager {
|
|
|
28585
28585
|
* console.log(`${offers.length} redemption offers available`);
|
|
28586
28586
|
*
|
|
28587
28587
|
* // Redeem a specific offer
|
|
28588
|
-
* const redemptionResult = await sdk.redemptions.
|
|
28588
|
+
* const redemptionResult = await sdk.redemptions.redeem('discount-10-percent');
|
|
28589
28589
|
* console.log('Redemption successful:', redemptionResult.success);
|
|
28590
28590
|
*
|
|
28591
28591
|
* // Check redemption history
|
|
@@ -28729,7 +28729,7 @@ class RedemptionManager {
|
|
|
28729
28729
|
* @example Basic Redemption
|
|
28730
28730
|
* ```typescript
|
|
28731
28731
|
* try {
|
|
28732
|
-
* const result = await sdk.redemptions.
|
|
28732
|
+
* const result = await sdk.redemptions.redeem('coffee-voucher-123');
|
|
28733
28733
|
*
|
|
28734
28734
|
* if (result.success) {
|
|
28735
28735
|
* console.log('✅ Redemption Successful!');
|
|
@@ -28785,7 +28785,7 @@ class RedemptionManager {
|
|
|
28785
28785
|
* });
|
|
28786
28786
|
*
|
|
28787
28787
|
* if (canAfford) {
|
|
28788
|
-
* const result = await sdk.redemptions.
|
|
28788
|
+
* const result = await sdk.redemptions.redeem(targetOffer.id);
|
|
28789
28789
|
* console.log('Redemption processed:', result.success);
|
|
28790
28790
|
* } else {
|
|
28791
28791
|
* console.log('Insufficient tokens for this redemption');
|
|
@@ -28793,7 +28793,7 @@ class RedemptionManager {
|
|
|
28793
28793
|
* }
|
|
28794
28794
|
* ```
|
|
28795
28795
|
*/
|
|
28796
|
-
async
|
|
28796
|
+
async redeem(redemptionId) {
|
|
28797
28797
|
return this.redemptionService.redeemRedemption(redemptionId);
|
|
28798
28798
|
}
|
|
28799
28799
|
/**
|
|
@@ -31520,7 +31520,7 @@ class PersSDK {
|
|
|
31520
31520
|
* @example
|
|
31521
31521
|
* ```typescript
|
|
31522
31522
|
* const redemptions = await sdk.redemptions.getActiveRedemptions();
|
|
31523
|
-
* await sdk.redemptions.
|
|
31523
|
+
* await sdk.redemptions.redeem(redemptionId);
|
|
31524
31524
|
* const history = await sdk.redemptions.getUserRedemptions();
|
|
31525
31525
|
* ```
|
|
31526
31526
|
*/
|
|
@@ -33488,16 +33488,16 @@ const useRedemptions = () => {
|
|
|
33488
33488
|
throw error;
|
|
33489
33489
|
}
|
|
33490
33490
|
}, [sdk, isInitialized, isAuthenticated]);
|
|
33491
|
-
const
|
|
33491
|
+
const redeem = react.useCallback(async (redemptionId) => {
|
|
33492
33492
|
if (!isInitialized || !sdk) {
|
|
33493
33493
|
throw new Error('SDK not initialized. Call initialize() first.');
|
|
33494
33494
|
}
|
|
33495
33495
|
if (!isAuthenticated) {
|
|
33496
|
-
throw new Error('SDK not authenticated.
|
|
33496
|
+
throw new Error('SDK not authenticated. redeem requires authentication.');
|
|
33497
33497
|
}
|
|
33498
33498
|
try {
|
|
33499
33499
|
console.log('Redeeming redemption:', redemptionId);
|
|
33500
|
-
const result = await sdk.redemptions.
|
|
33500
|
+
const result = await sdk.redemptions.redeem(redemptionId);
|
|
33501
33501
|
// Check if result has signing fields and sign transaction if required and signer is available
|
|
33502
33502
|
console.log('Redemption processed successfully:', result);
|
|
33503
33503
|
const txToken = result.senderTransaction?.actionable?.authToken;
|
|
@@ -33614,7 +33614,7 @@ const useRedemptions = () => {
|
|
|
33614
33614
|
return {
|
|
33615
33615
|
getActiveRedemptions,
|
|
33616
33616
|
getUserRedemptions,
|
|
33617
|
-
|
|
33617
|
+
redeem,
|
|
33618
33618
|
getRedemptionTypes,
|
|
33619
33619
|
createRedemption,
|
|
33620
33620
|
getAllRedemptions,
|