@dynamic-labs/react-native-extension 3.0.0-alpha.3 → 3.0.0-alpha.30

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.
Files changed (2) hide show
  1. package/index.cjs +27 -21
  2. package/package.json +8 -7
package/index.cjs CHANGED
@@ -8,10 +8,11 @@ var messageTransport = require('@dynamic-labs/message-transport');
8
8
  var logger$1 = require('@dynamic-labs/logger');
9
9
  var reactNative = require('react-native');
10
10
  var jsxRuntime = require('react/jsx-runtime');
11
- var expoLinking = require('expo-linking');
12
11
  var reactNativePasskeyStamper = require('@turnkey/react-native-passkey-stamper');
12
+ var expoLinking = require('expo-linking');
13
+ var expoWebBrowser = require('expo-web-browser');
13
14
 
14
- var version$1 = "3.0.0-alpha.3";
15
+ var version$1 = "3.0.0-alpha.30";
15
16
 
16
17
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
17
18
 
@@ -2959,25 +2960,6 @@ const setupFetchHandler = core => {
2959
2960
  }));
2960
2961
  };
2961
2962
 
2962
- const setupPlatformHandler = core => {
2963
- const platformChannel = messageTransport.createRequestChannel(core.messageTransport);
2964
- core.manifest.setPlatform('react-native');
2965
- platformChannel.handle('openURL', url => __awaiter(void 0, void 0, void 0, function* () {
2966
- yield expoLinking.openURL(url);
2967
- }));
2968
- platformChannel.handle('openNewWindow', url => __awaiter(void 0, void 0, void 0, function* () {
2969
- const error = new Error('openNewWindow message handler not implemented');
2970
- logger.error(error);
2971
- core.initialization.error = error;
2972
- throw error;
2973
- }));
2974
- // TODO: this is temporary and should be removed once we are able to get the redirect URL from
2975
- // dashboard as provided from the customer
2976
- platformChannel.handle('getRedirectUrl', () => __awaiter(void 0, void 0, void 0, function* () {
2977
- return expoLinking.createURL('');
2978
- }));
2979
- };
2980
-
2981
2963
  const setupPasskeyHandler = core => {
2982
2964
  const passkeysRequestChannel = messageTransport.createRequestChannel(core.messageTransport);
2983
2965
  passkeysRequestChannel.handle('createPasskey', _a => __awaiter(void 0, [_a], void 0, function* ({
@@ -3009,6 +2991,30 @@ const setupPasskeyHandler = core => {
3009
2991
  }));
3010
2992
  };
3011
2993
 
2994
+ const setupPlatformHandler = core => {
2995
+ const platformChannel = messageTransport.createRequestChannel(core.messageTransport);
2996
+ core.manifest.setPlatform('react-native');
2997
+ platformChannel.handle('openURL', url => __awaiter(void 0, void 0, void 0, function* () {
2998
+ yield expoLinking.openURL(url);
2999
+ }));
3000
+ platformChannel.handle('openAuthenticationWindow', _a => __awaiter(void 0, [_a], void 0, function* ({
3001
+ url,
3002
+ redirectUrl
3003
+ }) {
3004
+ const result = yield expoWebBrowser.openAuthSessionAsync(url, redirectUrl);
3005
+ // When not a success, result can only have a type which is a string describing
3006
+ // what happened in a single word.
3007
+ if (result.type !== 'success') throw new Error(result.type);
3008
+ return result.url;
3009
+ }));
3010
+ // WARNING: before using this URL for deeplinking it must be verified against the
3011
+ // environment's configured deeplink URLs
3012
+ // TODO: use the current path here so the deeplink points to the current exact route
3013
+ platformChannel.handle('getRedirectUrl', () => __awaiter(void 0, void 0, void 0, function* () {
3014
+ return expoLinking.createURL('');
3015
+ }));
3016
+ };
3017
+
3012
3018
  const defaultWebviewUrl = `https://webview.dynamicauth.com/${version$1}`;
3013
3019
  const ReactNativeExtension = ({
3014
3020
  webviewUrl: _webviewUrl = defaultWebviewUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/react-native-extension",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.30",
4
4
  "main": "./index.cjs",
5
5
  "module": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -14,15 +14,16 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@dynamic-labs/message-transport": "3.0.0-alpha.3",
18
- "@dynamic-labs/logger": "3.0.0-alpha.3",
19
- "@turnkey/react-native-passkey-stamper": "0.2.5",
20
- "expo-linking": "6.3.1"
17
+ "@dynamic-labs/message-transport": "3.0.0-alpha.30",
18
+ "@dynamic-labs/logger": "3.0.0-alpha.30",
19
+ "@turnkey/react-native-passkey-stamper": "0.2.5"
21
20
  },
22
21
  "peerDependencies": {
23
22
  "react": "^18.2.0",
24
- "react-native": "^0.73.6",
23
+ "react-native": ">=0.73.6 <0.75.0",
25
24
  "react-native-webview": "^13.6.4",
26
- "@dynamic-labs/client": "3.0.0-alpha.3"
25
+ "expo-linking": "^6.2.2",
26
+ "expo-web-browser": ">=12.0.0 <14.0.0",
27
+ "@dynamic-labs/client": "3.0.0-alpha.30"
27
28
  }
28
29
  }