@reown/appkit-react-native 0.0.0-feat-multi-social-20250701154123 → 0.0.0-feat-multi-social-20250701185040
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/lib/commonjs/AppKit.js +8 -5
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +6 -0
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +0 -6
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +0 -2
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js +14 -7
- package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js.map +1 -1
- package/lib/module/AppKit.js +8 -5
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +6 -0
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +0 -6
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +0 -2
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/social-login-list.js +14 -7
- package/lib/module/views/w3m-connect-view/components/social-login-list.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +1 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +2 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +0 -9
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/components/social-login-list.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +12 -7
- package/src/connectors/WalletConnectConnector.ts +11 -2
- package/src/modal/w3m-router/index.tsx +0 -6
- package/src/partials/w3m-header/index.tsx +0 -2
- package/src/views/w3m-connect-view/components/social-login-list.tsx +13 -5
- package/lib/commonjs/views/w3m-email-verify-device-view/index.js +0 -106
- package/lib/commonjs/views/w3m-email-verify-device-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-email-verify-device-view/styles.js +0 -25
- package/lib/commonjs/views/w3m-email-verify-device-view/styles.js.map +0 -1
- package/lib/commonjs/views/w3m-email-verify-otp-view/index.js +0 -86
- package/lib/commonjs/views/w3m-email-verify-otp-view/index.js.map +0 -1
- package/lib/module/views/w3m-email-verify-device-view/index.js +0 -99
- package/lib/module/views/w3m-email-verify-device-view/index.js.map +0 -1
- package/lib/module/views/w3m-email-verify-device-view/styles.js +0 -19
- package/lib/module/views/w3m-email-verify-device-view/styles.js.map +0 -1
- package/lib/module/views/w3m-email-verify-otp-view/index.js +0 -79
- package/lib/module/views/w3m-email-verify-otp-view/index.js.map +0 -1
- package/lib/typescript/views/w3m-email-verify-device-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-email-verify-device-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-email-verify-device-view/styles.d.ts +0 -18
- package/lib/typescript/views/w3m-email-verify-device-view/styles.d.ts.map +0 -1
- package/lib/typescript/views/w3m-email-verify-otp-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-email-verify-otp-view/index.d.ts.map +0 -1
- package/src/views/w3m-email-verify-device-view/index.tsx +0 -80
- package/src/views/w3m-email-verify-device-view/styles.ts +0 -19
- package/src/views/w3m-email-verify-otp-view/index.tsx +0 -75
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { FlexView, Icon, Link, Text, useTheme } from '@reown/appkit-ui-react-native';
|
|
5
|
-
import { ConnectorController, CoreHelperUtil, EventsController, RouterController, SnackController } from '@reown/appkit-core-react-native';
|
|
6
|
-
import useTimeout from '../../hooks/useTimeout';
|
|
7
|
-
import styles from './styles';
|
|
8
|
-
export function EmailVerifyDeviceView() {
|
|
9
|
-
const Theme = useTheme();
|
|
10
|
-
const {
|
|
11
|
-
connectors
|
|
12
|
-
} = useSnapshot(ConnectorController.state);
|
|
13
|
-
const {
|
|
14
|
-
data
|
|
15
|
-
} = RouterController.state;
|
|
16
|
-
const {
|
|
17
|
-
timeLeft,
|
|
18
|
-
startTimer
|
|
19
|
-
} = useTimeout(0);
|
|
20
|
-
const [loading, setLoading] = useState(false);
|
|
21
|
-
const authProvider = connectors.find(c => c.type === 'AUTH')?.provider;
|
|
22
|
-
const listenForDeviceApproval = async () => {
|
|
23
|
-
if (authProvider && data?.email) {
|
|
24
|
-
try {
|
|
25
|
-
await authProvider.connectDevice();
|
|
26
|
-
EventsController.sendEvent({
|
|
27
|
-
type: 'track',
|
|
28
|
-
event: 'DEVICE_REGISTERED_FOR_EMAIL'
|
|
29
|
-
});
|
|
30
|
-
EventsController.sendEvent({
|
|
31
|
-
type: 'track',
|
|
32
|
-
event: 'EMAIL_VERIFICATION_CODE_SENT'
|
|
33
|
-
});
|
|
34
|
-
RouterController.replace('EmailVerifyOtp', {
|
|
35
|
-
email: data.email
|
|
36
|
-
});
|
|
37
|
-
} catch (error) {
|
|
38
|
-
RouterController.goBack();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const onResendEmail = async () => {
|
|
43
|
-
try {
|
|
44
|
-
if (!data?.email || !authProvider) return;
|
|
45
|
-
setLoading(true);
|
|
46
|
-
authProvider?.connectEmail({
|
|
47
|
-
email: data.email
|
|
48
|
-
});
|
|
49
|
-
listenForDeviceApproval();
|
|
50
|
-
SnackController.showSuccess('Link resent');
|
|
51
|
-
startTimer(30);
|
|
52
|
-
setLoading(false);
|
|
53
|
-
} catch (e) {
|
|
54
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
55
|
-
SnackController.showError(parsedError);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
listenForDeviceApproval();
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
}, []);
|
|
62
|
-
return /*#__PURE__*/React.createElement(FlexView, {
|
|
63
|
-
alignItems: "center",
|
|
64
|
-
padding: ['0', '4xl', '3xl', '4xl']
|
|
65
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
66
|
-
style: [styles.iconContainer, {
|
|
67
|
-
backgroundColor: Theme['accent-glass-010']
|
|
68
|
-
}]
|
|
69
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
70
|
-
name: "verify",
|
|
71
|
-
size: "lg",
|
|
72
|
-
height: 28,
|
|
73
|
-
width: 28,
|
|
74
|
-
color: "accent-100"
|
|
75
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
76
|
-
center: true,
|
|
77
|
-
variant: "medium-600",
|
|
78
|
-
style: styles.headingText
|
|
79
|
-
}, "Register this device to continue"), /*#__PURE__*/React.createElement(Text, {
|
|
80
|
-
center: true,
|
|
81
|
-
variant: "paragraph-400"
|
|
82
|
-
}, "Check the instructions sent to", ' '), /*#__PURE__*/React.createElement(Text, {
|
|
83
|
-
variant: "paragraph-500"
|
|
84
|
-
}, data?.email ?? 'your email'), /*#__PURE__*/React.createElement(Text, {
|
|
85
|
-
variant: "small-400",
|
|
86
|
-
color: "fg-200",
|
|
87
|
-
style: styles.expiryText
|
|
88
|
-
}, "The link expires in 20 minutes"), /*#__PURE__*/React.createElement(FlexView, {
|
|
89
|
-
alignItems: "center",
|
|
90
|
-
justifyContent: "center",
|
|
91
|
-
flexDirection: "row"
|
|
92
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
93
|
-
variant: "small-400"
|
|
94
|
-
}, "Didn't receive it?"), /*#__PURE__*/React.createElement(Link, {
|
|
95
|
-
onPress: onResendEmail,
|
|
96
|
-
disabled: timeLeft > 0 || loading
|
|
97
|
-
}, timeLeft > 0 ? `Resend in ${timeLeft}s` : 'Resend link')));
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSnapshot","View","useEffect","useState","FlexView","Icon","Link","Text","useTheme","ConnectorController","CoreHelperUtil","EventsController","RouterController","SnackController","useTimeout","styles","EmailVerifyDeviceView","Theme","connectors","state","data","timeLeft","startTimer","loading","setLoading","authProvider","find","c","type","provider","listenForDeviceApproval","email","connectDevice","sendEvent","event","replace","error","goBack","onResendEmail","connectEmail","showSuccess","e","parsedError","parseError","showError","React","createElement","alignItems","padding","style","iconContainer","backgroundColor","name","size","height","width","color","center","variant","headingText","expiryText","justifyContent","flexDirection","onPress","disabled"],"sourceRoot":"../../../../src","sources":["views/w3m-email-verify-device-view/index.tsx"],"mappings":"AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,+BAA+B;AACpF,SACEC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,QAEV,iCAAiC;AACxC,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,MAAM,MAAM,UAAU;AAE7B,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAGT,QAAQ,CAAC,CAAC;EACxB,MAAM;IAAEU;EAAW,CAAC,GAAGlB,WAAW,CAACS,mBAAmB,CAACU,KAAK,CAAC;EAC7D,MAAM;IAAEC;EAAK,CAAC,GAAGR,gBAAgB,CAACO,KAAK;EACvC,MAAM;IAAEE,QAAQ;IAAEC;EAAW,CAAC,GAAGR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AACc,cAAc,EAAC,QAAQ;IAACC,aAAa,EAAC;EAAK,gBACvEjB,KAAA,CAAAC,aAAA,CAACvC,IAAI;IAACmD,OAAO,EAAC;EAAW,GAAC,oBAAwB,CAAC,eACnDb,KAAA,CAAAC,aAAA,CAACxC,IAAI;IAACyD,OAAO,EAAEzB,aAAc;IAAC0B,QAAQ,EAAE3C,QAAQ,GAAG,CAAC,IAAIE;EAAQ,GAC7DF,QAAQ,GAAG,CAAC,GAAI,aAAYA,QAAS,GAAE,GAAG,aACvC,CACE,CACF,CAAC;AAEf"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Spacing } from '@reown/appkit-ui-react-native';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
export default StyleSheet.create({
|
|
4
|
-
iconContainer: {
|
|
5
|
-
height: 64,
|
|
6
|
-
width: 64,
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
borderRadius: Spacing.xl,
|
|
10
|
-
marginBottom: Spacing['2xl']
|
|
11
|
-
},
|
|
12
|
-
headingText: {
|
|
13
|
-
marginBottom: Spacing.s
|
|
14
|
-
},
|
|
15
|
-
expiryText: {
|
|
16
|
-
marginVertical: Spacing.l
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Spacing","StyleSheet","create","iconContainer","height","width","justifyContent","alignItems","borderRadius","xl","marginBottom","headingText","s","expiryText","marginVertical","l"],"sourceRoot":"../../../../src","sources":["views/w3m-email-verify-device-view/styles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,+BAA+B;AACvD,SAASC,UAAU,QAAQ,cAAc;AAEzC,eAAeA,UAAU,CAACC,MAAM,CAAC;EAC/BC,aAAa,EAAE;IACbC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,EAAE;IACTC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAER,OAAO,CAACS,EAAE;IACxBC,YAAY,EAAEV,OAAO,CAAC,KAAK;EAC7B,CAAC;EACDW,WAAW,EAAE;IACXD,YAAY,EAAEV,OAAO,CAACY;EACxB,CAAC;EACDC,UAAU,EAAE;IACVC,cAAc,EAAEd,OAAO,CAACe;EAC1B;AACF,CAAC,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { ConnectionController, ConnectorController, CoreHelperUtil, EventsController, ModalController, RouterController, SnackController } from '@reown/appkit-core-react-native';
|
|
3
|
-
import useTimeout from '../../hooks/useTimeout';
|
|
4
|
-
import { OtpCodeView } from '../../partials/w3m-otp-code';
|
|
5
|
-
export function EmailVerifyOtpView() {
|
|
6
|
-
const {
|
|
7
|
-
timeLeft,
|
|
8
|
-
startTimer
|
|
9
|
-
} = useTimeout(0);
|
|
10
|
-
const {
|
|
11
|
-
data
|
|
12
|
-
} = RouterController.state;
|
|
13
|
-
const [loading, setLoading] = useState(false);
|
|
14
|
-
const [error, setError] = useState('');
|
|
15
|
-
const authConnector = ConnectorController.getAuthConnector();
|
|
16
|
-
const onOtpResend = async () => {
|
|
17
|
-
try {
|
|
18
|
-
if (!data?.email || !authConnector) return;
|
|
19
|
-
setLoading(true);
|
|
20
|
-
const provider = authConnector?.provider;
|
|
21
|
-
await provider.connectEmail({
|
|
22
|
-
email: data.email
|
|
23
|
-
});
|
|
24
|
-
SnackController.showSuccess('Code resent');
|
|
25
|
-
startTimer(30);
|
|
26
|
-
setLoading(false);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
29
|
-
SnackController.showError(parsedError);
|
|
30
|
-
setLoading(false);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const onOtpSubmit = async otp => {
|
|
34
|
-
if (!authConnector) return;
|
|
35
|
-
setLoading(true);
|
|
36
|
-
setError('');
|
|
37
|
-
try {
|
|
38
|
-
const provider = authConnector?.provider;
|
|
39
|
-
await provider.connectOtp({
|
|
40
|
-
otp
|
|
41
|
-
});
|
|
42
|
-
EventsController.sendEvent({
|
|
43
|
-
type: 'track',
|
|
44
|
-
event: 'EMAIL_VERIFICATION_CODE_PASS'
|
|
45
|
-
});
|
|
46
|
-
await ConnectionController.connectExternal(authConnector);
|
|
47
|
-
ModalController.close();
|
|
48
|
-
EventsController.sendEvent({
|
|
49
|
-
type: 'track',
|
|
50
|
-
event: 'CONNECT_SUCCESS',
|
|
51
|
-
properties: {
|
|
52
|
-
method: 'email',
|
|
53
|
-
name: authConnector.name || 'Unknown'
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
} catch (e) {
|
|
57
|
-
EventsController.sendEvent({
|
|
58
|
-
type: 'track',
|
|
59
|
-
event: 'EMAIL_VERIFICATION_CODE_FAIL'
|
|
60
|
-
});
|
|
61
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
62
|
-
if (parsedError?.includes('Invalid code')) {
|
|
63
|
-
setError('Invalid code. Try again.');
|
|
64
|
-
} else {
|
|
65
|
-
SnackController.showError(parsedError);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
setLoading(false);
|
|
69
|
-
};
|
|
70
|
-
return /*#__PURE__*/React.createElement(OtpCodeView, {
|
|
71
|
-
loading: loading,
|
|
72
|
-
error: error,
|
|
73
|
-
timeLeft: timeLeft,
|
|
74
|
-
email: data?.email,
|
|
75
|
-
onRetry: onOtpResend,
|
|
76
|
-
onSubmit: onOtpSubmit
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useState","ConnectionController","ConnectorController","CoreHelperUtil","EventsController","ModalController","RouterController","SnackController","useTimeout","OtpCodeView","EmailVerifyOtpView","timeLeft","startTimer","data","state","loading","setLoading","error","setError","authConnector","getAuthConnector","onOtpResend","email","provider","connectEmail","showSuccess","e","parsedError","parseError","showError","onOtpSubmit","otp","connectOtp","sendEvent","type","event","connectExternal","close","properties","method","name","includes","React","createElement","onRetry","onSubmit"],"sourceRoot":"../../../../src","sources":["views/w3m-email-verify-otp-view/index.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,cAAc,EACdC,gBAAgB,EAChBC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,QAEV,iCAAiC;AACxC,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,6BAA6B;AAEzD,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGJ,UAAU,CAAC,CAAC,CAAC;EAC9C,MAAM;IAAEK;EAAK,CAAC,GAAGP,gBAAgB,CAACQ,KAAK;EACvC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAAM,CAACiB,KAAK,EAAEC,QAAQ,CAAC,GAAGlB,QAAQ,CAAC,EAAE,CAAC;EACtC,MAAMmB,aAAa,GAAGjB,mBAAmB,CAACkB,gBAAgB,CAAC,CAAC;EAE5D,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAAY;IAC9B,IAAI;MACF,IAAI,CAACR,IAAI,EAAES,KAAK,IAAI,CAACH,aAAa,EAAE;MACpCH,UAAU,CAAC,IAAI,CAAC;MAChB,MAAMO,QAAQ,GAAGJ,aAAa,EAAEI,QAA+B;MAC/D,MAAMA,QAAQ,CAACC,YAAY,CAAC;QAAEF,KAAK,EAAET,IAAI,CAACS;MAAM,CAAC,CAAC;MAClDf,eAAe,CAACkB,WAAW,CAAC,aAAa,CAAC;MAC1Cb,UAAU,CAAC,EAAE,CAAC;MACdI,UAAU,CAAC,KAAK,CAAC;IACnB,CAAC,CAAC,OAAOU,CAAC,EAAE;MACV,MAA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,KAAA,CAAAC,aAAA,CAAClC,WAAW;IACVM,OAAO,EAAEA,OAAQ;IACjBE,KAAK,EAAEA,KAAM;IACbN,QAAQ,EAAEA,QAAS;IACnBW,KAAK,EAAET,IAAI,EAAES,KAAM;IACnBsB,OAAO,EAAEvB,WAAY;IACrBwB,QAAQ,EAAEf;EAAY,CACvB,CAAC;AAEN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-email-verify-device-view/index.tsx"],"names":[],"mappings":"AAeA,wBAAgB,qBAAqB,4CAgEpC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
iconContainer: {
|
|
3
|
-
height: number;
|
|
4
|
-
width: number;
|
|
5
|
-
justifyContent: "center";
|
|
6
|
-
alignItems: "center";
|
|
7
|
-
borderRadius: number;
|
|
8
|
-
marginBottom: number;
|
|
9
|
-
};
|
|
10
|
-
headingText: {
|
|
11
|
-
marginBottom: number;
|
|
12
|
-
};
|
|
13
|
-
expiryText: {
|
|
14
|
-
marginVertical: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-email-verify-device-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,wBAeG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-email-verify-otp-view/index.tsx"],"names":[],"mappings":"AAcA,wBAAgB,kBAAkB,4CA4DjC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { FlexView, Icon, Link, Text, useTheme } from '@reown/appkit-ui-react-native';
|
|
5
|
-
import {
|
|
6
|
-
ConnectorController,
|
|
7
|
-
CoreHelperUtil,
|
|
8
|
-
EventsController,
|
|
9
|
-
RouterController,
|
|
10
|
-
SnackController,
|
|
11
|
-
type AppKitFrameProvider
|
|
12
|
-
} from '@reown/appkit-core-react-native';
|
|
13
|
-
import useTimeout from '../../hooks/useTimeout';
|
|
14
|
-
import styles from './styles';
|
|
15
|
-
|
|
16
|
-
export function EmailVerifyDeviceView() {
|
|
17
|
-
const Theme = useTheme();
|
|
18
|
-
const { connectors } = useSnapshot(ConnectorController.state);
|
|
19
|
-
const { data } = RouterController.state;
|
|
20
|
-
const { timeLeft, startTimer } = useTimeout(0);
|
|
21
|
-
const [loading, setLoading] = useState(false);
|
|
22
|
-
const authProvider = connectors.find(c => c.type === 'AUTH')?.provider as AppKitFrameProvider;
|
|
23
|
-
|
|
24
|
-
const listenForDeviceApproval = async () => {
|
|
25
|
-
if (authProvider && data?.email) {
|
|
26
|
-
try {
|
|
27
|
-
await authProvider.connectDevice();
|
|
28
|
-
EventsController.sendEvent({ type: 'track', event: 'DEVICE_REGISTERED_FOR_EMAIL' });
|
|
29
|
-
EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_SENT' });
|
|
30
|
-
RouterController.replace('EmailVerifyOtp', { email: data.email });
|
|
31
|
-
} catch (error: any) {
|
|
32
|
-
RouterController.goBack();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const onResendEmail = async () => {
|
|
38
|
-
try {
|
|
39
|
-
if (!data?.email || !authProvider) return;
|
|
40
|
-
setLoading(true);
|
|
41
|
-
authProvider?.connectEmail({ email: data.email });
|
|
42
|
-
listenForDeviceApproval();
|
|
43
|
-
SnackController.showSuccess('Link resent');
|
|
44
|
-
startTimer(30);
|
|
45
|
-
setLoading(false);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
48
|
-
SnackController.showError(parsedError);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
listenForDeviceApproval();
|
|
54
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<FlexView alignItems="center" padding={['0', '4xl', '3xl', '4xl']}>
|
|
59
|
-
<View style={[styles.iconContainer, { backgroundColor: Theme['accent-glass-010'] }]}>
|
|
60
|
-
<Icon name="verify" size="lg" height={28} width={28} color="accent-100" />
|
|
61
|
-
</View>
|
|
62
|
-
<Text center variant="medium-600" style={styles.headingText}>
|
|
63
|
-
Register this device to continue
|
|
64
|
-
</Text>
|
|
65
|
-
<Text center variant="paragraph-400">
|
|
66
|
-
Check the instructions sent to{' '}
|
|
67
|
-
</Text>
|
|
68
|
-
<Text variant="paragraph-500">{data?.email ?? 'your email'}</Text>
|
|
69
|
-
<Text variant="small-400" color="fg-200" style={styles.expiryText}>
|
|
70
|
-
The link expires in 20 minutes
|
|
71
|
-
</Text>
|
|
72
|
-
<FlexView alignItems="center" justifyContent="center" flexDirection="row">
|
|
73
|
-
<Text variant="small-400">Didn't receive it?</Text>
|
|
74
|
-
<Link onPress={onResendEmail} disabled={timeLeft > 0 || loading}>
|
|
75
|
-
{timeLeft > 0 ? `Resend in ${timeLeft}s` : 'Resend link'}
|
|
76
|
-
</Link>
|
|
77
|
-
</FlexView>
|
|
78
|
-
</FlexView>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Spacing } from '@reown/appkit-ui-react-native';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
|
-
|
|
4
|
-
export default StyleSheet.create({
|
|
5
|
-
iconContainer: {
|
|
6
|
-
height: 64,
|
|
7
|
-
width: 64,
|
|
8
|
-
justifyContent: 'center',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
borderRadius: Spacing.xl,
|
|
11
|
-
marginBottom: Spacing['2xl']
|
|
12
|
-
},
|
|
13
|
-
headingText: {
|
|
14
|
-
marginBottom: Spacing.s
|
|
15
|
-
},
|
|
16
|
-
expiryText: {
|
|
17
|
-
marginVertical: Spacing.l
|
|
18
|
-
}
|
|
19
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ConnectionController,
|
|
4
|
-
ConnectorController,
|
|
5
|
-
CoreHelperUtil,
|
|
6
|
-
EventsController,
|
|
7
|
-
ModalController,
|
|
8
|
-
RouterController,
|
|
9
|
-
SnackController,
|
|
10
|
-
type AppKitFrameProvider
|
|
11
|
-
} from '@reown/appkit-core-react-native';
|
|
12
|
-
import useTimeout from '../../hooks/useTimeout';
|
|
13
|
-
import { OtpCodeView } from '../../partials/w3m-otp-code';
|
|
14
|
-
|
|
15
|
-
export function EmailVerifyOtpView() {
|
|
16
|
-
const { timeLeft, startTimer } = useTimeout(0);
|
|
17
|
-
const { data } = RouterController.state;
|
|
18
|
-
const [loading, setLoading] = useState(false);
|
|
19
|
-
const [error, setError] = useState('');
|
|
20
|
-
const authConnector = ConnectorController.getAuthConnector();
|
|
21
|
-
|
|
22
|
-
const onOtpResend = async () => {
|
|
23
|
-
try {
|
|
24
|
-
if (!data?.email || !authConnector) return;
|
|
25
|
-
setLoading(true);
|
|
26
|
-
const provider = authConnector?.provider as AppKitFrameProvider;
|
|
27
|
-
await provider.connectEmail({ email: data.email });
|
|
28
|
-
SnackController.showSuccess('Code resent');
|
|
29
|
-
startTimer(30);
|
|
30
|
-
setLoading(false);
|
|
31
|
-
} catch (e) {
|
|
32
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
33
|
-
SnackController.showError(parsedError);
|
|
34
|
-
setLoading(false);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const onOtpSubmit = async (otp: string) => {
|
|
39
|
-
if (!authConnector) return;
|
|
40
|
-
setLoading(true);
|
|
41
|
-
setError('');
|
|
42
|
-
try {
|
|
43
|
-
const provider = authConnector?.provider as AppKitFrameProvider;
|
|
44
|
-
await provider.connectOtp({ otp });
|
|
45
|
-
EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_PASS' });
|
|
46
|
-
await ConnectionController.connectExternal(authConnector);
|
|
47
|
-
ModalController.close();
|
|
48
|
-
EventsController.sendEvent({
|
|
49
|
-
type: 'track',
|
|
50
|
-
event: 'CONNECT_SUCCESS',
|
|
51
|
-
properties: { method: 'email', name: authConnector.name || 'Unknown' }
|
|
52
|
-
});
|
|
53
|
-
} catch (e) {
|
|
54
|
-
EventsController.sendEvent({ type: 'track', event: 'EMAIL_VERIFICATION_CODE_FAIL' });
|
|
55
|
-
const parsedError = CoreHelperUtil.parseError(e);
|
|
56
|
-
if (parsedError?.includes('Invalid code')) {
|
|
57
|
-
setError('Invalid code. Try again.');
|
|
58
|
-
} else {
|
|
59
|
-
SnackController.showError(parsedError);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
setLoading(false);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<OtpCodeView
|
|
67
|
-
loading={loading}
|
|
68
|
-
error={error}
|
|
69
|
-
timeLeft={timeLeft}
|
|
70
|
-
email={data?.email}
|
|
71
|
-
onRetry={onOtpResend}
|
|
72
|
-
onSubmit={onOtpSubmit}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|