@explorins/pers-sdk-react-native 2.2.0-alpha.7 → 2.2.0-alpha.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.
@@ -1,3 +1,4 @@
1
+ import 'react-native-url-polyfill/auto';
1
2
  export declare const initializeReactNativePolyfills: () => boolean;
2
3
  export { createSafeWeb3Check } from './web3-polyfills';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,8BAA8B,QAAO,OAuHjD,CAAC;AA0CF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/polyfills/index.ts"],"names":[],"mappings":"AAKA,OAAO,gCAAgC,CAAC;AAMxC,eAAO,MAAM,8BAA8B,QAAO,OA2GjD,CAAC;AA0CF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,5 +1,8 @@
1
1
  // React Native polyfills for crypto and Web3 functionality
2
2
  // Consolidated "batteries included" approach for React Native SDK
3
+ // CRITICAL: URL polyfill must be imported FIRST before any other code
4
+ // This provides full URLSearchParams support for React Native
5
+ import 'react-native-url-polyfill/auto';
3
6
  import { Buffer } from 'buffer';
4
7
  import { setupWeb3InstanceofPolyfill } from './web3-polyfills';
5
8
  // Initialize React Native polyfills
@@ -37,22 +40,7 @@ export const initializeReactNativePolyfills = () => {
37
40
  }
38
41
  };
39
42
  }
40
- // Add URL polyfill for Web3 compatibility
41
- if (typeof global !== 'undefined' && !global.URL) {
42
- try {
43
- // Try to use react-native-url-polyfill if available
44
- require('react-native-url-polyfill/auto');
45
- }
46
- catch {
47
- // Fallback to basic URL implementation
48
- global.URL = class URL {
49
- constructor(href) {
50
- this.href = href;
51
- }
52
- toString() { return this.href; }
53
- };
54
- }
55
- }
43
+ // URL polyfill is handled by react-native-url-polyfill/auto import at top
56
44
  // Add btoa/atob polyfills for Web3 compatibility
57
45
  if (typeof global !== 'undefined') {
58
46
  if (!global.btoa) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorins/pers-sdk-react-native",
3
- "version": "2.2.0-alpha.7",
3
+ "version": "2.2.0-alpha.8",
4
4
  "description": "React Native SDK for PERS Platform - Tourism Loyalty System with Blockchain Transaction Signing and WebAuthn Authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,10 +37,11 @@
37
37
  "author": "eXplorins",
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@explorins/pers-sdk": "^2.1.33-alpha.0",
40
+ "@explorins/pers-sdk": "^2.1.32",
41
41
  "@explorins/pers-signer": "^1.0.34",
42
42
  "buffer": "^6.0.3",
43
- "ethers": "^6.15.0"
43
+ "ethers": "^6.15.0",
44
+ "react-native-url-polyfill": "^2.0.0"
44
45
  },
45
46
  "browser": {
46
47
  "crypto": false,
@@ -1,6 +1,10 @@
1
1
  // React Native polyfills for crypto and Web3 functionality
2
2
  // Consolidated "batteries included" approach for React Native SDK
3
3
 
4
+ // CRITICAL: URL polyfill must be imported FIRST before any other code
5
+ // This provides full URLSearchParams support for React Native
6
+ import 'react-native-url-polyfill/auto';
7
+
4
8
  import { Buffer } from 'buffer';
5
9
  import { setupWeb3InstanceofPolyfill } from './web3-polyfills';
6
10
 
@@ -42,19 +46,7 @@ export const initializeReactNativePolyfills = (): boolean => {
42
46
  };
43
47
  }
44
48
 
45
- // Add URL polyfill for Web3 compatibility
46
- if (typeof global !== 'undefined' && !(global as any).URL) {
47
- try {
48
- // Try to use react-native-url-polyfill if available
49
- require('react-native-url-polyfill/auto');
50
- } catch {
51
- // Fallback to basic URL implementation
52
- (global as any).URL = class URL {
53
- constructor(public href: string) {}
54
- toString() { return this.href; }
55
- } as any;
56
- }
57
- }
49
+ // URL polyfill is handled by react-native-url-polyfill/auto import at top
58
50
 
59
51
  // Add btoa/atob polyfills for Web3 compatibility
60
52
  if (typeof global !== 'undefined') {