From d41141669da49d79988d43b9e476ed0eb07ae00c Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Mon, 23 Mar 2026 19:38:25 +0530 Subject: [PATCH 01/10] feat: add IMR_SETUP transaction type and bump SCGateway pod to 7.1.6 - Add IMR_SETUP transaction handling in iOS native layer with full response mapping (authToken, transactionId, imrAction, frequency, iscid) - Add imrSetup constant to JS constants and TypeScript type definitions --- ios/SmallcaseGateway.m | 21 +++++++++++++++++++++ react-native-smallcase-gateway.podspec | 2 +- src/constants.js | 1 + types/constants.d.ts | 1 + types/index.d.ts | 1 + 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ios/SmallcaseGateway.m b/ios/SmallcaseGateway.m index 69ee3937..7e3a75b3 100644 --- a/ios/SmallcaseGateway.m +++ b/ios/SmallcaseGateway.m @@ -290,6 +290,27 @@ @interface RCT_EXTERN_MODULE(SmallcaseGateway, NSObject) return; } + //MARK: intent - imr setup + if([response isKindOfClass: [ObjcTransactionIntentIMRSetup class]]) { + ObjcTransactionIntentIMRSetup *trxResponse = response; + [responseDict setValue:@"IMR_SETUP" forKey:@"transaction"]; + + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + [dict setValue: trxResponse.authToken forKey:@"smallcaseAuthToken"]; + [dict setValue: trxResponse.transactionId forKey:@"transactionId"]; + [dict setValue: trxResponse.imrAction forKey:@"imrAction"]; + [dict setValue: trxResponse.frequency forKey:@"frequency"]; + [dict setValue: trxResponse.iscid forKey:@"iscid"]; + [dict setValue: trxResponse.scheduledDate forKey:@"scheduledDate"]; + [dict setValue: trxResponse.triggerDate forKey:@"triggerDate"]; + [dict setValue: trxResponse.scid forKey:@"scid"]; + [dict setValue: trxResponse.signup forKey:@"signup"]; + [dict setValue: trxResponse.imrActive ? @"YES" : @"NO" forKey:@"imrActive"]; + + [responseDict setValue:dict forKey:@"data"]; + resolve(responseDict); + return; + } //MARK: intent - authorize holdings if([response isKindOfClass: [ObjcTransactionIntentAuthoriseHoldings class]]) { diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 72143205..8e2765a6 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.1.5' + s.dependency 'SCGateway', '7.1.6' s.dependency 'SCLoans', '7.1.1' end diff --git a/src/constants.js b/src/constants.js index 4e7e1860..3aa284a6 100644 --- a/src/constants.js +++ b/src/constants.js @@ -7,6 +7,7 @@ export const ENV = { export const TRANSACTION_TYPE = { connect: 'CONNECT', sipSetup: 'SIP_SETUP', + imrSetup: 'IMR_SETUP', fetchFunds: 'FETCH_FUNDS', transaction: 'TRANSACTION', holdingsImport: 'HOLDINGS_IMPORT', diff --git a/types/constants.d.ts b/types/constants.d.ts index 32111aff..6d4147b5 100644 --- a/types/constants.d.ts +++ b/types/constants.d.ts @@ -6,6 +6,7 @@ export namespace ENV { export namespace TRANSACTION_TYPE { const connect: string; const sipSetup: string; + const imrSetup: string; const fetchFunds: string; const transaction: string; const holdingsImport: string; diff --git a/types/index.d.ts b/types/index.d.ts index 66417fb5..7d27f6dc 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -61,6 +61,7 @@ declare const _default: { TRANSACTION_TYPE: { connect: string; sipSetup: string; + imrSetup: string; fetchFunds: string; transaction: string; holdingsImport: string; From 7cc87d6ebb6c03038fa885d2101512ffd77eeb6b Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Mon, 23 Mar 2026 19:38:42 +0530 Subject: [PATCH 02/10] chore(release): 7.3.5 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3f1309..e72f64bf 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.3.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.4...v7.3.5) (2026-03-23) + + +### Features + +* add IMR_SETUP transaction type and bump SCGateway pod to 7.1.6 ([d411416](https://github.com/smallcase/react-native-smallcase-gateway/commit/d41141669da49d79988d43b9e476ed0eb07ae00c)) + ### [7.3.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.3...v7.3.4) (2026-03-23) ### [7.3.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.2...v7.3.3) (2026-03-23) diff --git a/package.json b/package.json index 62ea534f..df264a5a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-smallcase-gateway", "title": "React Native Smallcase Gateway", - "version": "7.3.4", + "version": "7.3.5", "description": "smallcase gateway bindings for react native", "main": "src/index.js", "files": [ From 8858149307dcab1bc5a5ba7ae2ac8c80efbf1e4a Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sat, 28 Mar 2026 19:47:03 +0530 Subject: [PATCH 03/10] feat: stream smallplug analytics events via EventChannel --- .../app/screens/SmtScreen.tsx | 13 +++++-- src/SCGatewayEventEmitter.js | 38 +++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/smart_investing_react_native/app/screens/SmtScreen.tsx b/smart_investing_react_native/app/screens/SmtScreen.tsx index dee1fe83..b3d0cde1 100644 --- a/smart_investing_react_native/app/screens/SmtScreen.tsx +++ b/smart_investing_react_native/app/screens/SmtScreen.tsx @@ -1,6 +1,7 @@ import React from 'react'; import {Button, TextInput, View} from 'react-native'; import {launchSmallPlug} from '../apis/Functions'; +import {SCGatewayEventManager} from 'react-native-smallcase-gateway'; const SmtScreen = () => { const [targetEndpoint, onChangeTargetEndpoint] = React.useState< @@ -70,6 +71,12 @@ const SmtScreen = () => { backIconOpacity: bo, }; + const smallplugSub = SCGatewayEventManager.subscribeToSmallplugEvents( + event => { + console.log('[SmallPlug Event]:', event); + }, + ); + try { const result = await launchSmallPlug( targetEndpoint, @@ -79,16 +86,14 @@ const SmtScreen = () => { console.log('✅ Smallplug Success:', result); if (result?.data?.userInfo) { console.log(' User Info:', result.data.userInfo); - // You can use the userInfo object here, for example, show an alert - // alert(`Success! User phone: ${result.data.userInfo.phoneNumber}`); } } catch (error: any) { console.error(' Smallplug Error:', error); if (error?.data?.userInfo) { console.log(' User Info from error:', error.data.userInfo); - // You can use the userInfo object here - // alert(`Failure! User phone: ${error.data.userInfo.phoneNumber}`); } + } finally { + smallplugSub?.remove(); } }} title={'SmallPlug'} diff --git a/src/SCGatewayEventEmitter.js b/src/SCGatewayEventEmitter.js index 7bcfcf74..bfdaefcd 100644 --- a/src/SCGatewayEventEmitter.js +++ b/src/SCGatewayEventEmitter.js @@ -18,6 +18,7 @@ export const SCGatewayEventTypes = { SUPER_PROPERTIES_UPDATED: 'scgateway_super_properties_updated', USER_RESET: 'scgateway_user_reset', USER_IDENTIFY: 'scgateway_user_identify', + SMALLPLUG_ANALYTICS_EVENT: 'smallplug_analytics_event', }; const SCGatewayNotificationEvent = 'scg_notification'; @@ -104,6 +105,43 @@ class SCGatewayEvents { return subscription; } + /** + * Subscribe to SmallPlug / DM analytics events streamed during a launchSmallplug session. + * Events have shape: { eventName: string, data: object, timestamp: number } + * @param {(event: {eventName: string, data: any, timestamp: number}) => void} callback + * @returns {GatewayEventSubscription} + */ + subscribeToSmallplugEvents(callback) { + if (!this.isInitialized) { + console.warn('[SCGatewayEvents] Event emitter not initialized'); + return null; + } + + if (typeof callback !== 'function') { + console.warn('[SCGatewayEvents] Invalid callback provided for SmallPlug subscription'); + return null; + } + + const subscription = this.eventEmitter.addListener( + SCGatewayNotificationEvent, + (jsonString) => { + if (!jsonString) return; + let parsed; + try { + parsed = JSON.parse(jsonString); + } catch (e) { + return; + } + if (parsed.type !== 'smallplug_analytics_event') return; + const { eventName, data } = parsed.data ?? {}; + callback({ eventName, data, timestamp: parsed.timestamp ?? Date.now() }); + } + ); + + this.subscriptions.push(subscription); + return subscription; + } + /** * Unsubscribe from Gateway Events * @param {GatewayEventSubscription} subscription - Subscription returned from subscribeToGatewayEvents From 8c61207516271523e2108867eb8ceea23600f9e5 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sat, 28 Mar 2026 19:57:13 +0530 Subject: [PATCH 04/10] bump up sdk versions --- android/build.gradle | 2 +- react-native-smallcase-gateway.podspec | 2 +- types/index.d.ts | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 8c6c2fdd..a9f4434c 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.0.5' + implementation 'com.smallcase.gateway:sdk-dhruv-propagate-dm-events-17a02a6:6.0.5-3186-release' implementation 'com.smallcase.loans:sdk:5.1.1' implementation "androidx.core:core-ktx:1.3.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 72143205..23eb5783 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.1.5' + s.dependency 'SCGateway-dhruv-propagate-dm-events-baa3bc0', '7.1.0-17-debug' s.dependency 'SCLoans', '7.1.1' end diff --git a/types/index.d.ts b/types/index.d.ts index 66417fb5..285687c9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,6 +12,12 @@ export interface LoansEvent { timestamp: number; } +export interface SmallplugAnalyticsEvent { + eventName: string; + data: Record; + timestamp: number; +} + export interface GatewayEventSubscription { remove(): void; } @@ -22,6 +28,7 @@ export interface LoansEventSubscription { interface SCGatewayEventManagerInterface { subscribeToGatewayEvents(callback: ((event: GatewayEvent) => void)): GatewayEventSubscription | null; + subscribeToSmallplugEvents(callback: ((event: SmallplugAnalyticsEvent) => void)): GatewayEventSubscription | null; unsubscribeFromGatewayEvents(subscription: GatewayEventSubscription): void; } @@ -86,6 +93,7 @@ declare const _default: { SCLoansEventManager: SCLoansEventManagerInterface; subscribeToGatewayEvents: (callback: (event: GatewayEvent) => void) => GatewayEventSubscription | null; unsubscribeFromGatewayEvents: (subscription: GatewayEventSubscription) => void; + subscribeToSmallplugEvents: (callback: (event: SmallplugAnalyticsEvent) => void) => GatewayEventSubscription | null; subscribeToLoansEvent: (callback: (event: LoansEvent) => void) => LoansEventSubscription | null; unsubscribeFromLoansEvent: (subscription: LoansEventSubscription) => void; }; From c1d5a7c1a873b9da04e9bffe381e8d72fe3026b9 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sat, 28 Mar 2026 21:52:29 +0530 Subject: [PATCH 05/10] feat: stream smallplug analytics events via EventChannel --- react-native-smallcase-gateway.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 23eb5783..f321846b 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-dhruv-propagate-dm-events-baa3bc0', '7.1.0-17-debug' + s.dependency 'SCGateway-dhruv-propagate-dm-events-eaf8710', '7.1.0-18-debug' s.dependency 'SCLoans', '7.1.1' end From b27f6c7d81cb73221db598e604877d92f063790b Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sun, 29 Mar 2026 18:49:08 +0530 Subject: [PATCH 06/10] Revert "chore(release): 7.3.5" This reverts commit 7cc87d6ebb6c03038fa885d2101512ffd77eeb6b. --- CHANGELOG.md | 7 ------- package.json | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e72f64bf..4d3f1309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,6 @@ 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.3.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.4...v7.3.5) (2026-03-23) - - -### Features - -* add IMR_SETUP transaction type and bump SCGateway pod to 7.1.6 ([d411416](https://github.com/smallcase/react-native-smallcase-gateway/commit/d41141669da49d79988d43b9e476ed0eb07ae00c)) - ### [7.3.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.3...v7.3.4) (2026-03-23) ### [7.3.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.2...v7.3.3) (2026-03-23) diff --git a/package.json b/package.json index df264a5a..62ea534f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-smallcase-gateway", "title": "React Native Smallcase Gateway", - "version": "7.3.5", + "version": "7.3.4", "description": "smallcase gateway bindings for react native", "main": "src/index.js", "files": [ From b956bee353383fc80ed53a105748d2b3869e71e8 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sun, 29 Mar 2026 19:20:59 +0530 Subject: [PATCH 07/10] update the code for better handling of subscription --- .../app/screens/SmtScreen.tsx | 2 +- src/SCGatewayEventEmitter.js | 13 +++++++++++++ types/index.d.ts | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/smart_investing_react_native/app/screens/SmtScreen.tsx b/smart_investing_react_native/app/screens/SmtScreen.tsx index b3d0cde1..f2998d68 100644 --- a/smart_investing_react_native/app/screens/SmtScreen.tsx +++ b/smart_investing_react_native/app/screens/SmtScreen.tsx @@ -93,7 +93,7 @@ const SmtScreen = () => { console.log(' User Info from error:', error.data.userInfo); } } finally { - smallplugSub?.remove(); + SCGatewayEventManager.unsubscribeFromSmallplugEvents(smallplugSub); } }} title={'SmallPlug'} diff --git a/src/SCGatewayEventEmitter.js b/src/SCGatewayEventEmitter.js index bfdaefcd..4fa0298e 100644 --- a/src/SCGatewayEventEmitter.js +++ b/src/SCGatewayEventEmitter.js @@ -142,6 +142,19 @@ class SCGatewayEvents { return subscription; } + /** + * Unsubscribe from SmallPlug analytics events + * @param {GatewayEventSubscription} subscription - Subscription returned from subscribeToSmallplugEvents + */ + unsubscribeFromSmallplugEvents(subscription) { + if (subscription && typeof subscription.remove === 'function') { + subscription.remove(); + this.subscriptions = this.subscriptions.filter( + (sub) => sub !== subscription + ); + } + } + /** * Unsubscribe from Gateway Events * @param {GatewayEventSubscription} subscription - Subscription returned from subscribeToGatewayEvents diff --git a/types/index.d.ts b/types/index.d.ts index 441f92a7..548d96b1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -29,6 +29,7 @@ export interface LoansEventSubscription { interface SCGatewayEventManagerInterface { subscribeToGatewayEvents(callback: ((event: GatewayEvent) => void)): GatewayEventSubscription | null; subscribeToSmallplugEvents(callback: ((event: SmallplugAnalyticsEvent) => void)): GatewayEventSubscription | null; + unsubscribeFromSmallplugEvents(subscription: GatewayEventSubscription): void; unsubscribeFromGatewayEvents(subscription: GatewayEventSubscription): void; } From 649dceaae82fd66a8b1e072abda441d172c7554a Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sun, 29 Mar 2026 19:22:23 +0530 Subject: [PATCH 08/10] chore: bump ios SCGateway pod to 7.1.7 --- react-native-smallcase-gateway.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-native-smallcase-gateway.podspec b/react-native-smallcase-gateway.podspec index 8e2765a6..e76e092a 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.1.6' + s.dependency 'SCGateway', '7.1.7' s.dependency 'SCLoans', '7.1.1' end From 9e940a14d95d5944db02516e0245e463cbdf2078 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sun, 29 Mar 2026 19:22:40 +0530 Subject: [PATCH 09/10] chore: bump android SCGateway pod to 6.0.6 --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index a9f4434c..7f881a44 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-dhruv-propagate-dm-events-17a02a6:6.0.5-3186-release' + implementation 'com.smallcase.gateway:sdk:6.0.6' implementation 'com.smallcase.loans:sdk:5.1.1' implementation "androidx.core:core-ktx:1.3.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" From a1d004b3286d8e4d0d12aaf8513c3ac35ef792d3 Mon Sep 17 00:00:00 2001 From: Dhruv Porwal Date: Sun, 29 Mar 2026 19:25:46 +0530 Subject: [PATCH 10/10] chore(release): 7.3.5 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- src/SCGatewayEventEmitter.js | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3f1309..1da47e81 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.3.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.4...v7.3.5) (2026-03-29) + + +### Features + +* add IMR_SETUP transaction type and bump SCGateway pod to 7.1.6 ([d411416](https://github.com/smallcase/react-native-smallcase-gateway/commit/d41141669da49d79988d43b9e476ed0eb07ae00c)) + ### [7.3.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.3...v7.3.4) (2026-03-23) ### [7.3.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v7.3.2...v7.3.3) (2026-03-23) diff --git a/package.json b/package.json index 62ea534f..df264a5a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-smallcase-gateway", "title": "React Native Smallcase Gateway", - "version": "7.3.4", + "version": "7.3.5", "description": "smallcase gateway bindings for react native", "main": "src/index.js", "files": [ diff --git a/src/SCGatewayEventEmitter.js b/src/SCGatewayEventEmitter.js index 4fa0298e..31effa08 100644 --- a/src/SCGatewayEventEmitter.js +++ b/src/SCGatewayEventEmitter.js @@ -118,7 +118,9 @@ class SCGatewayEvents { } if (typeof callback !== 'function') { - console.warn('[SCGatewayEvents] Invalid callback provided for SmallPlug subscription'); + console.warn( + '[SCGatewayEvents] Invalid callback provided for SmallPlug subscription' + ); return null; } @@ -134,7 +136,11 @@ class SCGatewayEvents { } if (parsed.type !== 'smallplug_analytics_event') return; const { eventName, data } = parsed.data ?? {}; - callback({ eventName, data, timestamp: parsed.timestamp ?? Date.now() }); + callback({ + eventName, + data, + timestamp: parsed.timestamp ?? Date.now(), + }); } );