diff --git a/CHANGELOG.md b/CHANGELOG.md index 95dddc8a..d3ed8457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [7.7.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.7.0...v7.7.1) (2026-09-20) + + +### Features + +* expose webview-as-a-service ([648f235](https://github.com/smallcase/react-native-smallcase-gateway/commit/648f2359715094ce88f680e3ba18fc2c7cfbae4c)) + ## [7.7.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.6.2...v7.7.0) (2026-08-27) diff --git a/README.md b/README.md index 3c5d969e..cb47c098 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,8 @@ allprojects { repositories { // .. you other repositories maven { - url "http://artifactory.smallcase.com/artifactory/gradle-dev-local" - credentials { - username "react_native_user" - password "reactNativeUser123" - } - } + url "https://artifactory.smallcase.com/artifactory/SCGateway" + } } } ``` @@ -111,6 +107,9 @@ const res = await SmallcaseGateway.triggerTransaction(transactionId); // start lead generation flow SmallcaseGateway.triggerLeadGen({ email: "test@gmail.com" }); + +// launch a standalone WebView; setup/init are not required +await SmallcaseGateway.launchScWebView("https://www.smallcase.com"); ``` ## Debug / Contribution diff --git a/android/build.gradle b/android/build.gradle index 6a15a205..943a46b8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -149,7 +149,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion') dependencies { //noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' // From node_modules - implementation 'com.smallcase.gateway:sdk:6.1.2' + implementation 'com.smallcase.gateway:sdk:6.1.3' implementation 'com.smallcase.loans:sdk:5.3.2' implementation "androidx.core:core-ktx:1.3.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" diff --git a/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt b/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt index c36f9a6e..d9629576 100644 --- a/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt +++ b/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt @@ -1,5 +1,6 @@ package com.reactnativesmallcasegateway +import android.net.Uri import android.util.Log import androidx.appcompat.app.AppCompatActivity import com.facebook.react.bridge.* @@ -163,6 +164,28 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte } } + @ReactMethod + fun launchScWebView(url: String, promise: Promise) { + val activity = reactApplicationContext.currentActivity ?: run { + promise.reject("no_activity", "No active Android activity") + return + } + val uri = Uri.parse(url) + if (uri.scheme?.lowercase() !in setOf("http", "https") || uri.host.isNullOrBlank()) { + promise.reject("invalid_url", "A valid absolute HTTP(S) URL is required") + return + } + + activity.runOnUiThread { + try { + SmallcaseGatewaySdk.launchScWebView(activity, url) + promise.resolve(true) + } catch (error: Exception) { + promise.reject("launch_failed", error) + } + } + } + @ReactMethod fun launchSmallplug(targetEndpoint: String, params: String, promise: Promise) { @@ -562,4 +585,3 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte } } - diff --git a/ios/SmallcaseGateway.m b/ios/SmallcaseGateway.m index fa04027c..46c60e4e 100644 --- a/ios/SmallcaseGateway.m +++ b/ios/SmallcaseGateway.m @@ -360,6 +360,27 @@ @interface RCT_EXTERN_MODULE(SmallcaseGateway, NSObject) } //MARK: smallplug +RCT_REMAP_METHOD(launchScWebView, + urlString:(NSString *)urlString + launchScWebViewWithResolver:(RCTPromiseResolveBlock)resolve + rejecter:(RCTPromiseRejectBlock)reject) { + NSURL *url = [NSURL URLWithString:urlString]; + NSString *scheme = url.scheme.lowercaseString; + if (url == nil || url.host.length == 0 || + !([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])) { + reject(@"invalid_url", @"A valid absolute HTTP(S) URL is required", nil); + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [SCGateway.shared + launchScWebViewWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] + url:url + completion:^(__unused id response, __unused NSError *error) {}]; + resolve(@(YES)); + }); +} + RCT_REMAP_METHOD(launchSmallplug, targetEndpoint:(NSString *)targetEndpoint params:(NSString *)params @@ -809,4 +830,3 @@ - (NSError *)scLoanErrorToDict:(ScLoanError *)error { } @end - diff --git a/package.json b/package.json index 8c006258..627349e6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-smallcase-gateway", "title": "React Native Smallcase Gateway", - "version": "7.7.0", + "version": "7.7.1", "description": "smallcase gateway bindings for react native", "main": "src/index.js", "files": [ diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 55461ff8..ceb50544 100644 --- a/react-native-smallcase-gateway.podspec +++ b/react-native-smallcase-gateway.podspec @@ -34,6 +34,6 @@ Pod::Spec.new do |s| s.dependency "ReactCommon/turbomodule/core" end - s.dependency 'SCGateway', '7.2.0' + s.dependency 'SCGateway', '7.2.1' s.dependency 'SCLoans', '7.4.0' end diff --git a/smart_investing_react_native/app/screens/SmtScreen.tsx b/smart_investing_react_native/app/screens/SmtScreen.tsx index f2998d68..87d17507 100644 --- a/smart_investing_react_native/app/screens/SmtScreen.tsx +++ b/smart_investing_react_native/app/screens/SmtScreen.tsx @@ -1,9 +1,14 @@ import React from 'react'; -import {Button, TextInput, View} from 'react-native'; +import {Button, ScrollView, TextInput} from 'react-native'; import {launchSmallPlug} from '../apis/Functions'; -import {SCGatewayEventManager} from 'react-native-smallcase-gateway'; +import SmallcaseGateway, { + SCGatewayEventManager, +} from 'react-native-smallcase-gateway'; const SmtScreen = () => { + const [webViewUrl, onChangeWebViewUrl] = React.useState( + 'https://www.smallcase.com', + ); const [targetEndpoint, onChangeTargetEndpoint] = React.useState< string | null >(null); @@ -21,7 +26,7 @@ const SmtScreen = () => { string | null >(null); return ( - + { @@ -99,7 +104,24 @@ const SmtScreen = () => { title={'SmallPlug'} accessibilityLabel="Learn more about this purple button" /> - + +