react-native-plaid-link-sdk 10.8.0 → 11.0.1

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
@@ -145,6 +145,8 @@ You can also use the `usePlaidEmitter` hook in react functional components:
145
145
 
146
146
  | Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
147
147
  |-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
148
+ | 11.0.1 | * | [4.0.0+] | 21 | 33 | >=5.0.0 | 14.0 | Active, supports Xcode 15.0.1 |
149
+ | 11.0.0 | * | [4.0.0+] | 21 | 33 | >=5.0.0 | 14.0 | Active, supports Xcode 15.0.1 |
148
150
  | 10.8.0 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.7.0 | 11.0 | Active, supports Xcode 14 |
149
151
  | 10.7.0 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.6.4 | 11.0 | Active, supports Xcode 14 |
150
152
  | 10.6.4 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.6.4 | 11.0 | Active, supports Xcode 14 |
File without changes
@@ -1,2 +1,2 @@
1
- #Fri Jul 21 10:43:21 PDT 2023
2
- gradle.version=6.9
1
+ #Thu Nov 09 09:41:17 PST 2023
2
+ gradle.version=7.4.2
@@ -12,7 +12,7 @@ allprojects {
12
12
 
13
13
 
14
14
  buildscript {
15
- ext.kotlin_version = '1.7.10'
15
+ ext.kotlin_version = '1.8.22'
16
16
  repositories {
17
17
  google()
18
18
  mavenCentral()
@@ -70,7 +70,7 @@ repositories {
70
70
 
71
71
  dependencies {
72
72
  implementation "com.facebook.react:react-native:+"
73
- implementation "com.plaid.link:sdk-core:3.14.0"
73
+ implementation "com.plaid.link:sdk-core:4.0.0"
74
74
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
75
75
  implementation "com.jakewharton.rxrelay2:rxrelay:2.1.1"
76
76
  }
@@ -1,6 +1,6 @@
1
- #Wed Oct 23 12:48:00 PDT 2019
1
+ #Thu Nov 09 09:41:09 PST 2023
2
2
  distributionBase=GRADLE_USER_HOME
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3
4
  distributionPath=wrapper/dists
4
- zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
6
+ zipStoreBase=GRADLE_USER_HOME
@@ -4,7 +4,7 @@
4
4
  <application>
5
5
  <meta-data
6
6
  android:name="com.plaid.link.react_native"
7
- android:value="10.8.0" />
7
+ android:value="11.0.1" />
8
8
  </application>
9
9
 
10
10
  </manifest>
@@ -15,10 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
15
15
  import com.plaid.gson.PlaidJsonConverter
16
16
  import com.plaid.link.Plaid
17
17
  import com.plaid.link.configuration.LinkLogLevel
18
- import com.plaid.link.configuration.LinkPublicKeyConfiguration
19
18
  import com.plaid.link.configuration.LinkTokenConfiguration
20
- import com.plaid.link.configuration.PlaidEnvironment
21
- import com.plaid.link.configuration.PlaidProduct
22
19
  import com.plaid.link.event.LinkEvent
23
20
  import com.plaid.link.exception.LinkException
24
21
  import com.plaid.link.result.LinkAccountSubtype
@@ -39,31 +36,13 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
39
36
  private var onExitCallback: Callback? = null
40
37
 
41
38
  companion object {
42
- private const val PRODUCTS = "products"
43
- private const val PUBLIC_KEY = "publicKey"
44
- private const val ACCOUNT_SUBTYPES = "accountSubtypes"
45
- private const val CLIENT_NAME = "clientName"
46
- private const val COUNTRY_CODES = "countryCodes"
47
- private const val LANGUAGE = "language"
48
- private const val LOG_LEVEL = "logLevel"
49
- private const val ENV = "environment"
50
- private const val LINK_CUSTOMIZATION_NAME = "linkCustomizationName"
51
- private const val TOKEN = "token"
52
- private const val NO_LOADING_STATE = "noLoadingState"
53
- private const val USER_EMAIL = "userEmailAddress"
54
- private const val USER_NAME = "userLegalName"
55
- private const val USER_PHONE = "userPhoneNumber"
56
- private const val WEBHOOK = "webhook"
57
- private const val EXTRAS = "extras"
58
39
  private const val LINK_TOKEN_PREFIX = "link"
59
- private const val TYPE = "type"
60
- private const val SUBTYPE = "subtype"
61
40
 
62
41
  const val TAG = "PlaidAndroid"
63
42
  }
64
43
 
65
44
  override fun getName(): String {
66
- return "PlaidAndroid"
45
+ return PlaidModule.TAG
67
46
  }
68
47
 
69
48
  override fun initialize() {
@@ -76,10 +55,11 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
76
55
  reactApplicationContext.removeActivityEventListener(this)
77
56
  }
78
57
 
79
- private fun getLinkTokenConfiguration(obj: JSONObject, token: String?): LinkTokenConfiguration? {
80
- val extrasMap = mutableMapOf<String, String>()
81
- maybePopulateExtrasMap(obj, extrasMap)
82
-
58
+ private fun getLinkTokenConfiguration(
59
+ token: String,
60
+ noLoadingState: Boolean,
61
+ logLevel: LinkLogLevel,
62
+ ): LinkTokenConfiguration? {
83
63
  if (token == null) {
84
64
  return null
85
65
  }
@@ -88,138 +68,10 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
88
68
  return null
89
69
  }
90
70
 
91
- val logLevel =
92
- if (obj.has(LOG_LEVEL)) {
93
- getLogLevel(obj.getString(LOG_LEVEL))
94
- } else {
95
- LinkLogLevel.ASSERT
96
- }
97
-
98
71
  val builder = LinkTokenConfiguration.Builder()
99
72
  .token(token)
100
73
  .logLevel(logLevel)
101
- .noLoadingState(false)
102
-
103
- maybeGetBooleanField(obj, NO_LOADING_STATE)?.let {
104
- builder.noLoadingState(it)
105
- }
106
-
107
- if (extrasMap.isNotEmpty()) {
108
- builder.extraParams(extrasMap)
109
- }
110
-
111
- return builder.build()
112
- }
113
-
114
- private fun getLogLevel(logLevelString: String): LinkLogLevel {
115
- return LinkLogLevel.values().firstOrNull {
116
- it.name.equals(logLevelString, true)
117
- } ?: LinkLogLevel.ASSERT
118
- }
119
-
120
- private fun getLinkPublicKeyConfiguration(
121
- obj: JSONObject,
122
- publicKey: String
123
- ): LinkPublicKeyConfiguration {
124
- val extrasMap = mutableMapOf<String, String>()
125
- maybePopulateExtrasMap(obj, extrasMap)
126
-
127
- val productsArray = ArrayList<PlaidProduct>()
128
- var jsonArray = obj.getJSONArray(PRODUCTS)
129
- for (i in 0 until jsonArray.length()) {
130
- val productString = jsonArray.getString(i)
131
- if (!TextUtils.isEmpty(productString)) {
132
- for (product in PlaidProduct.values()) {
133
- if (!productsArray.contains(product) && product.name
134
- .equals(productString, ignoreCase = true)
135
- ) {
136
- productsArray.add(product)
137
- }
138
- }
139
- }
140
- }
141
-
142
- val logLevel =
143
- if (obj.has(LOG_LEVEL)) {
144
- getLogLevel(obj.getString(LOG_LEVEL))
145
- } else {
146
- LinkLogLevel.ASSERT
147
- }
148
-
149
- val builder = LinkPublicKeyConfiguration.Builder()
150
- .publicKey(publicKey)
151
- .clientName(obj.getString(CLIENT_NAME))
152
- .products(productsArray)
153
- .logLevel(logLevel)
154
-
155
- if (obj.has(ACCOUNT_SUBTYPES)) {
156
- val subtypeList = mutableListOf<LinkAccountSubtype>()
157
- val subtypesArray = obj.getJSONArray(ACCOUNT_SUBTYPES)
158
- for (i in 0 until subtypesArray.length()) {
159
- val subtypeObject = subtypesArray.get(i) as JSONObject
160
- subtypeList.add(
161
- LinkAccountSubtype.convert(
162
- subtypeObject.getString(SUBTYPE),
163
- subtypeObject.getString(TYPE)
164
- )
165
- )
166
- }
167
- builder.accountSubtypes = subtypeList
168
- }
169
-
170
- if (obj.has(COUNTRY_CODES)) {
171
- val countryCodes = ArrayList<String>()
172
- jsonArray = obj.getJSONArray(COUNTRY_CODES)
173
- for (i in 0 until jsonArray.length()) {
174
- countryCodes.add(jsonArray.getString(i))
175
- }
176
- if (countryCodes.isNotEmpty()) {
177
- builder.countryCodes(countryCodes)
178
- }
179
- }
180
-
181
- maybeGetStringField(obj, LANGUAGE)?.let {
182
- builder.language(it)
183
- }
184
-
185
- if (obj.has(ENV)) {
186
- if (!TextUtils.isEmpty(obj.getString(ENV))) {
187
- for (env in PlaidEnvironment.values()) {
188
- if (env.name.equals(obj.getString(ENV), ignoreCase = true)) {
189
- builder.environment(env)
190
- break
191
- }
192
- }
193
- }
194
- }
195
-
196
- maybeGetStringField(obj, LINK_CUSTOMIZATION_NAME)?.let {
197
- builder.linkCustomizationName(it)
198
- }
199
-
200
- maybeGetStringField(obj, TOKEN)?.let {
201
- builder.token(it)
202
- }
203
-
204
- maybeGetStringField(obj, USER_EMAIL)?.let {
205
- builder.userEmailAddress(it)
206
- }
207
-
208
- maybeGetStringField(obj, USER_NAME)?.let {
209
- builder.userLegalName(it)
210
- }
211
-
212
- maybeGetStringField(obj, USER_PHONE)?.let {
213
- builder.userPhoneNumber(it)
214
- }
215
-
216
- maybeGetStringField(obj, WEBHOOK)?.let {
217
- builder.webhook(it)
218
- }
219
-
220
- if (extrasMap.isNotEmpty()) {
221
- builder.extraParams(extrasMap)
222
- }
74
+ .noLoadingState(noLoadingState)
223
75
 
224
76
  return builder.build()
225
77
  }
@@ -227,7 +79,9 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
227
79
  @ReactMethod
228
80
  @Suppress("unused")
229
81
  fun startLinkActivityForResult(
230
- data: String,
82
+ token: String,
83
+ noLoadingState: Boolean,
84
+ logLevel: String,
231
85
  onSuccessCallback: Callback,
232
86
  onExitCallback: Callback
233
87
  ) {
@@ -243,30 +97,7 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
243
97
  .emit("onEvent", eventMap)
244
98
  }
245
99
 
246
- val obj = JSONObject(data)
247
- val publicKey = maybeGetStringField(obj, PUBLIC_KEY)
248
- // If we're initializing with a Link token, we will not use or
249
- // accept many of the client-side configs.
250
- val token = maybeGetStringField(obj, TOKEN)
251
- if (publicKey == null && token == null) {
252
- throw IllegalStateException("Token must be part of configuration.")
253
- }
254
-
255
- publicKey?.let {
256
- try {
257
- Plaid.create(
258
- reactApplicationContext.getApplicationContext() as Application,
259
- getLinkPublicKeyConfiguration(obj, it)
260
- ).open(activity)
261
- return
262
- } catch (ex: Exception) {
263
- Log.w("PlaidModule", "Public key provided but unable to open Link")
264
- Log.w("PlaidModule", ex.message ?: "")
265
- throw ex
266
- }
267
- }
268
-
269
- val tokenConfiguration = getLinkTokenConfiguration(obj, token)
100
+ val tokenConfiguration = getLinkTokenConfiguration(token, noLoadingState, getLogLevel(logLevel))
270
101
  tokenConfiguration?.let {
271
102
  Plaid.create(
272
103
  reactApplicationContext.getApplicationContext() as Application,
@@ -296,14 +127,14 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
296
127
  return null
297
128
  }
298
129
 
299
- private fun maybePopulateExtrasMap(obj: JSONObject, extrasMap: MutableMap<String, String>) {
300
- if (obj.has(EXTRAS)) {
301
- val extrasArray = obj.getJSONArray(EXTRAS)
302
- for (i in 0 until extrasArray.length()) {
303
- val extraObject = extrasArray.get(i) as JSONObject
304
- extraObject.keys().forEach { key ->
305
- extrasMap[key] = extraObject.getString(key)
306
- }
130
+ private fun getLogLevel(string: String): LinkLogLevel {
131
+ when (string) {
132
+ "debug" -> return LinkLogLevel.DEBUG
133
+ "info" -> return LinkLogLevel.INFO
134
+ "warn" -> return LinkLogLevel.WARN
135
+ "error" -> return LinkLogLevel.ERROR
136
+ else -> {
137
+ return LinkLogLevel.ASSERT
307
138
  }
308
139
  }
309
140
  }
package/dist/PlaidLink.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import React, { useEffect } from 'react';
11
11
  import { NativeEventEmitter, NativeModules, Platform, TouchableOpacity, } from 'react-native';
12
- import { LinkIOSPresentationStyle, } from './Types';
12
+ import { LinkIOSPresentationStyle, LinkLogLevel, } from './Types';
13
13
  /**
14
14
  * A hook that registers a listener on the Plaid emitter for the 'onEvent' type.
15
15
  * The listener is cleaned up when this view is unmounted
@@ -29,12 +29,10 @@ export const usePlaidEmitter = (LinkEventListener) => {
29
29
  }, []);
30
30
  };
31
31
  export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* () {
32
- if (props.tokenConfig == null) {
33
- console.log('The public_key is being deprecated. Learn how to upgrade to link_tokens at https://plaid.com/docs/link-token-migration-guide/');
34
- }
35
- let config = props.tokenConfig ? props.tokenConfig : props.publicKeyConfig;
32
+ var _a;
33
+ let config = props.tokenConfig;
36
34
  if (Platform.OS === 'android') {
37
- NativeModules.PlaidAndroid.startLinkActivityForResult(JSON.stringify(config), (result) => {
35
+ NativeModules.PlaidAndroid.startLinkActivityForResult(config.token, config.noLoadingState, (_a = config.logLevel) !== null && _a !== void 0 ? _a : LinkLogLevel.ERROR, (result) => {
38
36
  if (props.onSuccess != null) {
39
37
  props.onSuccess(result);
40
38
  }
@@ -49,7 +47,7 @@ export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* (
49
47
  });
50
48
  }
51
49
  else {
52
- NativeModules.RNLinksdk.create(config);
50
+ NativeModules.RNLinksdk.create(config.token, config.noLoadingState);
53
51
  let presentFullScreen = props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
54
52
  NativeModules.RNLinksdk.open(presentFullScreen, (result) => {
55
53
  if (props.onSuccess != null) {
package/dist/Types.d.ts CHANGED
@@ -7,26 +7,6 @@ export type LinkTokenConfiguration = (CommonPlaidLinkOptions & {
7
7
  token: string;
8
8
  noLoadingState: boolean;
9
9
  });
10
- export type LinkPublicKeyConfiguration = (CommonPlaidLinkOptions & {
11
- token?: string;
12
- publicKey?: string;
13
- clientName: string;
14
- environment: PlaidEnvironment;
15
- products: Array<PlaidProduct>;
16
- language: string;
17
- countryCodes: Array<string>;
18
- webhook?: string;
19
- userLegalName?: string;
20
- userEmailAddress?: string;
21
- userPhoneNumber?: string;
22
- linkCustomizationName?: string;
23
- accountSubtypes?: Array<LinkAccountSubtype>;
24
- oauthConfiguration?: OAuthConfiguration;
25
- });
26
- export interface OAuthConfiguration {
27
- nonce?: string;
28
- redirectUri?: string;
29
- }
30
10
  export declare enum LinkLogLevel {
31
11
  DEBUG = "debug",
32
12
  INFO = "info",
@@ -50,7 +30,7 @@ export declare enum PlaidProduct {
50
30
  PAYMENT_INITIATION = "payment_initiation",
51
31
  TRANSACTIONS = "transactions"
52
32
  }
53
- declare enum LinkAccountType {
33
+ export declare enum LinkAccountType {
54
34
  CREDIT = "credit",
55
35
  DEPOSITORY = "depository",
56
36
  INVESTMENT = "investment",
@@ -427,13 +407,12 @@ export declare enum LinkIOSPresentationStyle {
427
407
  export type LinkSuccessListener = (LinkSuccess: LinkSuccess) => void;
428
408
  export type LinkExitListener = (LinkExit: LinkExit) => void;
429
409
  export type LinkOnEventListener = (LinkEvent: LinkEvent) => void;
430
- export type PlaidLinkConfiguration = LinkTokenConfiguration | LinkPublicKeyConfiguration;
431
410
  export interface PlaidLinkProps {
432
- tokenConfig?: LinkTokenConfiguration;
433
- publicKeyConfig?: LinkPublicKeyConfiguration;
411
+ tokenConfig: LinkTokenConfiguration;
434
412
  onSuccess: LinkSuccessListener;
435
413
  onExit?: LinkExitListener;
436
414
  iOSPresentationStyle?: LinkIOSPresentationStyle;
415
+ logLevel?: LinkLogLevel;
437
416
  onPress?(): any;
438
417
  }
439
418
  export type PlaidLinkComponentProps = (PlaidLinkProps & {
package/dist/Types.js CHANGED
@@ -24,7 +24,7 @@ export var PlaidProduct;
24
24
  PlaidProduct["PAYMENT_INITIATION"] = "payment_initiation";
25
25
  PlaidProduct["TRANSACTIONS"] = "transactions";
26
26
  })(PlaidProduct || (PlaidProduct = {}));
27
- var LinkAccountType;
27
+ export var LinkAccountType;
28
28
  (function (LinkAccountType) {
29
29
  LinkAccountType["CREDIT"] = "credit";
30
30
  LinkAccountType["DEPOSITORY"] = "depository";
@@ -34,7 +34,8 @@ internal final class PLKEmbeddedView: UIView {
34
34
  var dictionary = RNLinksdk.dictionary(from: plkLinkSuccess) ?? [:]
35
35
  dictionary[self.embeddedEventName] = "onSuccess"
36
36
  self.onEmbeddedEvent?(dictionary)
37
- })
37
+ }
38
+ )
38
39
 
39
40
  config.onEvent = { [weak self] event in
40
41
  guard let self = self else { return }
@@ -58,13 +59,13 @@ internal final class PLKEmbeddedView: UIView {
58
59
 
59
60
  switch handlerCreationResult {
60
61
  case .failure(let error):
61
- throw(error)
62
+ throw (error)
62
63
  case .success(let handler):
63
64
  return handler
64
65
  }
65
66
  }
66
67
 
67
- private func makeEmbeddedView(rctViewController: UIViewController, handler: Handler) throws -> UIView {
68
+ private func makeEmbeddedView(rctViewController: UIViewController, handler: Handler) -> UIView {
68
69
  self.linkHandler = handler
69
70
 
70
71
  let presentationMethod: PresentationMethod
@@ -80,15 +81,7 @@ internal final class PLKEmbeddedView: UIView {
80
81
  presentationMethod = .viewController(rctViewController)
81
82
  }
82
83
 
83
- let embeddedResult = handler.createEmbeddedView(presentUsing: presentationMethod)
84
-
85
- switch embeddedResult {
86
- case .failure(let error):
87
- throw error
88
-
89
- case .success(let embeddedView):
90
- return embeddedView
91
- }
84
+ return handler.createEmbeddedView(presentUsing: presentationMethod)
92
85
  }
93
86
 
94
87
  private func createNativeEmbeddedView() {
@@ -97,12 +90,12 @@ internal final class PLKEmbeddedView: UIView {
97
90
 
98
91
  do {
99
92
  let handler = try makeHandler()
100
- let embeddedView = try makeEmbeddedView(rctViewController: rctViewController, handler: handler)
93
+ let embeddedView = makeEmbeddedView(rctViewController: rctViewController, handler: handler)
101
94
  setup(embeddedView: embeddedView)
102
95
  } catch {
103
96
  let dict: [String: Any] = [
104
97
  embeddedEventName: "onExit",
105
- "error": "\(error)"
98
+ "error": "\(error)",
106
99
  ]
107
100
 
108
101
  onEmbeddedEvent?(dict)
@@ -117,7 +110,7 @@ internal final class PLKEmbeddedView: UIView {
117
110
  embeddedView.topAnchor.constraint(equalTo: topAnchor),
118
111
  embeddedView.leadingAnchor.constraint(equalTo: leadingAnchor),
119
112
  embeddedView.trailingAnchor.constraint(equalTo: trailingAnchor),
120
- embeddedView.bottomAnchor.constraint(equalTo: bottomAnchor)
113
+ embeddedView.bottomAnchor.constraint(equalTo: bottomAnchor),
121
114
  ])
122
115
  }
123
116
  }
package/ios/RNLinksdk.m CHANGED
@@ -5,41 +5,12 @@
5
5
  #import <React/RCTConvert.h>
6
6
  #import <React/RCTUtils.h>
7
7
 
8
- #import <objc/runtime.h>
9
-
10
- static NSString* const kRNLinkKitConfigPublicKeyKey = @"publicKey";
11
- static NSString* const kRNLinkKitConfigEnvKey = @"environment";
12
- static NSString* const kRNLinkKitConfigProductsKey = @"products";
13
- static NSString* const kRNLinkKitConfigClientNameKey = @"clientName";
14
- static NSString* const kRNLinkKitConfigWebhookKey = @"webhook";
15
- static NSString* const kRNLinkKitConfigLinkCustomizationName = @"linkCustomizationName";
16
- static NSString* const kRNLinkKitConfigLinkTokenKey = @"token";
17
- static NSString* const kRNLinkKitConfigSelectAccountKey = @"selectAccount";
18
- static NSString* const kRNLinkKitConfigUserLegalNameKey = @"userLegalName";
19
- static NSString* const kRNLinkKitConfigUserEmailAddressKey = @"userEmailAddress";
20
- static NSString* const kRNLinkKitConfigUserPhoneNumberKey = @"userPhoneNumber";
21
- static NSString* const kRNLinkKitConfigAccountSubtypes = @"accountSubtypes";
22
- static NSString* const kRNLinkKitConfigCountryCodesKey = @"countryCodes";
23
- static NSString* const kRNLinkKitConfigLanguageKey = @"language";
24
- static NSString* const kRNLinkKitConfigInstitutionKey = @"institution";
25
- static NSString* const kRNLinkKitConfigNoLoadingStateKey = @"noLoadingState";
26
- static NSString* const kRNLinkKitConfigLongtailAuthKey = @"longtailAuth";
27
- static NSString* const kRNLinkKitConfigApiVersionKey = @"apiVersion";
28
- static NSString* const kRNLinkKitConfigOAuthRedirectUriKeyPath = @"oauthConfiguration.redirectUri";
29
- static NSString* const kRNLinkKitConfigOAuthNonceKeyPath = @"oauthConfiguration.nonce";
30
-
31
8
  static NSString* const kRNLinkKitOnEventEvent = @"onEvent";
32
9
  static NSString* const kRNLinkKitEventErrorKey = @"error";
33
10
  static NSString* const kRNLinkKitEventNameKey = @"event";
34
11
  static NSString* const kRNLinkKitEventMetadataKey = @"metadata";
35
12
  static NSString* const kRNLinkKitVersionConstant = @"version";
36
13
 
37
- NSString* const kRNLinkKitLinkTokenPrefix = @"link-";
38
- NSString* const kRNLinkKitItemAddTokenPrefix = @"item-add-";
39
- NSString* const kRNLinkKitPaymentTokenPrefix = @"payment";
40
- NSString* const kRNLinkKitDepositSwitchTokenPrefix = @"deposit-switch-";
41
- NSString* const kRNLinkKitPublicTokenPrefix = @"public-";
42
-
43
14
  @interface RNLinksdk ()
44
15
  @property (nonatomic, strong) id<PLKHandler> linkHandler;
45
16
  @property (nonatomic, strong) UIViewController* presentingViewController;
@@ -50,78 +21,17 @@ NSString* const kRNLinkKitPublicTokenPrefix = @"public-";
50
21
  @property (nonatomic, nullable, strong) NSError *creationError;
51
22
  @end
52
23
 
53
- #pragma mark -
54
-
55
- // Category to ensure both the old, typo spelling of `insitution` and
56
- // the corrected spelling `institution` are visible to the implementation
57
- // to allow compiling against any LinkKit dependency
58
- @interface PLKSuccessMetadata (InstitutionTypoFix)
59
-
60
- - (PLKInstitution * __nonnull)institution;
61
- - (PLKInstitution * __nonnull)insitution;
62
-
63
- @end
64
-
65
- // Class to have a distinct +load method to hook into the runtime before
66
- // SDK logic executes
67
- @interface PLKSuccessMetadataTypoFix : NSObject
68
-
69
- @end
70
-
71
- @implementation PLKSuccessMetadataTypoFix
72
-
73
- + (void)load {
74
- static dispatch_once_t onceToken;
75
- // dispatch_once out of an abundance of caution in case +load is ever called multiple times
76
- dispatch_once(&onceToken, ^{
77
- Class targetClass = NSClassFromString(@"PLKSuccessMetadata");
78
- if (targetClass == Nil) {
79
- return;
80
- }
81
-
82
- SEL typoSel = NSSelectorFromString(@"insitution");
83
- SEL correctSel = NSSelectorFromString(@"institution");
84
-
85
- BOOL respondsToTypoSel = class_respondsToSelector(targetClass, typoSel);
86
- BOOL respondsToCorrectSel = class_respondsToSelector(targetClass, correctSel);
87
-
88
- BOOL respondsToBoth = respondsToCorrectSel && respondsToTypoSel;
89
-
90
- // If PLKSuccessMetadata responds to both, no swizzling is necessary
91
- if (respondsToBoth) {
92
- return;
93
- }
94
-
95
- BOOL respondsToNeither = !(respondsToCorrectSel || respondsToTypoSel);
96
- // If PLKSuccessMetadata responds to neither, swizzling cannot fix this
97
- if (respondsToNeither) {
98
- NSString *githubIssueURLString = @"https://github.com/plaid/react-native-plaid-link-sdk/issues/new?assignees=&labels=&template=bug_report.md&title=";
99
- NSAssert(NO, @"%@ does not respond to correctly spelled %@ or legacy, typo %@. This is a bug in either react-native-plaid-link-sdk, or LinkKit. Please file an issue at: %@", NSStringFromClass(targetClass), NSStringFromSelector(correctSel), NSStringFromSelector(typoSel), githubIssueURLString);
100
- return;
101
- }
102
-
103
- SEL existingSel = respondsToCorrectSel ? correctSel : typoSel;
104
- SEL missingSel = respondsToTypoSel ? correctSel : typoSel;
105
-
106
- Method method = class_getInstanceMethod(targetClass, existingSel);
107
- const char* types = method_getTypeEncoding(method);
108
- IMP implementation = class_getMethodImplementation(targetClass, existingSel);
109
- class_addMethod(targetClass, missingSel, implementation, types);
110
- });
111
- }
112
-
113
- @end
114
24
 
115
25
  @implementation RNLinksdk
116
26
 
117
27
  RCT_EXPORT_MODULE();
118
28
 
119
29
  + (NSString*)sdkVersion {
120
- return @"10.8.0"; // SDK_VERSION
30
+ return @"11.0.1"; // SDK_VERSION
121
31
  }
122
32
 
123
33
  + (NSString*)objCBridgeVersion {
124
- return @"1.1.0";
34
+ return @"2.0.0";
125
35
  }
126
36
 
127
37
  + (BOOL)requiresMainQueueSetup
@@ -156,22 +66,9 @@ RCT_EXPORT_MODULE();
156
66
  self.hasObservers = NO;
157
67
  }
158
68
 
159
- RCT_EXPORT_METHOD(continueFromRedirectUriString:(NSString *)redirectUriString) {
160
- NSURL *receivedRedirectUri = (id)redirectUriString == [NSNull null] ? nil : [NSURL URLWithString:redirectUriString];
161
-
162
- if (receivedRedirectUri && self.linkHandler) {
163
- [self.linkHandler continueWithRedirectUri:receivedRedirectUri];
164
- }
165
- }
166
-
167
- RCT_EXPORT_METHOD(create:(NSDictionary*)configuration) {
168
- // Configuration
169
- NSString *linkTokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
170
- NSString *institution = [RCTConvert NSString:configuration[kRNLinkKitConfigInstitutionKey]];
171
-
172
- BOOL isUsingLinkToken = [linkTokenInput length] && [linkTokenInput hasPrefix:kRNLinkKitLinkTokenPrefix];
173
-
69
+ RCT_EXPORT_METHOD(create:(NSString*)token :(BOOL)noLoadingState) {
174
70
  __weak typeof(self) weakSelf = self;
71
+
175
72
  void (^onSuccess)(PLKLinkSuccess *) = ^(PLKLinkSuccess *success) {
176
73
  __typeof(weakSelf) strongSelf = weakSelf;
177
74
 
@@ -205,31 +102,14 @@ RCT_EXPORT_METHOD(create:(NSDictionary*)configuration) {
205
102
  }
206
103
  };
207
104
 
208
- if (isUsingLinkToken) {
209
- PLKLinkTokenConfiguration *config = [self getLinkTokenConfiguration:configuration
210
- onSuccessHandler:onSuccess];
211
- config.onEvent = onEvent;
212
- config.onExit = onExit;
213
- config.noLoadingState = configuration[kRNLinkKitConfigNoLoadingStateKey];
214
-
215
- NSError *creationError = nil;
216
- self.linkHandler = [PLKPlaid createWithLinkTokenConfiguration:config
217
- error:&creationError];
218
- self.creationError = creationError;
219
- } else {
220
- PLKLinkPublicKeyConfiguration *config = [self getLegacyLinkConfiguration:configuration
221
- onSuccessHandler:onSuccess];
222
- config.onEvent = onEvent;
223
- config.onExit = onExit;
224
- NSError *creationError = nil;
225
- self.linkHandler = [PLKPlaid createWithLinkPublicKeyConfiguration:config
226
- error:&creationError];
227
- self.creationError = creationError;
228
- }
105
+ PLKLinkTokenConfiguration *config = [PLKLinkTokenConfiguration createWithToken:token onSuccess:onSuccess];
106
+ config.onEvent = onEvent;
107
+ config.onExit = onExit;
108
+ config.noLoadingState = noLoadingState;
229
109
 
230
- if ([institution length] > 0) {
231
- self.institutionID = institution;
232
- }
110
+ NSError *creationError = nil;
111
+ self.linkHandler = [PLKPlaid createWithLinkTokenConfiguration:config error:&creationError];
112
+ self.creationError = creationError;
233
113
  }
234
114
 
235
115
  RCT_EXPORT_METHOD(open: (BOOL)fullScreen :(RCTResponseSenderBlock)onSuccess :(RCTResponseSenderBlock)onExit) {
@@ -237,7 +117,6 @@ RCT_EXPORT_METHOD(open: (BOOL)fullScreen :(RCTResponseSenderBlock)onSuccess :(RC
237
117
  self.successCallback = onSuccess;
238
118
  self.exitCallback = onExit;
239
119
  self.presentingViewController = RCTPresentedViewController();
240
- NSDictionary *options = self.institutionID.length > 0 ? @{@"institution_id": self.institutionID} : @{};
241
120
 
242
121
  // Some link flows do not need to present UI, so track if presentation happened so dismissal isn't
243
122
  // unnecessarily invoked.
@@ -260,7 +139,7 @@ RCT_EXPORT_METHOD(open: (BOOL)fullScreen :(RCTResponseSenderBlock)onSuccess :(RC
260
139
  didPresent = NO;
261
140
  }
262
141
  };
263
- [self.linkHandler openWithPresentationHandler:presentationHandler dismissalHandler:dismissalHandler options:options];
142
+ [self.linkHandler openWithPresentationHandler:presentationHandler dismissalHandler:dismissalHandler];
264
143
  } else {
265
144
  NSString *errorMessage = self.creationError ? self.creationError.userInfo[@"message"] : @"Create was not called.";
266
145
  NSString *errorCode = self.creationError ? [@(self.creationError.code) stringValue] : @"-1";
@@ -292,87 +171,6 @@ RCT_EXPORT_METHOD(dismiss) {
292
171
  self.linkHandler = nil;
293
172
  }
294
173
 
295
- - (PLKLinkTokenConfiguration *)getLinkTokenConfiguration:(NSDictionary *)configuration
296
- onSuccessHandler:(void(^)(PLKLinkSuccess *))onSuccessHandler {
297
- NSString *linkTokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
298
-
299
- return [PLKLinkTokenConfiguration createWithToken:linkTokenInput onSuccess:onSuccessHandler];
300
- }
301
-
302
- - (PLKLinkPublicKeyConfiguration *)getLegacyLinkConfiguration:(NSDictionary *)configuration
303
- onSuccessHandler:(void(^)(PLKLinkSuccess *))onSuccessHandler {
304
- NSString *key = [RCTConvert NSString:configuration[kRNLinkKitConfigPublicKeyKey]];
305
- NSString *tokenInput = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkTokenKey]];
306
- NSString *env = [RCTConvert NSString:configuration[kRNLinkKitConfigEnvKey]];
307
- NSArray<NSString*> *productsInput = [RCTConvert NSStringArray:configuration[kRNLinkKitConfigProductsKey]];
308
- NSString *clientName = [RCTConvert NSString:configuration[kRNLinkKitConfigClientNameKey]];
309
- NSString *webhook = [RCTConvert NSString:configuration[kRNLinkKitConfigWebhookKey]];
310
- NSString *linkCustomizationName = [RCTConvert NSString:configuration[kRNLinkKitConfigLinkCustomizationName]];
311
- NSString *userLegalName = [RCTConvert NSString:configuration[kRNLinkKitConfigUserLegalNameKey]];
312
- NSString *userEmailAddress = [RCTConvert NSString:configuration[kRNLinkKitConfigUserEmailAddressKey]];
313
- NSString *userPhoneNumber = [RCTConvert NSString:configuration[kRNLinkKitConfigUserPhoneNumberKey]];
314
- NSString *oauthRedirectUriInput = [configuration valueForKeyPath:kRNLinkKitConfigOAuthRedirectUriKeyPath];
315
- NSString *oauthRedirectUriString = [RCTConvert NSString:oauthRedirectUriInput];
316
- NSString *oauthNonceInput = [configuration valueForKeyPath:kRNLinkKitConfigOAuthNonceKeyPath];
317
- NSString *oauthNonce = [RCTConvert NSString:oauthNonceInput];
318
- id accountSubtypesInput = configuration[kRNLinkKitConfigAccountSubtypes];
319
- NSArray<NSDictionary<NSString*, NSString *>*> *accountSubtypeDictionaries = [RCTConvert NSDictionaryArray:accountSubtypesInput];
320
- NSArray<NSString*> *countryCodes = [RCTConvert NSStringArray:configuration[kRNLinkKitConfigCountryCodesKey]];
321
- NSString *language = [RCTConvert NSString:configuration[kRNLinkKitConfigLanguageKey]];
322
-
323
- PLKLinkPublicKeyConfigurationToken *token;
324
- BOOL isPaymentToken = [tokenInput hasPrefix:kRNLinkKitPaymentTokenPrefix];
325
- BOOL isItemAddToken = [tokenInput hasPrefix:kRNLinkKitItemAddTokenPrefix];
326
- BOOL isDepositSwitchToken = [tokenInput hasPrefix:kRNLinkKitDepositSwitchTokenPrefix];
327
- BOOL isPublicToken = [tokenInput hasPrefix:kRNLinkKitPublicTokenPrefix];
328
- if (isPaymentToken) {
329
- token = [PLKLinkPublicKeyConfigurationToken createWithPaymentToken:tokenInput publicKey:key];
330
- } else if (isItemAddToken) {
331
- token = [PLKLinkPublicKeyConfigurationToken createWithPublicToken:tokenInput publicKey:key];
332
- } else if (isDepositSwitchToken) {
333
- token = [PLKLinkPublicKeyConfigurationToken createWithDepositSwitchToken:tokenInput publicKey:key];
334
- } else if (isPublicToken) {
335
- token = [PLKLinkPublicKeyConfigurationToken createWithPublicToken:tokenInput publicKey:key];
336
- } else {
337
- token = [PLKLinkPublicKeyConfigurationToken createWithPublicKey:key];
338
- }
339
-
340
- PLKEnvironment environment = [RNLinksdk environmentFromString:env];
341
- NSArray<NSNumber *> *products = [RNLinksdk productsArrayFromProductsStringArray:productsInput];
342
- PLKLinkPublicKeyConfiguration *linkConfiguration = [[PLKLinkPublicKeyConfiguration alloc] initWithClientName:clientName
343
- environment:environment
344
- products:products
345
- language:language
346
- token:token
347
- countryCodes:countryCodes
348
- onSuccess:onSuccessHandler];
349
- if ([linkCustomizationName length] > 0) {
350
- linkConfiguration.linkCustomizationName = linkCustomizationName;
351
- }
352
- if ([webhook length] > 0) {
353
- linkConfiguration.webhook = [NSURL URLWithString:webhook];
354
- }
355
- if ([userLegalName length] > 0) {
356
- linkConfiguration.userLegalName = userLegalName;
357
- }
358
- if ([userEmailAddress length] > 0) {
359
- linkConfiguration.userEmailAddress = userEmailAddress;
360
- }
361
- if ([userPhoneNumber length] > 0) {
362
- linkConfiguration.userPhoneNumber = userPhoneNumber;
363
- }
364
- if ([oauthRedirectUriString length] > 0 && [oauthNonce length] > 0) {
365
- NSURL* oauthRedirectUri = [NSURL URLWithString:oauthRedirectUriString];
366
- linkConfiguration.oauthConfiguration = [PLKOAuthNonceConfiguration createWithNonce:oauthNonce
367
- redirectUri:oauthRedirectUri];
368
- }
369
- if ([accountSubtypeDictionaries count] > 0) {
370
- linkConfiguration.accountSubtypes = [RNLinksdk accountSubtypesArrayFromAccountSubtypeDictionaries:accountSubtypeDictionaries];
371
- }
372
-
373
- return linkConfiguration;
374
- }
375
-
376
174
  #pragma mark - Bridging
377
175
 
378
176
  + (PLKEnvironment)environmentFromString:(NSString *)string {
@@ -393,222 +191,6 @@ RCT_EXPORT_METHOD(dismiss) {
393
191
  return PLKEnvironmentDevelopment;
394
192
  }
395
193
 
396
- + (NSArray<NSNumber *> *)productsArrayFromProductsStringArray:(NSArray<NSString *> *)productsStringArray {
397
- NSMutableArray<NSNumber *> *results = [NSMutableArray arrayWithCapacity:productsStringArray.count];
398
-
399
- for (NSString *productString in productsStringArray) {
400
- NSNumber *product = [self productFromProductString:productString];
401
- if (product) {
402
- [results addObject:product];
403
- }
404
- }
405
-
406
- return [results copy];
407
- }
408
-
409
- + (NSNumber * __nullable)productFromProductString:(NSString *)productString {
410
- NSDictionary *productStringMap = @{
411
- @"auth": @(PLKProductAuth),
412
- @"identity": @(PLKProductIdentity),
413
- @"income": @(PLKProductIncome),
414
- @"transactions": @(PLKProductTransactions),
415
- @"assets": @(PLKProductAssets),
416
- @"liabilities": @(PLKProductLiabilities),
417
- @"investments": @(PLKProductInvestments),
418
- @"deposit_switch": @(PLKProductDepositSwitch),
419
- };
420
- return productStringMap[productString.lowercaseString];
421
- }
422
-
423
- + (NSArray<id<PLKAccountSubtype>> *)accountSubtypesArrayFromAccountSubtypeDictionaries:(NSArray<NSDictionary<NSString *, NSString *> *> *)accountSubtypeDictionaries {
424
- __block NSMutableArray<id<PLKAccountSubtype>> *results = [NSMutableArray array];
425
-
426
- for (NSDictionary *accountSubtypeDictionary in accountSubtypeDictionaries) {
427
- NSString *type = accountSubtypeDictionary[@"type"];
428
- NSString *subtype = accountSubtypeDictionary[@"subtype"];
429
- id<PLKAccountSubtype> result = [self accountSubtypeFromTypeString:type subtypeString:subtype];
430
- if (result) {
431
- [results addObject:result];
432
- }
433
- }
434
-
435
- return [results copy];
436
- }
437
-
438
- + (id<PLKAccountSubtype>)accountSubtypeFromTypeString:(NSString *)typeString
439
- subtypeString:(NSString *)subtypeString {
440
- NSString *normalizedTypeString = typeString.lowercaseString;
441
- NSString *normalizedSubtypeString = subtypeString.lowercaseString;
442
- if ([normalizedTypeString isEqualToString:@"other"]) {
443
- if ([normalizedSubtypeString isEqualToString:@"all"]) {
444
- return [PLKAccountSubtypeOther createWithValue:PLKAccountSubtypeValueOtherAll];
445
- } else if ([normalizedSubtypeString isEqualToString:@"other"]) {
446
- return [PLKAccountSubtypeOther createWithValue:PLKAccountSubtypeValueOtherOther];
447
- } else {
448
- return [PLKAccountSubtypeOther createWithRawStringValue:normalizedSubtypeString];
449
- }
450
- } else if ([normalizedTypeString isEqualToString:@"credit"]) {
451
- if ([normalizedSubtypeString isEqualToString:@"all"]) {
452
- return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditAll];
453
- } else if ([normalizedSubtypeString isEqualToString:@"credit card"]) {
454
- return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditCreditCard];
455
- } else if ([normalizedSubtypeString isEqualToString:@"paypal"]) {
456
- return [PLKAccountSubtypeCredit createWithValue:PLKAccountSubtypeValueCreditPaypal];
457
- } else {
458
- return [PLKAccountSubtypeCredit createWithUnknownValue:subtypeString];
459
- }
460
- } else if ([normalizedTypeString isEqualToString:@"loan"]) {
461
- if ([normalizedSubtypeString isEqualToString:@"all"]) {
462
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanAll];
463
- } else if ([normalizedSubtypeString isEqualToString:@"auto"]) {
464
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanAuto];
465
- } else if ([normalizedSubtypeString isEqualToString:@"business"]) {
466
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanBusiness];
467
- } else if ([normalizedSubtypeString isEqualToString:@"commercial"]) {
468
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanCommercial];
469
- } else if ([normalizedSubtypeString isEqualToString:@"construction"]) {
470
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanConstruction];
471
- } else if ([normalizedSubtypeString isEqualToString:@"consumer"]) {
472
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanConsumer];
473
- } else if ([normalizedSubtypeString isEqualToString:@"home equity"]) {
474
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanHomeEquity];
475
- } else if ([normalizedSubtypeString isEqualToString:@"line of credit"]) {
476
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanLineOfCredit];
477
- } else if ([normalizedSubtypeString isEqualToString:@"loan"]) {
478
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanLoan];
479
- } else if ([normalizedSubtypeString isEqualToString:@"mortgage"]) {
480
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanMortgage];
481
- } else if ([normalizedSubtypeString isEqualToString:@"overdraft"]) {
482
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanOverdraft];
483
- } else if ([normalizedSubtypeString isEqualToString:@"student"]) {
484
- return [PLKAccountSubtypeLoan createWithValue:PLKAccountSubtypeValueLoanStudent];
485
- } else {
486
- return [PLKAccountSubtypeLoan createWithUnknownValue:subtypeString];
487
- }
488
- } else if ([normalizedTypeString isEqualToString:@"depository"]) {
489
- if ([normalizedSubtypeString isEqualToString:@"all"]) {
490
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryAll];
491
- } else if ([normalizedSubtypeString isEqualToString:@"cash management"]) {
492
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryCashManagement];
493
- } else if ([normalizedSubtypeString isEqualToString:@"cd"]) {
494
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryCd];
495
- } else if ([normalizedSubtypeString isEqualToString:@"checking"]) {
496
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryChecking];
497
- } else if ([normalizedSubtypeString isEqualToString:@"ebt"]) {
498
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryEbt];
499
- } else if ([normalizedSubtypeString isEqualToString:@"hsa"]) {
500
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryHsa];
501
- } else if ([normalizedSubtypeString isEqualToString:@"money market"]) {
502
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryMoneyMarket];
503
- } else if ([normalizedSubtypeString isEqualToString:@"paypal"]) {
504
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryPaypal];
505
- } else if ([normalizedSubtypeString isEqualToString:@"prepaid"]) {
506
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositoryPrepaid];
507
- } else if ([normalizedSubtypeString isEqualToString:@"savings"]) {
508
- return [PLKAccountSubtypeDepository createWithValue:PLKAccountSubtypeValueDepositorySavings];
509
- } else {
510
- return [PLKAccountSubtypeDepository createWithUnknownValue:subtypeString];
511
- }
512
-
513
- } else if ([normalizedTypeString isEqualToString:@"investment"]) {
514
- if ([normalizedSubtypeString isEqualToString:@"all"]) {
515
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentAll];
516
- } else if ([normalizedSubtypeString isEqualToString:@"401a"]) {
517
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment401a];
518
- } else if ([normalizedSubtypeString isEqualToString:@"401k"]) {
519
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment401k];
520
- } else if ([normalizedSubtypeString isEqualToString:@"403B"]) {
521
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment403B];
522
- } else if ([normalizedSubtypeString isEqualToString:@"457b"]) {
523
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment457b];
524
- } else if ([normalizedSubtypeString isEqualToString:@"529"]) {
525
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestment529];
526
- } else if ([normalizedSubtypeString isEqualToString:@"brokerage"]) {
527
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentBrokerage];
528
- } else if ([normalizedSubtypeString isEqualToString:@"cash isa"]) {
529
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentCashIsa];
530
- } else if ([normalizedSubtypeString isEqualToString:@"education savings account"]) {
531
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentEducationSavingsAccount];
532
- } else if ([normalizedSubtypeString isEqualToString:@"fixed annuity"]) {
533
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentFixedAnnuity];
534
- } else if ([normalizedSubtypeString isEqualToString:@"gic"]) {
535
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentGic];
536
- } else if ([normalizedSubtypeString isEqualToString:@"health reimbursement arrangement"]) {
537
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentHealthReimbursementArrangement];
538
- } else if ([normalizedSubtypeString isEqualToString:@"hsa"]) {
539
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentHsa];
540
- } else if ([normalizedSubtypeString isEqualToString:@"ira"]) {
541
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentIra];
542
- } else if ([normalizedSubtypeString isEqualToString:@"isa"]) {
543
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentIsa];
544
- } else if ([normalizedSubtypeString isEqualToString:@"keogh"]) {
545
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentKeogh];
546
- } else if ([normalizedSubtypeString isEqualToString:@"lif"]) {
547
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLif];
548
- } else if ([normalizedSubtypeString isEqualToString:@"lira"]) {
549
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLira];
550
- } else if ([normalizedSubtypeString isEqualToString:@"lrif"]) {
551
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLrif];
552
- } else if ([normalizedSubtypeString isEqualToString:@"lrsp"]) {
553
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentLrsp];
554
- } else if ([normalizedSubtypeString isEqualToString:@"mutual fund"]) {
555
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentMutualFund];
556
- } else if ([normalizedSubtypeString isEqualToString:@"non-taxable brokerage account"]) {
557
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentNonTaxableBrokerageAccount];
558
- } else if ([normalizedSubtypeString isEqualToString:@"pension"]) {
559
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPension];
560
- } else if ([normalizedSubtypeString isEqualToString:@"plan"]) {
561
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPlan];
562
- } else if ([normalizedSubtypeString isEqualToString:@"prif"]) {
563
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentPrif];
564
- } else if ([normalizedSubtypeString isEqualToString:@"profit sharing plan"]) {
565
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentProfitSharingPlan];
566
- } else if ([normalizedSubtypeString isEqualToString:@"rdsp"]) {
567
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRdsp];
568
- } else if ([normalizedSubtypeString isEqualToString:@"resp"]) {
569
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentResp];
570
- } else if ([normalizedSubtypeString isEqualToString:@"retirement"]) {
571
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRetirement];
572
- } else if ([normalizedSubtypeString isEqualToString:@"rlif"]) {
573
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRlif];
574
- } else if ([normalizedSubtypeString isEqualToString:@"roth 401k"]) {
575
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRoth401k];
576
- } else if ([normalizedSubtypeString isEqualToString:@"roth"]) {
577
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRoth];
578
- } else if ([normalizedSubtypeString isEqualToString:@"rrif"]) {
579
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRrif];
580
- } else if ([normalizedSubtypeString isEqualToString:@"rrsp"]) {
581
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentRrsp];
582
- } else if ([normalizedSubtypeString isEqualToString:@"sarsep"]) {
583
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSarsep];
584
- } else if ([normalizedSubtypeString isEqualToString:@"sep ira"]) {
585
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSepIra];
586
- } else if ([normalizedSubtypeString isEqualToString:@"simple ira"]) {
587
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSimpleIra];
588
- } else if ([normalizedSubtypeString isEqualToString:@"sipp"]) {
589
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentSipp];
590
- } else if ([normalizedSubtypeString isEqualToString:@"stock plan"]) {
591
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentStockPlan];
592
- } else if ([normalizedSubtypeString isEqualToString:@"tfsa"]) {
593
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentTfsa];
594
- } else if ([normalizedSubtypeString isEqualToString:@"thrift savings plan"]) {
595
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentThriftSavingsPlan];
596
- } else if ([normalizedSubtypeString isEqualToString:@"trust"]) {
597
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentTrust];
598
- } else if ([normalizedSubtypeString isEqualToString:@"ugma"]) {
599
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentUgma];
600
- } else if ([normalizedSubtypeString isEqualToString:@"utma"]) {
601
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentUtma];
602
- } else if ([normalizedSubtypeString isEqualToString:@"variable annuity"]) {
603
- return [PLKAccountSubtypeInvestment createWithValue:PLKAccountSubtypeValueInvestmentVariableAnnuity];
604
- } else {
605
- return [PLKAccountSubtypeInvestment createWithUnknownValue:subtypeString];
606
- }
607
- }
608
-
609
- return [PLKAccountSubtypeUnknown createWithRawTypeStringValue:typeString rawSubtypeStringValue:subtypeString];
610
- }
611
-
612
194
  + (NSDictionary *)dictionaryFromSuccess:(PLKLinkSuccess *)success {
613
195
  PLKSuccessMetadata *metadata = success.metadata;
614
196
 
@@ -716,39 +298,23 @@ RCT_EXPORT_METHOD(dismiss) {
716
298
  return @{
717
299
  @"eventName": [self stringForEventName:event.eventName] ?: @"",
718
300
  @"metadata": @{
719
- @"errorType": [self errorTypeStringFromError:metadata.error] ?: @"",
720
301
  @"error_type": [self errorTypeStringFromError:metadata.error] ?: @"",
721
- @"errorCode": [self errorCodeStringFromError:metadata.error] ?: @"",
722
302
  @"error_code": [self errorCodeStringFromError:metadata.error] ?: @"",
723
- @"errorMessage": [self errorMessageFromError:metadata.error] ?: @"",
724
303
  @"error_message": [self errorMessageFromError:metadata.error] ?: @"",
725
- @"exitStatus": [self stringForExitStatus:metadata.exitStatus] ?: @"",
726
304
  @"exit_status": [self stringForExitStatus:metadata.exitStatus] ?: @"",
727
- @"institutionId": metadata.institutionID ?: @"",
728
305
  @"institution_id": metadata.institutionID ?: @"",
729
- @"institutionName": metadata.institutionName ?: @"",
730
306
  @"institution_name": metadata.institutionName ?: @"",
731
- @"institutionSearchQuery": metadata.institutionSearchQuery ?: @"",
732
307
  @"institution_search_query": metadata.institutionSearchQuery ?: @"",
733
- @"accountNumberMask": metadata.accountNumberMask ?: @"",
734
308
  @"account_number_mask": metadata.accountNumberMask ?: @"",
735
- @"isUpdateMode": metadata.isUpdateMode ?: @"",
736
309
  @"is_update_mode": metadata.isUpdateMode ?: @"",
737
- @"matchReason": metadata.matchReason ?: @"",
738
310
  @"match_reason": metadata.matchReason ?: @"",
739
- @"routingNumber": metadata.routingNumber ?: @"",
740
311
  @"routing_number": metadata.routingNumber ?: @"",
741
312
  @"selection": metadata.selection ?: @"",
742
- @"linkSessionId": metadata.linkSessionID ?: @"",
743
313
  @"link_session_id": metadata.linkSessionID ?: @"",
744
- @"mfaType": [self stringForMfaType:metadata.mfaType] ?: @"",
745
314
  @"mfa_type": [self stringForMfaType:metadata.mfaType] ?: @"",
746
- @"requestId": metadata.requestID ?: @"",
747
315
  @"request_id": metadata.requestID ?: @"",
748
316
  @"timestamp": [self iso8601StringFromDate:metadata.timestamp] ?: @"",
749
- @"viewName": [self stringForViewName:metadata.viewName] ?: @"",
750
317
  @"view_name": [self stringForViewName:metadata.viewName] ?: @"",
751
- @"metadataJson": metadata.metadataJSON ?: @"",
752
318
  @"metadata_json": metadata.metadataJSON ?: @"",
753
319
  },
754
320
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "10.8.0",
3
+ "version": "11.0.1",
4
4
  "description": "React Native Plaid Link SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "peerDependencies": {
43
43
  "react": "*",
44
- "react-native": ">=0.66.0"
44
+ "react-native": "*"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@react-native-community/eslint-plugin": "^1.1.0",
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/*.{h,m,swift}"
17
17
 
18
18
  s.dependency 'React-Core'
19
- s.dependency 'Plaid', '~> 4.7.0'
19
+ s.dependency 'Plaid', '~> 5.0.0'
20
20
  end