@explorins/pers-sdk-react-native 2.2.0-alpha.4 → 2.2.0-alpha.5
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/dist/hooks/index.js +1 -1
- package/dist/hooks/useRedemptions.d.ts +1 -1
- package/dist/hooks/useTransactionSigner.d.ts +5 -4
- package/dist/hooks/useTransactionSigner.d.ts.map +1 -1
- package/dist/hooks/useTransactionSigner.js +18 -8
- package/dist/hooks/useTransactions.d.ts +1 -1
- package/dist/index.js +28 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useTransactionSigner.ts +28 -12
package/dist/hooks/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { useAuth } from './useAuth';
|
|
|
3
3
|
export { useTokens } from './useTokens';
|
|
4
4
|
export { useTokenBalances } from './useTokenBalances';
|
|
5
5
|
export { useTransactions } from './useTransactions';
|
|
6
|
-
export { useTransactionSigner
|
|
6
|
+
export { useTransactionSigner } from './useTransactionSigner';
|
|
7
7
|
export { useBusiness } from './useBusiness';
|
|
8
8
|
export { useCampaigns } from './useCampaigns';
|
|
9
9
|
export { useRedemptions } from './useRedemptions';
|
|
@@ -44,7 +44,7 @@ export declare const useRedemptions: () => {
|
|
|
44
44
|
updateRedemption: (redemptionId: string, redemptionData: RedemptionCreateRequestDTO) => Promise<RedemptionDTO>;
|
|
45
45
|
toggleRedemptionStatus: (redemptionId: string) => Promise<RedemptionDTO>;
|
|
46
46
|
isAvailable: boolean;
|
|
47
|
-
signingStatus: import("@explorins/pers-signer").SigningStatus | null;
|
|
47
|
+
signingStatus: import("@explorins/pers-signer/types").SigningStatus | null;
|
|
48
48
|
signingStatusMessage: string | null;
|
|
49
49
|
};
|
|
50
50
|
export type RedemptionHook = ReturnType<typeof useRedemptions>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { StatusUpdateData } from '@explorins/pers-signer/types';
|
|
2
|
+
import type { SigningStatus as SigningStatusType } from '@explorins/pers-signer/types';
|
|
2
3
|
type SubmissionResult = import('@explorins/pers-signer/react-native').SubmissionResult;
|
|
3
4
|
type AuthenticatedUser = import('@explorins/pers-signer/react-native').AuthenticatedUser;
|
|
4
5
|
type TransactionSigningResult = import('@explorins/pers-signer/react-native').TransactionSigningResult;
|
|
5
|
-
export { SigningStatus };
|
|
6
|
+
export type { SigningStatusType as SigningStatus };
|
|
6
7
|
export type { StatusUpdateData };
|
|
7
8
|
/**
|
|
8
9
|
* Simple status callback function type for React Native consumers
|
|
9
10
|
* (Simplified from the signer SDK's object-based StatusCallback interface)
|
|
10
11
|
*/
|
|
11
|
-
export type OnStatusUpdateFn = (status:
|
|
12
|
+
export type OnStatusUpdateFn = (status: SigningStatusType, message: string, data?: StatusUpdateData) => void;
|
|
12
13
|
/**
|
|
13
14
|
* Return interface for the useTransactionSigner hook
|
|
14
15
|
*
|
|
@@ -28,7 +29,7 @@ export interface TransactionSignerHook {
|
|
|
28
29
|
signPersTransaction: (jwt: string, onStatusUpdate?: OnStatusUpdateFn) => Promise<TransactionSigningResult>;
|
|
29
30
|
isSignerInitialized: boolean;
|
|
30
31
|
isSignerAvailable: boolean;
|
|
31
|
-
currentStatus:
|
|
32
|
+
currentStatus: SigningStatusType | null;
|
|
32
33
|
statusMessage: string | null;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTransactionSigner.d.ts","sourceRoot":"","sources":["../../src/hooks/useTransactionSigner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoC,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACvG,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMvF,KAAK,gBAAgB,GAAG,OAAO,q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
1
|
import { useCallback, useState, useRef, useEffect } from 'react';
|
|
2
|
-
// import
|
|
3
|
-
import { SigningStatus } from '@explorins/pers-signer';
|
|
4
|
-
//
|
|
5
|
-
export { SigningStatus };
|
|
6
|
-
// Lazy-loaded signer SDK factory - initialized on first use to avoid native module timing issues
|
|
2
|
+
// Runtime const import - also from /types (no native deps)
|
|
3
|
+
import { SigningStatus as SigningStatusConst } from '@explorins/pers-signer/types';
|
|
4
|
+
// Lazy-loaded signer SDK - initialized on first use to avoid native module timing issues
|
|
7
5
|
let _createPersSignerSDK = null;
|
|
8
6
|
let _signerInitAttempted = false;
|
|
7
|
+
/**
|
|
8
|
+
* Get the SigningStatus const object
|
|
9
|
+
* Now directly imported from /types (no native deps, always available)
|
|
10
|
+
*/
|
|
11
|
+
function getSigningStatus() {
|
|
12
|
+
return SigningStatusConst;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* Lazily load the PERS Signer SDK.
|
|
11
16
|
*
|
|
@@ -22,7 +27,8 @@ function getSignerSDKFactory() {
|
|
|
22
27
|
_signerInitAttempted = true;
|
|
23
28
|
// Check for customer pre-initialized global (for native module timing issues)
|
|
24
29
|
if (typeof global !== 'undefined' && global.__PersSigner?.createPersSignerSDK) {
|
|
25
|
-
|
|
30
|
+
const globalModule = global.__PersSigner;
|
|
31
|
+
_createPersSignerSDK = globalModule.createPersSignerSDK;
|
|
26
32
|
return _createPersSignerSDK;
|
|
27
33
|
}
|
|
28
34
|
// Standard lazy load
|
|
@@ -360,7 +366,9 @@ export const useTransactionSigner = () => {
|
|
|
360
366
|
}
|
|
361
367
|
catch (error) {
|
|
362
368
|
console.error('[useTransactionSigner] JWT transaction signing failed:', error);
|
|
363
|
-
|
|
369
|
+
const SigningStatusEnum = getSigningStatus();
|
|
370
|
+
if (SigningStatusEnum)
|
|
371
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
364
372
|
setStatusMessage(error instanceof Error ? error.message : 'Transaction failed');
|
|
365
373
|
throw error; // Re-throw to maintain error handling upstream
|
|
366
374
|
}
|
|
@@ -417,7 +425,9 @@ export const useTransactionSigner = () => {
|
|
|
417
425
|
}
|
|
418
426
|
catch (error) {
|
|
419
427
|
console.error('[useTransactionSigner] Sign-only transaction failed:', error);
|
|
420
|
-
|
|
428
|
+
const SigningStatusEnum = getSigningStatus();
|
|
429
|
+
if (SigningStatusEnum)
|
|
430
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
421
431
|
setStatusMessage(error instanceof Error ? error.message : 'Signing failed');
|
|
422
432
|
throw error;
|
|
423
433
|
}
|
|
@@ -47,7 +47,7 @@ export declare const useTransactions: () => {
|
|
|
47
47
|
}) => Promise<PaginatedResponseDTO<TransactionDTO>>;
|
|
48
48
|
exportTransactionsCSV: () => Promise<Blob>;
|
|
49
49
|
isAvailable: boolean;
|
|
50
|
-
signingStatus: import("@explorins/pers-signer").SigningStatus | null;
|
|
50
|
+
signingStatus: import("@explorins/pers-signer/types").SigningStatus | null;
|
|
51
51
|
signingStatusMessage: string | null;
|
|
52
52
|
};
|
|
53
53
|
export type TransactionHook = ReturnType<typeof useTransactions>;
|
package/dist/index.js
CHANGED
|
@@ -42408,9 +42408,19 @@ function useTokenBalances(options) {
|
|
|
42408
42408
|
}
|
|
42409
42409
|
|
|
42410
42410
|
/**
|
|
42411
|
-
*
|
|
42411
|
+
* Signing status types for type-safe status updates
|
|
42412
|
+
* Using const pattern instead of enum for better bundling compatibility
|
|
42412
42413
|
*/
|
|
42413
|
-
|
|
42414
|
+
const SigningStatus = {
|
|
42415
|
+
INITIALIZING: 'initializing',
|
|
42416
|
+
AUTHENTICATING: 'authenticating',
|
|
42417
|
+
PREPARING: 'preparing',
|
|
42418
|
+
SIGNING: 'signing',
|
|
42419
|
+
SUBMITTING: 'submitting',
|
|
42420
|
+
COMPLETED: 'completed',
|
|
42421
|
+
ERROR: 'error',
|
|
42422
|
+
EXPIRED: 'expired'
|
|
42423
|
+
};
|
|
42414
42424
|
|
|
42415
42425
|
/**
|
|
42416
42426
|
* Error codes for transaction signing operations
|
|
@@ -42431,24 +42441,16 @@ var TransactionSigningErrorCode;
|
|
|
42431
42441
|
TransactionSigningErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
42432
42442
|
})(TransactionSigningErrorCode || (TransactionSigningErrorCode = {}));
|
|
42433
42443
|
|
|
42434
|
-
|
|
42435
|
-
* Signing status types for type-safe status updates
|
|
42436
|
-
* Using const pattern instead of enum for better bundling compatibility
|
|
42437
|
-
*/
|
|
42438
|
-
const SigningStatus = {
|
|
42439
|
-
INITIALIZING: 'initializing',
|
|
42440
|
-
AUTHENTICATING: 'authenticating',
|
|
42441
|
-
PREPARING: 'preparing',
|
|
42442
|
-
SIGNING: 'signing',
|
|
42443
|
-
SUBMITTING: 'submitting',
|
|
42444
|
-
COMPLETED: 'completed',
|
|
42445
|
-
ERROR: 'error',
|
|
42446
|
-
EXPIRED: 'expired'
|
|
42447
|
-
};
|
|
42448
|
-
|
|
42449
|
-
// Lazy-loaded signer SDK factory - initialized on first use to avoid native module timing issues
|
|
42444
|
+
// Lazy-loaded signer SDK - initialized on first use to avoid native module timing issues
|
|
42450
42445
|
let _createPersSignerSDK = null;
|
|
42451
42446
|
let _signerInitAttempted = false;
|
|
42447
|
+
/**
|
|
42448
|
+
* Get the SigningStatus const object
|
|
42449
|
+
* Now directly imported from /types (no native deps, always available)
|
|
42450
|
+
*/
|
|
42451
|
+
function getSigningStatus() {
|
|
42452
|
+
return SigningStatus;
|
|
42453
|
+
}
|
|
42452
42454
|
/**
|
|
42453
42455
|
* Lazily load the PERS Signer SDK.
|
|
42454
42456
|
*
|
|
@@ -42465,7 +42467,8 @@ function getSignerSDKFactory() {
|
|
|
42465
42467
|
_signerInitAttempted = true;
|
|
42466
42468
|
// Check for customer pre-initialized global (for native module timing issues)
|
|
42467
42469
|
if (typeof global !== 'undefined' && global.__PersSigner?.createPersSignerSDK) {
|
|
42468
|
-
|
|
42470
|
+
const globalModule = global.__PersSigner;
|
|
42471
|
+
_createPersSignerSDK = globalModule.createPersSignerSDK;
|
|
42469
42472
|
return _createPersSignerSDK;
|
|
42470
42473
|
}
|
|
42471
42474
|
// Standard lazy load
|
|
@@ -42803,7 +42806,9 @@ const useTransactionSigner = () => {
|
|
|
42803
42806
|
}
|
|
42804
42807
|
catch (error) {
|
|
42805
42808
|
console.error('[useTransactionSigner] JWT transaction signing failed:', error);
|
|
42806
|
-
|
|
42809
|
+
const SigningStatusEnum = getSigningStatus();
|
|
42810
|
+
if (SigningStatusEnum)
|
|
42811
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
42807
42812
|
setStatusMessage(error instanceof Error ? error.message : 'Transaction failed');
|
|
42808
42813
|
throw error; // Re-throw to maintain error handling upstream
|
|
42809
42814
|
}
|
|
@@ -42860,7 +42865,9 @@ const useTransactionSigner = () => {
|
|
|
42860
42865
|
}
|
|
42861
42866
|
catch (error) {
|
|
42862
42867
|
console.error('[useTransactionSigner] Sign-only transaction failed:', error);
|
|
42863
|
-
|
|
42868
|
+
const SigningStatusEnum = getSigningStatus();
|
|
42869
|
+
if (SigningStatusEnum)
|
|
42870
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
42864
42871
|
setStatusMessage(error instanceof Error ? error.message : 'Signing failed');
|
|
42865
42872
|
throw error;
|
|
42866
42873
|
}
|
|
@@ -45836,7 +45843,6 @@ exports.SDK_VERSION = SDK_VERSION;
|
|
|
45836
45843
|
exports.SOURCE_LOGIC_TYPES = SOURCE_LOGIC_TYPES;
|
|
45837
45844
|
exports.SOURCE_LOGIC_TYPE_VALUES = SOURCE_LOGIC_TYPE_VALUES;
|
|
45838
45845
|
exports.SdkErrorCodes = SdkErrorCodes;
|
|
45839
|
-
exports.SigningStatus = SigningStatus;
|
|
45840
45846
|
exports.StaticJwtAuthProvider = StaticJwtAuthProvider;
|
|
45841
45847
|
exports.TOKEN_VALIDITY_TYPE_VALUES = TOKEN_VALIDITY_TYPE_VALUES;
|
|
45842
45848
|
exports.TRANSACTION_FORMATS = TRANSACTION_FORMATS;
|