Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,33 @@ const res = await SmallcaseGateway.triggerTransaction(transactionId);
SmallcaseGateway.triggerLeadGen({ email: "test@gmail.com" });
```

## Incognito Mode

`triggerTransaction` accepts an optional 4th `incognito` argument (default `false`):

```javascript
// execute a transaction in incognito mode
const res = await SmallcaseGateway.triggerTransaction(
transactionId,
utmParams,
brokerList,
true // incognito
);
```

When `true`, the broker flow opens in a private/ephemeral browsing session:

- No cookies, cache, or login state from the flow persist on the device once it closes.
- Native broker app login (e.g. Kite/Zerodha app-to-app login) is skipped in favor of the in-app web login, even if the broker app is installed and would normally be used.

This is opt-in and fully backward compatible — existing calls to `triggerTransaction(transactionId)`, `triggerTransaction(transactionId, utmParams)`, or `triggerTransaction(transactionId, utmParams, brokerList)` are unaffected and continue to run in normal (non-incognito) mode.

**Known limitations:** incognito prevents local browser data from persisting, but it does not (and cannot) override OS-level Password AutoFill suggestions already saved to the device's keychain, and it does not affect the smallcase account's own broker-connection state — once a broker is connected (incognito or not), subsequent transactions for that same account will correctly recognize it as already connected, since that state lives on smallcase's backend, not in local browser storage.

**Requires:** `com.smallcase.gateway:sdk` (Android) and `SCGateway` (iOS) versions with incognito support. Check with the platform SDK release notes for the minimum version once released.

**Using incognito for a different (e.g. linked/family) account:** `incognito: true` on its own does not switch which smallcase account the SDK is acting as — it only changes how that call's browser session behaves. To connect or transact on behalf of a different smallcase account than the one currently authenticated, call `SmallcaseGateway.init(sdkToken)` again with that account's own token before calling `triggerTransaction` — the same way you would for any account switch, incognito or not.

## Debug / Contribution

Make sure you have react native dev environment set up
Expand Down
4 changes: 3 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.smallcase.gateway:sdk:6.1.1'
// INTERNAL TEST PIN: feat/incognito-mode branch build.
// Revert to: implementation 'com.smallcase.gateway:sdk:6.1.1'
implementation 'com.smallcase.gateway:sdk-feat-incognito-mode-c1b21c9:6.1.2-3193-release'
implementation 'com.smallcase.loans:sdk-sourav-native-dark-theme-cb54bf9:5.1.4-92-release'
implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
}

@ReactMethod
fun triggerTransaction(transactionId: String, utmParams: ReadableMap?, brokerList: ReadableArray?, promise: Promise) {
fun triggerTransaction(transactionId: String, utmParams: ReadableMap?, brokerList: ReadableArray?, incognito: Boolean?, promise: Promise) {

var safeBrokerList = listOf<String>()

Expand All @@ -104,6 +104,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
activity = activity,
transactionId = transactionId,
preProvidedBrokers = safeBrokerList,
incognito = incognito ?: false,
transactionResponseListener = object : TransactionResponseListener {
override fun onSuccess(transactionResult: TransactionResult) {
val res = resultToWritableMap(transactionResult, true)
Expand Down
3 changes: 3 additions & 0 deletions ios/SmallcaseGateway.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,17 @@ @interface RCT_EXTERN_MODULE(SmallcaseGateway, NSObject)
transactionId:(NSString *)transactionId
utmParams:(NSDictionary *)utmParams
brokerList:(NSArray *)brokerList
incognito:(nullable NSNumber *)incognito
triggerTransactionWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
BOOL isIncognito = incognito != nil ? [incognito boolValue] : NO;
[SCGateway.shared
triggerTransactionFlowWithTransactionId:transactionId
presentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController]
utmParams:utmParams
brokerConfig:brokerList
incognito:isIncognito
completion: ^(id response, NSError * error) {
if (error != nil) {
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
Expand Down
4 changes: 3 additions & 1 deletion react-native-smallcase-gateway.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ Pod::Spec.new do |s|
s.dependency "ReactCommon/turbomodule/core"
end

s.dependency 'SCGateway', '7.2.0'
# INTERNAL TEST PIN: feat/incognito-mode branch build.
# Revert to: s.dependency 'SCGateway', '7.2.0'
s.dependency 'SCGateway-feat-incognito-mode-2d15c7b', '7.2.0-28-release'
# INTERNAL TEST PIN: dark-theme branch build (mirrors the android/build.gradle pin).
# Revert to: s.dependency 'SCLoans', '7.2.0'
s.dependency 'SCLoans-sourav-native-dark-theme-37c97d9', '7.1.2-45-release'
Expand Down
12 changes: 10 additions & 2 deletions src/SmallcaseGateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,18 @@ const init = async (sdkToken, externalMeta) => {
* @param {string} transactionId
* @param {Object} [utmParams]
* @param {Array<string>} [brokerList]
* @param {boolean} [incognito] - when true, opens the broker flow in a private/incognito session that leaves no local browser data behind
* @returns {Promise<transactionRes>}
*/
const triggerTransaction = async (transactionId, utmParams, brokerList) => {
const triggerTransaction = async (
transactionId,
utmParams,
brokerList,
incognito
) => {
const safeUtm = safeObject(utmParams);
const safeId = typeof transactionId === 'string' ? transactionId : '';
const safeIncognito = typeof incognito === 'boolean' ? incognito : false;

let safeBrokerList = sanitizeBrokerList(brokerList);

Expand All @@ -121,7 +128,8 @@ const triggerTransaction = async (transactionId, utmParams, brokerList) => {
return SmallcaseGatewayNative.triggerTransaction(
safeId,
safeUtm,
safeBrokerList
safeBrokerList,
safeIncognito
);
};

Expand Down
3 changes: 2 additions & 1 deletion types/SmallcaseGateway.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ declare function archiveSmallcase(iscid: string): unknown;
* @param {string} transactionId
* @param {Object} [utmParams]
* @param {Array<string>} [brokerList]
* @param {boolean} [incognito] - when true, opens the broker flow in a private/incognito session that leaves no local browser data behind
* @returns {Promise<transactionRes>}
*/
declare function triggerTransaction(transactionId: string, utmParams?: any, brokerList?: Array<string>): Promise<transactionRes>;
declare function triggerTransaction(transactionId: string, utmParams?: any, brokerList?: Array<string>, incognito?: boolean): Promise<transactionRes>;
/**
* triggers a transaction with a transaction id
*
Expand Down
Loading