react-native-smallcase-gateway 2.3.1 → 3.0.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  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.
4
4
 
5
+ ## [3.0.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.3.1...v3.0.0) (2024-01-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * loans ([1ac32dc](https://github.com/smallcase/react-native-smallcase-gateway/commit/1ac32dc1506b5511ab7924a73bfd2b31d471fe8a))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **native:** changed Bridge method responses to conform to ScLoanResponse ([6f1a2b6](https://github.com/smallcase/react-native-smallcase-gateway/commit/6f1a2b621f90b7677d37e6dd2150487f46e3d5a7))
16
+
5
17
  ### [2.3.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.3.0...v2.3.1) (2023-12-08)
6
18
 
7
19
  ## [2.3.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.2.2...v2.3.0) (2023-10-17)
@@ -148,7 +148,8 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
148
148
  dependencies {
149
149
  //noinspection GradleDynamicVersion
150
150
  implementation 'com.facebook.react:react-native:+' // From node_modules
151
- implementation 'com.smallcase.gateway:sdk:3.11.0'
151
+ implementation 'com.smallcase.gateway:sdk:3.12.3'
152
+ implementation 'com.smallcase.loans:sdk:2.1.1'
152
153
  implementation "androidx.core:core-ktx:1.3.1"
153
154
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
154
155
  }
@@ -315,18 +315,13 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
315
315
  val scGatewayConfig = ScLoanConfig(gateway, scEnvironment)
316
316
  val setupResponse = ScLoan.setup(scGatewayConfig, object : ScLoanResult {
317
317
  override fun onFailure(error: ScLoanError) {
318
- val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
319
- promise.reject("error", errorWritableMap)
320
- }
321
-
322
- override fun onSuccess(response: ScLoanSuccess) {
323
- promise.resolve(response.toString())
324
- }
318
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
319
+ }
320
+
321
+ override fun onSuccess(response: ScLoanSuccess) {
322
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
323
+ }
325
324
  })
326
- // val writableMap: WritableMap = Arguments.createMap()
327
- // writableMap.putString("version", setupResponse.version)
328
- // writableMap.putInt("versionCode", setupResponse.versionCode.toInt())
329
- // promise.resolve(Gson().toJson(writableMap.toHashMap()))
330
325
  }
331
326
 
332
327
  @ReactMethod
@@ -341,12 +336,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
341
336
  val loanConfigObj = ScLoanInfo(interactionToken)
342
337
  ScLoan.apply(appCompatActivity, loanConfigObj, object : ScLoanResult {
343
338
  override fun onFailure(error: ScLoanError) {
344
- val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
345
- promise.reject("error", errorWritableMap)
339
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
346
340
  }
347
341
 
348
342
  override fun onSuccess(response: ScLoanSuccess) {
349
- promise.resolve(response.toString())
343
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
350
344
  }
351
345
  })
352
346
  }
@@ -363,12 +357,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
363
357
  val loanConfigObj = ScLoanInfo(interactionToken)
364
358
  ScLoan.pay(appCompatActivity, loanConfigObj, object : ScLoanResult {
365
359
  override fun onFailure(error: ScLoanError) {
366
- val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
367
- promise.reject("error", errorWritableMap)
360
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
368
361
  }
369
362
 
370
363
  override fun onSuccess(response: ScLoanSuccess) {
371
- promise.resolve(response.toString())
364
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
372
365
  }
373
366
  })
374
367
  }
@@ -385,16 +378,15 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
385
378
  val loanConfigObj = ScLoanInfo(interactionToken)
386
379
  ScLoan.withdraw(appCompatActivity, loanConfigObj, object : ScLoanResult {
387
380
  override fun onFailure(error: ScLoanError) {
388
- val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
389
- promise.reject("error", errorWritableMap)
381
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
390
382
  }
391
383
 
392
384
  override fun onSuccess(response: ScLoanSuccess) {
393
- promise.resolve(response.toString())
385
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
394
386
  }
395
387
  })
396
388
  }
397
-
389
+
398
390
  @ReactMethod
399
391
  fun service(loanConfig: ReadableMap, promise: Promise) {
400
392
  val appCompatActivity = currentActivity as? AppCompatActivity ?: return
@@ -407,12 +399,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
407
399
  val loanConfigObj = ScLoanInfo(interactionToken)
408
400
  ScLoan.service(appCompatActivity, loanConfigObj, object : ScLoanResult {
409
401
  override fun onFailure(error: ScLoanError) {
410
- val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
411
- promise.reject("error", errorWritableMap)
402
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
412
403
  }
413
404
 
414
405
  override fun onSuccess(response: ScLoanSuccess) {
415
- promise.resolve(response.toString())
406
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
416
407
  }
417
408
  })
418
409
  }
@@ -472,5 +463,20 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
472
463
  return errObj
473
464
  }
474
465
 
466
+ private fun scLoanResponseToWritableMap(response: ScLoansResponse?): WritableMap? {
467
+ val map = Arguments.createMap()
468
+ response?.also {
469
+ map.putBoolean("isSuccess", it.isSuccess)
470
+ map.putString("data", it.data)
471
+ }
472
+ if(response is ScLoanError) {
473
+ map.apply {
474
+ putInt("code", response.code)
475
+ putString("message", response.message)
476
+ }
477
+ }
478
+ return map
479
+ }
480
+
475
481
  }
476
482
 
@@ -518,19 +518,10 @@ RCT_REMAP_METHOD(setupLoans,
518
518
  [ScLoan.instance setupWithConfig:gatewayLoanConfig completion:^(ScLoanSuccess * success, ScLoanError * error) {
519
519
 
520
520
  if(error != nil) {
521
- if(error != nil) {
522
- NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
523
- [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
524
- [responseDict setValue:error.domain forKey:@"errorMessage"];
525
-
526
- NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
527
-
528
- reject(@"apply", @"Error while applying for Loan", err);
529
- return;
530
- }
521
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
522
+ return;
531
523
  }
532
-
533
- resolve(@(YES));
524
+ resolve([self scLoanSuccessToDict:success]);
534
525
  }];
535
526
  }
536
527
 
@@ -554,17 +545,10 @@ RCT_REMAP_METHOD(apply,
554
545
  [ScLoan.instance applyWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
555
546
 
556
547
  if(error != nil) {
557
- NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
558
- [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
559
- [responseDict setValue:error.domain forKey:@"errorMessage"];
560
-
561
- NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
562
-
563
- reject(@"apply", @"Error while applying for Loan", err);
548
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
564
549
  return;
565
550
  }
566
-
567
- resolve(success.data);
551
+ resolve([self scLoanSuccessToDict:success]);
568
552
  }];
569
553
  }
570
554
 
@@ -588,17 +572,10 @@ RCT_REMAP_METHOD(pay,
588
572
  [ScLoan.instance payWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
589
573
 
590
574
  if(error != nil) {
591
- NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
592
- [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
593
- [responseDict setValue:error.domain forKey:@"errorMessage"];
594
-
595
- NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
596
-
597
- reject(@"apply", @"Error while applying for Loan", err);
575
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
598
576
  return;
599
577
  }
600
-
601
- resolve(success.data);
578
+ resolve([self scLoanSuccessToDict:success]);
602
579
  }];
603
580
  }
604
581
 
@@ -622,17 +599,10 @@ RCT_REMAP_METHOD(withdraw,
622
599
  [ScLoan.instance withdrawWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
623
600
 
624
601
  if(error != nil) {
625
- NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
626
- [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
627
- [responseDict setValue:error.domain forKey:@"errorMessage"];
628
-
629
- NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
630
-
631
- reject(@"apply", @"Error while applying for Loan", err);
602
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
632
603
  return;
633
604
  }
634
-
635
- resolve(success.data);
605
+ resolve([self scLoanSuccessToDict:success]);
636
606
  }];
637
607
  }
638
608
 
@@ -656,22 +626,41 @@ RCT_REMAP_METHOD(service,
656
626
  [ScLoan.instance serviceWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
657
627
 
658
628
  if(error != nil) {
659
- NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
660
- [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
661
- [responseDict setValue:error.domain forKey:@"errorMessage"];
662
-
663
- NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
664
-
665
- reject(@"apply", @"Error while applying for Loan", err);
629
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
666
630
  return;
667
631
  }
668
-
669
- resolve(success.data);
632
+ resolve([self scLoanSuccessToDict:success]);
633
+
670
634
  }];
671
635
  }
672
636
 
673
637
  });
674
638
  }
675
639
 
640
+ - (NSDictionary *)scLoanSuccessToDict:(ScLoanSuccess *)success {
641
+ NSMutableDictionary *successDict = [NSMutableDictionary dictionary];
642
+ successDict[@"isSuccess"] = @(success.isSuccess);
643
+
644
+ id data = success.data;
645
+ if (data && ![data isKindOfClass:[NSNull class]]) {
646
+ successDict[@"data"] = data;
647
+ }
648
+
649
+ return successDict;
650
+ }
651
+
652
+ - (NSError *)scLoanErrorToDict:(ScLoanError *)error {
653
+
654
+ NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
655
+ [responseDict setValue:[NSNumber numberWithInteger:error.errorCode] forKey:@"code"];
656
+ [responseDict setValue:error.errorMessage forKey:@"message"];
657
+ [responseDict setValue:error.data forKey:@"data"];
658
+ [responseDict setValue:@NO forKey:@"isSuccess"];
659
+
660
+ NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
661
+ return err;
662
+
663
+ }
664
+
676
665
  @end
677
666
 
@@ -18,13 +18,24 @@ const {
18
18
  *
19
19
  * @typedef {Object} ScLoanInfo
20
20
  * @property {String} interactionToken
21
+ *
22
+ * @typedef {Object} ScLoanSuccess
23
+ * @property {boolean} isSuccess
24
+ * @property {string} data
25
+ *
26
+ * @typedef {Object} ScLoanError
27
+ * @property {boolean} isSuccess
28
+ * @property {number} code
29
+ * @property {string} message
30
+ * @property {string} data
21
31
  */
22
32
 
23
33
  /**
24
34
  * Setup ScLoans
25
35
  *
26
36
  * @param {ScLoanConfig} config
27
- * @returns {Promise<String>}
37
+ * @returns {Promise<ScLoanSuccess>}
38
+ * @throws {ScLoanError}
28
39
  */
29
40
  const setup = async config => {
30
41
  const safeConfig = (0, _util.safeObject)(config);
@@ -36,7 +47,8 @@ const setup = async config => {
36
47
  * Triggers the LOS Journey
37
48
  *
38
49
  * @param {ScLoanInfo} loanInfo
39
- * @returns {Promise<String>}
50
+ * @returns {Promise<ScLoanSuccess>}
51
+ * @throws {ScLoanError}
40
52
  */
41
53
  const apply = async loanInfo => {
42
54
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -47,7 +59,8 @@ const apply = async loanInfo => {
47
59
  * Triggers the Repayment Journey
48
60
  *
49
61
  * @param {ScLoanInfo} loanInfo
50
- * @returns {Promise<String>}
62
+ * @returns {Promise<ScLoanSuccess>}
63
+ * @throws {ScLoanError}
51
64
  */
52
65
  const pay = async loanInfo => {
53
66
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -58,7 +71,8 @@ const pay = async loanInfo => {
58
71
  * Triggers the Withdraw Journey
59
72
  *
60
73
  * @param {ScLoanInfo} loanInfo
61
- * @returns {Promise<String>}
74
+ * @returns {Promise<ScLoanSuccess>}
75
+ * @throws {ScLoanError}
62
76
  */
63
77
  const withdraw = async loanInfo => {
64
78
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -69,7 +83,8 @@ const withdraw = async loanInfo => {
69
83
  * Triggers the Servicing Journey
70
84
  *
71
85
  * @param {ScLoanInfo} loanInfo
72
- * @returns {Promise<String>}
86
+ * @returns {Promise<ScLoanSuccess>}
87
+ * @throws {ScLoanError}
73
88
  */
74
89
  const service = async loanInfo => {
75
90
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -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","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\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<String>}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if(safeConfig.environment === undefined || safeConfig.environment === null) 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<String>}\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<String>}\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<String>}\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<String>}\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC5B,MAAMC,UAAU,GAAG,IAAAC,gBAAU,EAACF,MAAM,CAAC;EACrC,IAAGC,UAAU,CAACE,WAAW,KAAKC,SAAS,IAAIH,UAAU,CAACE,WAAW,KAAK,IAAI,EAAEF,UAAU,CAACE,WAAW,GAAGE,cAAG,CAACC,IAAI;EAE7G,OAAOT,sBAAsB,CAACU,UAAU,CAACN,UAAU,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACW,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC5B,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACc,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACjC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACe,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACgB,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;AAEH,MAAMI,MAAM,GAAG;EACXf,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC;AACJ,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcH,MAAM"}
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","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) 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 */\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 */\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 */\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 */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC5B,MAAMC,UAAU,GAAG,IAAAC,gBAAU,EAACF,MAAM,CAAC;EACrC,IAAGC,UAAU,CAACE,WAAW,KAAKC,SAAS,IAAIH,UAAU,CAACE,WAAW,KAAK,IAAI,EAAEF,UAAU,CAACE,WAAW,GAAGE,cAAG,CAACC,IAAI;EAE7G,OAAOT,sBAAsB,CAACU,UAAU,CAACN,UAAU,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMO,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACW,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC5B,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACc,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACjC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACe,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACgB,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;AAEH,MAAMI,MAAM,GAAG;EACXf,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC;AACJ,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcH,MAAM","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_constants","_util","_package","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","safeObject","setHybridSdkVersion","version","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","ENV","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","platformSpecificColorHex","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","Platform","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion","_default","exports","default"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n showOrders\n};\n\nexport default SmallcaseGateway;\n"],"mappings":";;;;;;AAAA,I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A;AACA;AACA;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;EAChC,OAAO/D,sBAAsB,CAAC+D,aAAa,CAACvD,gBAAO,CAAC;AACtD,CAAC;AAED,MAAMT,gBAAgB,GAAG;EACvByB,IAAI;EACJ4B,UAAU;EACVE,cAAc;EACdE,wBAAwB;EACxBC,0BAA0B;EAC1BG,gBAAgB;EAChBjC,kBAAkB;EAClBM,oBAAoB;EACpB9B,oBAAoB;EACpBgC,eAAe;EACfK,2BAA2B;EAC3BuB,aAAa;EACbV;AACF,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanE,gBAAgB"}
1
+ {"version":3,"names":["_reactNative","require","_constants","_util","_package","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","safeObject","setHybridSdkVersion","version","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","ENV","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","platformSpecificColorHex","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","Platform","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion","_default","exports","default"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n showOrders\n};\n\nexport default SmallcaseGateway;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,MAAM;EAAEI,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,iBAAiB,GAAG,EAAE;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,MAAOC,SAAS,IAAK;EAChD,MAAMC,UAAU,GAAG,IAAAC,gBAAU,EAACF,SAAS,CAAC;EAExC,MAAMJ,sBAAsB,CAACO,mBAAmB,CAACC,gBAAO,CAAC;EAEzD,MAAM;IACJC,UAAU;IACVC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC;EACF,CAAC,GAAGR,UAAU;EAEd,MAAMS,gBAAgB,GAAGC,OAAO,CAACJ,YAAY,CAAC;EAC9C,MAAMK,gBAAgB,GAAGD,OAAO,CAACH,YAAY,CAAC;EAC9C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,GAAG,IAAAjC,gBAAU,EAACiD,WAAW,CAAC;EAC1C,MAAMzB,OAAO,GAAG,IAAAxB,gBAAU,EAACuB,SAAS,CAAC;EACrC,MAAM8B,gBAAgB,GAAG5C,OAAO,CAAC2C,YAAY,CAAC;EAE9C,OAAO1D,sBAAsB,CAACyD,0BAA0B,CACtDlB,UAAU,EACVT,OAAO,EACP6B,gBACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,MAAOC,KAAK,IAAK;EACxC,MAAMC,SAAS,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,EAAE;EAExD,OAAO7D,sBAAsB,CAAC4D,gBAAgB,CAACE,SAAS,CAAC;AAC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;EAChC,OAAO/D,sBAAsB,CAAC+D,aAAa,CAACvD,gBAAO,CAAC;AACtD,CAAC;AAED,MAAMT,gBAAgB,GAAG;EACvByB,IAAI;EACJ4B,UAAU;EACVE,cAAc;EACdE,wBAAwB;EACxBC,0BAA0B;EAC1BG,gBAAgB;EAChBjC,kBAAkB;EAClBM,oBAAoB;EACpB9B,oBAAoB;EACpBgC,eAAe;EACfK,2BAA2B;EAC3BuB,aAAa;EACbV;AACF,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanE,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ENV","exports","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":";;;;;;AAAO,MAAMA,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAG;EACjBE,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAEM,MAAMC,SAAS,GAAAZ,OAAA,CAAAY,SAAA,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC"}
1
+ {"version":3,"names":["ENV","exports","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":";;;;;;AAAO,MAAMA,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAG;EACjBE,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAEM,MAAMC,SAAS,GAAAZ,OAAA,CAAAY,SAAA,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_SmallcaseGateway","_interopRequireDefault","require","_ScLoan","_constants","obj","__esModule","default","_default","exports","SmallcaseGateway","ENV","ERROR_MSG","TRANSACTION_TYPE"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport ScLoan from \"./ScLoan\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport { ScLoan }\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA+D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAGhD;EAAE,GAAGG,yBAAgB;EAAEC,GAAG,EAAHA,cAAG;EAAEC,SAAS,EAATA,oBAAS;EAAEC,gBAAgB,EAAhBA;AAAiB,CAAC"}
1
+ {"version":3,"names":["_SmallcaseGateway","_interopRequireDefault","require","_ScLoan","_constants","obj","__esModule","default","_default","exports","SmallcaseGateway","ENV","ERROR_MSG","TRANSACTION_TYPE"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport ScLoan from \"./ScLoan\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport { ScLoan }\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA+D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAGhD;EAAE,GAAGG,yBAAgB;EAAEC,GAAG,EAAHA,cAAG;EAAEC,SAAS,EAATA,oBAAS;EAAEC,gBAAgB,EAAhBA;AAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["safeObject","obj","exports","platformSpecificColorHex","hex","Platform","OS"],"sources":["util.js"],"sourcesContent":["/**\n * check if value is a valid object.\n *\n *\n * (Native modules expect objects to not include `null`. wtf js)\n * @param {*} obj\n * @returns {Object} same object if its valid, else returns `{}`\n */\n export const safeObject = (obj) => {\n return obj && typeof obj === \"object\" ? obj : {};\n};\n\nexport function platformSpecificColorHex(hex) {\n if (Platform.OS === 'android') {\n return `#${hex}`\n }\n return hex\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACQ,MAAMA,UAAU,GAAIC,GAAG,IAAK;EAClC,OAAOA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAG,CAAC,CAAC;AAClD,CAAC;AAACC,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAEK,SAASG,wBAAwBA,CAACC,GAAG,EAAE;EAC5C,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAQ,IAAGF,GAAI,EAAC;EAClB;EACA,OAAOA,GAAG;AACZ"}
1
+ {"version":3,"names":["safeObject","obj","exports","platformSpecificColorHex","hex","Platform","OS"],"sources":["util.js"],"sourcesContent":["/**\n * check if value is a valid object.\n *\n *\n * (Native modules expect objects to not include `null`. wtf js)\n * @param {*} obj\n * @returns {Object} same object if its valid, else returns `{}`\n */\n export const safeObject = (obj) => {\n return obj && typeof obj === \"object\" ? obj : {};\n};\n\nexport function platformSpecificColorHex(hex) {\n if (Platform.OS === 'android') {\n return `#${hex}`\n }\n return hex\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACQ,MAAMA,UAAU,GAAIC,GAAG,IAAK;EAClC,OAAOA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAG,CAAC,CAAC;AAClD,CAAC;AAACC,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAEK,SAASG,wBAAwBA,CAACC,GAAG,EAAE;EAC5C,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAQ,IAAGF,GAAI,EAAC;EAClB;EACA,OAAOA,GAAG;AACZ","ignoreList":[]}
@@ -12,13 +12,24 @@ const {
12
12
  *
13
13
  * @typedef {Object} ScLoanInfo
14
14
  * @property {String} interactionToken
15
+ *
16
+ * @typedef {Object} ScLoanSuccess
17
+ * @property {boolean} isSuccess
18
+ * @property {string} data
19
+ *
20
+ * @typedef {Object} ScLoanError
21
+ * @property {boolean} isSuccess
22
+ * @property {number} code
23
+ * @property {string} message
24
+ * @property {string} data
15
25
  */
16
26
 
17
27
  /**
18
28
  * Setup ScLoans
19
29
  *
20
30
  * @param {ScLoanConfig} config
21
- * @returns {Promise<String>}
31
+ * @returns {Promise<ScLoanSuccess>}
32
+ * @throws {ScLoanError}
22
33
  */
23
34
  const setup = async config => {
24
35
  const safeConfig = safeObject(config);
@@ -30,7 +41,8 @@ const setup = async config => {
30
41
  * Triggers the LOS Journey
31
42
  *
32
43
  * @param {ScLoanInfo} loanInfo
33
- * @returns {Promise<String>}
44
+ * @returns {Promise<ScLoanSuccess>}
45
+ * @throws {ScLoanError}
34
46
  */
35
47
  const apply = async loanInfo => {
36
48
  const safeLoanInfo = safeObject(loanInfo);
@@ -41,7 +53,8 @@ const apply = async loanInfo => {
41
53
  * Triggers the Repayment Journey
42
54
  *
43
55
  * @param {ScLoanInfo} loanInfo
44
- * @returns {Promise<String>}
56
+ * @returns {Promise<ScLoanSuccess>}
57
+ * @throws {ScLoanError}
45
58
  */
46
59
  const pay = async loanInfo => {
47
60
  const safeLoanInfo = safeObject(loanInfo);
@@ -52,7 +65,8 @@ const pay = async loanInfo => {
52
65
  * Triggers the Withdraw Journey
53
66
  *
54
67
  * @param {ScLoanInfo} loanInfo
55
- * @returns {Promise<String>}
68
+ * @returns {Promise<ScLoanSuccess>}
69
+ * @throws {ScLoanError}
56
70
  */
57
71
  const withdraw = async loanInfo => {
58
72
  const safeLoanInfo = safeObject(loanInfo);
@@ -63,7 +77,8 @@ const withdraw = async loanInfo => {
63
77
  * Triggers the Servicing Journey
64
78
  *
65
79
  * @param {ScLoanInfo} loanInfo
66
- * @returns {Promise<String>}
80
+ * @returns {Promise<ScLoanSuccess>}
81
+ * @throws {ScLoanError}
67
82
  */
68
83
  const service = async loanInfo => {
69
84
  const safeLoanInfo = safeObject(loanInfo);
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","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\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<String>}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if(safeConfig.environment === undefined || safeConfig.environment === null) 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<String>}\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<String>}\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<String>}\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<String>}\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC5B,MAAMC,UAAU,GAAGN,UAAU,CAACK,MAAM,CAAC;EACrC,IAAGC,UAAU,CAACC,WAAW,KAAKC,SAAS,IAAIF,UAAU,CAACC,WAAW,KAAK,IAAI,EAAED,UAAU,CAACC,WAAW,GAAGN,GAAG,CAACQ,IAAI;EAE7G,OAAON,sBAAsB,CAACO,UAAU,CAACJ,UAAU,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACQ,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC5B,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACW,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACjC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACY,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACa,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;AAEH,MAAMI,MAAM,GAAG;EACXb,KAAK;EACLO,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC;AACJ,CAAC;AAED,eAAeC,MAAM"}
1
+ {"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","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) 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 */\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 */\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 */\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 */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\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;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+1 @@
1
- {"version":3,"names":["NativeModules","Platform","ENV","safeObject","platformSpecificColorHex","version","SmallcaseGateway","SmallcaseGatewayNative","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","setHybridSdkVersion","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n show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AC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;EAChC,OAAOzD,sBAAsB,CAACyD,aAAa,CAAC3D,OAAO,CAAC;AACtD,CAAC;AAED,MAAMC,gBAAgB,GAAG;EACvBqB,IAAI;EACJ0B,UAAU;EACVE,cAAc;EACdE,wBAAwB;EACxBC,0BAA0B;EAC1BG,gBAAgB;EAChB/B,kBAAkB;EAClBM,oBAAoB;EACpB3B,oBAAoB;EACpB6B,eAAe;EACfK,2BAA2B;EAC3BqB,aAAa;EACbV;AACF,CAAC;AAED,eAAehD,gBAAgB"}
1
+ {"version":3,"names":["NativeModules","Platform","ENV","safeObject","platformSpecificColorHex","version","SmallcaseGateway","SmallcaseGatewayNative","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","setHybridSdkVersion","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n showOrders\n};\n\nexport default SmallcaseGateway;\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,GAAG,QAAQ,aAAa;AACjC,SAASC,UAAU,EAAEC,wBAAwB,QAAQ,QAAQ;AAC7D,SAASC,OAAO,QAAQ,iBAAiB;AACzC,MAAM;EAAEC,gBAAgB,EAAEC;AAAuB,CAAC,GAAGP,aAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIQ,iBAAiB,GAAG,EAAE;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,MAAOC,SAAS,IAAK;EAChD,MAAMC,UAAU,GAAGR,UAAU,CAACO,SAAS,CAAC;EAExC,MAAMH,sBAAsB,CAACK,mBAAmB,CAACP,OAAO,CAAC;EAEzD,MAAM;IACJQ,UAAU;IACVC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC;EACF,CAAC,GAAGN,UAAU;EAEd,MAAMO,gBAAgB,GAAGC,OAAO,CAACJ,YAAY,CAAC;EAC9C,MAAMK,gBAAgB,GAAGD,OAAO,CAACH,YAAY,CAAC;EAC9C,MAAMK,cAAc,GAAGC,KAAK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AG9B,UAAU,CAAC6B,SAAS,CAAC;EACrC,MAAM4B,gBAAgB,GAAGzC,OAAO,CAACwC,YAAY,CAAC;EAE9C,OAAOpD,sBAAsB,CAACmD,0BAA0B,CACtDhB,UAAU,EACVT,OAAO,EACP2B,gBACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,MAAOC,KAAK,IAAK;EACxC,MAAMC,SAAS,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,EAAE;EAExD,OAAOvD,sBAAsB,CAACsD,gBAAgB,CAACE,SAAS,CAAC;AAC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;EAChC,OAAOzD,sBAAsB,CAACyD,aAAa,CAAC3D,OAAO,CAAC;AACtD,CAAC;AAED,MAAMC,gBAAgB,GAAG;EACvBqB,IAAI;EACJ0B,UAAU;EACVE,cAAc;EACdE,wBAAwB;EACxBC,0BAA0B;EAC1BG,gBAAgB;EAChB/B,kBAAkB;EAClBM,oBAAoB;EACpB3B,oBAAoB;EACpB6B,eAAe;EACfK,2BAA2B;EAC3BqB,aAAa;EACbV;AACF,CAAC;AAED,eAAehD,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ENV","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,GAAG,GAAG;EACjBC,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAED,OAAO,MAAMC,SAAS,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC"}
1
+ {"version":3,"names":["ENV","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,GAAG,GAAG;EACjBC,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAED,OAAO,MAAMC,SAAS,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["SmallcaseGateway","ScLoan","ENV","TRANSACTION_TYPE","ERROR_MSG"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport ScLoan from \"./ScLoan\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport { ScLoan }\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,GAAG,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,aAAa;AAE9D,SAASH,MAAM;AACf,eAAe;EAAE,GAAGD,gBAAgB;EAAEE,GAAG;EAAEE,SAAS;EAAED;AAAiB,CAAC"}
1
+ {"version":3,"names":["SmallcaseGateway","ScLoan","ENV","TRANSACTION_TYPE","ERROR_MSG"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport ScLoan from \"./ScLoan\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport { ScLoan }\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,GAAG,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,aAAa;AAE9D,SAASH,MAAM;AACf,eAAe;EAAE,GAAGD,gBAAgB;EAAEE,GAAG;EAAEE,SAAS;EAAED;AAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["safeObject","obj","platformSpecificColorHex","hex","Platform","OS"],"sources":["util.js"],"sourcesContent":["/**\n * check if value is a valid object.\n *\n *\n * (Native modules expect objects to not include `null`. wtf js)\n * @param {*} obj\n * @returns {Object} same object if its valid, else returns `{}`\n */\n export const safeObject = (obj) => {\n return obj && typeof obj === \"object\" ? obj : {};\n};\n\nexport function platformSpecificColorHex(hex) {\n if (Platform.OS === 'android') {\n return `#${hex}`\n }\n return hex\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,OAAO,MAAMA,UAAU,GAAIC,GAAG,IAAK;EAClC,OAAOA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,OAAO,SAASC,wBAAwBA,CAACC,GAAG,EAAE;EAC5C,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAQ,IAAGF,GAAI,EAAC;EAClB;EACA,OAAOA,GAAG;AACZ"}
1
+ {"version":3,"names":["safeObject","obj","platformSpecificColorHex","hex","Platform","OS"],"sources":["util.js"],"sourcesContent":["/**\n * check if value is a valid object.\n *\n *\n * (Native modules expect objects to not include `null`. wtf js)\n * @param {*} obj\n * @returns {Object} same object if its valid, else returns `{}`\n */\n export const safeObject = (obj) => {\n return obj && typeof obj === \"object\" ? obj : {};\n};\n\nexport function platformSpecificColorHex(hex) {\n if (Platform.OS === 'android') {\n return `#${hex}`\n }\n return hex\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,OAAO,MAAMA,UAAU,GAAIC,GAAG,IAAK;EAClC,OAAOA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,OAAO,SAASC,wBAAwBA,CAACC,GAAG,EAAE;EAC5C,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAQ,IAAGF,GAAI,EAAC;EAClB;EACA,OAAOA,GAAG;AACZ","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-smallcase-gateway",
3
3
  "title": "React Native Smallcase Gateway",
4
- "version": "2.3.1",
4
+ "version": "3.0.1",
5
5
  "description": "smallcase gateway bindings for react native",
6
6
  "main": "src/index.js",
7
7
  "files": [
@@ -10,6 +10,7 @@
10
10
  "android",
11
11
  "ios",
12
12
  "cpp",
13
+ "types",
13
14
  "react-native-smallcase-gateway.podspec",
14
15
  "!lib/typescript/example",
15
16
  "!android/build",
@@ -18,9 +19,11 @@
18
19
  "!**/__fixtures__",
19
20
  "!**/__mocks__"
20
21
  ],
22
+ "types": "types/index.d.ts",
21
23
  "scripts": {
22
24
  "test": "jest",
23
25
  "typescript": "tsc --noEmit",
26
+ "genTypes": "tsc src/index.js --declaration --emitDeclarationOnly --allowJs --noLib --outDir types",
24
27
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
25
28
  "prepare": "bob build",
26
29
  "release": "release-it",
@@ -47,7 +50,6 @@
47
50
  "registry": "https://registry.npmjs.org/"
48
51
  },
49
52
  "devDependencies": {
50
- "standard-version": "^9.1.0",
51
53
  "@arkweid/lefthook": "^0.7.7",
52
54
  "@babel/eslint-parser": "^7.18.2",
53
55
  "@commitlint/config-conventional": "^17.0.2",
@@ -67,6 +69,7 @@
67
69
  "react-native": "0.68.2",
68
70
  "react-native-builder-bob": "^0.18.3",
69
71
  "release-it": "^15.0.0",
72
+ "standard-version": "^9.1.0",
70
73
  "typescript": "^4.5.2"
71
74
  },
72
75
  "resolutions": {
@@ -33,5 +33,6 @@ Pod::Spec.new do |s|
33
33
  s.dependency "ReactCommon/turbomodule/core"
34
34
  end
35
35
 
36
- s.dependency 'SCGateway', '3.11.1'
36
+ s.dependency 'SCGateway', '3.11.3'
37
+ s.dependency 'SCLoans', '2.1.0'
37
38
  end
package/src/ScLoan.js CHANGED
@@ -11,13 +11,24 @@ const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
11
11
  *
12
12
  * @typedef {Object} ScLoanInfo
13
13
  * @property {String} interactionToken
14
+ *
15
+ * @typedef {Object} ScLoanSuccess
16
+ * @property {boolean} isSuccess
17
+ * @property {string} data
18
+ *
19
+ * @typedef {Object} ScLoanError
20
+ * @property {boolean} isSuccess
21
+ * @property {number} code
22
+ * @property {string} message
23
+ * @property {string} data
14
24
  */
15
25
 
16
26
  /**
17
27
  * Setup ScLoans
18
28
  *
19
29
  * @param {ScLoanConfig} config
20
- * @returns {Promise<String>}
30
+ * @returns {Promise<ScLoanSuccess>}
31
+ * @throws {ScLoanError}
21
32
  */
22
33
  const setup = async (config) => {
23
34
  const safeConfig = safeObject(config);
@@ -30,7 +41,8 @@ const setup = async (config) => {
30
41
  * Triggers the LOS Journey
31
42
  *
32
43
  * @param {ScLoanInfo} loanInfo
33
- * @returns {Promise<String>}
44
+ * @returns {Promise<ScLoanSuccess>}
45
+ * @throws {ScLoanError}
34
46
  */
35
47
  const apply = async (loanInfo) => {
36
48
  const safeLoanInfo = safeObject(loanInfo);
@@ -42,7 +54,8 @@ const apply = async (loanInfo) => {
42
54
  * Triggers the Repayment Journey
43
55
  *
44
56
  * @param {ScLoanInfo} loanInfo
45
- * @returns {Promise<String>}
57
+ * @returns {Promise<ScLoanSuccess>}
58
+ * @throws {ScLoanError}
46
59
  */
47
60
  const pay = async (loanInfo) => {
48
61
  const safeLoanInfo = safeObject(loanInfo);
@@ -54,7 +67,8 @@ const pay = async (loanInfo) => {
54
67
  * Triggers the Withdraw Journey
55
68
  *
56
69
  * @param {ScLoanInfo} loanInfo
57
- * @returns {Promise<String>}
70
+ * @returns {Promise<ScLoanSuccess>}
71
+ * @throws {ScLoanError}
58
72
  */
59
73
  const withdraw = async (loanInfo) => {
60
74
  const safeLoanInfo = safeObject(loanInfo);
@@ -66,7 +80,8 @@ const withdraw = async (loanInfo) => {
66
80
  * Triggers the Servicing Journey
67
81
  *
68
82
  * @param {ScLoanInfo} loanInfo
69
- * @returns {Promise<String>}
83
+ * @returns {Promise<ScLoanSuccess>}
84
+ * @throws {ScLoanError}
70
85
  */
71
86
  const service = async (loanInfo) => {
72
87
  const safeLoanInfo = safeObject(loanInfo);
@@ -0,0 +1,86 @@
1
+ export default ScLoan;
2
+ export type ScLoanConfig = {
3
+ gatewayName: string;
4
+ /**
5
+ * - environment
6
+ */
7
+ environment: 'production' | 'staging' | 'development';
8
+ };
9
+ export type ScLoanInfo = {
10
+ interactionToken: string;
11
+ };
12
+ export type ScLoanSuccess = {
13
+ isSuccess: boolean;
14
+ data: string;
15
+ };
16
+ export type ScLoanError = {
17
+ isSuccess: boolean;
18
+ code: number;
19
+ message: string;
20
+ data: string;
21
+ };
22
+ declare namespace ScLoan {
23
+ export { setup };
24
+ export { apply };
25
+ export { pay };
26
+ export { withdraw };
27
+ export { service };
28
+ }
29
+ /**
30
+ * @typedef {Object} ScLoanConfig
31
+ * @property {String} gatewayName
32
+ * @property {'production' | 'staging' | 'development'} environment - environment
33
+ *
34
+ * @typedef {Object} ScLoanInfo
35
+ * @property {String} interactionToken
36
+ *
37
+ * @typedef {Object} ScLoanSuccess
38
+ * @property {boolean} isSuccess
39
+ * @property {string} data
40
+ *
41
+ * @typedef {Object} ScLoanError
42
+ * @property {boolean} isSuccess
43
+ * @property {number} code
44
+ * @property {string} message
45
+ * @property {string} data
46
+ */
47
+ /**
48
+ * Setup ScLoans
49
+ *
50
+ * @param {ScLoanConfig} config
51
+ * @returns {Promise<ScLoanSuccess>}
52
+ * @throws {ScLoanError}
53
+ */
54
+ declare function setup(config: ScLoanConfig): Promise<ScLoanSuccess>;
55
+ /**
56
+ * Triggers the LOS Journey
57
+ *
58
+ * @param {ScLoanInfo} loanInfo
59
+ * @returns {Promise<ScLoanSuccess>}
60
+ * @throws {ScLoanError}
61
+ */
62
+ declare function apply(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
63
+ /**
64
+ * Triggers the Repayment Journey
65
+ *
66
+ * @param {ScLoanInfo} loanInfo
67
+ * @returns {Promise<ScLoanSuccess>}
68
+ * @throws {ScLoanError}
69
+ */
70
+ declare function pay(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
71
+ /**
72
+ * Triggers the Withdraw Journey
73
+ *
74
+ * @param {ScLoanInfo} loanInfo
75
+ * @returns {Promise<ScLoanSuccess>}
76
+ * @throws {ScLoanError}
77
+ */
78
+ declare function withdraw(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
79
+ /**
80
+ * Triggers the Servicing Journey
81
+ *
82
+ * @param {ScLoanInfo} loanInfo
83
+ * @returns {Promise<ScLoanSuccess>}
84
+ * @throws {ScLoanError}
85
+ */
86
+ declare function service(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
@@ -0,0 +1,187 @@
1
+ export default SmallcaseGateway;
2
+ export type envConfig = {
3
+ /**
4
+ * - unique name on consumer
5
+ */
6
+ gatewayName: string;
7
+ /**
8
+ * - leprechaun mode toggle
9
+ */
10
+ isLeprechaun: boolean;
11
+ /**
12
+ * - support AMO (subject to broker support)
13
+ */
14
+ isAmoEnabled: boolean;
15
+ /**
16
+ * - list of broker names
17
+ */
18
+ brokerList: Array<string>;
19
+ /**
20
+ * - environment name
21
+ */
22
+ environmentName: 'production' | 'staging' | 'development';
23
+ };
24
+ export type transactionRes = {
25
+ /**
26
+ * - response data
27
+ */
28
+ data: string;
29
+ /**
30
+ * - success flag
31
+ */
32
+ success: boolean;
33
+ /**
34
+ * - error code
35
+ */
36
+ errorCode?: number;
37
+ /**
38
+ * - transaction name
39
+ */
40
+ transaction: string;
41
+ };
42
+ export type userDetails = {
43
+ /**
44
+ * - name of user
45
+ */
46
+ name: string;
47
+ /**
48
+ * - email of user
49
+ */
50
+ email: string;
51
+ /**
52
+ * - contact of user
53
+ */
54
+ contact: string;
55
+ /**
56
+ * - pin-code of user
57
+ */
58
+ pinCode: string;
59
+ };
60
+ export type SmallplugUiConfig = {
61
+ /**
62
+ * - color of the header background
63
+ */
64
+ headerColor: string;
65
+ /**
66
+ * - opacity of the header background
67
+ */
68
+ headerOpacity: number;
69
+ /**
70
+ * - color of the back icon
71
+ */
72
+ backIconColor: string;
73
+ /**
74
+ * - opacity of the back icon
75
+ */
76
+ backIconOpacity: number;
77
+ };
78
+ declare namespace SmallcaseGateway {
79
+ export { init };
80
+ export { logoutUser };
81
+ export { triggerLeadGen };
82
+ export { triggerLeadGenWithStatus };
83
+ export { triggerLeadGenWithLoginCta };
84
+ export { archiveSmallcase };
85
+ export { triggerTransaction };
86
+ export { triggerMfTransaction };
87
+ export { setConfigEnvironment };
88
+ export { launchSmallplug };
89
+ export { launchSmallplugWithBranding };
90
+ export { getSdkVersion };
91
+ export { showOrders };
92
+ }
93
+ /**
94
+ * initialize sdk with a session
95
+ *
96
+ * note: this must be called after `setConfigEnvironment()`
97
+ * @param {string} sdkToken
98
+ */
99
+ declare function init(sdkToken: string): unknown;
100
+ /**
101
+ * Logs the user out and removes the web session.
102
+ *
103
+ * This promise will be rejected if logout was unsuccessful
104
+ *
105
+ * @returns {Promise}
106
+ */
107
+ declare function logoutUser(): Promise;
108
+ /**
109
+ * triggers the lead gen flow
110
+ *
111
+ * @param {userDetails} [userDetails]
112
+ * @param {Object} [utmParams]
113
+ */
114
+ declare function triggerLeadGen(userDetails?: userDetails, utmParams?: any): any;
115
+ /**
116
+ * triggers the lead gen flow
117
+ *
118
+ * @param {userDetails} [userDetails]
119
+ * * @returns {Promise}
120
+ */
121
+ declare function triggerLeadGenWithStatus(userDetails?: userDetails): Promise;
122
+ /**
123
+ * triggers the lead gen flow with an option of "login here" cta
124
+ *
125
+ * @param {userDetails} [userDetails]
126
+ * @param {Object} [utmParams]
127
+ * @param {boolean} [showLoginCta]
128
+ * @returns {Promise}
129
+ */
130
+ declare function triggerLeadGenWithLoginCta(userDetails?: userDetails, utmParams?: any, showLoginCta?: boolean): Promise;
131
+ /**
132
+ * Marks a smallcase as archived
133
+ *
134
+ * @param {String} iscid
135
+ */
136
+ declare function archiveSmallcase(iscid: string): unknown;
137
+ /**
138
+ * triggers a transaction with a transaction id
139
+ *
140
+ * @param {string} transactionId
141
+ * @param {Object} [utmParams]
142
+ * @param {Array<string>} [brokerList]
143
+ * @returns {Promise<transactionRes>}
144
+ */
145
+ declare function triggerTransaction(transactionId: string, utmParams?: any, brokerList?: Array<string>): Promise<transactionRes>;
146
+ /**
147
+ * triggers a transaction with a transaction id
148
+ *
149
+ * @param {string} transactionId
150
+ * @returns {Promise<transactionRes>}
151
+ */
152
+ declare function triggerMfTransaction(transactionId: string): Promise<transactionRes>;
153
+ /**
154
+ * configure the sdk with
155
+ * @param {envConfig} envConfig
156
+ */
157
+ declare function setConfigEnvironment(envConfig: envConfig): any;
158
+ /**
159
+ * launches smallcases module
160
+ *
161
+ * @param {string} targetEndpoint
162
+ * @param {string} params
163
+ */
164
+ declare function launchSmallplug(targetEndpoint: string, params: string): unknown;
165
+ /**
166
+ * launches smallcases module
167
+ *
168
+ * @param {string} targetEndpoint
169
+ * @param {string} params
170
+ * @param {string} headerColor
171
+ * @param {number} headerOpacity
172
+ * @param {string} backIconColor
173
+ * @param {number} backIconOpacity
174
+ */
175
+ declare function launchSmallplugWithBranding(targetEndpoint: string, params: string, headerColor: string, headerOpacity: number, backIconColor: string, backIconOpacity: number): unknown;
176
+ /**
177
+ * Returns the native android/ios and react-native sdk version
178
+ * (internal-tracking)
179
+ * @returns {Promise}
180
+ */
181
+ declare function getSdkVersion(): Promise;
182
+ /**
183
+ * This will display a list of all the orders that a user recently placed.
184
+ * This includes pending, successful, and failed orders.
185
+ * @returns
186
+ */
187
+ declare function showOrders(): unknown;
@@ -0,0 +1,33 @@
1
+ export namespace ENV {
2
+ const STAG: string;
3
+ const DEV: string;
4
+ const PROD: string;
5
+ }
6
+ export namespace TRANSACTION_TYPE {
7
+ const connect: string;
8
+ const sipSetup: string;
9
+ const fetchFunds: string;
10
+ const transaction: string;
11
+ const holdingsImport: string;
12
+ const authorizeHoldings: string;
13
+ const mfHoldingsImport: string;
14
+ }
15
+ export namespace ERROR_MSG {
16
+ const init_sdk: string;
17
+ const no_order: string;
18
+ const no_broker: string;
19
+ const invalid_jwt: string;
20
+ const market_closed: string;
21
+ const user_mismatch: string;
22
+ const order_pending: string;
23
+ const internal_error: string;
24
+ const user_cancelled: string;
25
+ const consent_denied: string;
26
+ const order_in_queue: string;
27
+ const invalid_gateway: string;
28
+ const transaction_expired: string;
29
+ const invalid_transactionId: string;
30
+ const insufficient_holdings: string;
31
+ const transaction_in_process: string;
32
+ const no_compatible_browser: string;
33
+ }
@@ -0,0 +1,51 @@
1
+ export { ScLoan };
2
+ declare const _default: {
3
+ ENV: {
4
+ STAG: string;
5
+ DEV: string;
6
+ PROD: string;
7
+ };
8
+ ERROR_MSG: {
9
+ init_sdk: string;
10
+ no_order: string;
11
+ no_broker: string;
12
+ invalid_jwt: string;
13
+ market_closed: string;
14
+ user_mismatch: string;
15
+ order_pending: string;
16
+ internal_error: string;
17
+ user_cancelled: string;
18
+ consent_denied: string;
19
+ order_in_queue: string;
20
+ invalid_gateway: string;
21
+ transaction_expired: string;
22
+ invalid_transactionId: string;
23
+ insufficient_holdings: string;
24
+ transaction_in_process: string;
25
+ no_compatible_browser: string;
26
+ };
27
+ TRANSACTION_TYPE: {
28
+ connect: string;
29
+ sipSetup: string;
30
+ fetchFunds: string;
31
+ transaction: string;
32
+ holdingsImport: string;
33
+ authorizeHoldings: string;
34
+ mfHoldingsImport: string;
35
+ };
36
+ init: (sdkToken: string) => unknown;
37
+ logoutUser: () => Promise;
38
+ triggerLeadGen: (userDetails?: import("./SmallcaseGateway").userDetails, utmParams?: any) => any;
39
+ triggerLeadGenWithStatus: (userDetails?: import("./SmallcaseGateway").userDetails) => Promise;
40
+ triggerLeadGenWithLoginCta: (userDetails?: import("./SmallcaseGateway").userDetails, utmParams?: any, showLoginCta?: boolean) => Promise;
41
+ archiveSmallcase: (iscid: string) => unknown;
42
+ triggerTransaction: (transactionId: string, utmParams?: any, brokerList?: string[]) => Promise<import("./SmallcaseGateway").transactionRes>;
43
+ triggerMfTransaction: (transactionId: string) => Promise<import("./SmallcaseGateway").transactionRes>;
44
+ setConfigEnvironment: (envConfig: import("./SmallcaseGateway").envConfig) => any;
45
+ launchSmallplug: (targetEndpoint: string, params: string) => unknown;
46
+ launchSmallplugWithBranding: (targetEndpoint: string, params: string, headerColor: string, headerOpacity: number, backIconColor: string, backIconOpacity: number) => unknown;
47
+ getSdkVersion: () => Promise;
48
+ showOrders: () => unknown;
49
+ };
50
+ export default _default;
51
+ import ScLoan from "./ScLoan";
@@ -0,0 +1,2 @@
1
+ export function platformSpecificColorHex(hex: any): any;
2
+ export function safeObject(obj: any): any;