react-native-visit-rn-sdk 2.0.16 → 2.0.18
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/lib/commonjs/SecondaryWebView.android.js +8 -26
- package/lib/commonjs/SecondaryWebView.android.js.map +1 -1
- package/lib/commonjs/SecondaryWebView.ios.js +14 -32
- package/lib/commonjs/SecondaryWebView.ios.js.map +1 -1
- package/lib/commonjs/Services.js +9 -11
- package/lib/commonjs/Services.js.map +1 -1
- package/lib/commonjs/androidLocation.js +9 -14
- package/lib/commonjs/androidLocation.js.map +1 -1
- package/lib/commonjs/constants.js +1 -2
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/index.android.js +14 -52
- package/lib/commonjs/index.android.js.map +1 -1
- package/lib/commonjs/index.ios.js +13 -49
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/iosLocation.js +9 -14
- package/lib/commonjs/iosLocation.js.map +1 -1
- package/lib/module/SecondaryWebView.android.js +5 -21
- package/lib/module/SecondaryWebView.android.js.map +1 -1
- package/lib/module/SecondaryWebView.ios.js +12 -28
- package/lib/module/SecondaryWebView.ios.js.map +1 -1
- package/lib/module/Services.js +7 -8
- package/lib/module/Services.js.map +1 -1
- package/lib/module/androidLocation.js +7 -10
- package/lib/module/androidLocation.js.map +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/index.android.js +10 -45
- package/lib/module/index.android.js.map +1 -1
- package/lib/module/index.ios.js +10 -44
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/iosLocation.js +7 -10
- package/lib/module/iosLocation.js.map +1 -1
- package/package.json +7 -6
- package/src/SecondaryWebView.android.js +0 -17
- package/src/SecondaryWebView.ios.js +1 -17
- package/src/index.android.js +0 -35
- package/src/index.ios.js +0 -35
package/src/index.ios.js
CHANGED
|
@@ -56,26 +56,6 @@ const unescapeHTML = (str) =>
|
|
|
56
56
|
|
|
57
57
|
const visitEvent = 'visit-event';
|
|
58
58
|
|
|
59
|
-
// Domains that stay inside the WebView. Matches the host exactly or any of its
|
|
60
|
-
// subdomains. Everything else (wa.me, tel:, mailto: ...) is handed to the OS.
|
|
61
|
-
const INTERNAL_HOSTS = ['getvisitapp.net', 'getvisitapp.com', 'myhubble.money'];
|
|
62
|
-
|
|
63
|
-
// Note: does not use `new URL()` - React Native's URL polyfill throws
|
|
64
|
-
// "URL.hostname is not implemented".
|
|
65
|
-
const isInternalUrl = (url) => {
|
|
66
|
-
const link = typeof url === 'string' ? url.trim() : '';
|
|
67
|
-
const match = /^https?:\/\/([^/?#]+)/i.exec(link);
|
|
68
|
-
if (!match) {
|
|
69
|
-
// about:blank / data: / blob: are rendered by the WebView itself.
|
|
70
|
-
return /^(about|data|blob):/i.test(link);
|
|
71
|
-
}
|
|
72
|
-
// Strip any userinfo and port before comparing.
|
|
73
|
-
const host = match[1].split('@').pop().split(':')[0].toLowerCase();
|
|
74
|
-
return INTERNAL_HOSTS.some(
|
|
75
|
-
(domain) => host === domain || host.endsWith(`.${domain}`)
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
59
|
const VisitRnSdkView = ({
|
|
80
60
|
cpsid,
|
|
81
61
|
baseUrl,
|
|
@@ -371,21 +351,6 @@ const VisitRnSdkView = ({
|
|
|
371
351
|
javascriptEnabled
|
|
372
352
|
webviewDebuggingEnabled={Boolean(isLoggingEnabled)}
|
|
373
353
|
onMessage={handleMessage}
|
|
374
|
-
onShouldStartLoadWithRequest={(request) => {
|
|
375
|
-
// Sub-frames (iframes) are never handed to the OS.
|
|
376
|
-
if (request.isTopFrame === false) {
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
if (isInternalUrl(request.url)) {
|
|
380
|
-
return true;
|
|
381
|
-
}
|
|
382
|
-
Linking.openURL(request.url).catch((err) => {
|
|
383
|
-
if (isLoggingEnabled) {
|
|
384
|
-
console.warn('Linking.openURL error: ', err);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
return false;
|
|
388
|
-
}}
|
|
389
354
|
onError={(errorMessage) => {
|
|
390
355
|
EventRegister.emitEvent(visitEvent, {
|
|
391
356
|
message: 'web-view-error',
|