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

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 (113) hide show
  1. package/lib/commonjs/AppKit.js +6 -1
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/connectors/WalletConnectConnector.js +1 -1
  4. package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
  5. package/lib/commonjs/index.js +9 -58
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/modal/w3m-modal/index.js +1 -14
  8. package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
  9. package/lib/commonjs/modal/w3m-router/index.js +1 -7
  10. package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
  11. package/lib/commonjs/partials/w3m-header/index.js +3 -12
  12. package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
  13. package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js +1 -1
  14. package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
  15. package/lib/commonjs/views/w3m-connect-socials-view/index.js +3 -10
  16. package/lib/commonjs/views/w3m-connect-socials-view/index.js.map +1 -1
  17. package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js +3 -7
  18. package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js.map +1 -1
  19. package/lib/commonjs/views/w3m-connect-view/index.js +9 -32
  20. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  21. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +2 -0
  22. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
  23. package/lib/commonjs/views/w3m-connecting-social-view/index.js +39 -61
  24. package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
  25. package/lib/commonjs/views/w3m-connecting-view/index.js +0 -13
  26. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  27. package/lib/module/AppKit.js +6 -1
  28. package/lib/module/AppKit.js.map +1 -1
  29. package/lib/module/connectors/WalletConnectConnector.js +1 -1
  30. package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
  31. package/lib/module/index.js +11 -6
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/modal/w3m-modal/index.js +2 -15
  34. package/lib/module/modal/w3m-modal/index.js.map +1 -1
  35. package/lib/module/modal/w3m-router/index.js +1 -7
  36. package/lib/module/modal/w3m-router/index.js.map +1 -1
  37. package/lib/module/partials/w3m-header/index.js +4 -13
  38. package/lib/module/partials/w3m-header/index.js.map +1 -1
  39. package/lib/module/views/w3m-account-default-view/components/auth-buttons.js +1 -1
  40. package/lib/module/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
  41. package/lib/module/views/w3m-connect-socials-view/index.js +4 -11
  42. package/lib/module/views/w3m-connect-socials-view/index.js.map +1 -1
  43. package/lib/module/views/w3m-connect-view/components/social-login-list.js +4 -8
  44. package/lib/module/views/w3m-connect-view/components/social-login-list.js.map +1 -1
  45. package/lib/module/views/w3m-connect-view/index.js +11 -34
  46. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  47. package/lib/module/views/w3m-connecting-siwe-view/index.js +2 -0
  48. package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
  49. package/lib/module/views/w3m-connecting-social-view/index.js +41 -63
  50. package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
  51. package/lib/module/views/w3m-connecting-view/index.js +1 -14
  52. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  53. package/lib/typescript/AppKit.d.ts.map +1 -1
  54. package/lib/typescript/index.d.ts +7 -6
  55. package/lib/typescript/index.d.ts.map +1 -1
  56. package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
  57. package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
  58. package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
  59. package/lib/typescript/views/w3m-connect-socials-view/index.d.ts.map +1 -1
  60. package/lib/typescript/views/w3m-connect-view/components/social-login-list.d.ts.map +1 -1
  61. package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
  62. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
  63. package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
  64. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  65. package/package.json +5 -5
  66. package/src/AppKit.ts +11 -2
  67. package/src/connectors/WalletConnectConnector.ts +1 -1
  68. package/src/index.ts +10 -10
  69. package/src/modal/w3m-modal/index.tsx +0 -12
  70. package/src/modal/w3m-router/index.tsx +1 -7
  71. package/src/partials/w3m-header/index.tsx +5 -22
  72. package/src/views/w3m-account-default-view/components/auth-buttons.tsx +1 -1
  73. package/src/views/w3m-connect-socials-view/index.tsx +3 -14
  74. package/src/views/w3m-connect-view/components/social-login-list.tsx +2 -14
  75. package/src/views/w3m-connect-view/index.tsx +9 -25
  76. package/src/views/w3m-connecting-siwe-view/index.tsx +1 -0
  77. package/src/views/w3m-connecting-social-view/index.tsx +44 -96
  78. package/src/views/w3m-connecting-view/index.tsx +1 -19
  79. package/lib/commonjs/views/w3m-connect-view/components/connect-email-input.js +0 -73
  80. package/lib/commonjs/views/w3m-connect-view/components/connect-email-input.js.map +0 -1
  81. package/lib/commonjs/views/w3m-connect-view/components/wallet-guide.js +0 -55
  82. package/lib/commonjs/views/w3m-connect-view/components/wallet-guide.js.map +0 -1
  83. package/lib/commonjs/views/w3m-connecting-farcaster-view/index.js +0 -124
  84. package/lib/commonjs/views/w3m-connecting-farcaster-view/index.js.map +0 -1
  85. package/lib/commonjs/views/w3m-connecting-farcaster-view/styles.js +0 -24
  86. package/lib/commonjs/views/w3m-connecting-farcaster-view/styles.js.map +0 -1
  87. package/lib/commonjs/views/w3m-create-view/index.js +0 -57
  88. package/lib/commonjs/views/w3m-create-view/index.js.map +0 -1
  89. package/lib/module/views/w3m-connect-view/components/connect-email-input.js +0 -67
  90. package/lib/module/views/w3m-connect-view/components/connect-email-input.js.map +0 -1
  91. package/lib/module/views/w3m-connect-view/components/wallet-guide.js +0 -49
  92. package/lib/module/views/w3m-connect-view/components/wallet-guide.js.map +0 -1
  93. package/lib/module/views/w3m-connecting-farcaster-view/index.js +0 -117
  94. package/lib/module/views/w3m-connecting-farcaster-view/index.js.map +0 -1
  95. package/lib/module/views/w3m-connecting-farcaster-view/styles.js +0 -18
  96. package/lib/module/views/w3m-connecting-farcaster-view/styles.js.map +0 -1
  97. package/lib/module/views/w3m-create-view/index.js +0 -51
  98. package/lib/module/views/w3m-create-view/index.js.map +0 -1
  99. package/lib/typescript/views/w3m-connect-view/components/connect-email-input.d.ts +0 -6
  100. package/lib/typescript/views/w3m-connect-view/components/connect-email-input.d.ts.map +0 -1
  101. package/lib/typescript/views/w3m-connect-view/components/wallet-guide.d.ts +0 -5
  102. package/lib/typescript/views/w3m-connect-view/components/wallet-guide.d.ts.map +0 -1
  103. package/lib/typescript/views/w3m-connecting-farcaster-view/index.d.ts +0 -2
  104. package/lib/typescript/views/w3m-connecting-farcaster-view/index.d.ts.map +0 -1
  105. package/lib/typescript/views/w3m-connecting-farcaster-view/styles.d.ts +0 -17
  106. package/lib/typescript/views/w3m-connecting-farcaster-view/styles.d.ts.map +0 -1
  107. package/lib/typescript/views/w3m-create-view/index.d.ts +0 -2
  108. package/lib/typescript/views/w3m-create-view/index.d.ts.map +0 -1
  109. package/src/views/w3m-connect-view/components/connect-email-input.tsx +0 -69
  110. package/src/views/w3m-connect-view/components/wallet-guide.tsx +0 -50
  111. package/src/views/w3m-connecting-farcaster-view/index.tsx +0 -140
  112. package/src/views/w3m-connecting-farcaster-view/styles.ts +0 -18
  113. package/src/views/w3m-create-view/index.tsx +0 -35
@@ -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
  );
@@ -4,16 +4,13 @@ import {
4
4
  ConnectionController,
5
5
  ConstantsUtil,
6
6
  CoreHelperUtil,
7
- ModalController,
8
7
  RouterController,
9
8
  SnackController,
10
9
  type Platform,
11
10
  OptionsController,
12
11
  ApiController,
13
- EventsController,
14
- ConnectionsController
12
+ EventsController
15
13
  } from '@reown/appkit-core-react-native';
16
- import { SIWEController } from '@reown/appkit-siwe-react-native';
17
14
  import { useAppKit } from '../../AppKitContext';
18
15
  import { ConnectingQrCode } from '../../partials/w3m-connecting-qrcode';
19
16
  import { ConnectingMobile } from '../../partials/w3m-connecting-mobile';
@@ -59,21 +56,6 @@ export function ConnectingView() {
59
56
  });
60
57
  }
61
58
  ConnectionController.setWcPromise(connectPromise);
62
- await connectPromise;
63
- // ConnectorController.setConnectedConnector('WALLET_CONNECT');
64
-
65
- if (
66
- OptionsController.state.isSiweEnabled &&
67
- ConnectionsController.state.activeNamespace === 'eip155'
68
- ) {
69
- if (SIWEController.state.status === 'success') {
70
- ModalController.close();
71
- } else {
72
- RouterController.push('ConnectingSiwe');
73
- }
74
- } else {
75
- ModalController.close();
76
- }
77
59
  }
78
60
  } catch (error) {
79
61
  ConnectionController.setWcError(true);
@@ -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"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.WalletGuide = WalletGuide;
7
- var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
8
- var _appkitUiReactNative = require("@reown/appkit-ui-react-native");
9
- var _reactNative = require("react-native");
10
- function WalletGuide({
11
- guide
12
- }) {
13
- const onExplorerPress = () => {
14
- _reactNative.Linking.openURL('https://explorer.walletconnect.com');
15
- };
16
- const onGetStartedPress = () => {
17
- _appkitCoreReactNative.RouterController.push('Create');
18
- };
19
- return guide === 'explore' ? /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
20
- alignItems: "center",
21
- justifyContent: "center"
22
- }, /*#__PURE__*/React.createElement(_appkitUiReactNative.Separator, {
23
- text: "or",
24
- style: styles.socialSeparator
25
- }), /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
26
- variant: "small-400",
27
- style: styles.text
28
- }, "Looking for a self-custody wallet?"), /*#__PURE__*/React.createElement(_appkitUiReactNative.Chip, {
29
- label: "Visit our explorer",
30
- variant: "transparent",
31
- rightIcon: "externalLink",
32
- leftIcon: "walletConnectLightBrown",
33
- size: "sm",
34
- onPress: onExplorerPress
35
- })) : /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
36
- alignItems: "center",
37
- justifyContent: "center",
38
- margin: "m",
39
- flexDirection: "row"
40
- }, /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
41
- variant: "small-400"
42
- }, "Haven't got a wallet?"), /*#__PURE__*/React.createElement(_appkitUiReactNative.Link, {
43
- onPress: onGetStartedPress,
44
- size: "sm"
45
- }, "Get started"));
46
- }
47
- const styles = _reactNative.StyleSheet.create({
48
- text: {
49
- marginBottom: _appkitUiReactNative.Spacing.xs
50
- },
51
- socialSeparator: {
52
- marginVertical: _appkitUiReactNative.Spacing.l
53
- }
54
- });
55
- //# sourceMappingURL=wallet-guide.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_appkitCoreReactNative","require","_appkitUiReactNative","_reactNative","WalletGuide","guide","onExplorerPress","Linking","openURL","onGetStartedPress","RouterController","push","React","createElement","FlexView","alignItems","justifyContent","Separator","text","style","styles","socialSeparator","Text","variant","Chip","label","rightIcon","leftIcon","size","onPress","margin","flexDirection","Link","StyleSheet","create","marginBottom","Spacing","xs","marginVertical","l"],"sourceRoot":"../../../../../src","sources":["views/w3m-connect-view/components/wallet-guide.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMO,SAASG,WAAWA,CAAC;EAAEC;AAAwB,CAAC,EAAE;EACvD,MAAMC,eAAe,GAAGA,CAAA,KAAM;IAC5BC,oBAAO,CAACC,OAAO,CAAC,oCAAoC,CAAC;EACvD,CAAC;EAED,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;IAC9BC,uCAAgB,CAACC,IAAI,CAAC,QAAQ,CAAC;EACjC,CAAC;EAED,OAAON,KAAK,KAAK,SAAS,gBACxBO,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAY,QAAQ;IAACC,UAAU,EAAC,QAAQ;IAACC,cAAc,EAAC;EAAQ,gBACnDJ,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAe,SAAS;IAACC,IAAI,EAAC,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC;EAAgB,CAAE,CAAC,eACtDT,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAoB,IAAI;IAACC,OAAO,EAAC,WAAW;IAACJ,KAAK,EAAEC,MAAM,CAACF;EAAK,GAAC,oCAExC,CAAC,eACPN,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAsB,IAAI;IACHC,KAAK,EAAC,oBAAoB;IAC1BF,OAAO,EAAC,aAAa;IACrBG,SAAS,EAAC,cAAc;IACxBC,QAAQ,EAAC,yBAAyB;IAClCC,IAAI,EAAC,IAAI;IACTC,OAAO,EAAEvB;EAAgB,CAC1B,CACO,CAAC,gBAEXM,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAY,QAAQ;IAACC,UAAU,EAAC,QAAQ;IAACC,cAAc,EAAC,QAAQ;IAACc,MAAM,EAAC,GAAG;IAACC,aAAa,EAAC;EAAK,gBAClFnB,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAAoB,IAAI;IAACC,OAAO,EAAC;EAAW,GAAC,uBAA2B,CAAC,eACtDX,KAAA,CAAAC,aAAA,CAACX,oBAAA,CAAA8B,IAAI;IAACH,OAAO,EAAEpB,iBAAkB;IAACmB,IAAI,EAAC;EAAI,GAAC,aAEtC,CACE,CACX;AACH;AAEA,MAAMR,MAAM,GAAGa,uBAAU,CAACC,MAAM,CAAC;EAC/BhB,IAAI,EAAE;IACJiB,YAAY,EAAEC,4BAAO,CAACC;EACxB,CAAC;EACDhB,eAAe,EAAE;IACfiB,cAAc,EAAEF,4BAAO,CAACG;EAC1B;AACF,CAAC,CAAC"}
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ConnectingFarcasterView = ConnectingFarcasterView;
7
- var _reactNative = require("react-native");
8
- var _react = require("react");
9
- var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
10
- var _appkitUiReactNative = require("@reown/appkit-ui-react-native");
11
- var _useCustomDimensions = require("../../hooks/useCustomDimensions");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function ConnectingFarcasterView() {
15
- const {
16
- maxWidth: width
17
- } = (0, _useCustomDimensions.useCustomDimensions)();
18
- const authConnector = _appkitCoreReactNative.ConnectorController.getAuthConnector();
19
- const [error, setError] = (0, _react.useState)(false);
20
- const [processing, setProcessing] = (0, _react.useState)(false);
21
- const [url, setUrl] = (0, _react.useState)();
22
- const showCopy = _appkitCoreReactNative.OptionsController.isClipboardAvailable();
23
- const provider = authConnector?.provider;
24
- const onConnect = (0, _react.useCallback)(async () => {
25
- try {
26
- if (provider && authConnector) {
27
- setError(false);
28
- const {
29
- url: farcasterUrl
30
- } = await provider.getFarcasterUri();
31
- setUrl(farcasterUrl);
32
- _reactNative.Linking.openURL(farcasterUrl);
33
- await provider.connectFarcaster();
34
- _appkitCoreReactNative.EventsController.sendEvent({
35
- type: 'track',
36
- event: 'SOCIAL_LOGIN_REQUEST_USER_DATA',
37
- properties: {
38
- provider: 'farcaster'
39
- }
40
- });
41
- setProcessing(true);
42
- await _appkitCoreReactNative.ConnectionController.connectExternal(authConnector);
43
- _appkitCoreReactNative.ConnectionController.setConnectedSocialProvider('farcaster');
44
- _appkitCoreReactNative.EventsController.sendEvent({
45
- type: 'track',
46
- event: 'SOCIAL_LOGIN_SUCCESS',
47
- properties: {
48
- provider: 'farcaster'
49
- }
50
- });
51
- setProcessing(false);
52
- _appkitCoreReactNative.ModalController.close();
53
- }
54
- } catch (e) {
55
- _appkitCoreReactNative.EventsController.sendEvent({
56
- type: 'track',
57
- event: 'SOCIAL_LOGIN_ERROR',
58
- properties: {
59
- provider: 'farcaster'
60
- }
61
- });
62
- // TODO: remove this once Farcaster session refresh is implemented
63
- // @ts-expect-error
64
- provider?.webviewRef?.current?.reload();
65
- _appkitCoreReactNative.SnackController.showError('Something went wrong');
66
- setError(true);
67
- setProcessing(false);
68
- }
69
- }, [provider, authConnector]);
70
- const onCopyUrl = () => {
71
- if (url) {
72
- _appkitCoreReactNative.OptionsController.copyToClipboard(url);
73
- _appkitCoreReactNative.SnackController.showSuccess('Link copied');
74
- }
75
- };
76
- (0, _react.useEffect)(() => {
77
- return () => {
78
- // TODO: remove this once Farcaster session refresh is implemented
79
- if (!_appkitCoreReactNative.ModalController.state.open) {
80
- // @ts-expect-error
81
- provider.webviewRef?.current?.reload();
82
- }
83
- };
84
- // @ts-expect-error
85
- }, [provider.webviewRef]);
86
- (0, _react.useEffect)(() => {
87
- onConnect();
88
- }, [onConnect]);
89
- return /*#__PURE__*/React.createElement(_appkitUiReactNative.FlexView, {
90
- alignItems: "center",
91
- alignSelf: "center",
92
- padding: ['2xl', 'l', '3xl', 'l'],
93
- style: {
94
- width
95
- }
96
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_appkitUiReactNative.LoadingThumbnail, {
97
- paused: !!error
98
- }, /*#__PURE__*/React.createElement(_appkitUiReactNative.Logo, {
99
- logo: "farcasterSquare",
100
- height: 72,
101
- width: 72
102
- }), error && /*#__PURE__*/React.createElement(_appkitUiReactNative.IconBox, {
103
- icon: 'close',
104
- border: true,
105
- background: true,
106
- backgroundColor: "icon-box-bg-error-100",
107
- size: "sm",
108
- iconColor: "error-100",
109
- style: _styles.default.errorIcon
110
- })), /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
111
- style: _styles.default.continueText,
112
- variant: "paragraph-500"
113
- }, processing ? 'Loading user data' : 'Continue in Farcaster'), /*#__PURE__*/React.createElement(_appkitUiReactNative.Text, {
114
- variant: "small-400",
115
- color: "fg-200"
116
- }, processing ? 'Please wait a moment while we load your data' : 'Connect in the Farcaster app'), showCopy && /*#__PURE__*/React.createElement(_appkitUiReactNative.Link, {
117
- iconLeft: "copySmall",
118
- color: "fg-200",
119
- style: _styles.default.copyButton,
120
- onPress: onCopyUrl,
121
- testID: "copy-link"
122
- }, "Copy link")));
123
- }
124
- //# sourceMappingURL=index.js.map