@virex-tech/paywallo-sdk 1.1.1 → 1.3.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/src/main/java/com/paywallo/sdk/PaywalloWebView.kt +45 -0
- package/android/src/main/java/com/paywallo/sdk/PaywalloWebViewManager.kt +1 -0
- package/dist/index.d.mts +83 -42
- package/dist/index.d.ts +83 -42
- package/dist/index.js +1109 -600
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1277 -759
- package/dist/index.mjs.map +1 -1
- package/ios/PaywalloWebView.h +1 -0
- package/ios/PaywalloWebView.m +20 -0
- package/ios/PaywalloWebViewManager.m +1 -0
- package/ios/PaywalloWebViewModule.h +1 -0
- package/ios/PaywalloWebViewModule.m +8 -1
- package/package.json +1 -1
package/ios/PaywalloWebView.h
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
@property (nonatomic, copy) NSString *injectedJavaScript;
|
|
10
10
|
@property (nonatomic, copy) RCTDirectEventBlock onMessage;
|
|
11
11
|
@property (nonatomic, copy) RCTDirectEventBlock onLoadEnd;
|
|
12
|
+
@property (nonatomic, copy) RCTDirectEventBlock onError;
|
|
12
13
|
|
|
13
14
|
- (void)injectJavaScript:(NSString *)script;
|
|
14
15
|
|
package/ios/PaywalloWebView.m
CHANGED
|
@@ -147,10 +147,30 @@
|
|
|
147
147
|
|
|
148
148
|
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
|
|
149
149
|
{
|
|
150
|
+
NSString *urlString = webView.URL ? webView.URL.absoluteString : @"";
|
|
151
|
+
NSDictionary *errorInfo = @{
|
|
152
|
+
@"code": @(error.code),
|
|
153
|
+
@"description": error.localizedDescription ?: @"",
|
|
154
|
+
@"url": urlString
|
|
155
|
+
};
|
|
156
|
+
if (self.onError) {
|
|
157
|
+
self.onError(@{@"type": @"error", @"payload": errorInfo});
|
|
158
|
+
}
|
|
159
|
+
[PaywalloWebViewModule emitWebViewError:errorInfo];
|
|
150
160
|
}
|
|
151
161
|
|
|
152
162
|
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
|
|
153
163
|
{
|
|
164
|
+
NSString *urlString = webView.URL ? webView.URL.absoluteString : @"";
|
|
165
|
+
NSDictionary *errorInfo = @{
|
|
166
|
+
@"code": @(error.code),
|
|
167
|
+
@"description": error.localizedDescription ?: @"",
|
|
168
|
+
@"url": urlString
|
|
169
|
+
};
|
|
170
|
+
if (self.onError) {
|
|
171
|
+
self.onError(@{@"type": @"error", @"payload": errorInfo});
|
|
172
|
+
}
|
|
173
|
+
[PaywalloWebViewModule emitWebViewError:errorInfo];
|
|
154
174
|
}
|
|
155
175
|
|
|
156
176
|
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
|
|
@@ -20,6 +20,7 @@ RCT_EXPORT_VIEW_PROPERTY(sourceHtml, NSString)
|
|
|
20
20
|
RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString)
|
|
21
21
|
RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock)
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(onLoadEnd, RCTDirectEventBlock)
|
|
23
|
+
RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock)
|
|
23
24
|
|
|
24
25
|
RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)reactTag script:(NSString *)script)
|
|
25
26
|
{
|
|
@@ -17,7 +17,7 @@ RCT_EXPORT_MODULE(PaywalloWebViewModule);
|
|
|
17
17
|
|
|
18
18
|
- (NSArray<NSString *> *)supportedEvents
|
|
19
19
|
{
|
|
20
|
-
return @[@"PaywalloWebViewMessage", @"PaywalloWebViewLoadEnd"];
|
|
20
|
+
return @[@"PaywalloWebViewMessage", @"PaywalloWebViewLoadEnd", @"PaywalloWebViewError"];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
+ (void)emitWebViewMessage:(NSDictionary *)message
|
|
@@ -34,6 +34,13 @@ RCT_EXPORT_MODULE(PaywalloWebViewModule);
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
+ (void)emitWebViewError:(NSDictionary *)errorPayload
|
|
38
|
+
{
|
|
39
|
+
if (sharedInstance) {
|
|
40
|
+
[sharedInstance sendEventWithName:@"PaywalloWebViewError" body:errorPayload];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
+ (BOOL)requiresMainQueueSetup
|
|
38
45
|
{
|
|
39
46
|
return YES;
|
package/package.json
CHANGED