Skip to content

Commit

Permalink
Merge pull request #682 from plaid/dt-feature-submit-api
Browse files Browse the repository at this point in the history
  • Loading branch information
dtroupe-plaid authored Jun 26, 2024
2 parents e542504 + 4bf3c7f commit 136d7ff
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 18 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# RELEASES

## LinkKit V11.11.0 — 2024-06-26

### React Native

#### Requirements

This SDK now works with any supported version of React Native.

#### Changes

- Update Android SDK to 4.5.0.
- Update iOS SDK to 5.6.0.
- Add submit API.

### Android

Android SDK [4.5.0](https://github.com/plaid/plaid-link-android/releases/tag/v4.5.0)

#### Changes
- Add PROFILE_DATA_REVIEW event view name.
- Add LAYER_READY and LAYER_NOT_AVAILABLE event names.
- Add submit API to the LinkHandler.

#### Requirements

| Name | Version |
|------|---------|
| Android Studio | 4.0+ |
| Kotlin | 1.8+ |

### iOS

iOS SDK [5.6.0](https://github.com/plaid/plaid-link-ios/releases/tag/5.6.0)

#### Changes

- Add submit API for Layer.
- Improved Remember Me Experience

#### Requirements

| Name | Version |
|------|---------|
| Xcode | >= 15.0.1 |
| iOS | >= 14.0 |

## LinkKit V11.10.3 — 2024-06-04

### React Native
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ While these older versions are expected to continue to work without disruption,

| Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
|-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
| 11.11.0 | * | [4.5.0+] | 21 | 34 | >=5.6.0 | 14.0 | Active, supports Xcode 15.0.1 |
| 11.10.3 | * | [4.4.2+] | 21 | 34 | >=5.5.1 | 14.0 | Active, supports Xcode 15.0.1 |
| 11.10.2 | * | [4.3.1+] | 21 | 34 | >=5.5.1 | 14.0 | Active, supports Xcode 15.0.1 |
| 11.10.1 | * | [4.3.1+] | 21 | 34 | >=5.5.0 | 14.0 | Active, supports Xcode 15.0.1 |
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ android {
compileSdkVersion 31

defaultConfig {
minSdkVersion rootProject.ext.safeExtGet("minSdkVersion", 21)
minSdkVersion rootProject.ext.has("minSdkVersion") ? rootProject.ext.minSdkVersion : 21
targetSdkVersion 31
versionCode 1
versionName "0.0.1"
Expand Down Expand Up @@ -106,7 +106,7 @@ repositories {

dependencies {
implementation "com.facebook.react:react-native:+"
implementation "com.plaid.link:sdk-core:4.4.2"
implementation "com.plaid.link:sdk-core:4.5.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.jakewharton.rxrelay2:rxrelay:2.1.1"
}
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<application>
<meta-data
android:name="com.plaid.link.react_native"
android:value="11.10.3" />
android:value="11.11.0" />
</application>

</manifest>
9 changes: 9 additions & 0 deletions android/src/main/java/com/plaid/PlaidModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.plaid.link.configuration.LinkTokenConfiguration
import com.plaid.link.event.LinkEvent
import com.plaid.link.exception.LinkException
import com.plaid.link.result.LinkResultHandler
import com.plaid.link.SubmissionData
import org.json.JSONException
import org.json.JSONObject

Expand Down Expand Up @@ -76,6 +77,14 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
return builder.build()
}

@ReactMethod
override fun submit(phoneNumber: String?) {
if (plaidHandler != null) {
val submissionData = SubmissionData(phoneNumber = phoneNumber)
plaidHandler?.submit(submissionData)
}
}

@ReactMethod
override fun create(
token: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public NativePlaidLinkModuleAndroidSpec(ReactApplicationContext reactContext) {
@DoNotStrip
public abstract void startLinkActivityForResult(String token, boolean noLoadingState, String logLevel, Callback onSuccessCallback, Callback onExitCallback);

@ReactMethod
@DoNotStrip
public abstract void submit(String phoneNumber);

@ReactMethod
@DoNotStrip
public abstract void addListener(String eventName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public NativePlaidLinkModuleiOSSpec(ReactApplicationContext reactContext) {
@DoNotStrip
public abstract void dismiss();

@ReactMethod
@DoNotStrip
public abstract void submit(String phoneNumber);

@ReactMethod
@DoNotStrip
public abstract void addListener(String eventName);
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ PODS:
- React-Mapbuffer (0.73.6):
- glog
- React-debug
- react-native-plaid-link-sdk (11.10.2):
- react-native-plaid-link-sdk (11.10.3):
- Plaid (~> 5.5.1)
- React-Core
- react-native-safe-area-context (4.9.0):
Expand Down Expand Up @@ -1372,7 +1372,7 @@ SPEC CHECKSUMS:
React-jsinspector: 85583ef014ce53d731a98c66a0e24496f7a83066
React-logger: 3eb80a977f0d9669468ef641a5e1fabbc50a09ec
React-Mapbuffer: 84ea43c6c6232049135b1550b8c60b2faac19fab
react-native-plaid-link-sdk: c2189fa607db61658773399ceceb411cbfc56063
react-native-plaid-link-sdk: 24a9dc17b081a8a4469d478af87f286c11cd8ea1
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
React-nativeconfig: b4d4e9901d4cabb57be63053fd2aa6086eb3c85f
React-NativeModulesApple: cd26e56d56350e123da0c1e3e4c76cb58a05e1ee
Expand Down
20 changes: 11 additions & 9 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/src/Screens/PlaidLinkScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
LinkTokenConfiguration,
} from 'react-native-plaid-link-sdk';

import {create, open} from 'react-native-plaid-link-sdk/dist/PlaidLink';
import {create, open} from 'react-native-plaid-link-sdk';

function isValidString(str: string): boolean {
if (str && str.trim() !== '') {
Expand Down
16 changes: 15 additions & 1 deletion ios/RNLinksdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ @implementation RNLinksdk
RCT_EXPORT_MODULE();

+ (NSString*)sdkVersion {
return @"11.10.3"; // SDK_VERSION
return @"11.11.0"; // SDK_VERSION
}

+ (NSString*)objCBridgeVersion {
Expand Down Expand Up @@ -181,6 +181,14 @@ - (void)stopObserving {
self.presentingViewController = nil;
}

RCT_EXPORT_METHOD(submit:(NSString * _Nullable)phoneNumber) {
if (self.linkHandler) {
PLKSubmissionData *submissionData = [[PLKSubmissionData alloc] init];
submissionData.phoneNumber = phoneNumber;
[self.linkHandler submit: submissionData];
}
}

#pragma mark - Bridging

+ (PLKEnvironment)environmentFromString:(NSString *)string {
Expand Down Expand Up @@ -473,6 +481,10 @@ + (NSString *)stringForEventName:(PLKEventName *)eventName {
return @"CONNECT_NEW_INSTITUTION";
case PLKEventNameValueSubmitOTP:
return @"SUBMIT_OTP";
case PLKEventNameValueLayerReady:
return @"LAYER_READY";
case PLKEventNameValueLayerNotAvailable:
return @"LAYER_NOT_AVAILABLE";
}
return @"unknown";
}
Expand Down Expand Up @@ -618,6 +630,8 @@ + (NSString *)stringForViewName:(PLKViewName *)viewName {
return @"SELECT_SAVED_INSTITUTION";
case PLKViewNameValueSelectSavedAccount:
return @"SELECT_SAVED_ACCOUNT";
case PLKViewNameValueProfileDataReview:
return @"PROFILE_DATA_REVIEW";
}

return @"unknown";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-plaid-link-sdk",
"version": "11.10.3",
"version": "11.11.0",
"description": "React Native Plaid Link SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion react-native-plaid-link-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Pod::Spec.new do |s|
end

s.dependency 'React-Core'
s.dependency 'Plaid', '~> 5.5.1'
s.dependency 'Plaid', '~> 5.6.0'
end
9 changes: 9 additions & 0 deletions src/PlaidLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
LinkTokenConfiguration,
PlaidLinkComponentProps,
PlaidLinkProps,
SubmissionData,
} from './Types';
import RNLinksdkAndroid from './fabric/NativePlaidLinkModuleAndroid';
import RNLinksdkiOS from './fabric/NativePlaidLinkModuleiOS';
Expand Down Expand Up @@ -100,6 +101,14 @@ export const dismissLink = () => {
}
};

export const submit = (data: SubmissionData): void => {
if (Platform.OS === 'android') {
RNLinksdkAndroid?.submit(data.phoneNumber);
} else {
RNLinksdkiOS?.submit(data.phoneNumber);
}
};

/**
* @deprecated This component is deprecated. Create your own component and use the create & open methods.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,3 +557,7 @@ export interface LinkOpenProps {
export type PlaidLinkComponentProps = (PlaidLinkProps & {
children: React.ReactNode
});

export interface SubmissionData {
phoneNumber?: string;
};
1 change: 1 addition & 0 deletions src/fabric/NativePlaidLinkModuleAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface Spec extends TurboModule {
onSuccessCallback: (result: UnsafeObject<LinkSuccess>) => void,
onExitCallback: (result: UnsafeObject<LinkExit>) => void
): void;
submit(phoneNumber: string | undefined): void;
// those two are here for event emitter methods
addListener(eventName: string): void;
removeListeners(count: Double): void;
Expand Down
1 change: 1 addition & 0 deletions src/fabric/NativePlaidLinkModuleiOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Spec extends TurboModule {
onExit: (error: UnsafeObject<LinkError>, result: UnsafeObject<LinkExit>) => void,
): void;
dismiss(): void;
submit(phoneNumber: string | undefined): void;
// those two are here for event emitter methods
addListener(eventName: string): void;
removeListeners(count: Int32): void;
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
dismissLink,
usePlaidEmitter,
PlaidLink,
submit,
} from './PlaidLink';

export * from './Types';
Expand All @@ -18,6 +19,7 @@ export {
open,
dismissLink,
usePlaidEmitter,
submit,
};

// Components
Expand Down

0 comments on commit 136d7ff

Please sign in to comment.