@reown/appkit-react-native 0.0.0-feat-multi-siwe-20250623183423 → 0.0.0-feat-multi-social-20250630195637

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 (101) hide show
  1. package/lib/commonjs/connectors/WalletConnectConnector.js +1 -1
  2. package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
  3. package/lib/commonjs/index.js +9 -58
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/modal/w3m-modal/index.js +1 -14
  6. package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
  7. package/lib/commonjs/modal/w3m-router/index.js +1 -7
  8. package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
  9. package/lib/commonjs/partials/w3m-header/index.js +3 -12
  10. package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
  11. package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js +1 -1
  12. package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
  13. package/lib/commonjs/views/w3m-connect-socials-view/index.js +3 -10
  14. package/lib/commonjs/views/w3m-connect-socials-view/index.js.map +1 -1
  15. package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js +3 -7
  16. package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js.map +1 -1
  17. package/lib/commonjs/views/w3m-connect-view/index.js +9 -32
  18. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  19. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +2 -0
  20. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
  21. package/lib/commonjs/views/w3m-connecting-social-view/index.js +39 -61
  22. package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
  23. package/lib/module/connectors/WalletConnectConnector.js +1 -1
  24. package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
  25. package/lib/module/index.js +11 -6
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/modal/w3m-modal/index.js +2 -15
  28. package/lib/module/modal/w3m-modal/index.js.map +1 -1
  29. package/lib/module/modal/w3m-router/index.js +1 -7
  30. package/lib/module/modal/w3m-router/index.js.map +1 -1
  31. package/lib/module/partials/w3m-header/index.js +4 -13
  32. package/lib/module/partials/w3m-header/index.js.map +1 -1
  33. package/lib/module/views/w3m-account-default-view/components/auth-buttons.js +1 -1
  34. package/lib/module/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
  35. package/lib/module/views/w3m-connect-socials-view/index.js +4 -11
  36. package/lib/module/views/w3m-connect-socials-view/index.js.map +1 -1
  37. package/lib/module/views/w3m-connect-view/components/social-login-list.js +4 -8
  38. package/lib/module/views/w3m-connect-view/components/social-login-list.js.map +1 -1
  39. package/lib/module/views/w3m-connect-view/index.js +11 -34
  40. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  41. package/lib/module/views/w3m-connecting-siwe-view/index.js +2 -0
  42. package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
  43. package/lib/module/views/w3m-connecting-social-view/index.js +41 -63
  44. package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
  45. package/lib/typescript/index.d.ts +7 -6
  46. package/lib/typescript/index.d.ts.map +1 -1
  47. package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
  48. package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
  49. package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
  50. package/lib/typescript/views/w3m-connect-socials-view/index.d.ts.map +1 -1
  51. package/lib/typescript/views/w3m-connect-view/components/social-login-list.d.ts.map +1 -1
  52. package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
  53. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
  54. package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
  55. package/package.json +5 -5
  56. package/src/connectors/WalletConnectConnector.ts +1 -1
  57. package/src/index.ts +10 -10
  58. package/src/modal/w3m-modal/index.tsx +0 -12
  59. package/src/modal/w3m-router/index.tsx +1 -7
  60. package/src/partials/w3m-header/index.tsx +5 -22
  61. package/src/views/w3m-account-default-view/components/auth-buttons.tsx +1 -1
  62. package/src/views/w3m-connect-socials-view/index.tsx +3 -14
  63. package/src/views/w3m-connect-view/components/social-login-list.tsx +2 -14
  64. package/src/views/w3m-connect-view/index.tsx +9 -25
  65. package/src/views/w3m-connecting-siwe-view/index.tsx +1 -0
  66. package/src/views/w3m-connecting-social-view/index.tsx +44 -96
  67. package/lib/commonjs/views/w3m-connect-view/components/connect-email-input.js +0 -73
  68. package/lib/commonjs/views/w3m-connect-view/components/connect-email-input.js.map +0 -1
  69. package/lib/commonjs/views/w3m-connect-view/components/wallet-guide.js +0 -55
  70. package/lib/commonjs/views/w3m-connect-view/components/wallet-guide.js.map +0 -1
  71. package/lib/commonjs/views/w3m-connecting-farcaster-view/index.js +0 -124
  72. package/lib/commonjs/views/w3m-connecting-farcaster-view/index.js.map +0 -1
  73. package/lib/commonjs/views/w3m-connecting-farcaster-view/styles.js +0 -24
  74. package/lib/commonjs/views/w3m-connecting-farcaster-view/styles.js.map +0 -1
  75. package/lib/commonjs/views/w3m-create-view/index.js +0 -57
  76. package/lib/commonjs/views/w3m-create-view/index.js.map +0 -1
  77. package/lib/module/views/w3m-connect-view/components/connect-email-input.js +0 -67
  78. package/lib/module/views/w3m-connect-view/components/connect-email-input.js.map +0 -1
  79. package/lib/module/views/w3m-connect-view/components/wallet-guide.js +0 -49
  80. package/lib/module/views/w3m-connect-view/components/wallet-guide.js.map +0 -1
  81. package/lib/module/views/w3m-connecting-farcaster-view/index.js +0 -117
  82. package/lib/module/views/w3m-connecting-farcaster-view/index.js.map +0 -1
  83. package/lib/module/views/w3m-connecting-farcaster-view/styles.js +0 -18
  84. package/lib/module/views/w3m-connecting-farcaster-view/styles.js.map +0 -1
  85. package/lib/module/views/w3m-create-view/index.js +0 -51
  86. package/lib/module/views/w3m-create-view/index.js.map +0 -1
  87. package/lib/typescript/views/w3m-connect-view/components/connect-email-input.d.ts +0 -6
  88. package/lib/typescript/views/w3m-connect-view/components/connect-email-input.d.ts.map +0 -1
  89. package/lib/typescript/views/w3m-connect-view/components/wallet-guide.d.ts +0 -5
  90. package/lib/typescript/views/w3m-connect-view/components/wallet-guide.d.ts.map +0 -1
  91. package/lib/typescript/views/w3m-connecting-farcaster-view/index.d.ts +0 -2
  92. package/lib/typescript/views/w3m-connecting-farcaster-view/index.d.ts.map +0 -1
  93. package/lib/typescript/views/w3m-connecting-farcaster-view/styles.d.ts +0 -17
  94. package/lib/typescript/views/w3m-connecting-farcaster-view/styles.d.ts.map +0 -1
  95. package/lib/typescript/views/w3m-create-view/index.d.ts +0 -2
  96. package/lib/typescript/views/w3m-create-view/index.d.ts.map +0 -1
  97. package/src/views/w3m-connect-view/components/connect-email-input.tsx +0 -69
  98. package/src/views/w3m-connect-view/components/wallet-guide.tsx +0 -50
  99. package/src/views/w3m-connecting-farcaster-view/index.tsx +0 -140
  100. package/src/views/w3m-connecting-farcaster-view/styles.ts +0 -18
  101. package/src/views/w3m-create-view/index.tsx +0 -35
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /********** Components **********/
1
2
  export {
2
3
  AccountButton as AccountButton,
3
4
  type AccountButtonProps
@@ -12,21 +13,12 @@ export {
12
13
  type NetworkButtonProps as NetworkButtonProps
13
14
  } from './modal/w3m-network-button';
14
15
  export { AppKit } from './modal/w3m-modal';
15
- export { AppKitRouter } from './modal/w3m-router';
16
16
 
17
- export { AppKitScaffold } from './client';
17
+ /********** Types **********/
18
18
  export type { LibraryOptions, ScaffoldOptions } from './client';
19
-
20
19
  export type * from '@reown/appkit-core-react-native';
21
- export { CoreHelperUtil } from '@reown/appkit-core-react-native';
22
-
23
- export * from './AppKit';
24
- export { AppKitProvider } from './AppKitContext';
25
-
26
20
  export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
27
21
 
28
- export { WalletConnectConnector } from './connectors/WalletConnectConnector';
29
-
30
22
  /****** Hooks *******/
31
23
  export { useAppKit } from './hooks/useAppKit';
32
24
  export { useProvider } from './hooks/useProvider';
@@ -37,3 +29,11 @@ export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEv
37
29
  /********** Networks **********/
38
30
  export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
39
31
  export { bitcoin, bitcoinTestnet } from '@reown/appkit-common-react-native';
32
+
33
+ /********** Main **********/
34
+ export { createAppKit } from './AppKit';
35
+ export { AppKitProvider } from './AppKitContext';
36
+
37
+ // TODO: REMOVE
38
+ /********** To be removed **********/
39
+ export { CoreHelperUtil } from '@reown/appkit-core-react-native';
@@ -5,13 +5,10 @@ import Modal from 'react-native-modal';
5
5
  import { Card, ThemeProvider } from '@reown/appkit-ui-react-native';
6
6
  import {
7
7
  ApiController,
8
- ConnectorController,
9
8
  EventsController,
10
9
  ModalController,
11
10
  OptionsController,
12
11
  RouterController,
13
- type AppKitFrameProvider,
14
- WebviewController,
15
12
  ThemeController,
16
13
  ConnectionsController
17
14
  } from '@reown/appkit-core-react-native';
@@ -27,18 +24,12 @@ import { useAppKit } from '../../AppKitContext';
27
24
  export function AppKit() {
28
25
  const { disconnect } = useAppKit();
29
26
  const { open } = useSnapshot(ModalController.state);
30
- const { connectors, connectedConnector } = useSnapshot(ConnectorController.state);
31
- const { frameViewVisible, webviewVisible } = useSnapshot(WebviewController.state);
32
27
  const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
33
28
  const { projectId } = useSnapshot(OptionsController.state);
34
29
  const { height } = useWindowDimensions();
35
30
  const { isLandscape } = useCustomDimensions();
36
31
  const portraitHeight = height - 80;
37
32
  const landScapeHeight = height * 0.95 - (StatusBar.currentHeight ?? 0);
38
- const authProvider = connectors.find(c => c.type === 'AUTH')?.provider as AppKitFrameProvider;
39
- const AuthView = authProvider?.AuthView;
40
- const SocialView = authProvider?.Webview;
41
- const showAuth = !connectedConnector || connectedConnector === 'AUTH';
42
33
 
43
34
  const onBackButtonPress = () => {
44
35
  if (RouterController.state.history.length > 1) {
@@ -83,7 +74,6 @@ export function AppKit() {
83
74
  <ThemeProvider themeMode={themeMode} themeVariables={themeVariables}>
84
75
  <Modal
85
76
  style={styles.modal}
86
- coverScreen={!frameViewVisible && !webviewVisible}
87
77
  isVisible={open}
88
78
  useNativeDriver
89
79
  useNativeDriverForBackdrop
@@ -103,8 +93,6 @@ export function AppKit() {
103
93
  <Snackbar />
104
94
  </Card>
105
95
  </Modal>
106
- {!!showAuth && AuthView && <AuthView />}
107
- {!!showAuth && SocialView && <SocialView />}
108
96
  </ThemeProvider>
109
97
  </>
110
98
  );
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect, useMemo } from 'react';
2
1
  import { useSnapshot } from 'valtio';
2
+ import { useLayoutEffect, useMemo } from 'react';
3
3
  import { RouterController } from '@reown/appkit-core-react-native';
4
4
 
5
5
  import { AccountDefaultView } from '../../views/w3m-account-default-view';
@@ -9,9 +9,7 @@ import { ConnectView } from '../../views/w3m-connect-view';
9
9
  import { ConnectSocialsView } from '../../views/w3m-connect-socials-view';
10
10
  import { ConnectingView } from '../../views/w3m-connecting-view';
11
11
  import { ConnectingExternalView } from '../../views/w3m-connecting-external-view';
12
- import { ConnectingFarcasterView } from '../../views/w3m-connecting-farcaster-view';
13
12
  import { ConnectingSocialView } from '../../views/w3m-connecting-social-view';
14
- import { CreateView } from '../../views/w3m-create-view';
15
13
  import { ConnectingSiweView } from '../../views/w3m-connecting-siwe-view';
16
14
  import { EmailVerifyOtpView } from '../../views/w3m-email-verify-otp-view';
17
15
  import { EmailVerifyDeviceView } from '../../views/w3m-email-verify-device-view';
@@ -67,12 +65,8 @@ export function AppKitRouter() {
67
65
  return ConnectingSiweView;
68
66
  case 'ConnectingSocial':
69
67
  return ConnectingSocialView;
70
- case 'ConnectingFarcaster':
71
- return ConnectingFarcasterView;
72
68
  case 'ConnectingWalletConnect':
73
69
  return ConnectingView;
74
- case 'Create':
75
- return CreateView;
76
70
  case 'EmailVerifyDevice':
77
71
  return EmailVerifyDeviceView;
78
72
  case 'EmailVerifyOtp':
@@ -3,10 +3,7 @@ import {
3
3
  RouterController,
4
4
  ModalController,
5
5
  EventsController,
6
- type RouterControllerState,
7
- ConnectionController,
8
- ConnectorController,
9
- type AppKitFrameProvider
6
+ type RouterControllerState
10
7
  } from '@reown/appkit-core-react-native';
11
8
  import { IconLink, Text, FlexView } from '@reown/appkit-ui-react-native';
12
9
  import { StringUtil } from '@reown/appkit-common-react-native';
@@ -24,8 +21,8 @@ export function Header() {
24
21
  const connectorName = _data?.connector?.name;
25
22
  const walletName = _data?.wallet?.name;
26
23
  const networkName = _data?.network?.name;
27
- const socialName = ConnectionController.state.selectedSocialProvider
28
- ? StringUtil.capitalize(ConnectionController.state.selectedSocialProvider)
24
+ const socialName = _data?.socialProvider
25
+ ? StringUtil.capitalize(_data?.socialProvider)
29
26
  : undefined;
30
27
 
31
28
  return {
@@ -36,10 +33,8 @@ export function Header() {
36
33
  ConnectSocials: 'All socials',
37
34
  ConnectingExternal: connectorName ?? 'Connect wallet',
38
35
  ConnectingSiwe: undefined,
39
- ConnectingFarcaster: socialName ?? 'Connecting Social',
40
36
  ConnectingSocial: socialName ?? 'Connecting Social',
41
37
  ConnectingWalletConnect: walletName ?? 'WalletConnect',
42
- Create: 'Create wallet',
43
38
  EmailVerifyDevice: ' ',
44
39
  EmailVerifyOtp: 'Confirm email',
45
40
  GetWallet: 'Get a wallet',
@@ -75,23 +70,11 @@ export function Header() {
75
70
  const header = headings(data, view);
76
71
 
77
72
  const checkSocial = () => {
78
- if (
79
- RouterController.state.view === 'ConnectingFarcaster' ||
80
- RouterController.state.view === 'ConnectingSocial'
81
- ) {
82
- const socialProvider = ConnectionController.state.selectedSocialProvider;
83
- const authProvider = ConnectorController.getAuthConnector()?.provider as AppKitFrameProvider;
84
-
85
- if (authProvider && socialProvider === 'farcaster') {
86
- // TODO: remove this once Farcaster session refresh is implemented
87
- // @ts-expect-error
88
- authProvider.webviewRef?.current?.reload();
89
- }
90
-
73
+ if (RouterController.state.view === 'ConnectingSocial') {
91
74
  EventsController.sendEvent({
92
75
  type: 'track',
93
76
  event: 'SOCIAL_LOGIN_CANCELED',
94
- properties: { provider: ConnectionController.state.selectedSocialProvider! }
77
+ properties: { provider: RouterController.state.data?.socialProvider! }
95
78
  });
96
79
  }
97
80
  };
@@ -34,7 +34,7 @@ export function AuthButtons({
34
34
  </ListSocial>
35
35
  ) : (
36
36
  <ListItem
37
- icon="mail"
37
+ icon="email"
38
38
  onPress={onPress}
39
39
  chevron
40
40
  testID="button-email"
@@ -1,13 +1,10 @@
1
- import { useEffect } from 'react';
2
1
  import { useSnapshot } from 'valtio';
3
2
  import { ScrollView } from 'react-native';
4
3
  import { StringUtil, type SocialProvider } from '@reown/appkit-common-react-native';
5
4
  import {
6
- ConnectionController,
7
5
  EventsController,
8
6
  OptionsController,
9
- RouterController,
10
- WebviewController
7
+ RouterController
11
8
  } from '@reown/appkit-core-react-native';
12
9
  import { FlexView, ListSocial, Text } from '@reown/appkit-ui-react-native';
13
10
 
@@ -20,22 +17,14 @@ export function ConnectSocialsView() {
20
17
  const socialProviders = (features?.socials ?? []) as SocialProvider[];
21
18
 
22
19
  const onItemPress = (provider: SocialProvider) => {
23
- ConnectionController.setSelectedSocialProvider(provider);
24
20
  EventsController.sendEvent({
25
21
  type: 'track',
26
22
  event: 'SOCIAL_LOGIN_STARTED',
27
23
  properties: { provider }
28
24
  });
29
- if (provider === 'farcaster') {
30
- RouterController.push('ConnectingFarcaster');
31
- } else {
32
- RouterController.push('ConnectingSocial');
33
- }
34
- };
35
25
 
36
- useEffect(() => {
37
- WebviewController.setConnecting(false);
38
- }, []);
26
+ RouterController.push('ConnectingSocial', { socialProvider: provider });
27
+ };
39
28
 
40
29
  return (
41
30
  <ScrollView style={{ paddingHorizontal: padding }} bounces={false}>
@@ -1,12 +1,7 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
  import { FlexView, ListSocial, LogoSelect, Spacing, Text } from '@reown/appkit-ui-react-native';
3
3
  import { type SocialProvider, StringUtil } from '@reown/appkit-common-react-native';
4
- import {
5
- ConnectionController,
6
- EventsController,
7
- RouterController,
8
- WebviewController
9
- } from '@reown/appkit-core-react-native';
4
+ import { EventsController, RouterController } from '@reown/appkit-core-react-native';
10
5
 
11
6
  export interface SocialLoginListProps {
12
7
  options: readonly SocialProvider[];
@@ -23,19 +18,12 @@ export function SocialLoginList({ options, disabled }: SocialLoginListProps) {
23
18
  bottomSocials = showMoreButton ? bottomSocials.slice(0, MAX_OPTIONS - 2) : bottomSocials;
24
19
 
25
20
  const onItemPress = (provider: SocialProvider) => {
26
- ConnectionController.setSelectedSocialProvider(provider);
27
21
  EventsController.sendEvent({
28
22
  type: 'track',
29
23
  event: 'SOCIAL_LOGIN_STARTED',
30
24
  properties: { provider }
31
25
  });
32
- WebviewController.setConnecting(false);
33
-
34
- if (provider === 'farcaster') {
35
- RouterController.push('ConnectingFarcaster');
36
- } else {
37
- RouterController.push('ConnectingSocial');
38
- }
26
+ RouterController.push('ConnectingSocial', { socialProvider: provider });
39
27
  };
40
28
 
41
29
  const onMorePress = () => {
@@ -1,5 +1,5 @@
1
1
  import { useSnapshot } from 'valtio';
2
- import { Platform, ScrollView, View } from 'react-native';
2
+ import { ScrollView, View } from 'react-native';
3
3
  import {
4
4
  ApiController,
5
5
  ConnectorController,
@@ -9,10 +9,8 @@ import {
9
9
  RouterController,
10
10
  type WcWallet
11
11
  } from '@reown/appkit-core-react-native';
12
- import { FlexView, Icon, ListItem, Separator, Spacing, Text } from '@reown/appkit-ui-react-native';
12
+ import { FlexView, Icon, ListItem, Separator, Text } from '@reown/appkit-ui-react-native';
13
13
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
14
- import { ConnectEmailInput } from './components/connect-email-input';
15
- import { useKeyboard } from '../../hooks/useKeyboard';
16
14
  import { Placeholder } from '../../partials/w3m-placeholder';
17
15
  import { ConnectorList } from './components/connectors-list';
18
16
  import { CustomWalletList } from './components/custom-wallet-list';
@@ -20,38 +18,26 @@ import { AllWalletsButton } from './components/all-wallets-button';
20
18
  import { AllWalletList } from './components/all-wallet-list';
21
19
  import { RecentWalletList } from './components/recent-wallet-list';
22
20
  import { SocialLoginList } from './components/social-login-list';
23
- import { WalletGuide } from './components/wallet-guide';
24
21
  import styles from './styles';
25
22
 
26
23
  export function ConnectView() {
27
24
  const connectors = ConnectorController.state.connectors;
28
- const { authLoading } = useSnapshot(ConnectorController.state);
25
+ // const { authLoading } = useSnapshot(ConnectorController.state);
29
26
  const { prefetchError } = useSnapshot(ApiController.state);
30
27
  const { features } = useSnapshot(OptionsController.state);
31
28
  const { padding } = useCustomDimensions();
32
- const { keyboardShown, keyboardHeight } = useKeyboard();
33
29
 
34
30
  //TODO: check this
35
31
  // const isWalletConnectEnabled = connectors.some(c => c.type === 'WALLET_CONNECT');
36
32
  const isWalletConnectEnabled = true;
37
- const isAuthEnabled = connectors.some(c => c.type === 'AUTH');
38
33
  const isCoinbaseEnabled = connectors.some(c => c.type === 'COINBASE');
39
- const isEmailEnabled = isAuthEnabled && features?.email;
40
- const isSocialEnabled = isAuthEnabled && features?.socials && features?.socials.length > 0;
34
+ const isSocialEnabled = features?.socials && features?.socials.length > 0;
41
35
  const showConnectWalletsButton =
42
- isWalletConnectEnabled && isAuthEnabled && !features?.emailShowWallets;
43
- const showSeparator =
44
- isAuthEnabled &&
45
- (isEmailEnabled || isSocialEnabled) &&
46
- (isWalletConnectEnabled || isCoinbaseEnabled);
36
+ isWalletConnectEnabled && isSocialEnabled && !features?.showWallets;
37
+ const showSeparator = isSocialEnabled && (isWalletConnectEnabled || isCoinbaseEnabled);
47
38
  const showLoadingError = !showConnectWalletsButton && prefetchError;
48
39
  const showList = !showConnectWalletsButton && !showLoadingError;
49
40
 
50
- const paddingBottom = Platform.select({
51
- android: keyboardShown ? keyboardHeight + Spacing['2xl'] : Spacing['2xl'],
52
- default: Spacing['2xl']
53
- });
54
-
55
41
  const onWalletPress = (wallet: WcWallet, isInstalled?: boolean) => {
56
42
  const connector = connectors.find(c => c.explorerId === wallet.id);
57
43
  if (connector) {
@@ -79,12 +65,11 @@ export function ConnectView() {
79
65
 
80
66
  return (
81
67
  <ScrollView style={{ paddingHorizontal: padding }} bounces={false}>
82
- <FlexView padding={['xs', '0', '0', '0']} style={{ paddingBottom }}>
83
- {isEmailEnabled && <ConnectEmailInput loading={authLoading} />}
84
- {isSocialEnabled && <SocialLoginList options={features?.socials} disabled={authLoading} />}
68
+ <FlexView padding={['xs', '0', '2xl', '0']}>
69
+ {isSocialEnabled && <SocialLoginList options={features?.socials} />}
85
70
  {showSeparator && <Separator text="or" style={styles.socialSeparator} />}
86
71
 
87
- <FlexView padding={['0', 's', '0', 's']}>
72
+ <FlexView padding={['0', 's', 'xs', 's']}>
88
73
  {showConnectWalletsButton && (
89
74
  <ListItem contentStyle={styles.connectWalletButton} onPress={onViewAllPress}>
90
75
  <Icon name="wallet" size="lg" />
@@ -134,7 +119,6 @@ export function ConnectView() {
134
119
  />
135
120
  </>
136
121
  )}
137
- {isAuthEnabled && <WalletGuide guide="get-started" />}
138
122
  </FlexView>
139
123
  </FlexView>
140
124
  </ScrollView>
@@ -96,6 +96,7 @@ export function ConnectingSiweView() {
96
96
  });
97
97
  };
98
98
 
99
+ //TODO: Add profile image in Avatar
99
100
  return (
100
101
  <FlexView padding={['2xl', 's', '3xl', 's']}>
101
102
  <IconLink
@@ -1,121 +1,73 @@
1
1
  import { useSnapshot } from 'valtio';
2
2
  import { useCallback, useEffect, useState } from 'react';
3
- import { Platform } from 'react-native';
4
3
  import {
5
4
  ConnectionController,
6
- ConnectorController,
5
+ CoreHelperUtil,
7
6
  EventsController,
8
- ModalController,
9
7
  RouterController,
10
- SnackController,
11
- WebviewController,
12
- type AppKitFrameProvider
8
+ SnackController
13
9
  } from '@reown/appkit-core-react-native';
14
10
  import { FlexView, LoadingThumbnail, IconBox, Logo, Text } from '@reown/appkit-ui-react-native';
15
- import { StringUtil } from '@reown/appkit-common-react-native';
11
+ import { ConstantsUtil, StringUtil } from '@reown/appkit-common-react-native';
16
12
 
17
13
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
18
14
  import styles from './styles';
15
+ import { useAppKit } from '../../AppKitContext';
16
+ import { UiUtil } from '../../utils/UiUtil';
19
17
 
20
18
  export function ConnectingSocialView() {
21
19
  const { maxWidth: width } = useCustomDimensions();
22
- const { processingAuth } = useSnapshot(WebviewController.state);
23
- const { selectedSocialProvider } = useSnapshot(ConnectionController.state);
24
- const authConnector = ConnectorController.getAuthConnector();
20
+ const { connect } = useAppKit();
21
+ const { data } = useSnapshot(RouterController.state);
22
+ const { wcUri } = useSnapshot(ConnectionController.state);
25
23
  const [error, setError] = useState(false);
26
- const provider = authConnector?.provider as AppKitFrameProvider;
27
24
 
28
25
  const onConnect = useCallback(async () => {
29
26
  try {
30
- if (
31
- !WebviewController.state.connecting &&
32
- provider &&
33
- ConnectionController.state.selectedSocialProvider
34
- ) {
35
- const { uri } = await provider.getSocialRedirectUri({
36
- provider: ConnectionController.state.selectedSocialProvider
27
+ if (wcUri) {
28
+ const { redirect, href } = CoreHelperUtil.formatUniversalUrl(
29
+ ConstantsUtil.WEB_WALLET_URL,
30
+ wcUri,
31
+ RouterController.state.data?.socialProvider
32
+ );
33
+ const wcLinking = { name: 'Reown Wallet', href };
34
+ ConnectionController.setWcLinking(wcLinking);
35
+ await CoreHelperUtil.openLink(redirect);
36
+ await ConnectionController.state.wcPromise;
37
+ //todo: rename this. its not just UI
38
+ UiUtil.storeConnectedWallet(wcLinking);
39
+ EventsController.sendEvent({
40
+ type: 'track',
41
+ event: 'SOCIAL_LOGIN_SUCCESS',
42
+ properties: { provider: RouterController.state.data?.socialProvider! }
37
43
  });
38
- WebviewController.setWebviewUrl(uri);
39
-
40
- const isNativeApple =
41
- ConnectionController.state.selectedSocialProvider === 'apple' && Platform.OS === 'ios';
42
-
43
- WebviewController.setWebviewVisible(!isNativeApple);
44
- WebviewController.setConnecting(true);
45
- WebviewController.setConnectingProvider(ConnectionController.state.selectedSocialProvider);
46
44
  }
47
45
  } catch (e) {
48
- WebviewController.setWebviewVisible(false);
49
- WebviewController.setWebviewUrl(undefined);
50
- WebviewController.setConnecting(false);
51
- WebviewController.setConnectingProvider(undefined);
46
+ EventsController.sendEvent({
47
+ type: 'track',
48
+ event: 'SOCIAL_LOGIN_ERROR',
49
+ properties: { provider: RouterController.state.data?.socialProvider! }
50
+ });
52
51
  SnackController.showError('Something went wrong');
53
52
  setError(true);
54
53
  }
55
- }, [provider]);
56
-
57
- const socialMessageHandler = useCallback(
58
- async (url: string) => {
59
- try {
60
- if (
61
- url.includes('/sdk/oauth') &&
62
- ConnectionController.state.selectedSocialProvider &&
63
- authConnector &&
64
- !WebviewController.state.processingAuth
65
- ) {
66
- WebviewController.setProcessingAuth(true);
67
- WebviewController.setWebviewVisible(false);
68
- const parsedUrl = new URL(url);
69
-
70
- EventsController.sendEvent({
71
- type: 'track',
72
- event: 'SOCIAL_LOGIN_REQUEST_USER_DATA',
73
- properties: { provider: ConnectionController.state.selectedSocialProvider }
74
- });
75
-
76
- await provider?.connectSocial(parsedUrl.search);
77
- await ConnectionController.connectExternal(authConnector);
78
- ConnectionController.setConnectedSocialProvider(
79
- ConnectionController.state.selectedSocialProvider
80
- );
81
- WebviewController.setConnecting(false);
82
-
83
- EventsController.sendEvent({
84
- type: 'track',
85
- event: 'SOCIAL_LOGIN_SUCCESS',
86
- properties: { provider: ConnectionController.state.selectedSocialProvider }
87
- });
54
+ }, [wcUri]);
88
55
 
89
- ModalController.close();
90
- WebviewController.reset();
91
- }
92
- } catch (e) {
93
- EventsController.sendEvent({
94
- type: 'track',
95
- event: 'SOCIAL_LOGIN_ERROR',
96
- properties: { provider: ConnectionController.state.selectedSocialProvider! }
97
- });
98
- WebviewController.reset();
99
- RouterController.goBack();
100
- SnackController.showError('Something went wrong');
101
- }
102
- },
103
- [authConnector, provider]
104
- );
56
+ const initializeConnection = useCallback(async () => {
57
+ const connectPromise = connect('walletconnect');
58
+ ConnectionController.setWcPromise(connectPromise);
59
+ }, [connect]);
105
60
 
106
61
  useEffect(() => {
107
- onConnect();
108
- }, [onConnect]);
62
+ initializeConnection();
63
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
+ }, []);
109
65
 
110
66
  useEffect(() => {
111
- if (!provider) return;
112
-
113
- const unsubscribe = provider?.getEventEmitter().addListener('social', socialMessageHandler);
114
-
115
- return () => {
116
- unsubscribe.removeListener('social', socialMessageHandler);
117
- };
118
- }, [socialMessageHandler, provider]);
67
+ if (wcUri) {
68
+ onConnect();
69
+ }
70
+ }, [wcUri, onConnect]);
119
71
 
120
72
  return (
121
73
  <FlexView
@@ -125,7 +77,7 @@ export function ConnectingSocialView() {
125
77
  style={{ width }}
126
78
  >
127
79
  <LoadingThumbnail paused={!!error}>
128
- <Logo logo={selectedSocialProvider ?? 'more'} height={72} width={72} />
80
+ <Logo logo={data?.socialProvider ?? 'more'} height={72} width={72} />
129
81
  {error && (
130
82
  <IconBox
131
83
  icon={'close'}
@@ -139,14 +91,10 @@ export function ConnectingSocialView() {
139
91
  )}
140
92
  </LoadingThumbnail>
141
93
  <Text style={styles.continueText} variant="paragraph-500">
142
- {processingAuth
143
- ? 'Loading user data'
144
- : `Continue with ${StringUtil.capitalize(selectedSocialProvider)}`}
94
+ Continue with {StringUtil.capitalize(data?.socialProvider ?? 'Login')}
145
95
  </Text>
146
96
  <Text variant="small-400" color="fg-200">
147
- {processingAuth
148
- ? 'Please wait a moment while we load your data'
149
- : 'Connect in the provider window'}
97
+ Continue in your browser
150
98
  </Text>
151
99
  </FlexView>
152
100
  );
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ConnectEmailInput = ConnectEmailInput;
7
- var _valtio = require("valtio");
8
- var _react = require("react");
9
- var _appkitUiReactNative = require("@reown/appkit-ui-react-native");
10
- var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
11
- function ConnectEmailInput({
12
- loading
13
- }) {
14
- const {
15
- connectors
16
- } = (0, _valtio.useSnapshot)(_appkitCoreReactNative.ConnectorController.state);
17
- const [inputLoading, setInputLoading] = (0, _react.useState)(false);
18
- const [error, setError] = (0, _react.useState)('');
19
- const [isValidEmail, setIsValidEmail] = (0, _react.useState)(false);
20
- const authProvider = connectors.find(c => c.type === 'AUTH')?.provider;
21
- const onChangeText = value => {
22
- setIsValidEmail(_appkitCoreReactNative.CoreHelperUtil.isValidEmail(value));
23
- setError('');
24
- };
25
- const onEmailFocus = () => {
26
- _appkitCoreReactNative.EventsController.sendEvent({
27
- type: 'track',
28
- event: 'EMAIL_LOGIN_SELECTED'
29
- });
30
- };
31
- const onEmailSubmit = async email => {
32
- try {
33
- if (email.length === 0) return;
34
- setInputLoading(true);
35
- const response = await authProvider.connectEmail({
36
- email
37
- });
38
- _appkitCoreReactNative.EventsController.sendEvent({
39
- type: 'track',
40
- event: 'EMAIL_SUBMITTED'
41
- });
42
- if (response.action === 'VERIFY_DEVICE') {
43
- _appkitCoreReactNative.RouterController.push('EmailVerifyDevice', {
44
- email
45
- });
46
- } else if (response.action === 'VERIFY_OTP') {
47
- _appkitCoreReactNative.RouterController.push('EmailVerifyOtp', {
48
- email
49
- });
50
- }
51
- } catch (e) {
52
- const parsedError = _appkitCoreReactNative.CoreHelperUtil.parseError(e);
53
- if (parsedError?.includes('valid email')) {
54
- setError('Invalid email. Try again.');
55
- } else {
56
- _appkitCoreReactNative.SnackController.showError(parsedError);
57
- }
58
- } finally {
59
- setInputLoading(false);
60
- }
61
- };
62
- return /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
63
- padding: ['0', 's', '0', 's']
64
- }, /*#__PURE__*/React.createElement(_appkitUiReactNative.EmailInput, {
65
- onSubmit: onEmailSubmit,
66
- onFocus: onEmailFocus,
67
- loading: inputLoading || loading,
68
- errorMessage: error,
69
- onChangeText: onChangeText,
70
- submitEnabled: isValidEmail
71
- }));
72
- }
73
- //# sourceMappingURL=connect-email-input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_valtio","require","_react","_appkitUiReactNative","_appkitCoreReactNative","ConnectEmailInput","loading","connectors","useSnapshot","ConnectorController","state","inputLoading","setInputLoading","useState","error","setError","isValidEmail","setIsValidEmail","authProvider","find","c","type","provider","onChangeText","value","CoreHelperUtil","onEmailFocus","EventsController","sendEvent","event","onEmailSubmit","email","length","response","connectEmail","action","RouterController","push","e","parsedError","parseError","includes","SnackController","showError","React","createElement","FlexView","padding","EmailInput","onSubmit","onFocus","errorMessage","submitEnabled"],"sourceRoot":"../../../../../src","sources":["views/w3m-connect-view/components/connect-email-input.tsx"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AAaO,SAASI,iBAAiBA,CAAC;EAAEC;AAAe,CAAC,EAAE;EACpD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,mBAAW,EAACC,0CAAmB,CAACC,KAAK,CAAC;EAC7D,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EACvD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAF,eAAQ,EAAC,EAAE,CAAC;EACtC,MAAM,CAACG,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAJ,eAAQ,EAAC,KAAK,CAAC;EACvD,MAAMK,YAAY,GAAGX,UAAU,CAACY,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAK,MAAM,CAAC,EAAEC,QAA+B;EAE7F,MAAMC,YAAY,GAAIC,KAAa,IAAK;IACtCP,eAAe,CAACQ,qCAAc,CAACT,YAAY,CAACQ,KAAK,CAAC,CAAC;IACnDT,QAAQ,CAAC,EAAE,CAAC;EACd,CAAC;EAED,MAAMW,YAAY,GAAGA,CAAA,KAAM;IACzBC,uCAAgB,CAACC,SAAS,CAAC;MAAEP,IAAI,EAAE,OAAO;MAAEQ,KAAK,EAAE;IAAuB,CAAC,CAAC;EAC9E,CAAC;EAED,MAAMC,aAAa,GAAG,MAAOC,KAAa,IAAK;IAC7C,IAAI;MACF,IAAIA,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;MAExBpB,eAAe,CAAC,IAAI,CAAC;MACrB,MAAMqB,QAAQ,GAAG,MAAMf,YAAY,CAACgB,YAAY,CAAC;QAAEH;MAAM,CAAC,CAAC;MAC3DJ,uCAAgB,CAACC,SAAS,CAAC;QAAEP,IAAI,EAAE,OAAO;QAAEQ,KAAK,EAAE;MAAkB,CAAC,CAAC;MACvE,IAAII,QAAQ,CAACE,MAAM,KAAK,eAAe,EAAE;QACvCC,uCAAgB,CAACC,IAAI,CAAC,mBAAmB,EAAE;UAAEN;QAAM,CAAC,CAAC;MACvD,CAAC,MAAM,IAAIE,QAAQ,CAACE,MAAM,KAAK,YAAY,EAAE;QAC3CC,uCAAgB,CAACC,IAAI,CAAC,gBAAgB,EAAE;UAAEN;QAAM,CAAC,CAAC;MACpD;IACF,CAAC,CAAC,OAAOO,CAAM,EAAE;MACf,MAAMC,WAAW,GAAGd,qCAAc,CAACe,UAAU,CAACF,CAAC,CAAC;MAChD,IAAIC,WAAW,EAAEE,QAAQ,CAAC,aAAa,CAAC,EAAE;QACxC1B,QAAQ,CAAC,2BAA2B,CAAC;MACvC,CAAC,MAAM;QACL2B,sCAAe,CAACC,SAAS,CAACJ,WAAW,CAAC;MACxC;IACF,CAAC,SAAS;MACR3B,eAAe,CAAC,KAAK,CAAC;IACxB;EACF,CAAC;EAED,oBACEgC,KAAA,CAAAC,aAAA,CAAC1C,oBAAA,CAAA2C,QAAQ;IAACC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;EAAE,gBACtCH,KAAA,CAAAC,aAAA,CAAC1C,oBAAA,CAAA6C,UAAU;IACTC,QAAQ,EAAEnB,aAAc;IACxBoB,OAAO,EAAExB,YAAa;IACtBpB,OAAO,EAAEK,YAAY,IAAIL,OAAQ;IACjC6C,YAAY,EAAErC,KAAM;IACpBS,YAAY,EAAEA,YAAa;IAC3B6B,aAAa,EAAEpC;EAAa,CAC7B,CACO,CAAC;AAEf"}