@explorins/pers-sdk-react-native 2.2.0-alpha.4 → 2.2.0-alpha.7
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 +40 -29
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- 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
|
@@ -4564,20 +4564,25 @@ class UserApi {
|
|
|
4564
4564
|
*/
|
|
4565
4565
|
async getAllUsersPublicProfiles(filter = null, options) {
|
|
4566
4566
|
let url = `${this.basePath}/public`;
|
|
4567
|
-
|
|
4567
|
+
// Use object-based params instead of URLSearchParams for React Native compatibility
|
|
4568
|
+
const params = {};
|
|
4568
4569
|
if (filter) {
|
|
4569
4570
|
// Same parameter pattern for compatibility
|
|
4570
|
-
params
|
|
4571
|
-
params
|
|
4571
|
+
params['filterKey'] = filter.key;
|
|
4572
|
+
params['filterValue'] = filter.value;
|
|
4572
4573
|
}
|
|
4573
4574
|
// Add pagination parameters
|
|
4574
4575
|
if (options) {
|
|
4575
4576
|
Object.entries(buildPaginationParams(options)).forEach(([key, value]) => {
|
|
4576
|
-
params
|
|
4577
|
+
params[key] = value;
|
|
4577
4578
|
});
|
|
4578
4579
|
}
|
|
4579
|
-
|
|
4580
|
-
|
|
4580
|
+
// Build query string manually for RN compatibility
|
|
4581
|
+
const queryString = Object.entries(params)
|
|
4582
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
4583
|
+
.join('&');
|
|
4584
|
+
if (queryString) {
|
|
4585
|
+
url += `?${queryString}`;
|
|
4581
4586
|
}
|
|
4582
4587
|
const response = await this.apiClient.get(url);
|
|
4583
4588
|
return normalizeToPaginated(response);
|
|
@@ -10351,7 +10356,7 @@ class DefaultAuthProvider {
|
|
|
10351
10356
|
/** SDK package name */
|
|
10352
10357
|
const SDK_NAME = "@explorins/pers-sdk";
|
|
10353
10358
|
/** SDK version - injected from package.json at build time */
|
|
10354
|
-
const SDK_VERSION = "2.1.
|
|
10359
|
+
const SDK_VERSION = "2.1.33-alpha.0";
|
|
10355
10360
|
/** Full SDK identifier for headers */
|
|
10356
10361
|
const SDK_USER_AGENT = `${SDK_NAME}/${SDK_VERSION}`;
|
|
10357
10362
|
|
|
@@ -42408,9 +42413,19 @@ function useTokenBalances(options) {
|
|
|
42408
42413
|
}
|
|
42409
42414
|
|
|
42410
42415
|
/**
|
|
42411
|
-
*
|
|
42416
|
+
* Signing status types for type-safe status updates
|
|
42417
|
+
* Using const pattern instead of enum for better bundling compatibility
|
|
42412
42418
|
*/
|
|
42413
|
-
|
|
42419
|
+
const SigningStatus = {
|
|
42420
|
+
INITIALIZING: 'initializing',
|
|
42421
|
+
AUTHENTICATING: 'authenticating',
|
|
42422
|
+
PREPARING: 'preparing',
|
|
42423
|
+
SIGNING: 'signing',
|
|
42424
|
+
SUBMITTING: 'submitting',
|
|
42425
|
+
COMPLETED: 'completed',
|
|
42426
|
+
ERROR: 'error',
|
|
42427
|
+
EXPIRED: 'expired'
|
|
42428
|
+
};
|
|
42414
42429
|
|
|
42415
42430
|
/**
|
|
42416
42431
|
* Error codes for transaction signing operations
|
|
@@ -42431,24 +42446,16 @@ var TransactionSigningErrorCode;
|
|
|
42431
42446
|
TransactionSigningErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
42432
42447
|
})(TransactionSigningErrorCode || (TransactionSigningErrorCode = {}));
|
|
42433
42448
|
|
|
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
|
|
42449
|
+
// Lazy-loaded signer SDK - initialized on first use to avoid native module timing issues
|
|
42450
42450
|
let _createPersSignerSDK = null;
|
|
42451
42451
|
let _signerInitAttempted = false;
|
|
42452
|
+
/**
|
|
42453
|
+
* Get the SigningStatus const object
|
|
42454
|
+
* Now directly imported from /types (no native deps, always available)
|
|
42455
|
+
*/
|
|
42456
|
+
function getSigningStatus() {
|
|
42457
|
+
return SigningStatus;
|
|
42458
|
+
}
|
|
42452
42459
|
/**
|
|
42453
42460
|
* Lazily load the PERS Signer SDK.
|
|
42454
42461
|
*
|
|
@@ -42465,7 +42472,8 @@ function getSignerSDKFactory() {
|
|
|
42465
42472
|
_signerInitAttempted = true;
|
|
42466
42473
|
// Check for customer pre-initialized global (for native module timing issues)
|
|
42467
42474
|
if (typeof global !== 'undefined' && global.__PersSigner?.createPersSignerSDK) {
|
|
42468
|
-
|
|
42475
|
+
const globalModule = global.__PersSigner;
|
|
42476
|
+
_createPersSignerSDK = globalModule.createPersSignerSDK;
|
|
42469
42477
|
return _createPersSignerSDK;
|
|
42470
42478
|
}
|
|
42471
42479
|
// Standard lazy load
|
|
@@ -42803,7 +42811,9 @@ const useTransactionSigner = () => {
|
|
|
42803
42811
|
}
|
|
42804
42812
|
catch (error) {
|
|
42805
42813
|
console.error('[useTransactionSigner] JWT transaction signing failed:', error);
|
|
42806
|
-
|
|
42814
|
+
const SigningStatusEnum = getSigningStatus();
|
|
42815
|
+
if (SigningStatusEnum)
|
|
42816
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
42807
42817
|
setStatusMessage(error instanceof Error ? error.message : 'Transaction failed');
|
|
42808
42818
|
throw error; // Re-throw to maintain error handling upstream
|
|
42809
42819
|
}
|
|
@@ -42860,7 +42870,9 @@ const useTransactionSigner = () => {
|
|
|
42860
42870
|
}
|
|
42861
42871
|
catch (error) {
|
|
42862
42872
|
console.error('[useTransactionSigner] Sign-only transaction failed:', error);
|
|
42863
|
-
|
|
42873
|
+
const SigningStatusEnum = getSigningStatus();
|
|
42874
|
+
if (SigningStatusEnum)
|
|
42875
|
+
setCurrentStatus(SigningStatusEnum.ERROR);
|
|
42864
42876
|
setStatusMessage(error instanceof Error ? error.message : 'Signing failed');
|
|
42865
42877
|
throw error;
|
|
42866
42878
|
}
|
|
@@ -45836,7 +45848,6 @@ exports.SDK_VERSION = SDK_VERSION;
|
|
|
45836
45848
|
exports.SOURCE_LOGIC_TYPES = SOURCE_LOGIC_TYPES;
|
|
45837
45849
|
exports.SOURCE_LOGIC_TYPE_VALUES = SOURCE_LOGIC_TYPE_VALUES;
|
|
45838
45850
|
exports.SdkErrorCodes = SdkErrorCodes;
|
|
45839
|
-
exports.SigningStatus = SigningStatus;
|
|
45840
45851
|
exports.StaticJwtAuthProvider = StaticJwtAuthProvider;
|
|
45841
45852
|
exports.TOKEN_VALIDITY_TYPE_VALUES = TOKEN_VALIDITY_TYPE_VALUES;
|
|
45842
45853
|
exports.TRANSACTION_FORMATS = TRANSACTION_FORMATS;
|