react-native-plaid-link-sdk 11.8.2 → 11.10.0
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 +3 -1
- package/android/build.gradle +37 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/plaid/PLKEmbeddedViewManager.kt +21 -5
- package/android/src/main/java/com/plaid/PlaidModule.kt +13 -12
- package/android/src/main/java/com/plaid/PlaidPackage.java +93 -22
- package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerDelegate.java +34 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerInterface.java +18 -0
- package/android/src/paper/java/com/plaid/NativePlaidLinkModuleAndroidSpec.java +54 -0
- package/android/src/paper/java/com/plaid/NativePlaidLinkModuleiOSSpec.java +54 -0
- package/dist/EmbeddedLink/EmbeddedLinkView.d.ts +1 -1
- package/dist/EmbeddedLink/NativeEmbeddedLinkView.d.ts +1 -1
- package/dist/EmbeddedLink/NativeEmbeddedLinkView.js +1 -6
- package/dist/PlaidLink.d.ts +1 -1
- package/dist/PlaidLink.js +18 -16
- package/dist/fabric/EmbeddedLinkViewNativeComponent.d.ts +15 -0
- package/dist/fabric/EmbeddedLinkViewNativeComponent.js +2 -0
- package/dist/fabric/NativePlaidLinkModuleAndroid.d.ts +13 -0
- package/dist/fabric/NativePlaidLinkModuleAndroid.js +4 -0
- package/dist/fabric/NativePlaidLinkModuleiOS.d.ts +13 -0
- package/dist/fabric/NativePlaidLinkModuleiOS.js +4 -0
- package/dist/fabric/fabricUtils.d.ts +1 -0
- package/dist/fabric/fabricUtils.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/ios/PLKEmbeddedView.m +1 -1
- package/ios/PLKEmbeddedView.swift +4 -4
- package/ios/PLKEmbeddedViewComponentView.h +15 -0
- package/ios/PLKEmbeddedViewComponentView.mm +85 -0
- package/ios/PLKFabricHelpers.h +70 -0
- package/ios/RNLinksdk.h +10 -8
- package/ios/{RNLinksdk.m → RNLinksdk.mm} +18 -9
- package/ios/RNLinksdk.xcodeproj/project.pbxproj +20 -4
- package/ios/RNLinksdk.xcodeproj/project.xcworkspace/xcuserdata/dtroupe.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNLinksdk.xcworkspace/xcuserdata/dtroupe.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNPlaidHelper.h +7 -0
- package/ios/RNPlaidHelper.m +10 -0
- package/ios/react_native_plaid_link_sdk.h +2 -0
- package/package.json +14 -4
- package/react-native-plaid-link-sdk.podspec +14 -2
- package/src/EmbeddedLink/EmbeddedLinkView.tsx +95 -0
- package/src/EmbeddedLink/EmbeddedLinkView.web.tsx +5 -0
- package/src/EmbeddedLink/NativeEmbeddedLinkView.tsx +3 -0
- package/src/PlaidLink.tsx +181 -0
- package/src/Types.ts +559 -0
- package/src/__tests__/Types.tests.ts +15 -0
- package/src/fabric/EmbeddedLinkViewNativeComponent.ts +24 -0
- package/src/fabric/NativePlaidLinkModuleAndroid.ts +26 -0
- package/src/fabric/NativePlaidLinkModuleiOS.ts +21 -0
- package/src/fabric/fabricUtils.ts +2 -0
- package/src/index.ts +25 -0
package/README.md
CHANGED
|
@@ -179,6 +179,8 @@ While these older versions are expected to continue to work without disruption,
|
|
|
179
179
|
|
|
180
180
|
| Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
|
|
181
181
|
|-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
|
|
182
|
+
| 11.10.0 | * | [4.4.0+] | 21 | 34 | >=5.5.0 | 14.0 | Active, supports Xcode 15.0.1 |
|
|
183
|
+
| 11.9.0 | * | [4.3.1+] | 21 | 34 | >=5.5.0 | 14.0 | Active, supports Xcode 15.0.1 |
|
|
182
184
|
| 11.8.2 | * | [4.3.1+] | 21 | 34 | >=5.4.2 | 14.0 | Active, supports Xcode 15.0.1 |
|
|
183
185
|
| 11.8.1 | * | [4.3.1+] | 21 | 34 | >=5.4.2 | 14.0 | Active, supports Xcode 15.0.1 |
|
|
184
186
|
| 11.8.0 | * | [4.3.1+] | 21 | 34 | >=5.4.2 | 14.0 | Active, supports Xcode 15.0.1 |
|
|
@@ -221,4 +223,4 @@ While these older versions are expected to continue to work without disruption,
|
|
|
221
223
|
|
|
222
224
|
## Contributing
|
|
223
225
|
|
|
224
|
-
See the [contributor guidelines](CONTRIBUTING.md) to learn how to contribute to the repository.
|
|
226
|
+
See the [contributor guidelines](CONTRIBUTING.md) to learn how to contribute to the repository.
|
package/android/build.gradle
CHANGED
|
@@ -12,7 +12,12 @@ allprojects {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
buildscript {
|
|
15
|
-
ext
|
|
15
|
+
ext {
|
|
16
|
+
kotlin_version = '1.8.22'
|
|
17
|
+
}
|
|
18
|
+
ext.safeExtGet = {prop, fallback ->
|
|
19
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
20
|
+
}
|
|
16
21
|
repositories {
|
|
17
22
|
google()
|
|
18
23
|
mavenCentral()
|
|
@@ -25,10 +30,32 @@ buildscript {
|
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
def isNewArchitectureEnabled() {
|
|
34
|
+
// To opt-in for the New Architecture, you can either:
|
|
35
|
+
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
36
|
+
// - Invoke gradle with `-newArchEnabled=true`
|
|
37
|
+
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
38
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isNewArchitectureEnabled()) {
|
|
42
|
+
apply plugin: "com.facebook.react"
|
|
43
|
+
}
|
|
44
|
+
|
|
28
45
|
apply plugin: 'com.android.library'
|
|
29
46
|
apply plugin: "kotlin-android"
|
|
30
47
|
|
|
31
48
|
android {
|
|
49
|
+
|
|
50
|
+
// Used to override the NDK path/version on internal CI or by allowing
|
|
51
|
+
// users to customize the NDK path/version from their root project (e.g. for M1 support)
|
|
52
|
+
if (rootProject.hasProperty("ndkPath")) {
|
|
53
|
+
ndkPath rootProject.ext.ndkPath
|
|
54
|
+
}
|
|
55
|
+
if (rootProject.hasProperty("ndkVersion")) {
|
|
56
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
57
|
+
}
|
|
58
|
+
|
|
32
59
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
|
|
33
60
|
if (agpVersion >= 7) {
|
|
34
61
|
namespace 'com.plaid'
|
|
@@ -40,6 +67,7 @@ android {
|
|
|
40
67
|
targetSdkVersion 31
|
|
41
68
|
versionCode 1
|
|
42
69
|
versionName "0.0.1"
|
|
70
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
43
71
|
}
|
|
44
72
|
lintOptions {
|
|
45
73
|
abortOnError false
|
|
@@ -52,6 +80,14 @@ android {
|
|
|
52
80
|
}
|
|
53
81
|
}
|
|
54
82
|
|
|
83
|
+
sourceSets.main {
|
|
84
|
+
java {
|
|
85
|
+
if (!isNewArchitectureEnabled()) {
|
|
86
|
+
srcDirs += 'src/paper/java'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
55
91
|
buildTypes {
|
|
56
92
|
release {
|
|
57
93
|
debuggable = false
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
package com.plaid
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
3
4
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
4
5
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
5
7
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
|
+
import com.facebook.react.viewmanagers.PLKEmbeddedViewManagerDelegate
|
|
9
|
+
import com.facebook.react.viewmanagers.PLKEmbeddedViewManagerInterface
|
|
10
|
+
|
|
11
|
+
@ReactModule(name = PLKEmbeddedViewManager.REACT_CLASS)
|
|
12
|
+
class PLKEmbeddedViewManager : SimpleViewManager<PLKEmbeddedView>(),
|
|
13
|
+
PLKEmbeddedViewManagerInterface<PLKEmbeddedView> {
|
|
14
|
+
private val delegate: ViewManagerDelegate<PLKEmbeddedView>
|
|
15
|
+
|
|
16
|
+
init {
|
|
17
|
+
delegate = PLKEmbeddedViewManagerDelegate(this)
|
|
18
|
+
}
|
|
6
19
|
|
|
7
|
-
class PLKEmbeddedViewManager : SimpleViewManager<PLKEmbeddedView>() {
|
|
8
20
|
override fun getName(): String {
|
|
9
21
|
return REACT_CLASS
|
|
10
22
|
}
|
|
@@ -14,14 +26,18 @@ class PLKEmbeddedViewManager : SimpleViewManager<PLKEmbeddedView>() {
|
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
@ReactProp(name = "token")
|
|
17
|
-
fun setToken(view: PLKEmbeddedView, token: String?) {
|
|
29
|
+
override fun setToken(view: PLKEmbeddedView, token: String?) {
|
|
18
30
|
view.setToken(token ?: "")
|
|
19
31
|
}
|
|
20
32
|
|
|
33
|
+
override fun setIOSPresentationStyle(view: PLKEmbeddedView, value: String?) {
|
|
34
|
+
// Unsupported on Android
|
|
35
|
+
}
|
|
36
|
+
|
|
21
37
|
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
|
|
22
|
-
return
|
|
23
|
-
EVENT_NAME to
|
|
24
|
-
"phasedRegistrationNames" to
|
|
38
|
+
return mutableMapOf(
|
|
39
|
+
EVENT_NAME to mutableMapOf(
|
|
40
|
+
"phasedRegistrationNames" to mutableMapOf(
|
|
25
41
|
"bubbled" to EVENT_NAME
|
|
26
42
|
)
|
|
27
43
|
))
|
|
@@ -8,7 +8,6 @@ import android.util.Log
|
|
|
8
8
|
import com.facebook.react.bridge.ActivityEventListener
|
|
9
9
|
import com.facebook.react.bridge.Callback
|
|
10
10
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
11
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
12
11
|
import com.facebook.react.bridge.ReactMethod
|
|
13
12
|
import com.facebook.react.module.annotations.ReactModule
|
|
14
13
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -19,15 +18,13 @@ import com.plaid.link.configuration.LinkLogLevel
|
|
|
19
18
|
import com.plaid.link.configuration.LinkTokenConfiguration
|
|
20
19
|
import com.plaid.link.event.LinkEvent
|
|
21
20
|
import com.plaid.link.exception.LinkException
|
|
22
|
-
import com.plaid.link.result.LinkAccountSubtype
|
|
23
21
|
import com.plaid.link.result.LinkResultHandler
|
|
24
22
|
import org.json.JSONException
|
|
25
23
|
import org.json.JSONObject
|
|
26
|
-
import java.util.ArrayList
|
|
27
24
|
|
|
28
|
-
@ReactModule(name = PlaidModule.
|
|
25
|
+
@ReactModule(name = PlaidModule.NAME)
|
|
29
26
|
class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
30
|
-
|
|
27
|
+
NativePlaidLinkModuleAndroidSpec(reactContext), ActivityEventListener {
|
|
31
28
|
|
|
32
29
|
val mActivityResultManager by lazy { ActivityResultManager() }
|
|
33
30
|
|
|
@@ -41,11 +38,11 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
41
38
|
companion object {
|
|
42
39
|
private const val LINK_TOKEN_PREFIX = "link"
|
|
43
40
|
|
|
44
|
-
const val
|
|
41
|
+
const val NAME = "PlaidAndroid"
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
override fun getName(): String {
|
|
48
|
-
return
|
|
45
|
+
return NAME
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
override fun initialize() {
|
|
@@ -53,8 +50,8 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
53
50
|
reactApplicationContext.addActivityEventListener(this)
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
override fun
|
|
57
|
-
super.
|
|
53
|
+
override fun invalidate() {
|
|
54
|
+
super.invalidate()
|
|
58
55
|
reactApplicationContext.removeActivityEventListener(this)
|
|
59
56
|
}
|
|
60
57
|
|
|
@@ -80,7 +77,7 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
@ReactMethod
|
|
83
|
-
fun create(
|
|
80
|
+
override fun create(
|
|
84
81
|
token: String,
|
|
85
82
|
noLoadingState: Boolean,
|
|
86
83
|
logLevel: String,
|
|
@@ -111,7 +108,7 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
@ReactMethod
|
|
114
|
-
fun open(onSuccessCallback: Callback, onExitCallback: Callback) {
|
|
111
|
+
override fun open(onSuccessCallback: Callback, onExitCallback: Callback) {
|
|
115
112
|
val activity = currentActivity ?: throw IllegalStateException("Current activity is null")
|
|
116
113
|
|
|
117
114
|
plaidHandler?.let { handler ->
|
|
@@ -127,7 +124,7 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
127
124
|
|
|
128
125
|
@ReactMethod
|
|
129
126
|
@Suppress("unused")
|
|
130
|
-
fun startLinkActivityForResult(
|
|
127
|
+
override fun startLinkActivityForResult(
|
|
131
128
|
token: String,
|
|
132
129
|
noLoadingState: Boolean,
|
|
133
130
|
logLevel: String,
|
|
@@ -162,6 +159,10 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
|
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
161
|
|
|
162
|
+
override fun addListener(eventName: String?) = Unit
|
|
163
|
+
|
|
164
|
+
override fun removeListeners(count: Double) = Unit
|
|
165
|
+
|
|
165
166
|
private fun maybeGetStringField(obj: JSONObject, fieldName: String): String? {
|
|
166
167
|
if (obj.has(fieldName) && !TextUtils.isEmpty(obj.getString(fieldName))) {
|
|
167
168
|
return obj.getString(fieldName)
|
|
@@ -1,46 +1,117 @@
|
|
|
1
1
|
package com.plaid;
|
|
2
2
|
|
|
3
|
-
import java.util.
|
|
3
|
+
import java.util.ArrayList;
|
|
4
4
|
import java.util.HashMap;
|
|
5
5
|
import java.util.List;
|
|
6
6
|
import java.util.Map;
|
|
7
7
|
|
|
8
8
|
import com.facebook.react.TurboReactPackage;
|
|
9
|
+
import com.facebook.react.ViewManagerOnDemandReactPackage;
|
|
10
|
+
import com.facebook.react.bridge.ModuleSpec;
|
|
9
11
|
import com.facebook.react.bridge.NativeModule;
|
|
10
12
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.common.MapBuilder;
|
|
14
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
15
|
+
import com.facebook.react.module.annotations.ReactModuleList;
|
|
11
16
|
import com.facebook.react.module.model.ReactModuleInfo;
|
|
12
17
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
13
18
|
import com.facebook.react.uimanager.ViewManager;
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
import javax.annotation.Nonnull;
|
|
21
|
+
import javax.annotation.Nullable;
|
|
22
|
+
import javax.inject.Provider;
|
|
23
|
+
|
|
24
|
+
@ReactModuleList(nativeModules = {PlaidModule.class})
|
|
25
|
+
public class PlaidPackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage {
|
|
26
|
+
|
|
27
|
+
private @Nullable Map<String, ModuleSpec> mViewManagers;
|
|
28
|
+
|
|
29
|
+
private Map<String, ModuleSpec> getViewManagersMap(final ReactApplicationContext reactContext) {
|
|
30
|
+
if (mViewManagers == null) {
|
|
31
|
+
Map<String, ModuleSpec> specs = MapBuilder.newHashMap();
|
|
32
|
+
specs.put(
|
|
33
|
+
PLKEmbeddedViewManager.REACT_CLASS,
|
|
34
|
+
ModuleSpec.viewManagerSpec(
|
|
35
|
+
new Provider<NativeModule>() {
|
|
36
|
+
@Override
|
|
37
|
+
public NativeModule get() {
|
|
38
|
+
return new PLKEmbeddedViewManager();
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
mViewManagers = specs;
|
|
42
|
+
}
|
|
43
|
+
return mViewManagers;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** {@inheritDoc} */
|
|
47
|
+
@Override
|
|
48
|
+
public List<String> getViewManagerNames(ReactApplicationContext reactContext) {
|
|
49
|
+
return new ArrayList<>(getViewManagersMap(reactContext).keySet());
|
|
50
|
+
}
|
|
17
51
|
|
|
18
52
|
@Override
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return new PlaidModule(reactContext);
|
|
53
|
+
protected List<ModuleSpec> getViewManagers(ReactApplicationContext reactContext) {
|
|
54
|
+
return new ArrayList<>(getViewManagersMap(reactContext).values());
|
|
22
55
|
}
|
|
23
56
|
|
|
57
|
+
/** {@inheritDoc} */
|
|
24
58
|
@Override
|
|
25
|
-
public
|
|
26
|
-
|
|
59
|
+
public @Nullable ViewManager createViewManager(
|
|
60
|
+
ReactApplicationContext reactContext, String viewManagerName) {
|
|
61
|
+
ModuleSpec spec = getViewManagersMap(reactContext).get(viewManagerName);
|
|
62
|
+
return spec != null ? (ViewManager) spec.getProvider().get() : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public NativeModule getModule(String name, @Nonnull ReactApplicationContext reactContext) {
|
|
67
|
+
switch (name) {
|
|
68
|
+
case PlaidModule.NAME:
|
|
69
|
+
return new PlaidModule(reactContext);
|
|
70
|
+
default:
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
27
73
|
}
|
|
28
74
|
|
|
29
75
|
@Override
|
|
30
76
|
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
77
|
+
try {
|
|
78
|
+
Class<?> reactModuleInfoProviderClass =
|
|
79
|
+
Class.forName("com.plaid.PlaidPackage$$ReactModuleInfoProvider");
|
|
80
|
+
return (ReactModuleInfoProvider) reactModuleInfoProviderClass.newInstance();
|
|
81
|
+
} catch (ClassNotFoundException e) {
|
|
82
|
+
// ReactModuleSpecProcessor does not run at build-time. Create this ReactModuleInfoProvider by
|
|
83
|
+
// hand.
|
|
84
|
+
return new ReactModuleInfoProvider() {
|
|
85
|
+
@Override
|
|
86
|
+
public Map<String, ReactModuleInfo> getReactModuleInfos() {
|
|
87
|
+
final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
|
|
88
|
+
|
|
89
|
+
Class<? extends NativeModule>[] moduleList =
|
|
90
|
+
new Class[]{
|
|
91
|
+
PlaidModule.class,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
for (Class<? extends NativeModule> moduleClass : moduleList) {
|
|
95
|
+
ReactModule reactModule = moduleClass.getAnnotation(ReactModule.class);
|
|
96
|
+
|
|
97
|
+
reactModuleInfoMap.put(
|
|
98
|
+
reactModule.name(),
|
|
99
|
+
new ReactModuleInfo(
|
|
100
|
+
reactModule.name(),
|
|
101
|
+
moduleClass.getName(),
|
|
102
|
+
reactModule.canOverrideExistingModule(),
|
|
103
|
+
reactModule.needsEagerInit(),
|
|
104
|
+
reactModule.hasConstants(),
|
|
105
|
+
reactModule.isCxxModule(),
|
|
106
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return reactModuleInfoMap;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
} catch (InstantiationException | IllegalAccessException e) {
|
|
113
|
+
throw new RuntimeException(
|
|
114
|
+
"No ReactModuleInfoProvider for com.plaid.PlaidPackage$$ReactModuleInfoProvider", e);
|
|
115
|
+
}
|
|
45
116
|
}
|
|
46
117
|
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerDelegate.java
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManagerInterface;
|
|
16
|
+
|
|
17
|
+
public class PLKEmbeddedViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & PLKEmbeddedViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
18
|
+
public PLKEmbeddedViewManagerDelegate(U viewManager) {
|
|
19
|
+
super(viewManager);
|
|
20
|
+
}
|
|
21
|
+
@Override
|
|
22
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
23
|
+
switch (propName) {
|
|
24
|
+
case "token":
|
|
25
|
+
mViewManager.setToken(view, value == null ? null : (String) value);
|
|
26
|
+
break;
|
|
27
|
+
case "iOSPresentationStyle":
|
|
28
|
+
mViewManager.setIOSPresentationStyle(view, value == null ? null : (String) value);
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
super.setProperty(view, propName, value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerInterface.java
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
|
|
15
|
+
public interface PLKEmbeddedViewManagerInterface<T extends View> {
|
|
16
|
+
void setToken(T view, @Nullable String value);
|
|
17
|
+
void setIOSPresentationStyle(T view, @Nullable String value);
|
|
18
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.plaid;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Callback;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
+
import javax.annotation.Nonnull;
|
|
22
|
+
|
|
23
|
+
public abstract class NativePlaidLinkModuleAndroidSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
+
public static final String NAME = "PlaidAndroid";
|
|
25
|
+
|
|
26
|
+
public NativePlaidLinkModuleAndroidSpec(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public @Nonnull String getName() {
|
|
32
|
+
return NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
public abstract void create(String token, boolean noLoadingState, String logLevel);
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
public abstract void open(Callback onSuccess, Callback onExit);
|
|
42
|
+
|
|
43
|
+
@ReactMethod
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
public abstract void startLinkActivityForResult(String token, boolean noLoadingState, String logLevel, Callback onSuccessCallback, Callback onExitCallback);
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
public abstract void addListener(String eventName);
|
|
50
|
+
|
|
51
|
+
@ReactMethod
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
public abstract void removeListeners(double count);
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.plaid;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Callback;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
+
import javax.annotation.Nonnull;
|
|
22
|
+
|
|
23
|
+
public abstract class NativePlaidLinkModuleiOSSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
+
public static final String NAME = "RNLinksdk";
|
|
25
|
+
|
|
26
|
+
public NativePlaidLinkModuleiOSSpec(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public @Nonnull String getName() {
|
|
32
|
+
return NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
public abstract void create(String token, boolean noLoadingState);
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
public abstract void open(boolean fullScreen, Callback onSuccess, Callback onExit);
|
|
42
|
+
|
|
43
|
+
@ReactMethod
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
public abstract void dismiss();
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
public abstract void addListener(String eventName);
|
|
50
|
+
|
|
51
|
+
@ReactMethod
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
public abstract void removeListeners(int count);
|
|
54
|
+
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { LinkSuccessListener, LinkExitListener, LinkIOSPresentationStyle, LinkOnEventListener } from '../Types';
|
|
4
4
|
type EmbeddedLinkProps = {
|
|
5
|
-
token:
|
|
5
|
+
token: string;
|
|
6
6
|
iOSPresentationStyle: LinkIOSPresentationStyle;
|
|
7
7
|
onEvent: LinkOnEventListener | undefined;
|
|
8
8
|
onSuccess: LinkSuccessListener;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import NativeEmbeddedLinkView from '../fabric/EmbeddedLinkViewNativeComponent';
|
|
2
2
|
export default NativeEmbeddedLinkView;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
// Error "Tried to register two views with the same name PLKEmbeddedView"
|
|
3
|
-
// will be thrown during hot reload when any change is made to the
|
|
4
|
-
// file that is calling this requireNativeComponent('PLKEmbeddedView') call.
|
|
5
|
-
// Leaving this in its own file resolves this issue.
|
|
6
|
-
const NativeEmbeddedLinkView = requireNativeComponent('PLKEmbeddedView');
|
|
1
|
+
import NativeEmbeddedLinkView from '../fabric/EmbeddedLinkViewNativeComponent';
|
|
7
2
|
export default NativeEmbeddedLinkView;
|
package/dist/PlaidLink.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { LinkEventListener, LinkOpenProps, LinkTokenConfiguration, PlaidLinkComp
|
|
|
6
6
|
*
|
|
7
7
|
* @param LinkEventListener the listener to call
|
|
8
8
|
*/
|
|
9
|
-
export declare const usePlaidEmitter: (
|
|
9
|
+
export declare const usePlaidEmitter: (linkEventListener: LinkEventListener) => void;
|
|
10
10
|
export declare const create: (props: LinkTokenConfiguration) => void;
|
|
11
11
|
export declare const open: (props: LinkOpenProps) => Promise<void>;
|
|
12
12
|
export declare const dismissLink: () => void;
|
package/dist/PlaidLink.js
CHANGED
|
@@ -7,21 +7,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var _a;
|
|
10
11
|
import React, { useEffect } from 'react';
|
|
11
|
-
import { NativeEventEmitter,
|
|
12
|
+
import { NativeEventEmitter, Platform, TouchableOpacity } from 'react-native';
|
|
12
13
|
import { LinkIOSPresentationStyle, LinkLogLevel, } from './Types';
|
|
14
|
+
import RNLinksdkAndroid from './fabric/NativePlaidLinkModuleAndroid';
|
|
15
|
+
import RNLinksdkiOS from './fabric/NativePlaidLinkModuleiOS';
|
|
16
|
+
const RNLinksdk = (_a = (Platform.OS === 'android' ? RNLinksdkAndroid : RNLinksdkiOS)) !== null && _a !== void 0 ? _a : undefined;
|
|
13
17
|
/**
|
|
14
18
|
* A hook that registers a listener on the Plaid emitter for the 'onEvent' type.
|
|
15
19
|
* The listener is cleaned up when this view is unmounted
|
|
16
20
|
*
|
|
17
21
|
* @param LinkEventListener the listener to call
|
|
18
22
|
*/
|
|
19
|
-
export const usePlaidEmitter = (
|
|
23
|
+
export const usePlaidEmitter = (linkEventListener) => {
|
|
20
24
|
useEffect(() => {
|
|
21
|
-
const emitter = new NativeEventEmitter(
|
|
22
|
-
|
|
23
|
-
: NativeModules.PlaidAndroid);
|
|
24
|
-
const listener = emitter.addListener('onEvent', LinkEventListener);
|
|
25
|
+
const emitter = new NativeEventEmitter(RNLinksdk);
|
|
26
|
+
const listener = emitter.addListener('onEvent', linkEventListener);
|
|
25
27
|
// Clean up after this effect:
|
|
26
28
|
return function cleanup() {
|
|
27
29
|
listener.remove();
|
|
@@ -33,15 +35,15 @@ export const create = (props) => {
|
|
|
33
35
|
let token = props.token;
|
|
34
36
|
let noLoadingState = (_a = props.noLoadingState) !== null && _a !== void 0 ? _a : false;
|
|
35
37
|
if (Platform.OS === 'android') {
|
|
36
|
-
|
|
38
|
+
RNLinksdkAndroid === null || RNLinksdkAndroid === void 0 ? void 0 : RNLinksdkAndroid.create(token, noLoadingState, (_b = props.logLevel) !== null && _b !== void 0 ? _b : LinkLogLevel.ERROR);
|
|
37
39
|
}
|
|
38
40
|
else {
|
|
39
|
-
|
|
41
|
+
RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.create(token, noLoadingState);
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
45
|
if (Platform.OS === 'android') {
|
|
44
|
-
|
|
46
|
+
RNLinksdkAndroid === null || RNLinksdkAndroid === void 0 ? void 0 : RNLinksdkAndroid.open((result) => {
|
|
45
47
|
if (props.onSuccess != null) {
|
|
46
48
|
props.onSuccess(result);
|
|
47
49
|
}
|
|
@@ -57,7 +59,7 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
57
59
|
}
|
|
58
60
|
else {
|
|
59
61
|
let presentFullScreen = props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
|
|
60
|
-
|
|
62
|
+
RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.open(presentFullScreen, (result) => {
|
|
61
63
|
if (props.onSuccess != null) {
|
|
62
64
|
props.onSuccess(result);
|
|
63
65
|
}
|
|
@@ -77,7 +79,7 @@ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
77
79
|
});
|
|
78
80
|
export const dismissLink = () => {
|
|
79
81
|
if (Platform.OS === 'ios') {
|
|
80
|
-
|
|
82
|
+
RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.dismiss();
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
/**
|
|
@@ -103,11 +105,11 @@ export const PlaidLink = (props) => {
|
|
|
103
105
|
* @deprecated This method is deprecated. For faster loading use the create & open methods.
|
|
104
106
|
*/
|
|
105
107
|
export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
-
var
|
|
108
|
+
var _b, _c;
|
|
107
109
|
let config = props.tokenConfig;
|
|
108
|
-
let noLoadingState = (
|
|
110
|
+
let noLoadingState = (_b = config.noLoadingState) !== null && _b !== void 0 ? _b : false;
|
|
109
111
|
if (Platform.OS === 'android') {
|
|
110
|
-
|
|
112
|
+
RNLinksdkAndroid === null || RNLinksdkAndroid === void 0 ? void 0 : RNLinksdkAndroid.startLinkActivityForResult(config.token, noLoadingState, (_c = config.logLevel) !== null && _c !== void 0 ? _c : LinkLogLevel.ERROR, (result) => {
|
|
111
113
|
if (props.onSuccess != null) {
|
|
112
114
|
props.onSuccess(result);
|
|
113
115
|
}
|
|
@@ -122,9 +124,9 @@ export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
122
124
|
});
|
|
123
125
|
}
|
|
124
126
|
else {
|
|
125
|
-
|
|
127
|
+
RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.create(config.token, noLoadingState);
|
|
126
128
|
let presentFullScreen = props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
|
|
127
|
-
|
|
129
|
+
RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.open(presentFullScreen, (result) => {
|
|
128
130
|
if (props.onSuccess != null) {
|
|
129
131
|
props.onSuccess(result);
|
|
130
132
|
}
|