@dynamic-labs/legacy-react-native-extension 5.2.0 → 5.3.0

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/index.cjs CHANGED
@@ -35,7 +35,7 @@ function _interopNamespace(e) {
35
35
  return Object.freeze(n);
36
36
  }
37
37
 
38
- var version = "5.2.0";
38
+ var version = "5.3.0";
39
39
 
40
40
  function _extends() {
41
41
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -795,12 +795,20 @@ const setupPlatformHandler = core => {
795
795
  });
796
796
  };
797
797
 
798
+ const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_DOCS_URL = 'https://docs.dynamic.xyz/overview/migrations/react-native-expo-secure-store-to-keychain';
799
+ const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_MESSAGE = 'react-native-keychain native module is not available. ' + 'Install and link the peer dependency, then rebuild the native app. ' + `See ${REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_DOCS_URL}`;
798
800
  const assertValidSource = source => {
799
801
  if (source !== 'secureStorage') {
800
802
  throw new Error(`Invalid storage source "${source}"`);
801
803
  }
802
804
  };
805
+ const assertReactNativeKeychainAvailable = () => {
806
+ if (!reactNative.NativeModules['RNKeychainManager']) {
807
+ throw new Error(REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_MESSAGE);
808
+ }
809
+ };
803
810
  const setupStorageHandler = core => {
811
+ assertReactNativeKeychainAvailable();
804
812
  const storageRequestChannel = messageTransport.createRequestChannel(core.messageTransport);
805
813
  storageRequestChannel.handle('getItem', _a => __awaiter(void 0, [_a], void 0, function* ({
806
814
  key,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
2
- import { StyleSheet, Platform } from 'react-native';
2
+ import { StyleSheet, Platform, NativeModules } from 'react-native';
3
3
  import { useEffect, useRef, useState } from 'react';
4
4
  import { WebView as WebView$1 } from 'react-native-webview';
5
5
  import { createWebViewLoadController, EMBEDDED_WEBVIEW_HTTP_ERROR_DOMAIN } from '@dynamic-labs/legacy-client';
@@ -14,7 +14,7 @@ import { openAuthSessionAsync } from 'expo-web-browser';
14
14
  import { getGenericPassword, resetGenericPassword, setGenericPassword } from 'react-native-keychain';
15
15
  import { createPasskey, PasskeyStamper } from '@turnkey/react-native-passkey-stamper';
16
16
 
17
- var version = "5.2.0";
17
+ var version = "5.3.0";
18
18
 
19
19
  function _extends() {
20
20
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -774,12 +774,20 @@ const setupPlatformHandler = core => {
774
774
  });
775
775
  };
776
776
 
777
+ const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_DOCS_URL = 'https://docs.dynamic.xyz/overview/migrations/react-native-expo-secure-store-to-keychain';
778
+ const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_MESSAGE = 'react-native-keychain native module is not available. ' + 'Install and link the peer dependency, then rebuild the native app. ' + `See ${REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_DOCS_URL}`;
777
779
  const assertValidSource = source => {
778
780
  if (source !== 'secureStorage') {
779
781
  throw new Error(`Invalid storage source "${source}"`);
780
782
  }
781
783
  };
784
+ const assertReactNativeKeychainAvailable = () => {
785
+ if (!NativeModules['RNKeychainManager']) {
786
+ throw new Error(REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_MESSAGE);
787
+ }
788
+ };
782
789
  const setupStorageHandler = core => {
790
+ assertReactNativeKeychainAvailable();
783
791
  const storageRequestChannel = createRequestChannel(core.messageTransport);
784
792
  storageRequestChannel.handle('getItem', _a => __awaiter(void 0, [_a], void 0, function* ({
785
793
  key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/legacy-react-native-extension",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "main": "./index.cjs",
5
5
  "module": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -18,11 +18,11 @@
18
18
  "@turnkey/react-native-passkey-stamper": "1.2.7",
19
19
  "@react-native-documents/picker": "^11.0.0",
20
20
  "react-native-fs": ">=2.20.0",
21
- "@dynamic-labs/assert-package-version": "5.2.0",
22
- "@dynamic-labs/legacy-client": "5.2.0",
23
- "@dynamic-labs/logger": "5.2.0",
24
- "@dynamic-labs/message-transport": "5.2.0",
25
- "@dynamic-labs/webview-messages": "5.2.0"
21
+ "@dynamic-labs/assert-package-version": "5.3.0",
22
+ "@dynamic-labs/legacy-client": "5.3.0",
23
+ "@dynamic-labs/logger": "5.3.0",
24
+ "@dynamic-labs/message-transport": "5.3.0",
25
+ "@dynamic-labs/webview-messages": "5.3.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=18.0.0 <20.0.0",
@@ -1,2 +1,4 @@
1
1
  import { Core } from '@dynamic-labs/legacy-client';
2
+ export declare const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_DOCS_URL = "https://docs.dynamic.xyz/overview/migrations/react-native-expo-secure-store-to-keychain";
3
+ export declare const REACT_NATIVE_KEYCHAIN_NOT_AVAILABLE_MESSAGE: string;
2
4
  export declare const setupStorageHandler: (core: Core) => void;