-
Notifications
You must be signed in to change notification settings - Fork 1
/
LinkExample.tsx
68 lines (62 loc) · 2.3 KB
/
LinkExample.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import {SafeAreaView, StyleSheet, Text, TouchableOpacity} from 'react-native';
import {
AccountCallbackPayload,
ArgyleLink,
FormCallbackPayload,
} from '@argyleio/argyle-plugin-react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
export const LinkExample = (): JSX.Element => {
const callbackFired = (key: string, response: any = {}) => {
console.log('callback fired', key, response);
};
const start = () => {
const config = {
userToken: 'USER_TOKEN',
sandbox: true,
onAccountCreated: (response: AccountCallbackPayload) =>
callbackFired('onAccountCreated', response),
onAccountConnected: (response: AccountCallbackPayload) =>
callbackFired('onAccountConnected', response),
onAccountRemoved: (response: AccountCallbackPayload) =>
callbackFired('onAccountRemoved', response),
onAccountError: (response: AccountCallbackPayload) =>
callbackFired('onAccountError', response),
onDDSSuccess: (response: AccountCallbackPayload) =>
callbackFired('onDDSSuccess', response),
onDDSError: (response: AccountCallbackPayload) =>
callbackFired('onDDSError', response),
onClose: () => callbackFired('onClose'),
onExitIntroClicked: () => callbackFired('onExitIntroClicked'),
onError: (response: any) => callbackFired('onError', response),
onTokenExpired: (updateToken: any) => {
// updateToken('<token>')
callbackFired('onTokenExpired', updateToken);
},
onUIEvent: (response: any) => callbackFired('onUIEvent', response),
onFormSubmitted: (response: FormCallbackPayload) =>
callbackFired('onFormSubmitted', response),
onDocumentsSubmitted: (response: FormCallbackPayload) =>
callbackFired('onDocumentsSubmitted', response),
};
ArgyleLink.start(config);
};
return (
<SafeAreaView style={styles.background}>
<Text style={styles.welcome}>📱️ Argyle Link SDK️</Text>
<TouchableOpacity testID="start" onPress={start}>
<Text style={styles.welcome}>Start</Text>
</TouchableOpacity>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
background: {
backgroundColor: Colors.lighter,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});