@getvouch/react-native-sdk 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/9.0.0/checksums/checksums.lock +0 -0
- package/android/.gradle/9.0.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.0.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.0.0/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/getvouch/rn/VouchRNModule.kt +1 -1
- package/ios/VouchRN.mm +45 -77
- 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 +1 -6
- package/lib/typescript/NativeVouch.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeVouch.ts +1 -7
- package/src/index.ts +3 -4
- package/vouch-rn.podspec +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/android/build.gradle
CHANGED
|
@@ -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) {
|
|
28
28
|
if (this.customerId != null) {
|
|
29
29
|
Log.w(NAME, "VouchSDK is already initialized")
|
|
30
30
|
return
|
package/ios/VouchRN.mm
CHANGED
|
@@ -26,52 +26,16 @@ RCT_EXPORT_MODULE(VouchRN)
|
|
|
26
26
|
return self;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
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
|
+
RCT_EXPORT_METHOD(initialize : (NSString *)customerId) {
|
|
36
30
|
if (self.initialized) {
|
|
37
31
|
RCTLogWarn(@"VouchSDK is already initialized");
|
|
38
32
|
return;
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
// VouchSDK uses WebKit components which must be initialized on the main
|
|
35
|
+
// VouchSDK uses WebKit components which must be initialized on the main
|
|
36
|
+
// thread
|
|
42
37
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
43
|
-
|
|
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];
|
|
38
|
+
self.sdk = [[VouchSDKBridge alloc] initWithCustomerId:customerId];
|
|
75
39
|
self.initialized = YES;
|
|
76
40
|
|
|
77
41
|
RCTLogInfo(@"VouchSDK initialized with customerId: %@", customerId);
|
|
@@ -82,12 +46,10 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, isInitialized) {
|
|
|
82
46
|
return @(self.initialized);
|
|
83
47
|
}
|
|
84
48
|
|
|
85
|
-
RCT_EXPORT_METHOD(start
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
: (RCTResponseSenderBlock)onSuccess onError
|
|
90
|
-
: (RCTResponseSenderBlock)onError) {
|
|
49
|
+
RCT_EXPORT_METHOD(start : (NSString *)dataSourceId webhookUrl : (NSString *)
|
|
50
|
+
webhookUrl inputs : (NSDictionary *)inputs onSuccess : (
|
|
51
|
+
RCTResponseSenderBlock)
|
|
52
|
+
onSuccess onError : (RCTResponseSenderBlock)onError) {
|
|
91
53
|
if (!self.initialized) {
|
|
92
54
|
RCTLogError(@"VouchSDK must be initialized before calling start");
|
|
93
55
|
NSDictionary *errorDict = @{
|
|
@@ -112,41 +74,47 @@ RCT_EXPORT_METHOD(start
|
|
|
112
74
|
}
|
|
113
75
|
|
|
114
76
|
// Call the Swift start method to get the view controller
|
|
115
|
-
UIViewController *viewController =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
77
|
+
UIViewController *viewController = [bridge
|
|
78
|
+
startWithDataSourceId:dataSourceId
|
|
79
|
+
webhookUrl:webhookUrl
|
|
80
|
+
inputs:inputsDict
|
|
81
|
+
completion:^(VouchSuccessObjC *success,
|
|
82
|
+
VouchErrorObjC *error) {
|
|
83
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
84
|
+
// Dismiss the view controller
|
|
85
|
+
UIViewController *presentedVC =
|
|
86
|
+
[self getRootViewController].presentedViewController;
|
|
87
|
+
if (presentedVC) {
|
|
88
|
+
[presentedVC
|
|
89
|
+
dismissViewControllerAnimated:YES
|
|
90
|
+
completion:^{
|
|
91
|
+
if (success) {
|
|
92
|
+
NSDictionary *successDict =
|
|
93
|
+
@{
|
|
94
|
+
@"proofId" :
|
|
95
|
+
success.proofId
|
|
96
|
+
};
|
|
97
|
+
onSuccess(@[ successDict ]);
|
|
98
|
+
} else if (error) {
|
|
99
|
+
NSDictionary *errorDict = @{
|
|
100
|
+
@"proofId" :
|
|
101
|
+
error.proofId,
|
|
102
|
+
@"reason" :
|
|
103
|
+
@(error.reason),
|
|
104
|
+
@"description" : error
|
|
105
|
+
.localizedDescription
|
|
106
|
+
};
|
|
107
|
+
onError(@[ errorDict ]);
|
|
108
|
+
}
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}];
|
|
143
113
|
|
|
144
114
|
// Present the view controller modally
|
|
145
115
|
UIViewController *rootVC = [self getRootViewController];
|
|
146
116
|
if (rootVC) {
|
|
147
|
-
[rootVC presentViewController:viewController
|
|
148
|
-
animated:YES
|
|
149
|
-
completion:nil];
|
|
117
|
+
[rootVC presentViewController:viewController animated:YES completion:nil];
|
|
150
118
|
} else {
|
|
151
119
|
RCTLogError(@"Could not find root view controller to present VouchSDK");
|
|
152
120
|
NSDictionary *errorDict = @{
|
|
@@ -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,GA0CpCC,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","
|
|
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;AAAsE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AActE,MAAMG,QAAQ,CAAC;EACb;AACF;AACA;AACA;EACEC,UAAUA,CAACC,MAAsB,EAAQ;IACvCC,oBAAW,CAACF,UAAU,CAACC,MAAM,CAACE,UAAU,CAAC;EAC3C;;EAEA;AACF;AACA;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAOF,oBAAW,CAACE,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;MACtCP,oBAAW,CAACG,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,CAAAlB,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;AA0ClD,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","
|
|
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,MAAoC,eAAe;AAcrE,MAAMC,QAAQ,CAAC;EACb;AACF;AACA;AACA;EACEC,UAAUA,CAACC,MAAsB,EAAQ;IACvCH,WAAW,CAACE,UAAU,CAACC,MAAM,CAACC,UAAU,CAAC;EAC3C;;EAEA;AACF;AACA;AACA;EACEC,aAAaA,CAAA,EAAY;IACvB,OAAOL,WAAW,CAACK,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;MACtCV,WAAW,CAACM,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,IAAId,QAAQ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -7,17 +7,12 @@ 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
|
-
}
|
|
15
10
|
export interface Spec extends TurboModule {
|
|
16
11
|
/**
|
|
17
12
|
* Initialize the Vouch SDK with a customer ID
|
|
18
13
|
* @param customerId - Your customer ID provided by Vouch
|
|
19
14
|
*/
|
|
20
|
-
initialize(customerId: string
|
|
15
|
+
initialize(customerId: string): void;
|
|
21
16
|
/**
|
|
22
17
|
* Check if the SDK is initialized
|
|
23
18
|
* @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,
|
|
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;IAErC;;;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,14 +1,13 @@
|
|
|
1
|
-
import { VouchSuccess, VouchError
|
|
1
|
+
import { VouchSuccess, VouchError } from './NativeVouch';
|
|
2
2
|
export interface VouchSDKConfig {
|
|
3
3
|
customerId: string;
|
|
4
|
-
style?: VouchStyle;
|
|
5
4
|
}
|
|
6
5
|
export interface VouchStartParams {
|
|
7
6
|
dataSourceId: string;
|
|
8
7
|
webhookUrl: string;
|
|
9
8
|
inputs?: Object;
|
|
10
9
|
}
|
|
11
|
-
export type { VouchSuccess, VouchError
|
|
10
|
+
export type { VouchSuccess, VouchError };
|
|
12
11
|
declare class VouchSDK {
|
|
13
12
|
/**
|
|
14
13
|
* 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,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,CAAC;AAEzC,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,18 +11,12 @@ 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
|
-
|
|
20
14
|
export interface Spec extends TurboModule {
|
|
21
15
|
/**
|
|
22
16
|
* Initialize the Vouch SDK with a customer ID
|
|
23
17
|
* @param customerId - Your customer ID provided by Vouch
|
|
24
18
|
*/
|
|
25
|
-
initialize(customerId: string
|
|
19
|
+
initialize(customerId: string): void;
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* Check if the SDK is initialized
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import NativeVouch, { VouchSuccess, VouchError
|
|
1
|
+
import NativeVouch, { VouchSuccess, VouchError } from './NativeVouch';
|
|
2
2
|
|
|
3
3
|
export interface VouchSDKConfig {
|
|
4
4
|
customerId: string;
|
|
5
|
-
style?: VouchStyle;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
export interface VouchStartParams {
|
|
@@ -11,7 +10,7 @@ export interface VouchStartParams {
|
|
|
11
10
|
inputs?: Object;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export type { VouchSuccess, VouchError
|
|
13
|
+
export type { VouchSuccess, VouchError };
|
|
15
14
|
|
|
16
15
|
class VouchSDK {
|
|
17
16
|
/**
|
|
@@ -19,7 +18,7 @@ class VouchSDK {
|
|
|
19
18
|
* @param config - Configuration object with customerId
|
|
20
19
|
*/
|
|
21
20
|
initialize(config: VouchSDKConfig): void {
|
|
22
|
-
NativeVouch.initialize(config.customerId
|
|
21
|
+
NativeVouch.initialize(config.customerId);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
/**
|
package/vouch-rn.podspec
CHANGED