@explorins/pers-sdk-react-native 2.3.7 → 2.3.8
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/LICENSE +21 -0
- package/README.md +1266 -1244
- package/dist/__tests__/PersSDKProvider.test.js +33 -0
- package/dist/hooks/useBusiness.d.ts +2 -2
- package/dist/hooks/useBusiness.d.ts.map +1 -1
- package/dist/hooks/useBusiness.js +2 -2
- package/dist/hooks/useIPFSUrl.d.ts +3 -3
- package/dist/hooks/useIPFSUrl.d.ts.map +1 -1
- package/dist/hooks/useIPFSUrl.js +7 -7
- package/dist/hooks/useWeb3.js +4 -4
- package/dist/index.js +2400 -487
- package/dist/index.js.map +1 -1
- package/dist/providers/PersSDKProvider.d.ts +4 -0
- package/dist/providers/PersSDKProvider.d.ts.map +1 -1
- package/dist/providers/PersSDKProvider.js +14 -0
- package/dist/providers/react-native-http-client.d.ts +2 -0
- package/dist/providers/react-native-http-client.d.ts.map +1 -1
- package/dist/providers/react-native-http-client.js +5 -2
- package/dist/storage/rn-secure-storage.d.ts.map +1 -1
- package/dist/storage/rn-secure-storage.js +21 -8
- package/package.json +3 -3
- package/src/__tests__/PersSDKProvider.test.tsx +484 -420
- package/src/__tests__/setup.ts +40 -40
- package/src/hooks/index.ts +60 -60
- package/src/hooks/useAnalytics.ts +327 -327
- package/src/hooks/useAuth.ts +265 -265
- package/src/hooks/useBookings.ts +191 -191
- package/src/hooks/useBusiness.ts +251 -251
- package/src/hooks/useCampaigns.ts +500 -500
- package/src/hooks/useDonations.ts +66 -66
- package/src/hooks/useEvents.ts +372 -372
- package/src/hooks/useFiles.ts +155 -155
- package/src/hooks/useIPFSUrl.ts +192 -192
- package/src/hooks/usePurchases.ts +65 -65
- package/src/hooks/useRedemptions.ts +467 -467
- package/src/hooks/useTenants.ts +72 -72
- package/src/hooks/useTokenBalances.ts +385 -385
- package/src/hooks/useTokens.ts +313 -313
- package/src/hooks/useTransactionSigner.ts +611 -611
- package/src/hooks/useTransactions.ts +299 -299
- package/src/hooks/useTriggerSources.ts +301 -301
- package/src/hooks/useUserStatus.ts +61 -61
- package/src/hooks/useUsers.ts +167 -167
- package/src/hooks/useWeb3.ts +355 -355
- package/src/index.ts +777 -777
- package/src/polyfills/index.ts +160 -160
- package/src/polyfills/web3-polyfills.ts +97 -97
- package/src/providers/PersSDKProvider.tsx +393 -374
- package/src/providers/react-native-auth-provider.ts +110 -110
- package/src/providers/react-native-http-client.ts +150 -145
- package/src/providers/rn-dpop-provider.ts +190 -190
- package/src/storage/async-storage-token-storage.ts +185 -185
- package/src/storage/rn-secure-storage.ts +182 -170
- package/src/types/react-native-globals.d.ts +45 -45
- package/src/utils/index.ts +8 -8
- package/src/utils/platform-detection.ts +86 -86
- package/dist/index-CzLxqePZ.js +0 -7717
- package/dist/index-CzLxqePZ.js.map +0 -1
package/src/__tests__/setup.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
|
|
3
|
-
// Mock React Native modules
|
|
4
|
-
jest.mock('react-native', () => ({
|
|
5
|
-
Platform: {
|
|
6
|
-
OS: 'ios',
|
|
7
|
-
select: jest.fn((obj) => obj.ios || obj.default)
|
|
8
|
-
},
|
|
9
|
-
AppState: {
|
|
10
|
-
addEventListener: jest.fn(() => ({
|
|
11
|
-
remove: jest.fn()
|
|
12
|
-
})),
|
|
13
|
-
currentState: 'active'
|
|
14
|
-
}
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
// Mock AsyncStorage
|
|
18
|
-
jest.mock('@react-native-async-storage/async-storage', () => ({
|
|
19
|
-
default: {
|
|
20
|
-
getItem: jest.fn(),
|
|
21
|
-
setItem: jest.fn(),
|
|
22
|
-
removeItem: jest.fn(),
|
|
23
|
-
clear: jest.fn(),
|
|
24
|
-
getAllKeys: jest.fn(() => Promise.resolve([]))
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
// Silence console errors in tests unless explicitly needed
|
|
29
|
-
const originalConsoleError = console.error;
|
|
30
|
-
const originalConsoleWarn = console.warn;
|
|
31
|
-
|
|
32
|
-
beforeAll(() => {
|
|
33
|
-
console.error = jest.fn();
|
|
34
|
-
console.warn = jest.fn();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
afterAll(() => {
|
|
38
|
-
console.error = originalConsoleError;
|
|
39
|
-
console.warn = originalConsoleWarn;
|
|
40
|
-
});
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
|
|
3
|
+
// Mock React Native modules
|
|
4
|
+
jest.mock('react-native', () => ({
|
|
5
|
+
Platform: {
|
|
6
|
+
OS: 'ios',
|
|
7
|
+
select: jest.fn((obj) => obj.ios || obj.default)
|
|
8
|
+
},
|
|
9
|
+
AppState: {
|
|
10
|
+
addEventListener: jest.fn(() => ({
|
|
11
|
+
remove: jest.fn()
|
|
12
|
+
})),
|
|
13
|
+
currentState: 'active'
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
// Mock AsyncStorage
|
|
18
|
+
jest.mock('@react-native-async-storage/async-storage', () => ({
|
|
19
|
+
default: {
|
|
20
|
+
getItem: jest.fn(),
|
|
21
|
+
setItem: jest.fn(),
|
|
22
|
+
removeItem: jest.fn(),
|
|
23
|
+
clear: jest.fn(),
|
|
24
|
+
getAllKeys: jest.fn(() => Promise.resolve([]))
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
// Silence console errors in tests unless explicitly needed
|
|
29
|
+
const originalConsoleError = console.error;
|
|
30
|
+
const originalConsoleWarn = console.warn;
|
|
31
|
+
|
|
32
|
+
beforeAll(() => {
|
|
33
|
+
console.error = jest.fn();
|
|
34
|
+
console.warn = jest.fn();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterAll(() => {
|
|
38
|
+
console.error = originalConsoleError;
|
|
39
|
+
console.warn = originalConsoleWarn;
|
|
40
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
// Export all hooks (only hooks, no providers to avoid circular dependency)
|
|
2
|
-
export { useAuth } from './useAuth';
|
|
3
|
-
export { useTokens } from './useTokens';
|
|
4
|
-
export { useTokenBalances } from './useTokenBalances';
|
|
5
|
-
export { useTransactions } from './useTransactions';
|
|
6
|
-
export { useTransactionSigner, SigningStatus } from './useTransactionSigner';
|
|
7
|
-
export { useBusiness } from './useBusiness';
|
|
8
|
-
export { useCampaigns } from './useCampaigns';
|
|
9
|
-
export { useRedemptions } from './useRedemptions';
|
|
10
|
-
export { useWeb3 } from './useWeb3';
|
|
11
|
-
export { useResolvedUrl, useMetadata, useIPFSUrl, useTransactionMetadata } from './useIPFSUrl';
|
|
12
|
-
export { usePurchases } from './usePurchases';
|
|
13
|
-
export { useTenants } from './useTenants';
|
|
14
|
-
export { useUsers } from './useUsers';
|
|
15
|
-
export { useUserStatus } from './useUserStatus';
|
|
16
|
-
export { useFiles } from './useFiles';
|
|
17
|
-
export { useAnalytics } from './useAnalytics';
|
|
18
|
-
export { useDonations } from './useDonations';
|
|
19
|
-
export { useEvents } from './useEvents';
|
|
20
|
-
export { useTriggerSources } from './useTriggerSources';
|
|
21
|
-
export { useBookings } from './useBookings';
|
|
22
|
-
|
|
23
|
-
// Re-export auth-related types for convenience
|
|
24
|
-
export type { RawUserData } from './useAuth';
|
|
25
|
-
export type {
|
|
26
|
-
TransactionSignerHook,
|
|
27
|
-
SubmissionResult,
|
|
28
|
-
AuthenticatedUser,
|
|
29
|
-
TransactionSigningResult,
|
|
30
|
-
StatusUpdateData,
|
|
31
|
-
OnStatusUpdateFn,
|
|
32
|
-
SigningStatus as SigningStatusType
|
|
33
|
-
} from './useTransactionSigner';
|
|
34
|
-
export type { AccountOwnedTokensResult, Web3Hook } from './useWeb3';
|
|
35
|
-
export type { EventsHook, PersEvent, EventHandler, EventFilter, Unsubscribe } from './useEvents';
|
|
36
|
-
export type {
|
|
37
|
-
TokenBalanceWithToken,
|
|
38
|
-
UseTokenBalancesOptions,
|
|
39
|
-
UseTokenBalancesResult
|
|
40
|
-
} from './useTokenBalances';
|
|
41
|
-
|
|
42
|
-
// Export campaign-related types
|
|
43
|
-
export type { CampaignClaimFilters, CampaignFilterOptions, CampaignHook, GetCampaignsOptions } from './useCampaigns';
|
|
44
|
-
|
|
45
|
-
// Export redemption-related types
|
|
46
|
-
export type { RedemptionRedeemFilters, RedemptionFilterOptions, RedemptionHook, GetRedemptionsOptions } from './useRedemptions';
|
|
47
|
-
|
|
48
|
-
// Export business-related types
|
|
49
|
-
export type { BusinessFilterOptions, BusinessHook } from './useBusiness';
|
|
50
|
-
|
|
51
|
-
// Export transaction-related types
|
|
52
|
-
export type { TransactionQueryOptions, TransactionHook } from './useTransactions';
|
|
53
|
-
|
|
54
|
-
// Export trigger source-related types
|
|
55
|
-
export type { TriggerSourceQueryOptions, TriggerSourceHook } from './useTriggerSources';
|
|
56
|
-
|
|
57
|
-
// Export analytics-related types
|
|
58
|
-
export type { AnalyticsHook } from './useAnalytics';
|
|
59
|
-
|
|
60
|
-
// Export booking-related types
|
|
1
|
+
// Export all hooks (only hooks, no providers to avoid circular dependency)
|
|
2
|
+
export { useAuth } from './useAuth';
|
|
3
|
+
export { useTokens } from './useTokens';
|
|
4
|
+
export { useTokenBalances } from './useTokenBalances';
|
|
5
|
+
export { useTransactions } from './useTransactions';
|
|
6
|
+
export { useTransactionSigner, SigningStatus } from './useTransactionSigner';
|
|
7
|
+
export { useBusiness } from './useBusiness';
|
|
8
|
+
export { useCampaigns } from './useCampaigns';
|
|
9
|
+
export { useRedemptions } from './useRedemptions';
|
|
10
|
+
export { useWeb3 } from './useWeb3';
|
|
11
|
+
export { useResolvedUrl, useMetadata, useIPFSUrl, useTransactionMetadata } from './useIPFSUrl';
|
|
12
|
+
export { usePurchases } from './usePurchases';
|
|
13
|
+
export { useTenants } from './useTenants';
|
|
14
|
+
export { useUsers } from './useUsers';
|
|
15
|
+
export { useUserStatus } from './useUserStatus';
|
|
16
|
+
export { useFiles } from './useFiles';
|
|
17
|
+
export { useAnalytics } from './useAnalytics';
|
|
18
|
+
export { useDonations } from './useDonations';
|
|
19
|
+
export { useEvents } from './useEvents';
|
|
20
|
+
export { useTriggerSources } from './useTriggerSources';
|
|
21
|
+
export { useBookings } from './useBookings';
|
|
22
|
+
|
|
23
|
+
// Re-export auth-related types for convenience
|
|
24
|
+
export type { RawUserData } from './useAuth';
|
|
25
|
+
export type {
|
|
26
|
+
TransactionSignerHook,
|
|
27
|
+
SubmissionResult,
|
|
28
|
+
AuthenticatedUser,
|
|
29
|
+
TransactionSigningResult,
|
|
30
|
+
StatusUpdateData,
|
|
31
|
+
OnStatusUpdateFn,
|
|
32
|
+
SigningStatus as SigningStatusType
|
|
33
|
+
} from './useTransactionSigner';
|
|
34
|
+
export type { AccountOwnedTokensResult, Web3Hook } from './useWeb3';
|
|
35
|
+
export type { EventsHook, PersEvent, EventHandler, EventFilter, Unsubscribe } from './useEvents';
|
|
36
|
+
export type {
|
|
37
|
+
TokenBalanceWithToken,
|
|
38
|
+
UseTokenBalancesOptions,
|
|
39
|
+
UseTokenBalancesResult
|
|
40
|
+
} from './useTokenBalances';
|
|
41
|
+
|
|
42
|
+
// Export campaign-related types
|
|
43
|
+
export type { CampaignClaimFilters, CampaignFilterOptions, CampaignHook, GetCampaignsOptions } from './useCampaigns';
|
|
44
|
+
|
|
45
|
+
// Export redemption-related types
|
|
46
|
+
export type { RedemptionRedeemFilters, RedemptionFilterOptions, RedemptionHook, GetRedemptionsOptions } from './useRedemptions';
|
|
47
|
+
|
|
48
|
+
// Export business-related types
|
|
49
|
+
export type { BusinessFilterOptions, BusinessHook } from './useBusiness';
|
|
50
|
+
|
|
51
|
+
// Export transaction-related types
|
|
52
|
+
export type { TransactionQueryOptions, TransactionHook } from './useTransactions';
|
|
53
|
+
|
|
54
|
+
// Export trigger source-related types
|
|
55
|
+
export type { TriggerSourceQueryOptions, TriggerSourceHook } from './useTriggerSources';
|
|
56
|
+
|
|
57
|
+
// Export analytics-related types
|
|
58
|
+
export type { AnalyticsHook } from './useAnalytics';
|
|
59
|
+
|
|
60
|
+
// Export booking-related types
|
|
61
61
|
export type { BookingHook, BookingQueryOptions, BookingValidationOptions } from './useBookings';
|