react-native-smallcase-gateway 7.4.4 → 7.6.0
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/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt +15 -5
- package/ios/SmallcaseGateway.m +23 -5
- package/lib/commonjs/ScLoan.js +3 -0
- package/lib/commonjs/ScLoan.js.map +1 -1
- package/lib/module/ScLoan.js +3 -0
- package/lib/module/ScLoan.js.map +1 -1
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +1 -1
- package/src/ScLoan.js +3 -0
- package/types/ScLoan.d.ts +4 -0
package/android/build.gradle
CHANGED
|
@@ -150,7 +150,7 @@ dependencies {
|
|
|
150
150
|
//noinspection GradleDynamicVersion
|
|
151
151
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
152
152
|
implementation 'com.smallcase.gateway:sdk:6.1.2'
|
|
153
|
-
implementation 'com.smallcase.loans:sdk:5.
|
|
153
|
+
implementation 'com.smallcase.loans:sdk:5.3.0'
|
|
154
154
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
155
155
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
156
156
|
}
|
|
@@ -352,7 +352,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
352
352
|
promise.reject(Throwable("Interaction token is null"))
|
|
353
353
|
return
|
|
354
354
|
}
|
|
355
|
-
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
355
|
+
val loanConfigObj = ScLoanInfo(interactionToken, parseColorScheme(hashMap["colorScheme"]))
|
|
356
356
|
ScLoan.apply(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
357
357
|
override fun onFailure(error: ScLoanError) {
|
|
358
358
|
promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
|
|
@@ -376,7 +376,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
376
376
|
promise.reject(Throwable("Interaction token is null"))
|
|
377
377
|
return
|
|
378
378
|
}
|
|
379
|
-
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
379
|
+
val loanConfigObj = ScLoanInfo(interactionToken, parseColorScheme(hashMap["colorScheme"]))
|
|
380
380
|
ScLoan.pay(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
381
381
|
override fun onFailure(error: ScLoanError) {
|
|
382
382
|
promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
|
|
@@ -400,7 +400,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
400
400
|
promise.reject(Throwable("Interaction token is null"))
|
|
401
401
|
return
|
|
402
402
|
}
|
|
403
|
-
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
403
|
+
val loanConfigObj = ScLoanInfo(interactionToken, parseColorScheme(hashMap["colorScheme"]))
|
|
404
404
|
ScLoan.withdraw(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
405
405
|
override fun onFailure(error: ScLoanError) {
|
|
406
406
|
promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
|
|
@@ -424,7 +424,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
424
424
|
promise.reject(Throwable("Interaction token is null"))
|
|
425
425
|
return
|
|
426
426
|
}
|
|
427
|
-
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
427
|
+
val loanConfigObj = ScLoanInfo(interactionToken, parseColorScheme(hashMap["colorScheme"]))
|
|
428
428
|
ScLoan.service(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
429
429
|
override fun onFailure(error: ScLoanError) {
|
|
430
430
|
promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
|
|
@@ -448,7 +448,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
448
448
|
promise.reject(Throwable("Interaction token is null"))
|
|
449
449
|
return
|
|
450
450
|
}
|
|
451
|
-
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
451
|
+
val loanConfigObj = ScLoanInfo(interactionToken, parseColorScheme(hashMap["colorScheme"]))
|
|
452
452
|
ScLoan.triggerInteraction(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
453
453
|
override fun onFailure(error: ScLoanError) {
|
|
454
454
|
promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
|
|
@@ -460,6 +460,16 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
460
460
|
})
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
+
// colorScheme rides the bridge as a primitive string (not a serialized object) and is
|
|
464
|
+
// mapped back to the native enum here. Unknown/absent → null, so the SDK keeps its
|
|
465
|
+
// "partner sent nothing → light, don't force theme param" default.
|
|
466
|
+
private fun parseColorScheme(value: String?): ScLoanColorScheme? = when (value) {
|
|
467
|
+
"dark" -> ScLoanColorScheme.DARK
|
|
468
|
+
"light" -> ScLoanColorScheme.LIGHT
|
|
469
|
+
"system" -> ScLoanColorScheme.SYSTEM
|
|
470
|
+
else -> null
|
|
471
|
+
}
|
|
472
|
+
|
|
463
473
|
private fun getProtocol(envName: String): Environment.PROTOCOL {
|
|
464
474
|
return when (envName) {
|
|
465
475
|
"production" -> Environment.PROTOCOL.PRODUCTION
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -628,6 +628,24 @@ RCT_REMAP_METHOD(setupLoans,
|
|
|
628
628
|
});
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
+
// colorScheme rides the bridge as a primitive string (not a serialized object) and is
|
|
632
|
+
// mapped back to the native enum here. Unknown/absent → the token-only initializer, so the
|
|
633
|
+
// SDK keeps its "partner sent nothing → light, don't force theme param" default.
|
|
634
|
+
- (ScLoanInfo *)loanInfoFromDict:(NSDictionary *)loanInfo {
|
|
635
|
+
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
636
|
+
id scheme = loanInfo[@"colorScheme"];
|
|
637
|
+
if ([scheme isKindOfClass:[NSString class]]) {
|
|
638
|
+
if ([scheme isEqualToString:@"dark"]) {
|
|
639
|
+
return [[ScLoanInfo alloc] initWithInteractionToken:interactionToken colorScheme:ScLoanColorSchemeDark];
|
|
640
|
+
} else if ([scheme isEqualToString:@"light"]) {
|
|
641
|
+
return [[ScLoanInfo alloc] initWithInteractionToken:interactionToken colorScheme:ScLoanColorSchemeLight];
|
|
642
|
+
} else if ([scheme isEqualToString:@"system"]) {
|
|
643
|
+
return [[ScLoanInfo alloc] initWithInteractionToken:interactionToken colorScheme:ScLoanColorSchemeSystem];
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
|
|
647
|
+
}
|
|
648
|
+
|
|
631
649
|
RCT_REMAP_METHOD(apply,
|
|
632
650
|
loanInfo: (NSDictionary *)loanInfo
|
|
633
651
|
applyWithResolver:(RCTPromiseResolveBlock)resolve
|
|
@@ -640,7 +658,7 @@ RCT_REMAP_METHOD(apply,
|
|
|
640
658
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
641
659
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
642
660
|
|
|
643
|
-
ScLoanInfo *gatewayLoanInfo = [
|
|
661
|
+
ScLoanInfo *gatewayLoanInfo = [self loanInfoFromDict:loanInfo];
|
|
644
662
|
|
|
645
663
|
[ScLoan.instance applyWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
646
664
|
|
|
@@ -667,7 +685,7 @@ RCT_REMAP_METHOD(pay,
|
|
|
667
685
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
668
686
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
669
687
|
|
|
670
|
-
ScLoanInfo *gatewayLoanInfo = [
|
|
688
|
+
ScLoanInfo *gatewayLoanInfo = [self loanInfoFromDict:loanInfo];
|
|
671
689
|
|
|
672
690
|
[ScLoan.instance payWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
673
691
|
|
|
@@ -694,7 +712,7 @@ RCT_REMAP_METHOD(withdraw,
|
|
|
694
712
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
695
713
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
696
714
|
|
|
697
|
-
ScLoanInfo *gatewayLoanInfo = [
|
|
715
|
+
ScLoanInfo *gatewayLoanInfo = [self loanInfoFromDict:loanInfo];
|
|
698
716
|
|
|
699
717
|
[ScLoan.instance withdrawWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
700
718
|
|
|
@@ -721,7 +739,7 @@ RCT_REMAP_METHOD(service,
|
|
|
721
739
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
722
740
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
723
741
|
|
|
724
|
-
ScLoanInfo *gatewayLoanInfo = [
|
|
742
|
+
ScLoanInfo *gatewayLoanInfo = [self loanInfoFromDict:loanInfo];
|
|
725
743
|
|
|
726
744
|
[ScLoan.instance serviceWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
727
745
|
|
|
@@ -749,7 +767,7 @@ RCT_REMAP_METHOD(triggerInteraction,
|
|
|
749
767
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
750
768
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
751
769
|
|
|
752
|
-
ScLoanInfo *gatewayLoanInfo = [
|
|
770
|
+
ScLoanInfo *gatewayLoanInfo = [self loanInfoFromDict:loanInfo];
|
|
753
771
|
|
|
754
772
|
[ScLoan.instance triggerInteractionWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
755
773
|
|
package/lib/commonjs/ScLoan.js
CHANGED
|
@@ -18,6 +18,9 @@ const {
|
|
|
18
18
|
*
|
|
19
19
|
* @typedef {Object} ScLoanInfo
|
|
20
20
|
* @property {String} interactionToken
|
|
21
|
+
* @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.
|
|
22
|
+
* Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,
|
|
23
|
+
* or omit to let the web app default to light for partner sessions.
|
|
21
24
|
*
|
|
22
25
|
* @typedef {Object} ScLoanSuccess
|
|
23
26
|
* @property {boolean} isSuccess
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_util","_constants","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","setup","config","safeConfig","safeObject","environment","undefined","ENV","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","triggerInteraction","ScLoan","_default","exports","default"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n *\n * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if (safeConfig.environment === undefined || safeConfig.environment === null)\n safeConfig.environment = ENV.PROD;\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n};\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n};\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n};\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n};\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n};\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;\n"],"mappings":";;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;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAClC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACgB,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GAAG,MAAOL,QAAQ,IAAK;EAC7C,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACiB,kBAAkB,CAACJ,YAAY,CAAC;AAChE,CAAC;AAED,MAAMK,MAAM,GAAG;EACbhB,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC,OAAO;EACPC;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaH,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_util","_constants","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","setup","config","safeConfig","safeObject","environment","undefined","ENV","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","triggerInteraction","ScLoan","_default","exports","default"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n * @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.\n * Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,\n * or omit to let the web app default to light for partner sessions.\n *\n * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if (safeConfig.environment === undefined || safeConfig.environment === null)\n safeConfig.environment = ENV.PROD;\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n};\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n};\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n};\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n};\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n};\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,MAAM;EAAEG,gBAAgB,EAAEC;AAAuB,CAAC,GAAGC,0BAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC9B,MAAMC,UAAU,GAAG,IAAAC,gBAAU,EAACF,MAAM,CAAC;EACrC,IAAIC,UAAU,CAACE,WAAW,KAAKC,SAAS,IAAIH,UAAU,CAACE,WAAW,KAAK,IAAI,EACzEF,UAAU,CAACE,WAAW,GAAGE,cAAG,CAACC,IAAI;EAEnC,OAAOT,sBAAsB,CAACU,UAAU,CAACN,UAAU,CAAC;AACtD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACW,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACc,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACnC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACe,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAClC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACgB,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GAAG,MAAOL,QAAQ,IAAK;EAC7C,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACiB,kBAAkB,CAACJ,YAAY,CAAC;AAChE,CAAC;AAED,MAAMK,MAAM,GAAG;EACbhB,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC,OAAO;EACPC;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaH,MAAM","ignoreList":[]}
|
package/lib/module/ScLoan.js
CHANGED
|
@@ -12,6 +12,9 @@ const {
|
|
|
12
12
|
*
|
|
13
13
|
* @typedef {Object} ScLoanInfo
|
|
14
14
|
* @property {String} interactionToken
|
|
15
|
+
* @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.
|
|
16
|
+
* Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,
|
|
17
|
+
* or omit to let the web app default to light for partner sessions.
|
|
15
18
|
*
|
|
16
19
|
* @typedef {Object} ScLoanSuccess
|
|
17
20
|
* @property {boolean} isSuccess
|
package/lib/module/ScLoan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","triggerInteraction","ScLoan"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n *\n * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if (safeConfig.environment === undefined || safeConfig.environment === null)\n safeConfig.environment = ENV.PROD;\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n};\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n};\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n};\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n};\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n};\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,GAAG,QAAQ,aAAa;AAEjC,MAAM;EAAEC,gBAAgB,EAAEC;AAAuB,CAAC,GAAGJ,aAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC9B,MAAMC,UAAU,GAAGN,UAAU,CAACK,MAAM,CAAC;EACrC,IAAIC,UAAU,CAACC,WAAW,KAAKC,SAAS,IAAIF,UAAU,CAACC,WAAW,KAAK,IAAI,EACzED,UAAU,CAACC,WAAW,GAAGN,GAAG,CAACQ,IAAI;EAEnC,OAAON,sBAAsB,CAACO,UAAU,CAACJ,UAAU,CAAC;AACtD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACQ,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACW,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACnC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACY,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAClC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACa,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GAAG,MAAOL,QAAQ,IAAK;EAC7C,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACc,kBAAkB,CAACJ,YAAY,CAAC;AAChE,CAAC;AAED,MAAMK,MAAM,GAAG;EACbd,KAAK;EACLO,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC,OAAO;EACPC;AACF,CAAC;AAED,eAAeC,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","triggerInteraction","ScLoan"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n * @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.\n * Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,\n * or omit to let the web app default to light for partner sessions.\n *\n * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if (safeConfig.environment === undefined || safeConfig.environment === null)\n safeConfig.environment = ENV.PROD;\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n};\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n};\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n};\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n};\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n};\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,GAAG,QAAQ,aAAa;AAEjC,MAAM;EAAEC,gBAAgB,EAAEC;AAAuB,CAAC,GAAGJ,aAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC9B,MAAMC,UAAU,GAAGN,UAAU,CAACK,MAAM,CAAC;EACrC,IAAIC,UAAU,CAACC,WAAW,KAAKC,SAAS,IAAIF,UAAU,CAACC,WAAW,KAAK,IAAI,EACzED,UAAU,CAAC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ignoreList":[]}
|
package/package.json
CHANGED
package/src/ScLoan.js
CHANGED
|
@@ -11,6 +11,9 @@ const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
|
11
11
|
*
|
|
12
12
|
* @typedef {Object} ScLoanInfo
|
|
13
13
|
* @property {String} interactionToken
|
|
14
|
+
* @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.
|
|
15
|
+
* Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,
|
|
16
|
+
* or omit to let the web app default to light for partner sessions.
|
|
14
17
|
*
|
|
15
18
|
* @typedef {Object} ScLoanSuccess
|
|
16
19
|
* @property {boolean} isSuccess
|
package/types/ScLoan.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type ScLoanConfig = {
|
|
|
8
8
|
};
|
|
9
9
|
export type ScLoanInfo = {
|
|
10
10
|
interactionToken: string;
|
|
11
|
+
colorScheme?: 'dark' | 'light' | 'system';
|
|
11
12
|
};
|
|
12
13
|
export type ScLoanSuccess = {
|
|
13
14
|
isSuccess: boolean;
|
|
@@ -34,6 +35,9 @@ declare namespace ScLoan {
|
|
|
34
35
|
*
|
|
35
36
|
* @typedef {Object} ScLoanInfo
|
|
36
37
|
* @property {String} interactionToken
|
|
38
|
+
* @property {'dark' | 'light' | 'system'} [colorScheme] - color scheme for the LAS web UI.
|
|
39
|
+
* Pass `dark`/`light` when your app has a resolved theme, `system` to mirror the device,
|
|
40
|
+
* or omit to let the web app default to light for partner sessions.
|
|
37
41
|
*
|
|
38
42
|
* @typedef {Object} ScLoanSuccess
|
|
39
43
|
* @property {boolean} isSuccess
|