@getvouch/react-native-sdk 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/io/getvouch/rn/VouchRNModule.kt +1 -1
- package/ios/VouchRN.mm +40 -2
- package/lib/commonjs/NativeVouch.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeVouch.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeVouch.d.ts +6 -1
- package/lib/typescript/NativeVouch.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeVouch.ts +7 -1
- package/src/index.ts +4 -3
- package/vouch-rn.podspec +2 -2
|
@@ -24,7 +24,7 @@ class VouchRNModule(reactContext: ReactApplicationContext) :
|
|
|
24
24
|
|
|
25
25
|
override fun getName(): String = NAME
|
|
26
26
|
|
|
27
|
-
override fun initialize(customerId: String) {
|
|
27
|
+
override fun initialize(customerId: String, style: ReadableMap?) {
|
|
28
28
|
if (this.customerId != null) {
|
|
29
29
|
Log.w(NAME, "VouchSDK is already initialized")
|
|
30
30
|
return
|
package/ios/VouchRN.mm
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "VouchRN.h"
|
|
2
|
+
#import <React/RCTConvert.h>
|
|
2
3
|
#import <React/RCTLog.h>
|
|
3
4
|
#import <VouchSDK/VouchSDK-Swift.h>
|
|
4
5
|
|
|
@@ -25,7 +26,13 @@ RCT_EXPORT_MODULE(VouchRN)
|
|
|
25
26
|
return self;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
30
|
+
RCT_EXPORT_METHOD(initialize : (NSString *)customerId
|
|
31
|
+
style : (JS::NativeVouch::VouchStyle &)style) {
|
|
32
|
+
#else
|
|
33
|
+
RCT_EXPORT_METHOD(initialize : (NSString *)customerId
|
|
34
|
+
style : (NSDictionary *)style) {
|
|
35
|
+
#endif
|
|
29
36
|
if (self.initialized) {
|
|
30
37
|
RCTLogWarn(@"VouchSDK is already initialized");
|
|
31
38
|
return;
|
|
@@ -33,7 +40,38 @@ RCT_EXPORT_METHOD(initialize : (NSString *)customerId) {
|
|
|
33
40
|
|
|
34
41
|
// VouchSDK uses WebKit components which must be initialized on the main thread
|
|
35
42
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
36
|
-
|
|
43
|
+
VouchStyleObjC *styleObjC = nil;
|
|
44
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
45
|
+
NSString *logoName = style.logo();
|
|
46
|
+
NSString *logoSmallName = style.logoSmall();
|
|
47
|
+
NSString *footerLogoName = style.footerLogo();
|
|
48
|
+
|
|
49
|
+
UIImage *logo = logoName.length > 0 ? [RCTConvert UIImage:logoName] : nil;
|
|
50
|
+
UIImage *logoSmall = logoSmallName.length > 0 ? [RCTConvert UIImage:logoSmallName] : nil;
|
|
51
|
+
UIImage *footerLogo = footerLogoName.length > 0 ? [RCTConvert UIImage:footerLogoName] : nil;
|
|
52
|
+
|
|
53
|
+
if (logo || logoSmall || footerLogo) {
|
|
54
|
+
styleObjC = [[VouchStyleObjC alloc] initWithLogo:logo
|
|
55
|
+
logoSmall:logoSmall
|
|
56
|
+
footerLogo:footerLogo];
|
|
57
|
+
}
|
|
58
|
+
#else
|
|
59
|
+
if ([style isKindOfClass:[NSDictionary class]] && style.count > 0) {
|
|
60
|
+
id logoValue = style[@"logo"];
|
|
61
|
+
id logoSmallValue = style[@"logoSmall"];
|
|
62
|
+
id footerLogoValue = style[@"footerLogo"];
|
|
63
|
+
|
|
64
|
+
UIImage *logo = logoValue == [NSNull null] ? nil : [RCTConvert UIImage:logoValue];
|
|
65
|
+
UIImage *logoSmall = logoSmallValue == [NSNull null] ? nil : [RCTConvert UIImage:logoSmallValue];
|
|
66
|
+
UIImage *footerLogo = footerLogoValue == [NSNull null] ? nil : [RCTConvert UIImage:footerLogoValue];
|
|
67
|
+
|
|
68
|
+
styleObjC = [[VouchStyleObjC alloc] initWithLogo:logo
|
|
69
|
+
logoSmall:logoSmall
|
|
70
|
+
footerLogo:footerLogo];
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
self.sdk = [[VouchSDKBridge alloc] initWithCustomerId:customerId style:styleObjC];
|
|
37
75
|
self.initialized = YES;
|
|
38
76
|
|
|
39
77
|
RCTLogInfo(@"VouchSDK initialized with customerId: %@", customerId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVouch.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVouch.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAgDpCC,gCAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeVouch","_interopRequireDefault","require","e","__esModule","default","VouchSDK","initialize","config","NativeVouch","customerId","isInitialized","start","params","Promise","resolve","reject","dataSourceId","webhookUrl","inputs","result","error","_default","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_NativeVouch","_interopRequireDefault","require","e","__esModule","default","VouchSDK","initialize","config","NativeVouch","customerId","style","isInitialized","start","params","Promise","resolve","reject","dataSourceId","webhookUrl","inputs","result","error","_default","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAkF,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAelF,MAAMG,QAAQ,CAAC;EACb;AACF;AACA;AACA;EACEC,UAAUA,CAACC,MAAsB,EAAQ;IACvCC,oBAAW,CAACF,UAAU,CAACC,MAAM,CAACE,UAAU,EAAEF,MAAM,CAACG,KAAK,IAAI,CAAC,CAAC,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAOH,oBAAW,CAACG,aAAa,CAAC,CAAC;EACpC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,KAAKA,CAACC,MAAwB,EAAyB;IACrD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtCR,oBAAW,CAACI,KAAK,CACfC,MAAM,CAACI,YAAY,EACnBJ,MAAM,CAACK,UAAU,EACjBL,MAAM,CAACM,MAAM,IAAI,IAAI,EACpBC,MAAM,IAAKL,OAAO,CAACK,MAAM,CAAC,EAC1BC,KAAK,IAAKL,MAAM,CAACK,KAAK,CACzB,CAAC;IACH,CAAC,CAAC;EACJ;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEc,IAAIC,QAAQ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVouch.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeVouch.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAgDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeVouch","VouchSDK","initialize","config","customerId","isInitialized","start","params","Promise","resolve","reject","dataSourceId","webhookUrl","inputs","result","error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,WAAW,
|
|
1
|
+
{"version":3,"names":["NativeVouch","VouchSDK","initialize","config","customerId","style","isInitialized","start","params","Promise","resolve","reject","dataSourceId","webhookUrl","inputs","result","error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAOA,WAAW,MAAgD,eAAe;AAejF,MAAMC,QAAQ,CAAC;EACb;AACF;AACA;AACA;EACEC,UAAUA,CAACC,MAAsB,EAAQ;IACvCH,WAAW,CAACE,UAAU,CAACC,MAAM,CAACC,UAAU,EAAED,MAAM,CAACE,KAAK,IAAI,CAAC,CAAC,CAAC;EAC/D;;EAEA;AACF;AACA;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAON,WAAW,CAACM,aAAa,CAAC,CAAC;EACpC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,KAAKA,CAACC,MAAwB,EAAyB;IACrD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtCX,WAAW,CAACO,KAAK,CACfC,MAAM,CAACI,YAAY,EACnBJ,MAAM,CAACK,UAAU,EACjBL,MAAM,CAACM,MAAM,IAAI,IAAI,EACpBC,MAAM,IAAKL,OAAO,CAACK,MAAM,CAAC,EAC1BC,KAAK,IAAKL,MAAM,CAACK,KAAK,CACzB,CAAC;IACH,CAAC,CAAC;EACJ;AACF;AAEA,eAAe,IAAIf,QAAQ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,12 +7,17 @@ export interface VouchError {
|
|
|
7
7
|
reason: number;
|
|
8
8
|
description: string;
|
|
9
9
|
}
|
|
10
|
+
export interface VouchStyle {
|
|
11
|
+
logo?: string;
|
|
12
|
+
logoSmall?: string;
|
|
13
|
+
footerLogo?: string;
|
|
14
|
+
}
|
|
10
15
|
export interface Spec extends TurboModule {
|
|
11
16
|
/**
|
|
12
17
|
* Initialize the Vouch SDK with a customer ID
|
|
13
18
|
* @param customerId - Your customer ID provided by Vouch
|
|
14
19
|
*/
|
|
15
|
-
initialize(customerId: string): void;
|
|
20
|
+
initialize(customerId: string, style: VouchStyle): void;
|
|
16
21
|
/**
|
|
17
22
|
* Check if the SDK is initialized
|
|
18
23
|
* @returns true if initialized, false otherwise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeVouch.d.ts","sourceRoot":"","sources":["../../src/NativeVouch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeVouch.d.ts","sourceRoot":"","sources":["../../src/NativeVouch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;OAGG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAExD;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC;IAEzB;;;;;;;OAOG;IACH,KAAK,CACH,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,EACzC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GACnC,IAAI,CAAC;CACT;;AAED,wBAAiE"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { VouchSuccess, VouchError } from './NativeVouch';
|
|
1
|
+
import { VouchSuccess, VouchError, VouchStyle } from './NativeVouch';
|
|
2
2
|
export interface VouchSDKConfig {
|
|
3
3
|
customerId: string;
|
|
4
|
+
style?: VouchStyle;
|
|
4
5
|
}
|
|
5
6
|
export interface VouchStartParams {
|
|
6
7
|
dataSourceId: string;
|
|
7
8
|
webhookUrl: string;
|
|
8
9
|
inputs?: Object;
|
|
9
10
|
}
|
|
10
|
-
export type { VouchSuccess, VouchError };
|
|
11
|
+
export type { VouchSuccess, VouchError, VouchStyle };
|
|
11
12
|
declare class VouchSDK {
|
|
12
13
|
/**
|
|
13
14
|
* Initialize the Vouch SDK
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAErD,cAAM,QAAQ;IACZ;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIxC;;;OAGG;IACH,aAAa,IAAI,OAAO;IAIxB;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAWvD;;AAED,wBAA8B"}
|
package/package.json
CHANGED
package/src/NativeVouch.ts
CHANGED
|
@@ -11,12 +11,18 @@ export interface VouchError {
|
|
|
11
11
|
description: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface VouchStyle {
|
|
15
|
+
logo?: string;
|
|
16
|
+
logoSmall?: string;
|
|
17
|
+
footerLogo?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
export interface Spec extends TurboModule {
|
|
15
21
|
/**
|
|
16
22
|
* Initialize the Vouch SDK with a customer ID
|
|
17
23
|
* @param customerId - Your customer ID provided by Vouch
|
|
18
24
|
*/
|
|
19
|
-
initialize(customerId: string): void;
|
|
25
|
+
initialize(customerId: string, style: VouchStyle): void;
|
|
20
26
|
|
|
21
27
|
/**
|
|
22
28
|
* Check if the SDK is initialized
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import NativeVouch, { VouchSuccess, VouchError } from './NativeVouch';
|
|
1
|
+
import NativeVouch, { VouchSuccess, VouchError, VouchStyle } from './NativeVouch';
|
|
2
2
|
|
|
3
3
|
export interface VouchSDKConfig {
|
|
4
4
|
customerId: string;
|
|
5
|
+
style?: VouchStyle;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
export interface VouchStartParams {
|
|
@@ -10,7 +11,7 @@ export interface VouchStartParams {
|
|
|
10
11
|
inputs?: Object;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export type { VouchSuccess, VouchError };
|
|
14
|
+
export type { VouchSuccess, VouchError, VouchStyle };
|
|
14
15
|
|
|
15
16
|
class VouchSDK {
|
|
16
17
|
/**
|
|
@@ -18,7 +19,7 @@ class VouchSDK {
|
|
|
18
19
|
* @param config - Configuration object with customerId
|
|
19
20
|
*/
|
|
20
21
|
initialize(config: VouchSDKConfig): void {
|
|
21
|
-
NativeVouch.initialize(config.customerId);
|
|
22
|
+
NativeVouch.initialize(config.customerId, config.style ?? {});
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
/**
|
package/vouch-rn.podspec
CHANGED
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package["license"]
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
|
-
s.platforms = { :ios => "
|
|
13
|
+
s.platforms = { :ios => "14.0" }
|
|
14
14
|
s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
install_modules_dependencies(s)
|
|
20
20
|
|
|
21
21
|
# Vouch SDK dependency
|
|
22
|
-
s.dependency "vouch-ios-sdk", "~> 0.0.
|
|
22
|
+
s.dependency "vouch-ios-sdk", "~> 0.0.9"
|
|
23
23
|
end
|