react-native-plaid-link-sdk 12.0.1 → 12.0.2

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/README.md CHANGED
@@ -184,6 +184,7 @@ While these older versions are expected to continue to work without disruption,
184
184
 
185
185
  | Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
186
186
  |-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
187
+ | 12.0.2 | * | [5.0.0+] | 21 | 34 | >=6.0.2 | 14.0 | Active, supports Xcode 16.1.0 |
187
188
  | 12.0.1 | * | [5.0.0+] | 21 | 34 | >=6.0.2 | 14.0 | Active, supports Xcode 16.1.0 |
188
189
  | 12.0.0 | * | [5.0.0+] | 21 | 34 | >=6.0.0 | 14.0 | Active, supports Xcode 16.1.0 |
189
190
  | 12.0.0-beta.3 | * | [4.4.0+] | 21 | 34 | >=6.0.0 | 14.0 | Active, supports Xcode 15.3.0 |
@@ -4,7 +4,7 @@
4
4
  <application>
5
5
  <meta-data
6
6
  android:name="com.plaid.link.react_native"
7
- android:value="12.0.1" />
7
+ android:value="12.0.2" />
8
8
  </application>
9
9
 
10
10
  </manifest>
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function App(): React.JSX.Element;
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import { Platform, TextInput, Text, TouchableOpacity, View, ScrollView, } from 'react-native';
3
+ import { styles } from './Styles';
4
+ import { LinkLogLevel, dismissLink, usePlaidEmitter, LinkIOSPresentationStyle, create, open, syncFinanceKit, submit, EmbeddedLinkView, } from 'react-native-plaid-link-sdk';
5
+ function isValidString(str) {
6
+ return str.trim() !== '';
7
+ }
8
+ function createLinkTokenConfiguration(token, noLoadingState = false) {
9
+ console.log(`token: ${token}`);
10
+ return {
11
+ token: token,
12
+ noLoadingState: noLoadingState,
13
+ };
14
+ }
15
+ function createSubmissionData(phoneNumber) {
16
+ return {
17
+ phoneNumber: phoneNumber,
18
+ };
19
+ }
20
+ function createLinkOpenProps() {
21
+ return {
22
+ onSuccess: (success) => {
23
+ console.log('Success: ', success);
24
+ success.metadata.accounts.forEach(it => console.log('accounts', it));
25
+ },
26
+ onExit: (linkExit) => {
27
+ console.log('Exit: ', linkExit);
28
+ dismissLink();
29
+ },
30
+ iOSPresentationStyle: LinkIOSPresentationStyle.MODAL,
31
+ logLevel: LinkLogLevel.ERROR,
32
+ };
33
+ }
34
+ const EmbeddedView = ({ token }) => {
35
+ let content;
36
+ if (token) {
37
+ content = (<View>
38
+ <EmbeddedLinkView token={token} iOSPresentationStyle={LinkIOSPresentationStyle.MODAL} onEvent={(event) => console.log('onEvent', event)} onSuccess={(success) => console.log('onSuccess', success)} onExit={(exit) => console.log('onExit', exit)} style={styles.embedded}/>
39
+ </View>);
40
+ }
41
+ else {
42
+ content = (
43
+ // eslint-disable-next-line react-native/no-inline-styles
44
+ <Text style={{ fontSize: 24, color: '#2196F3', textAlign: 'center' }}>
45
+ Enter Link Token
46
+ </Text>);
47
+ }
48
+ // eslint-disable-next-line react-native/no-inline-styles
49
+ return <View style={{ padding: 24 }}>{content}</View>;
50
+ };
51
+ export default function App() {
52
+ const [text, setText] = React.useState('');
53
+ const [disabled, setDisabled] = React.useState(true);
54
+ const iOSVersionParts = String(Platform.Version).split('.');
55
+ const [majorVersion, minorVersion] = iOSVersionParts.length >= 2 ? iOSVersionParts : [null, null];
56
+ const financeKitText = () => {
57
+ if (majorVersion && minorVersion) {
58
+ const majorInt = parseInt(majorVersion, 10);
59
+ const minorInt = parseInt(minorVersion, 10);
60
+ if (majorInt > 17 || (majorInt === 17 && minorInt >= 4)) {
61
+ return <Text style={styles.button}>Sync FinanceKit</Text>;
62
+ }
63
+ else {
64
+ return (<Text style={styles.button}>
65
+ FinanceKit not supported on this version of iOS
66
+ </Text>);
67
+ }
68
+ }
69
+ else {
70
+ return <Text style={styles.button}>Invalid iOS version</Text>;
71
+ }
72
+ };
73
+ // Use event emitter to get real-time events during a Link Session.
74
+ usePlaidEmitter((event) => {
75
+ console.log(event);
76
+ });
77
+ return (
78
+ // eslint-disable-next-line react-native/no-inline-styles
79
+ <ScrollView contentContainerStyle={{ padding: 16 }}>
80
+ {/* Input for Link Token */}
81
+ <View style={styles.emptyView}/>
82
+ <TextInput style={styles.input} onChangeText={newText => {
83
+ setText(newText);
84
+ setDisabled(!isValidString(newText));
85
+ }} value={text} placeholder="link-sandbox-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" placeholderTextColor={'#D3D3D3'}/>
86
+
87
+ {/* Embedded Link View */}
88
+ <EmbeddedView token={text}/>
89
+
90
+ {/* Create Link */}
91
+ <TouchableOpacity style={styles.button} onPress={() => {
92
+ if (isValidString(text)) {
93
+ const tokenConfiguration = createLinkTokenConfiguration(text);
94
+ create(tokenConfiguration);
95
+ setDisabled(false);
96
+ }
97
+ }}>
98
+ <Text style={styles.button}>Create Link</Text>
99
+ </TouchableOpacity>
100
+
101
+ {/* Submit Phone Number */}
102
+ <TouchableOpacity disabled={disabled} style={disabled ? styles.disabledButton : styles.button} onPress={() => {
103
+ const submissionData = createSubmissionData('415-555-0015');
104
+ submit(submissionData);
105
+ }}>
106
+ <Text style={styles.button}>Submit Layer Phone Number</Text>
107
+ </TouchableOpacity>
108
+
109
+ {/* Open Link */}
110
+ <TouchableOpacity disabled={disabled} style={disabled ? styles.disabledButton : styles.button} onPress={() => {
111
+ const openProps = createLinkOpenProps();
112
+ open(openProps);
113
+ setDisabled(true);
114
+ }}>
115
+ <Text style={styles.button}>Open Link</Text>
116
+ </TouchableOpacity>
117
+
118
+ {/* Sync FinanceKit */}
119
+ <TouchableOpacity style={styles.button} onPress={() => {
120
+ const completionHandler = (error) => {
121
+ if (error) {
122
+ console.error('Error:', error);
123
+ }
124
+ else {
125
+ console.log('Sync completed successfully');
126
+ }
127
+ };
128
+ const requestAuthorizationIfNeeded = true;
129
+ syncFinanceKit(text, requestAuthorizationIfNeeded, completionHandler);
130
+ }}>
131
+ {financeKitText()}
132
+ </TouchableOpacity>
133
+ </ScrollView>);
134
+ }
@@ -0,0 +1,69 @@
1
+ export namespace styles {
2
+ namespace button {
3
+ let elevation: number;
4
+ let backgroundColor: string;
5
+ let width: "90%";
6
+ let margin: number;
7
+ let paddingVertical: number;
8
+ let fontSize: number;
9
+ let textAlign: "center";
10
+ let color: string;
11
+ let borderRadius: number;
12
+ let alignSelf: "center";
13
+ let textTransform: "uppercase";
14
+ let overflow: "hidden";
15
+ }
16
+ namespace disabledButton {
17
+ let elevation_1: number;
18
+ export { elevation_1 as elevation };
19
+ let backgroundColor_1: string;
20
+ export { backgroundColor_1 as backgroundColor };
21
+ let width_1: "90%";
22
+ export { width_1 as width };
23
+ let margin_1: number;
24
+ export { margin_1 as margin };
25
+ let paddingVertical_1: number;
26
+ export { paddingVertical_1 as paddingVertical };
27
+ let fontSize_1: number;
28
+ export { fontSize_1 as fontSize };
29
+ let textAlign_1: "center";
30
+ export { textAlign_1 as textAlign };
31
+ let color_1: string;
32
+ export { color_1 as color };
33
+ let borderRadius_1: number;
34
+ export { borderRadius_1 as borderRadius };
35
+ let alignSelf_1: "center";
36
+ export { alignSelf_1 as alignSelf };
37
+ let textTransform_1: "uppercase";
38
+ export { textTransform_1 as textTransform };
39
+ let overflow_1: "hidden";
40
+ export { overflow_1 as overflow };
41
+ export let opacity: number;
42
+ }
43
+ namespace input {
44
+ export let height: number;
45
+ let margin_2: number;
46
+ export { margin_2 as margin };
47
+ let width_2: "90%";
48
+ export { width_2 as width };
49
+ let alignSelf_2: "center";
50
+ export { alignSelf_2 as alignSelf };
51
+ export let borderWidth: number;
52
+ export let padding: number;
53
+ export let borderColor: any;
54
+ }
55
+ namespace embedded {
56
+ let width_3: "95%";
57
+ export { width_3 as width };
58
+ let alignSelf_3: "center";
59
+ export { alignSelf_3 as alignSelf };
60
+ let height_1: number;
61
+ export { height_1 as height };
62
+ }
63
+ namespace emptyView {
64
+ let height_2: number;
65
+ export { height_2 as height };
66
+ let backgroundColor_2: string;
67
+ export { backgroundColor_2 as backgroundColor };
68
+ }
69
+ }
@@ -0,0 +1,51 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Colors } from 'react-native/Libraries/NewAppScreen';
3
+ export const styles = StyleSheet.create({
4
+ button: {
5
+ elevation: 8,
6
+ backgroundColor: '#2196F3',
7
+ width: '90%',
8
+ margin: 4,
9
+ paddingVertical: 4,
10
+ fontSize: 16,
11
+ textAlign: 'center',
12
+ color: 'white',
13
+ borderRadius: 4,
14
+ alignSelf: 'center',
15
+ textTransform: 'uppercase',
16
+ overflow: 'hidden',
17
+ },
18
+ disabledButton: {
19
+ elevation: 8,
20
+ backgroundColor: '#2196F3',
21
+ width: '90%',
22
+ margin: 4,
23
+ paddingVertical: 4,
24
+ fontSize: 16,
25
+ textAlign: 'center',
26
+ color: 'white',
27
+ borderRadius: 4,
28
+ alignSelf: 'center',
29
+ textTransform: 'uppercase',
30
+ overflow: 'hidden',
31
+ opacity: 0.5,
32
+ },
33
+ input: {
34
+ height: 40,
35
+ margin: 12,
36
+ width: '90%',
37
+ alignSelf: 'center',
38
+ borderWidth: 1,
39
+ padding: 10,
40
+ borderColor: Colors.black,
41
+ },
42
+ embedded: {
43
+ width: '95%',
44
+ alignSelf: 'center',
45
+ height: 360,
46
+ },
47
+ emptyView: {
48
+ height: 80,
49
+ backgroundColor: 'transparent', // Transparent background to keep it empty
50
+ },
51
+ });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @format
3
+ */
4
+ import 'react-native';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @format
3
+ */
4
+ import 'react-native';
5
+ import React from 'react';
6
+ import App from '../App';
7
+ // Note: import explicitly to use the types shipped with jest.
8
+ import { it } from '@jest/globals';
9
+ // Note: test renderer must be required after react-native.
10
+ import renderer from 'react-test-renderer';
11
+ it('renders correctly', () => {
12
+ renderer.create(<App />);
13
+ });
@@ -0,0 +1 @@
1
+ export let presets: string[];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ module.exports = {
3
+ presets: ['module:@react-native/babel-preset'],
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @format
3
+ */
4
+ import { AppRegistry } from 'react-native';
5
+ import App from './App';
6
+ import { name as appName } from './app.json';
7
+ AppRegistry.registerComponent(appName, () => App);
@@ -0,0 +1 @@
1
+ export let preset: string;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ module.exports = {
3
+ preset: 'react-native',
4
+ };
@@ -0,0 +1,2 @@
1
+ declare const _exports: any;
2
+ export = _exports;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
3
+ /**
4
+ * Metro configuration
5
+ * https://reactnative.dev/docs/metro
6
+ *
7
+ * @type {import('metro-config').MetroConfig}
8
+ */
9
+ const config = {};
10
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
@@ -47,7 +47,6 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
47
47
  if (props.onSuccess != null) {
48
48
  props.onSuccess(result);
49
49
  }
50
- return true;
51
50
  }, (result) => {
52
51
  if (props.onExit != null) {
53
52
  if (result.error != null && result.error.displayMessage != null) {
@@ -56,7 +55,6 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
56
55
  }
57
56
  props.onExit(result);
58
57
  }
59
- return true;
60
58
  });
61
59
  }
62
60
  else {
@@ -65,7 +63,6 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
65
63
  if (props.onSuccess != null) {
66
64
  props.onSuccess(result);
67
65
  }
68
- return true;
69
66
  }, (error, result) => {
70
67
  if (props.onExit != null) {
71
68
  if (error) {
@@ -77,7 +74,6 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
77
74
  props.onExit(result);
78
75
  }
79
76
  }
80
- return true;
81
77
  });
82
78
  }
83
79
  });
@@ -118,13 +114,11 @@ export const syncFinanceKit = (token, requestAuthorizationIfNeeded, completion)
118
114
  else {
119
115
  RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.syncFinanceKit(token, requestAuthorizationIfNeeded, () => {
120
116
  completion();
121
- return true;
122
117
  }, (error) => {
123
118
  completion({
124
119
  type: error.type,
125
120
  message: error.message,
126
121
  });
127
- return true;
128
122
  });
129
123
  }
130
124
  };
@@ -3,13 +3,13 @@ import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  import { UnsafeObject } from './fabricUtils';
4
4
  import { LinkSuccess, LinkExit, LinkError, FinanceKitError } from '../Types';
5
5
  export interface Spec extends TurboModule {
6
- create(token: string, noLoadingState: boolean): boolean;
7
- open(fullScreen: boolean, onSuccess: (result: UnsafeObject<LinkSuccess>) => boolean, onExit: (error: UnsafeObject<LinkError>, result: UnsafeObject<LinkExit>) => boolean): boolean;
8
- dismiss(): boolean;
9
- submit(phoneNumber: string | undefined): boolean;
10
- addListener(eventName: string): boolean;
11
- removeListeners(count: Int32): boolean;
12
- syncFinanceKit(token: string, requestAuthorizationIfNeeded: boolean, onSuccess: (success: boolean) => boolean, onError: (error: UnsafeObject<FinanceKitError>) => boolean): boolean;
6
+ create(token: string, noLoadingState: boolean): void;
7
+ open(fullScreen: boolean, onSuccess: (result: UnsafeObject<LinkSuccess>) => void, onExit: (error: UnsafeObject<LinkError>, result: UnsafeObject<LinkExit>) => void): void;
8
+ dismiss(): void;
9
+ submit(phoneNumber: string | undefined): void;
10
+ addListener(eventName: string): void;
11
+ removeListeners(count: Int32): void;
12
+ syncFinanceKit(token: string, requestAuthorizationIfNeeded: boolean, onSuccess: (success: boolean) => void, onError: (error: UnsafeObject<FinanceKitError>) => void): void;
13
13
  }
14
14
  declare const _default: Spec | null;
15
15
  export default _default;
@@ -19,8 +19,9 @@
19
19
  #import <react_native_plaid_link_sdk/react_native_plaid_link_sdk-Swift.h>
20
20
 
21
21
  #else
22
- #ifdef USE_FRAMEWORKS
22
+ #if __has_include(<react_native_plaid_link_sdk/react_native_plaid_link_sdk-Swift.h>)
23
23
  // Include the header for projects using frameworks (`use_frameworks!` in the Podfile).
24
+ // Frameworks are being used (static or dynamic).
24
25
  #import <react_native_plaid_link_sdk/react_native_plaid_link_sdk-Swift.h>
25
26
 
26
27
  #else
@@ -45,6 +46,7 @@
45
46
  3. Refer to these GitHub issues for more details:
46
47
  - https://github.com/plaid/react-native-plaid-link-sdk/issues/713
47
48
  - https://github.com/plaid/react-native-plaid-link-sdk/issues/732
49
+ - https://github.com/plaid/react-native-plaid-link-sdk/issues/747
48
50
 
49
51
  ### Troubleshooting:
50
52
  - If `USE_FRAMEWORKS` is not working, ensure it is correctly passed as a preprocessor macro in your Xcode build settings.
package/ios/RNLinksdk.mm CHANGED
@@ -28,7 +28,7 @@ static NSString* const kRNLinkKitVersionConstant = @"version";
28
28
  RCT_EXPORT_MODULE();
29
29
 
30
30
  + (NSString*)sdkVersion {
31
- return @"12.0.1"; // SDK_VERSION
31
+ return @"12.0.2"; // SDK_VERSION
32
32
  }
33
33
 
34
34
  + (NSString*)objCBridgeVersion {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "React Native Plaid Link SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",