webtonative 1.0.75-beta.6 → 1.0.76
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/ATTConsent/index.js +1 -54
- package/AdMob/index.js +1 -102
- package/AppReview/index.js +1 -22
- package/AppsFlyer/index.js +4 -43
- package/BackgroundLocation/index.js +4 -65
- package/Beacon/index.js +1 -30
- package/Biometric/index.js +1 -125
- package/Bluetooth/index.js +1 -67
- package/BottomNavigation/index.js +4 -41
- package/Clipboard/index.js +4 -45
- package/Facebook/events.js +4 -44
- package/Facebook/index.js +1 -29
- package/Firebase/Analytics/index.js +4 -110
- package/Firebase/Messaging/index.js +4 -64
- package/Firebase/index.js +1 -31
- package/FirebaseAnalytics/index.js +1 -29
- package/Haptics/index.js +1 -21
- package/InAppPurchase/index.js +1 -81
- package/InAppUpdate/index.js +1 -39
- package/MediaPlayer/index.js +7 -56
- package/NativeContacts/index.js +6 -51
- package/NativeDatastore/index.js +1 -0
- package/Notification/index.js +5 -42
- package/OneSignal/index.js +1 -265
- package/Printing/index.js +1 -20
- package/README.md +2 -31
- package/Screen/index.js +4 -35
- package/Siri/index.js +1 -26
- package/SocialLogin/apple.js +1 -32
- package/SocialLogin/facebook.js +3 -55
- package/SocialLogin/google.js +4 -56
- package/SocialLogin/index.js +1 -23
- package/Stripe/index.js +1 -49
- package/VoiceSearch/index.js +1 -34
- package/barcode/barcode-scan.js +1 -40
- package/barcode/formats.js +1 -23
- package/barcode/index.js +1 -13
- package/barcode/types.js +1 -22
- package/index.js +2 -535
- package/package.json +3 -134
- package/utills.js +1 -111
- package/webtonative.min.js +1 -1
- package/ATTConsent/index.d.ts +0 -17
- package/ATTConsent/index.d.ts.map +0 -1
- package/ATTConsent/index.js.map +0 -1
- package/ATTConsent/types.d.ts +0 -15
- package/ATTConsent/types.d.ts.map +0 -1
- package/ATTConsent/types.js +0 -3
- package/ATTConsent/types.js.map +0 -1
- package/AdMob/index.d.ts +0 -31
- package/AdMob/index.d.ts.map +0 -1
- package/AdMob/index.js.map +0 -1
- package/AdMob/types.d.ts +0 -25
- package/AdMob/types.d.ts.map +0 -1
- package/AdMob/types.js +0 -4
- package/AdMob/types.js.map +0 -1
- package/AppReview/index.d.ts +0 -7
- package/AppReview/index.d.ts.map +0 -1
- package/AppReview/index.js.map +0 -1
- package/AppReview/types.d.ts +0 -8
- package/AppReview/types.d.ts.map +0 -1
- package/AppReview/types.js +0 -4
- package/AppReview/types.js.map +0 -1
- package/AppsFlyer/index.d.ts +0 -15
- package/AppsFlyer/index.d.ts.map +0 -1
- package/AppsFlyer/index.js.map +0 -1
- package/AppsFlyer/types.d.ts +0 -10
- package/AppsFlyer/types.d.ts.map +0 -1
- package/AppsFlyer/types.js +0 -3
- package/AppsFlyer/types.js.map +0 -1
- package/BackgroundLocation/index.d.ts +0 -12
- package/BackgroundLocation/index.d.ts.map +0 -1
- package/BackgroundLocation/index.js.map +0 -1
- package/BackgroundLocation/types.d.ts +0 -32
- package/BackgroundLocation/types.d.ts.map +0 -1
- package/BackgroundLocation/types.js +0 -3
- package/BackgroundLocation/types.js.map +0 -1
- package/Beacon/index.d.ts +0 -7
- package/Beacon/index.d.ts.map +0 -1
- package/Beacon/index.js.map +0 -1
- package/Beacon/types.d.ts +0 -19
- package/Beacon/types.d.ts.map +0 -1
- package/Beacon/types.js +0 -3
- package/Beacon/types.js.map +0 -1
- package/Biometric/index.d.ts +0 -27
- package/Biometric/index.d.ts.map +0 -1
- package/Biometric/index.js.map +0 -1
- package/Biometric/types.d.ts +0 -24
- package/Biometric/types.d.ts.map +0 -1
- package/Biometric/types.js +0 -3
- package/Biometric/types.js.map +0 -1
- package/Bluetooth/index.d.ts +0 -17
- package/Bluetooth/index.d.ts.map +0 -1
- package/Bluetooth/index.js.map +0 -1
- package/Bluetooth/types.d.ts +0 -34
- package/Bluetooth/types.d.ts.map +0 -1
- package/Bluetooth/types.js +0 -3
- package/Bluetooth/types.js.map +0 -1
- package/BottomNavigation/index.d.ts +0 -11
- package/BottomNavigation/index.d.ts.map +0 -1
- package/BottomNavigation/index.js.map +0 -1
- package/BottomNavigation/types.d.ts +0 -9
- package/BottomNavigation/types.d.ts.map +0 -1
- package/BottomNavigation/types.js +0 -3
- package/BottomNavigation/types.js.map +0 -1
- package/Clipboard/index.d.ts +0 -12
- package/Clipboard/index.d.ts.map +0 -1
- package/Clipboard/index.js.map +0 -1
- package/Clipboard/types.d.ts +0 -20
- package/Clipboard/types.d.ts.map +0 -1
- package/Clipboard/types.js +0 -4
- package/Clipboard/types.js.map +0 -1
- package/Facebook/events.d.ts +0 -13
- package/Facebook/events.d.ts.map +0 -1
- package/Facebook/events.js.map +0 -1
- package/Facebook/index.d.ts +0 -3
- package/Facebook/index.d.ts.map +0 -1
- package/Facebook/index.js.map +0 -1
- package/Facebook/types.d.ts +0 -22
- package/Facebook/types.d.ts.map +0 -1
- package/Facebook/types.js +0 -3
- package/Facebook/types.js.map +0 -1
- package/Firebase/Analytics/index.d.ts +0 -32
- package/Firebase/Analytics/index.d.ts.map +0 -1
- package/Firebase/Analytics/index.js.map +0 -1
- package/Firebase/Messaging/index.d.ts +0 -17
- package/Firebase/Messaging/index.d.ts.map +0 -1
- package/Firebase/Messaging/index.js.map +0 -1
- package/Firebase/index.d.ts +0 -4
- package/Firebase/index.d.ts.map +0 -1
- package/Firebase/index.js.map +0 -1
- package/Firebase/types.d.ts +0 -58
- package/Firebase/types.d.ts.map +0 -1
- package/Firebase/types.js +0 -4
- package/Firebase/types.js.map +0 -1
- package/FirebaseAnalytics/index.d.ts +0 -3
- package/FirebaseAnalytics/index.d.ts.map +0 -1
- package/FirebaseAnalytics/index.js.map +0 -1
- package/Haptics/index.d.ts +0 -7
- package/Haptics/index.d.ts.map +0 -1
- package/Haptics/index.js.map +0 -1
- package/Haptics/types.d.ts +0 -8
- package/Haptics/types.d.ts.map +0 -1
- package/Haptics/types.js +0 -3
- package/Haptics/types.js.map +0 -1
- package/InAppPurchase/index.d.ts +0 -23
- package/InAppPurchase/index.d.ts.map +0 -1
- package/InAppPurchase/index.js.map +0 -1
- package/InAppPurchase/types.d.ts +0 -34
- package/InAppPurchase/types.d.ts.map +0 -1
- package/InAppPurchase/types.js +0 -3
- package/InAppPurchase/types.js.map +0 -1
- package/InAppUpdate/index.d.ts +0 -12
- package/InAppUpdate/index.d.ts.map +0 -1
- package/InAppUpdate/index.js.map +0 -1
- package/InAppUpdate/types.d.ts +0 -15
- package/InAppUpdate/types.d.ts.map +0 -1
- package/InAppUpdate/types.js +0 -3
- package/InAppUpdate/types.js.map +0 -1
- package/MediaPlayer/index.d.ts +0 -17
- package/MediaPlayer/index.d.ts.map +0 -1
- package/MediaPlayer/index.js.map +0 -1
- package/MediaPlayer/types.d.ts +0 -14
- package/MediaPlayer/types.d.ts.map +0 -1
- package/MediaPlayer/types.js +0 -3
- package/MediaPlayer/types.js.map +0 -1
- package/NativeContacts/index.d.ts +0 -12
- package/NativeContacts/index.d.ts.map +0 -1
- package/NativeContacts/index.js.map +0 -1
- package/NativeContacts/types.d.ts +0 -14
- package/NativeContacts/types.d.ts.map +0 -1
- package/NativeContacts/types.js +0 -3
- package/NativeContacts/types.js.map +0 -1
- package/Notification/index.d.ts +0 -11
- package/Notification/index.d.ts.map +0 -1
- package/Notification/index.js.map +0 -1
- package/Notification/types.d.ts +0 -14
- package/Notification/types.d.ts.map +0 -1
- package/Notification/types.js +0 -3
- package/Notification/types.js.map +0 -1
- package/OneSignal/index.d.ts +0 -18
- package/OneSignal/index.d.ts.map +0 -1
- package/OneSignal/index.js.map +0 -1
- package/OneSignal/types.d.ts +0 -41
- package/OneSignal/types.d.ts.map +0 -1
- package/OneSignal/types.js +0 -4
- package/OneSignal/types.js.map +0 -1
- package/Printing/index.d.ts +0 -7
- package/Printing/index.d.ts.map +0 -1
- package/Printing/index.js.map +0 -1
- package/Printing/types.d.ts +0 -9
- package/Printing/types.d.ts.map +0 -1
- package/Printing/types.js +0 -3
- package/Printing/types.js.map +0 -1
- package/Screen/index.d.ts +0 -9
- package/Screen/index.d.ts.map +0 -1
- package/Screen/index.js.map +0 -1
- package/Screen/types.d.ts +0 -6
- package/Screen/types.d.ts.map +0 -1
- package/Screen/types.js +0 -4
- package/Screen/types.js.map +0 -1
- package/Siri/index.d.ts +0 -7
- package/Siri/index.d.ts.map +0 -1
- package/Siri/index.js.map +0 -1
- package/Siri/types.d.ts +0 -14
- package/Siri/types.d.ts.map +0 -1
- package/Siri/types.js +0 -3
- package/Siri/types.js.map +0 -1
- package/SocialLogin/apple.d.ts +0 -12
- package/SocialLogin/apple.d.ts.map +0 -1
- package/SocialLogin/apple.js.map +0 -1
- package/SocialLogin/facebook.d.ts +0 -22
- package/SocialLogin/facebook.d.ts.map +0 -1
- package/SocialLogin/facebook.js.map +0 -1
- package/SocialLogin/google.d.ts +0 -22
- package/SocialLogin/google.d.ts.map +0 -1
- package/SocialLogin/google.js.map +0 -1
- package/SocialLogin/index.d.ts +0 -17
- package/SocialLogin/index.d.ts.map +0 -1
- package/SocialLogin/index.js.map +0 -1
- package/SocialLogin/types.d.ts +0 -39
- package/SocialLogin/types.d.ts.map +0 -1
- package/SocialLogin/types.js +0 -3
- package/SocialLogin/types.js.map +0 -1
- package/Stripe/index.d.ts +0 -3
- package/Stripe/index.d.ts.map +0 -1
- package/Stripe/index.js.map +0 -1
- package/Stripe/types.d.ts +0 -32
- package/Stripe/types.d.ts.map +0 -1
- package/Stripe/types.js +0 -3
- package/Stripe/types.js.map +0 -1
- package/VoiceSearch/index.d.ts +0 -13
- package/VoiceSearch/index.d.ts.map +0 -1
- package/VoiceSearch/index.js.map +0 -1
- package/VoiceSearch/types.d.ts +0 -10
- package/VoiceSearch/types.d.ts.map +0 -1
- package/VoiceSearch/types.js +0 -3
- package/VoiceSearch/types.js.map +0 -1
- package/barcode/barcode-scan.d.ts +0 -16
- package/barcode/barcode-scan.d.ts.map +0 -1
- package/barcode/barcode-scan.js.map +0 -1
- package/barcode/barcode-types.d.ts +0 -18
- package/barcode/barcode-types.d.ts.map +0 -1
- package/barcode/barcode-types.js +0 -3
- package/barcode/barcode-types.js.map +0 -1
- package/barcode/formats.d.ts +0 -18
- package/barcode/formats.d.ts.map +0 -1
- package/barcode/formats.js.map +0 -1
- package/barcode/index.d.ts +0 -5
- package/barcode/index.d.ts.map +0 -1
- package/barcode/index.js.map +0 -1
- package/barcode/types.d.ts +0 -17
- package/barcode/types.d.ts.map +0 -1
- package/barcode/types.js.map +0 -1
- package/index.d.ts +0 -156
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/types/index.d.ts +0 -50
- package/types/index.d.ts.map +0 -1
- package/types/index.js +0 -4
- package/types/index.js.map +0 -1
- package/utills.d.ts +0 -12
- package/utills.d.ts.map +0 -1
- package/utills.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,537 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNativeApp = exports.platform = exports.registerNotification = exports.showNativeComponents = exports.hideNativeComponents = exports.setOrientation = exports.checkPermission = exports.getAddOnStatus = exports.getSafeArea = exports.customBackHandling = exports.disableScreenshot = exports.updateAppIcon = exports.showPermission = exports.openAppSettingForPermission = exports.forceUpdateCookies = exports.appFirstLoad = exports.addToSiri = exports.loadOfferCard = exports.nfcSupported = exports.printFunction = exports.showDateTimePicker = exports.closeApp = exports.shareFile = exports.clearAppCache = exports.enablePullToRefresh = exports.openUrlInBrowser = exports.shareLink = exports.isDeviceGPSEnabled = exports.showInAppReview = exports.deviceInfo = exports.customFileDownload = exports.downloadBlobFile = exports.downloadFile = exports.statusBar = exports.hideSplashScreen = exports.isAndroidORIosApp = exports.isIosApp = exports.isAndroidApp = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Repository for webtonative javascript sdk. Build your android/ios app from https://webtonative.com.
|
|
6
|
-
* This is in beta phase.
|
|
7
|
-
* @example npm install webtonative
|
|
8
|
-
* import webtonative from "webtonative";
|
|
9
|
-
* const wtn = webtonative();
|
|
10
|
-
*/
|
|
11
|
-
var utills_1 = require("./utills");
|
|
12
|
-
Object.defineProperty(exports, "isNativeApp", { enumerable: true, get: function () { return utills_1.isNativeApp; } });
|
|
13
|
-
Object.defineProperty(exports, "platform", { enumerable: true, get: function () { return utills_1.platform; } });
|
|
14
|
-
exports.isAndroidApp = utills_1.platform === "ANDROID_APP";
|
|
15
|
-
exports.isIosApp = utills_1.platform === "IOS_APP";
|
|
16
|
-
exports.isAndroidORIosApp = ["ANDROID_APP", "IOS_APP"].includes(utills_1.platform);
|
|
17
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIosApp=exports.isDeviceGPSEnabled=exports.isAndroidORIosApp=exports.isAndroidApp=exports.hideSplashScreen=exports.hideNativeComponents=exports.getSafeArea=exports.getAddOnStatus=exports.forceUpdateCookies=exports.enablePullToRefresh=exports.downloadFile=exports.downloadBlobFile=exports.disableScreenshot=exports.deviceInfo=exports["default"]=exports.customFileDownload=exports.customBackHandling=exports.closeApp=exports.clearAppCache=exports.checkPermission=exports.appFirstLoad=exports.addToSiri=void 0,Object.defineProperty(exports,"isNativeApp",{enumerable:!0,get:function get(){return _utills.isNativeApp}}),exports.openUrlInBrowser=exports.openAppSettingForPermission=exports.nfcSupported=exports.loadOfferCard=void 0,Object.defineProperty(exports,"platform",{enumerable:!0,get:function get(){return _utills.platform}}),exports.updateAppIcon=exports.statusBar=exports.showPermission=exports.showNativeComponents=exports.showInAppReview=exports.showDateTimePicker=exports.shareLink=exports.shareFile=exports.setOrientation=exports.registerNotification=exports.printFunction=void 0;var _utills=require("./utills"),isAndroidApp="ANDROID_APP"===_utills.platform;exports.isAndroidApp=isAndroidApp;var isIosApp="IOS_APP"===_utills.platform;exports.isIosApp=isIosApp;var isAndroidORIosApp=["ANDROID_APP","IOS_APP"].includes(_utills.platform);/**
|
|
18
2
|
* This function hides splash screen
|
|
19
3
|
* @example wtn.hideSplashScreen()
|
|
20
|
-
*/
|
|
21
|
-
var hideSplashScreen = function () {
|
|
22
|
-
utills_1.isNativeApp && utills_1.webToNative.hideSplashScreen && utills_1.webToNative.hideSplashScreen();
|
|
23
|
-
};
|
|
24
|
-
exports.hideSplashScreen = hideSplashScreen;
|
|
25
|
-
var statusBar = function (options) {
|
|
26
|
-
if (utills_1.isNativeApp) {
|
|
27
|
-
if (exports.isAndroidApp) {
|
|
28
|
-
utills_1.webToNative.statusBar && utills_1.webToNative.statusBar(JSON.stringify(options));
|
|
29
|
-
}
|
|
30
|
-
else if (exports.isIosApp) {
|
|
31
|
-
utills_1.webToNativeIos &&
|
|
32
|
-
utills_1.webToNativeIos.postMessage({
|
|
33
|
-
action: "statusBar",
|
|
34
|
-
color: options.color,
|
|
35
|
-
style: options.style,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.statusBar = statusBar;
|
|
41
|
-
var downloadFile = function (downloadUrl) {
|
|
42
|
-
if (utills_1.isNativeApp) {
|
|
43
|
-
if (exports.isAndroidApp) {
|
|
44
|
-
// Android implementation
|
|
45
|
-
}
|
|
46
|
-
else if (exports.isIosApp) {
|
|
47
|
-
utills_1.webToNativeIos &&
|
|
48
|
-
utills_1.webToNativeIos.postMessage({
|
|
49
|
-
action: "downloadFile",
|
|
50
|
-
downloadUrl: downloadUrl,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.downloadFile = downloadFile;
|
|
56
|
-
var downloadBlobFile = function (_a) {
|
|
57
|
-
var fileName = _a.fileName, downloadUrl = _a.downloadUrl;
|
|
58
|
-
if (["IOS_APP"].includes(utills_1.platform)) {
|
|
59
|
-
exports.isIosApp &&
|
|
60
|
-
utills_1.webToNativeIos &&
|
|
61
|
-
utills_1.webToNativeIos.postMessage({
|
|
62
|
-
action: "downloadBlobFile",
|
|
63
|
-
fileName: fileName,
|
|
64
|
-
url: downloadUrl,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
exports.downloadBlobFile = downloadBlobFile;
|
|
69
|
-
var customFileDownload = function (_a) {
|
|
70
|
-
var downloadUrl = _a.downloadUrl, fileName = _a.fileName, isBlob = _a.isBlob, mimeType = _a.mimeType, cookies = _a.cookies, userAgent = _a.userAgent, openFileAfterDownload = _a.openFileAfterDownload;
|
|
71
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
72
|
-
utills_1.platform === "ANDROID_APP" &&
|
|
73
|
-
utills_1.webToNative.downloadFile &&
|
|
74
|
-
utills_1.webToNative.downloadFile(JSON.stringify({
|
|
75
|
-
url: downloadUrl,
|
|
76
|
-
fileName: fileName,
|
|
77
|
-
isBlob: isBlob,
|
|
78
|
-
mimeType: mimeType,
|
|
79
|
-
cookies: cookies,
|
|
80
|
-
userAgent: userAgent,
|
|
81
|
-
openFileAfterDownload: openFileAfterDownload,
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
exports.customFileDownload = customFileDownload;
|
|
86
|
-
var deviceInfo = function () {
|
|
87
|
-
return new Promise(function (resolve, reject) {
|
|
88
|
-
(0, utills_1.registerCb)(function (results) {
|
|
89
|
-
if (results) {
|
|
90
|
-
resolve(results);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
reject({
|
|
94
|
-
err: "Error getting device info",
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "deviceInfo",
|
|
99
|
-
});
|
|
100
|
-
if (utills_1.platform === "ANDROID_APP") {
|
|
101
|
-
utills_1.webToNative.getDeviceInfo && utills_1.webToNative.getDeviceInfo();
|
|
102
|
-
}
|
|
103
|
-
else if (utills_1.platform === "IOS_APP") {
|
|
104
|
-
utills_1.webToNativeIos &&
|
|
105
|
-
utills_1.webToNativeIos.postMessage({
|
|
106
|
-
action: "deviceInfo",
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
reject("This function will work in Native App Powered By WebToNative");
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
exports.deviceInfo = deviceInfo;
|
|
115
|
-
var showInAppReview = function () {
|
|
116
|
-
utills_1.isNativeApp && utills_1.webToNative.showInAppReview && utills_1.webToNative.showInAppReview();
|
|
117
|
-
};
|
|
118
|
-
exports.showInAppReview = showInAppReview;
|
|
119
|
-
var isDeviceGPSEnabled = function (options) {
|
|
120
|
-
if (options === void 0) { options = {}; }
|
|
121
|
-
var callback = options.callback;
|
|
122
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
123
|
-
(0, utills_1.registerCb)(function (response) {
|
|
124
|
-
var type = response.type;
|
|
125
|
-
if (type === "isDeviceGPSEnabled") {
|
|
126
|
-
callback && callback(response);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
utills_1.platform === "ANDROID_APP" &&
|
|
130
|
-
utills_1.webToNative.isLocationServiceEnabled &&
|
|
131
|
-
utills_1.webToNative.isLocationServiceEnabled();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
exports.isDeviceGPSEnabled = isDeviceGPSEnabled;
|
|
135
|
-
var shareLink = function (_a) {
|
|
136
|
-
var _b = _a.url, url = _b === void 0 ? "" : _b;
|
|
137
|
-
if (url) {
|
|
138
|
-
exports.isAndroidApp && utills_1.webToNative.openShareIntent && utills_1.webToNative.openShareIntent(url);
|
|
139
|
-
exports.isIosApp &&
|
|
140
|
-
utills_1.webToNativeIos &&
|
|
141
|
-
utills_1.webToNativeIos.postMessage({
|
|
142
|
-
action: "share",
|
|
143
|
-
url: url,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
throw "url is mandatory";
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
exports.shareLink = shareLink;
|
|
151
|
-
var openUrlInBrowser = function (url) {
|
|
152
|
-
if (url === void 0) { url = ""; }
|
|
153
|
-
if (url) {
|
|
154
|
-
exports.isAndroidApp && utills_1.webToNative.openUrlInBrowser && utills_1.webToNative.openUrlInBrowser(url);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
throw "url is mandatory";
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
exports.openUrlInBrowser = openUrlInBrowser;
|
|
161
|
-
var enablePullToRefresh = function (status) {
|
|
162
|
-
exports.isAndroidApp && utills_1.webToNative.enableSwipeRefresh && utills_1.webToNative.enableSwipeRefresh(status);
|
|
163
|
-
};
|
|
164
|
-
exports.enablePullToRefresh = enablePullToRefresh;
|
|
165
|
-
var clearAppCache = function (reload) {
|
|
166
|
-
exports.isAndroidApp &&
|
|
167
|
-
utills_1.webToNative.clearWebViewCache &&
|
|
168
|
-
utills_1.webToNative.clearWebViewCache(JSON.stringify({ reload: reload }));
|
|
169
|
-
};
|
|
170
|
-
exports.clearAppCache = clearAppCache;
|
|
171
|
-
var shareFile = function (fileUrl, fileExtension, text) {
|
|
172
|
-
if (fileUrl === void 0) { fileUrl = null; }
|
|
173
|
-
if (fileExtension === void 0) { fileExtension = null; }
|
|
174
|
-
if (text === void 0) { text = null; }
|
|
175
|
-
exports.isAndroidApp && utills_1.webToNative.shareFile && utills_1.webToNative.shareFile(fileUrl, fileExtension, text);
|
|
176
|
-
};
|
|
177
|
-
exports.shareFile = shareFile;
|
|
178
|
-
var closeApp = function () {
|
|
179
|
-
exports.isAndroidApp && utills_1.webToNative.closeApp && utills_1.webToNative.closeApp();
|
|
180
|
-
exports.isIosApp &&
|
|
181
|
-
utills_1.webToNativeIos &&
|
|
182
|
-
utills_1.webToNativeIos.postMessage({
|
|
183
|
-
action: "closeApp",
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
exports.closeApp = closeApp;
|
|
187
|
-
var showDateTimePicker = function (options) {
|
|
188
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
189
|
-
var callback_1 = options.callback, showDate = options.showDate, showTime = options.showTime;
|
|
190
|
-
(0, utills_1.registerCb)(function (response) {
|
|
191
|
-
var type = response.type;
|
|
192
|
-
if (type === "DATE_TIME_PICKER") {
|
|
193
|
-
callback_1 && callback_1(response);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
exports.isAndroidApp &&
|
|
197
|
-
utills_1.webToNative.pickDateTime &&
|
|
198
|
-
utills_1.webToNative.pickDateTime(JSON.stringify({
|
|
199
|
-
showDate: showDate,
|
|
200
|
-
showTime: showTime,
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
exports.showDateTimePicker = showDateTimePicker;
|
|
205
|
-
var printFunction = function (options) {
|
|
206
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
207
|
-
var _a = options.type, type = _a === void 0 ? "url" : _a, _b = options.url, url = _b === void 0 ? "" : _b;
|
|
208
|
-
exports.isAndroidApp &&
|
|
209
|
-
utills_1.webToNative.print &&
|
|
210
|
-
utills_1.webToNative.print(JSON.stringify({
|
|
211
|
-
type: type,
|
|
212
|
-
url: url,
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
exports.printFunction = printFunction;
|
|
217
|
-
var nfcSupported = function (options) {
|
|
218
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
219
|
-
var callback_2 = options.callback;
|
|
220
|
-
(0, utills_1.registerCb)(function (response) {
|
|
221
|
-
var type = response.type;
|
|
222
|
-
if (type === "nfcSupported") {
|
|
223
|
-
callback_2 && callback_2(response);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
exports.isAndroidApp && utills_1.webToNative.nfcSupported && utills_1.webToNative.nfcSupported();
|
|
227
|
-
exports.isIosApp &&
|
|
228
|
-
utills_1.webToNativeIos &&
|
|
229
|
-
utills_1.webToNativeIos.postMessage({
|
|
230
|
-
action: "nfcSupported",
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
exports.nfcSupported = nfcSupported;
|
|
235
|
-
var loadOfferCard = function (options) {
|
|
236
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
237
|
-
exports.isAndroidApp && utills_1.webToNative.showOfferCard && utills_1.webToNative.showOfferCard(JSON.stringify(options));
|
|
238
|
-
if (options.data) {
|
|
239
|
-
options.data = JSON.stringify(options.data);
|
|
240
|
-
}
|
|
241
|
-
exports.isIosApp && utills_1.webToNativeIos && utills_1.webToNativeIos.postMessage(options);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
exports.loadOfferCard = loadOfferCard;
|
|
245
|
-
var addToSiri = function (options) {
|
|
246
|
-
if (["IOS_APP"].includes(utills_1.platform)) {
|
|
247
|
-
if (options.data)
|
|
248
|
-
options.data = JSON.stringify(options.data);
|
|
249
|
-
exports.isIosApp && utills_1.webToNativeIos && utills_1.webToNativeIos.postMessage(options);
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
exports.addToSiri = addToSiri;
|
|
253
|
-
var appFirstLoad = function () {
|
|
254
|
-
return new Promise(function (resolve, reject) {
|
|
255
|
-
(0, utills_1.registerCb)(function (results) {
|
|
256
|
-
var type = results.type;
|
|
257
|
-
if (type === "firstCallWhenAppStarted") {
|
|
258
|
-
if (results) {
|
|
259
|
-
resolve(results);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
reject({
|
|
263
|
-
err: "Error getting request",
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}, {
|
|
268
|
-
key: "firstCallWhenAppStarted",
|
|
269
|
-
});
|
|
270
|
-
if (utills_1.platform === "ANDROID_APP") {
|
|
271
|
-
utills_1.webToNative.firstCallWhenAppStarted && utills_1.webToNative.firstCallWhenAppStarted();
|
|
272
|
-
}
|
|
273
|
-
else if (utills_1.platform === "IOS_APP") {
|
|
274
|
-
utills_1.webToNativeIos &&
|
|
275
|
-
utills_1.webToNativeIos.postMessage({
|
|
276
|
-
action: "firstCallWhenAppStarted",
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
reject("This function will work in Native App Powered By WebToNative");
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
exports.appFirstLoad = appFirstLoad;
|
|
285
|
-
var forceUpdateCookies = function () {
|
|
286
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
287
|
-
exports.isAndroidApp && utills_1.webToNative.forceUpdateCookies && utills_1.webToNative.forceUpdateCookies();
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
exports.forceUpdateCookies = forceUpdateCookies;
|
|
291
|
-
var openAppSettingForPermission = function (options) {
|
|
292
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
293
|
-
var callback_3 = options.callback, values = options.values;
|
|
294
|
-
(0, utills_1.registerCb)(function (response) {
|
|
295
|
-
var type = response.type, typeValue = response.typeValue;
|
|
296
|
-
if (type === "openAppSettingForPermission") {
|
|
297
|
-
callback_3 && callback_3(response);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
exports.isAndroidApp &&
|
|
301
|
-
utills_1.webToNative.openAppSettingForPermission &&
|
|
302
|
-
utills_1.webToNative.openAppSettingForPermission(values);
|
|
303
|
-
exports.isIosApp &&
|
|
304
|
-
utills_1.webToNativeIos &&
|
|
305
|
-
utills_1.webToNativeIos.postMessage({
|
|
306
|
-
action: "openAppSettingForPermission",
|
|
307
|
-
values: values,
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
exports.openAppSettingForPermission = openAppSettingForPermission;
|
|
312
|
-
var showPermission = function (options) {
|
|
313
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
314
|
-
var callback_4 = options.callback, permission = options.permission, _a = options.openAppSetting, openAppSetting = _a === void 0 ? false : _a, alertDialogStyle = options.alertDialogStyle;
|
|
315
|
-
(0, utills_1.registerCb)(function (response) {
|
|
316
|
-
var type = response.type, typeValue = response.typeValue;
|
|
317
|
-
if (type === "showPermission" || typeValue === "showPermission") {
|
|
318
|
-
callback_4 && callback_4(response);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
exports.isAndroidApp &&
|
|
322
|
-
utills_1.webToNative.showPermission &&
|
|
323
|
-
utills_1.webToNative.showPermission(JSON.stringify({
|
|
324
|
-
permission: permission,
|
|
325
|
-
openAppSetting: openAppSetting,
|
|
326
|
-
alertDialogStyle: alertDialogStyle,
|
|
327
|
-
}));
|
|
328
|
-
exports.isIosApp &&
|
|
329
|
-
utills_1.webToNativeIos &&
|
|
330
|
-
utills_1.webToNativeIos.postMessage({
|
|
331
|
-
action: "showPermission",
|
|
332
|
-
permission: permission,
|
|
333
|
-
openAppSetting: openAppSetting,
|
|
334
|
-
alertDialogStyle: alertDialogStyle,
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
exports.showPermission = showPermission;
|
|
339
|
-
var updateAppIcon = function (options) {
|
|
340
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
341
|
-
var _a = options.active, active = _a === void 0 ? false : _a, _b = options.iconName, iconName = _b === void 0 ? null : _b;
|
|
342
|
-
exports.isAndroidApp &&
|
|
343
|
-
utills_1.webToNative.updateAppIcon &&
|
|
344
|
-
utills_1.webToNative.updateAppIcon(JSON.stringify({
|
|
345
|
-
active: active,
|
|
346
|
-
iconName: iconName,
|
|
347
|
-
}));
|
|
348
|
-
exports.isIosApp &&
|
|
349
|
-
utills_1.webToNativeIos &&
|
|
350
|
-
utills_1.webToNativeIos.postMessage({
|
|
351
|
-
action: "updateAppIcon",
|
|
352
|
-
iconName: iconName,
|
|
353
|
-
active: active,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
exports.updateAppIcon = updateAppIcon;
|
|
358
|
-
var disableScreenshot = function (options) {
|
|
359
|
-
if (["IOS_APP"].includes(utills_1.platform)) {
|
|
360
|
-
var _a = options.ssKey, ssKey = _a === void 0 ? false : _a;
|
|
361
|
-
exports.isIosApp &&
|
|
362
|
-
utills_1.webToNativeIos &&
|
|
363
|
-
utills_1.webToNativeIos.postMessage({
|
|
364
|
-
action: "disableScreenshotForPage",
|
|
365
|
-
ssKey: ssKey,
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
exports.disableScreenshot = disableScreenshot;
|
|
370
|
-
var customBackHandling = function (options) {
|
|
371
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
372
|
-
var _a = options.enable, enable = _a === void 0 ? false : _a;
|
|
373
|
-
exports.isAndroidApp &&
|
|
374
|
-
utills_1.webToNative.customBackHandling &&
|
|
375
|
-
utills_1.webToNative.customBackHandling(JSON.stringify({ enable: enable }));
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
exports.customBackHandling = customBackHandling;
|
|
379
|
-
var getSafeArea = function (options) {
|
|
380
|
-
if (["IOS_APP"].includes(utills_1.platform)) {
|
|
381
|
-
var callback_5 = options.callback;
|
|
382
|
-
(0, utills_1.registerCb)(function (response) {
|
|
383
|
-
var type = response.type;
|
|
384
|
-
if (type === "getSafeArea") {
|
|
385
|
-
callback_5 && callback_5(response);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
exports.isIosApp &&
|
|
389
|
-
utills_1.webToNativeIos &&
|
|
390
|
-
utills_1.webToNativeIos.postMessage({
|
|
391
|
-
action: "getSafeArea",
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
exports.getSafeArea = getSafeArea;
|
|
396
|
-
var getAddOnStatus = function (options) {
|
|
397
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
398
|
-
var callback_6 = options.callback, addOnName = options.addOnName;
|
|
399
|
-
(0, utills_1.registerCb)(function (response) {
|
|
400
|
-
var type = response.type;
|
|
401
|
-
if (type === "getAddOnStatus") {
|
|
402
|
-
callback_6 && callback_6(response);
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
exports.isAndroidApp &&
|
|
406
|
-
utills_1.webToNative.getAddOnStatus &&
|
|
407
|
-
utills_1.webToNative.getAddOnStatus(JSON.stringify({
|
|
408
|
-
addOnName: addOnName,
|
|
409
|
-
}));
|
|
410
|
-
exports.isIosApp &&
|
|
411
|
-
utills_1.webToNativeIos &&
|
|
412
|
-
utills_1.webToNativeIos.postMessage({
|
|
413
|
-
action: "getAddOnStatus",
|
|
414
|
-
addOnName: addOnName,
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
exports.getAddOnStatus = getAddOnStatus;
|
|
419
|
-
var checkPermission = function (options) {
|
|
420
|
-
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
421
|
-
var callback_7 = options.callback, permissionName = options.permissionName;
|
|
422
|
-
(0, utills_1.registerCb)(function (response) {
|
|
423
|
-
var type = response.type;
|
|
424
|
-
if (type === "checkPermission") {
|
|
425
|
-
callback_7 && callback_7(response);
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
exports.isAndroidApp &&
|
|
429
|
-
utills_1.webToNative.checkPermission &&
|
|
430
|
-
utills_1.webToNative.checkPermission(JSON.stringify(permissionName));
|
|
431
|
-
exports.isIosApp &&
|
|
432
|
-
utills_1.webToNativeIos &&
|
|
433
|
-
utills_1.webToNativeIos.postMessage({
|
|
434
|
-
action: "checkPermission",
|
|
435
|
-
permissionName: permissionName,
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
exports.checkPermission = checkPermission;
|
|
440
|
-
var setOrientation = function (options) {
|
|
441
|
-
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
442
|
-
var orientation_1 = options.orientation, _a = options.forceOrientation, forceOrientation = _a === void 0 ? false : _a;
|
|
443
|
-
exports.isAndroidApp &&
|
|
444
|
-
utills_1.webToNative.setOrientation &&
|
|
445
|
-
utills_1.webToNative.setOrientation(JSON.stringify({
|
|
446
|
-
orientation: orientation_1,
|
|
447
|
-
forceOrientation: forceOrientation,
|
|
448
|
-
}));
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
exports.setOrientation = setOrientation;
|
|
452
|
-
var hideNativeComponents = function (options) {
|
|
453
|
-
if (exports.isAndroidORIosApp) {
|
|
454
|
-
var components = (options || {}).components;
|
|
455
|
-
exports.isAndroidApp &&
|
|
456
|
-
utills_1.webToNative.hideNativeComponents &&
|
|
457
|
-
utills_1.webToNative.hideNativeComponents(JSON.stringify(options));
|
|
458
|
-
exports.isIosApp &&
|
|
459
|
-
utills_1.webToNativeIos &&
|
|
460
|
-
utills_1.webToNativeIos.postMessage({
|
|
461
|
-
action: "hideNativeComponents",
|
|
462
|
-
components: components,
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
exports.hideNativeComponents = hideNativeComponents;
|
|
467
|
-
var showNativeComponents = function (options) {
|
|
468
|
-
if (exports.isAndroidORIosApp) {
|
|
469
|
-
var components = (options || {}).components;
|
|
470
|
-
exports.isAndroidApp &&
|
|
471
|
-
utills_1.webToNative.showNativeComponents &&
|
|
472
|
-
utills_1.webToNative.showNativeComponents(JSON.stringify(options));
|
|
473
|
-
exports.isIosApp &&
|
|
474
|
-
utills_1.webToNativeIos &&
|
|
475
|
-
utills_1.webToNativeIos.postMessage({
|
|
476
|
-
action: "showNativeComponents",
|
|
477
|
-
components: components,
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
exports.showNativeComponents = showNativeComponents;
|
|
482
|
-
var registerNotification = function (options) {
|
|
483
|
-
if (exports.isAndroidORIosApp) {
|
|
484
|
-
var callback_8 = (options || {}).callback;
|
|
485
|
-
(0, utills_1.registerCb)(function (response) {
|
|
486
|
-
var type = response.type;
|
|
487
|
-
if (type === "registerNotification") {
|
|
488
|
-
callback_8 && callback_8(response);
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
exports.isAndroidApp && utills_1.webToNative.registerNotification && utills_1.webToNative.registerNotification();
|
|
492
|
-
exports.isIosApp &&
|
|
493
|
-
utills_1.webToNativeIos &&
|
|
494
|
-
utills_1.webToNativeIos.postMessage({
|
|
495
|
-
action: "registerNotification",
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
exports.registerNotification = registerNotification;
|
|
500
|
-
exports.default = {
|
|
501
|
-
isAndroidApp: exports.isAndroidApp,
|
|
502
|
-
isIosApp: exports.isIosApp,
|
|
503
|
-
hideSplashScreen: exports.hideSplashScreen,
|
|
504
|
-
statusBar: exports.statusBar,
|
|
505
|
-
deviceInfo: exports.deviceInfo,
|
|
506
|
-
showInAppReview: exports.showInAppReview,
|
|
507
|
-
shareLink: exports.shareLink,
|
|
508
|
-
platform: utills_1.platform,
|
|
509
|
-
isNativeApp: utills_1.isNativeApp,
|
|
510
|
-
isDeviceGPSEnabled: exports.isDeviceGPSEnabled,
|
|
511
|
-
openUrlInBrowser: exports.openUrlInBrowser,
|
|
512
|
-
enablePullToRefresh: exports.enablePullToRefresh,
|
|
513
|
-
shareFile: exports.shareFile,
|
|
514
|
-
clearAppCache: exports.clearAppCache,
|
|
515
|
-
closeApp: exports.closeApp,
|
|
516
|
-
showDateTimePicker: exports.showDateTimePicker,
|
|
517
|
-
downloadBlobFile: exports.downloadBlobFile,
|
|
518
|
-
customFileDownload: exports.customFileDownload,
|
|
519
|
-
printFunction: exports.printFunction,
|
|
520
|
-
loadOfferCard: exports.loadOfferCard,
|
|
521
|
-
appFirstLoad: exports.appFirstLoad,
|
|
522
|
-
addToSiri: exports.addToSiri,
|
|
523
|
-
showPermission: exports.showPermission,
|
|
524
|
-
forceUpdateCookies: exports.forceUpdateCookies,
|
|
525
|
-
updateAppIcon: exports.updateAppIcon,
|
|
526
|
-
disableScreenshot: exports.disableScreenshot,
|
|
527
|
-
getSafeArea: exports.getSafeArea,
|
|
528
|
-
getAddOnStatus: exports.getAddOnStatus,
|
|
529
|
-
setOrientation: exports.setOrientation,
|
|
530
|
-
checkPermission: exports.checkPermission,
|
|
531
|
-
openAppSettingForPermission: exports.openAppSettingForPermission,
|
|
532
|
-
customBackHandling: exports.customBackHandling,
|
|
533
|
-
hideNativeComponents: exports.hideNativeComponents,
|
|
534
|
-
showNativeComponents: exports.showNativeComponents,
|
|
535
|
-
registerNotification: exports.registerNotification,
|
|
536
|
-
};
|
|
537
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
*/exports.isAndroidORIosApp=isAndroidORIosApp;var hideSplashScreen=function(){_utills.isNativeApp&&_utills.webToNative.hideSplashScreen()};exports.hideSplashScreen=hideSplashScreen;var statusBar=function(a){_utills.isNativeApp&&(isAndroidApp?_utills.webToNative.statusBar(JSON.stringify(a)):isIosApp&&_utills.webToNativeIos.postMessage({action:"statusBar",color:a.color,style:a.style}))};exports.statusBar=statusBar;var downloadFile=function(a){_utills.isNativeApp&&(isAndroidApp||isIosApp&&_utills.webToNativeIos.postMessage({action:"downloadFile",downloadUrl:a}))};exports.downloadFile=downloadFile;var downloadBlobFile=function(a){var b=a.fileName,c=a.downloadUrl;["IOS_APP"].includes(_utills.platform)&&isIosApp&&_utills.webToNativeIos.postMessage({action:"downloadBlobFile",fileName:b,url:c})};exports.downloadBlobFile=downloadBlobFile;var customFileDownload=function(a){var b=a.downloadUrl,c=a.fileName,d=a.isBlob,e=a.mimeType,f=a.cookies,g=a.userAgent,h=a.openFileAfterDownload;["ANDROID_APP"].includes(_utills.platform)&&"ANDROID_APP"===_utills.platform&&_utills.webToNative.downloadFile(JSON.stringify({url:b,fileName:c,isBlob:d,mimeType:e,cookies:f,userAgent:g,openFileAfterDownload:h}))};exports.customFileDownload=customFileDownload;var deviceInfo=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){c?a(c):b({err:"Error getting device info"})},{key:"deviceInfo"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.getDeviceInfo():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"deviceInfo"}):b("This function will work in Native App Powered By WebToNative")})};exports.deviceInfo=deviceInfo;var showInAppReview=function(){_utills.isNativeApp&&_utills.webToNative.showInAppReview()};exports.showInAppReview=showInAppReview;var isDeviceGPSEnabled=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.callback;["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&((0,_utills.registerCb)(function(a){var c=a.type;"isDeviceGPSEnabled"===c&&b&&b(a)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.isLocationServiceEnabled())};exports.isDeviceGPSEnabled=isDeviceGPSEnabled;var shareLink=function(a){var b=a.url,c=void 0===b?"":b;if(c)isAndroidApp&&_utills.webToNative.openShareIntent(c),isIosApp&&_utills.webToNativeIos.postMessage({action:"share",url:c});else throw"url is mandatory"};exports.shareLink=shareLink;var openUrlInBrowser=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"";if(a)isAndroidApp&&_utills.webToNative.openUrlInBrowser(a);else throw"url is mandatory"};exports.openUrlInBrowser=openUrlInBrowser;var enablePullToRefresh=function(a){isAndroidApp&&_utills.webToNative.enableSwipeRefresh(a)};exports.enablePullToRefresh=enablePullToRefresh;var clearAppCache=function(a){isAndroidApp&&_utills.webToNative.clearWebViewCache(JSON.stringify({reload:a}))};exports.clearAppCache=clearAppCache;var shareFile=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;isAndroidApp&&_utills.webToNative.shareFile(a,b,c)};exports.shareFile=shareFile;var closeApp=function(){isAndroidApp&&_utills.webToNative.closeApp(),isIosApp&&_utills.webToNativeIos.postMessage({action:"closeApp"})};exports.closeApp=closeApp;var showDateTimePicker=function(a){if(["ANDROID_APP"].includes(_utills.platform)){var b=a.callback,c=a.showDate,d=a.showTime;(0,_utills.registerCb)(function(a){var c=a.type;"DATE_TIME_PICKER"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.pickDateTime(JSON.stringify({showDate:c,showTime:d}))}};exports.showDateTimePicker=showDateTimePicker;var printFunction=function(a){if(["ANDROID_APP"].includes(_utills.platform)){var b=a.type,c=void 0===b?"url":b,d=a.url,e=void 0===d?"":d;isAndroidApp&&_utills.webToNative.print(JSON.stringify({type:c,url:e}))}};exports.printFunction=printFunction;var nfcSupported=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback;(0,_utills.registerCb)(function(a){var c=a.type;"nfcSupported"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.nfcSupported(),isIosApp&&_utills.webToNativeIos.postMessage({action:"nfcSupported"})}};exports.nfcSupported=nfcSupported;var loadOfferCard=function(a){["ANDROID_APP","IOS_APP"].includes(_utills.platform)&&(isAndroidApp&&_utills.webToNative.showOfferCard(JSON.stringify(a)),a.data&&(a.data=JSON.stringify(a.data)),isIosApp&&_utills.webToNativeIos.postMessage(a))};exports.loadOfferCard=loadOfferCard;var addToSiri=function(a){["IOS_APP"].includes(_utills.platform)&&(a.data&&(a.data=JSON.stringify(a.data)),isIosApp&&_utills.webToNativeIos.postMessage(a))};exports.addToSiri=addToSiri;var appFirstLoad=function(){return new Promise(function(a,b){(0,_utills.registerCb)(function(c){var d=c.type;"firstCallWhenAppStarted"===d&&(c?a(c):b({err:"Error getting request"}))},{key:"firstCallWhenAppStarted"}),"ANDROID_APP"===_utills.platform?_utills.webToNative.firstCallWhenAppStarted():"IOS_APP"===_utills.platform?_utills.webToNativeIos.postMessage({action:"firstCallWhenAppStarted"}):b("This function will work in Native App Powered By WebToNative")})};exports.appFirstLoad=appFirstLoad;var forceUpdateCookies=function(){["ANDROID_APP"].includes(_utills.platform)&&isAndroidApp&&_utills.webToNative.forceUpdateCookies()};exports.forceUpdateCookies=forceUpdateCookies;var openAppSettingForPermission=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.values;(0,_utills.registerCb)(function(a){var c=a.type,d=a.typeValue;"openAppSettingForPermission"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.openAppSettingForPermission(c),isIosApp&&_utills.webToNativeIos.postMessage({action:"openAppSettingForPermission",values:c})}};exports.openAppSettingForPermission=openAppSettingForPermission;var showPermission=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.permission,d=a.openAppSetting,e=void 0!==d&&d,f=a.alertDialogStyle;(0,_utills.registerCb)(function(a){var c=a.type,d=a.typeValue;("showPermission"===c||"showPermission"===d)&&b&&b(a)}),isAndroidApp&&_utills.webToNative.showPermission(JSON.stringify({permission:c,openAppSetting:e,alertDialogStyle:f})),isIosApp&&_utills.webToNativeIos.postMessage({action:"showPermission",permission:c,openAppSetting:e,alertDialogStyle:f})}};exports.showPermission=showPermission;var updateAppIcon=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.active,c=void 0!==b&&b,d=a.iconName,e=void 0===d?null:d;isAndroidApp&&_utills.webToNative.updateAppIcon(JSON.stringify({active:c,iconName:e})),isIosApp&&_utills.webToNativeIos.postMessage({action:"updateAppIcon",iconName:e,active:c})}};exports.updateAppIcon=updateAppIcon;var disableScreenshot=function(a){if(["IOS_APP"].includes(_utills.platform)){var b=a.ssKey;isIosApp&&_utills.webToNativeIos.postMessage({action:"disableScreenshotForPage",ssKey:void 0!==b&&b})}};exports.disableScreenshot=disableScreenshot;var customBackHandling=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.enable,c=void 0!==b&&b;isAndroidApp&&_utills.webToNative.customBackHandling(JSON.stringify({enable:c})),isIosApp&&_utills.webToNativeIos.postMessage({action:"customBackHandling",enable:c})}};exports.customBackHandling=customBackHandling;var getSafeArea=function(a){if(["IOS_APP"].includes(_utills.platform)){var b=a.callback;(0,_utills.registerCb)(function(a){var c=a.type;"getSafeArea"===c&&b&&b(a)}),isIosApp&&_utills.webToNativeIos.postMessage({action:"getSafeArea"})}};exports.getSafeArea=getSafeArea;var getAddOnStatus=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.addOnName;(0,_utills.registerCb)(function(a){var c=a.type;"getAddOnStatus"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.getAddOnStatus(JSON.stringify({addOnName:c})),isIosApp&&_utills.webToNativeIos.postMessage({action:"getAddOnStatus",addOnName:c})}};exports.getAddOnStatus=getAddOnStatus;var checkPermission=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.permissionName;(0,_utills.registerCb)(function(a){var c=a.type;"checkPermission"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.checkPermission(JSON.stringify(c)),isIosApp&&_utills.webToNativeIos.postMessage({action:"checkPermission",permissionName:c})}};exports.checkPermission=checkPermission;var setOrientation=function(a){if(["ANDROID_APP"].includes(_utills.platform)){var b=a.orientation,c=a.forceOrientation;isAndroidApp&&_utills.webToNative.setOrientation(JSON.stringify({orientation:b,forceOrientation:void 0!==c&&c}))}};exports.setOrientation=setOrientation;var hideNativeComponents=function(a){if(isAndroidORIosApp){var b=(a||{}).components;isAndroidApp&&_utills.webToNative.hideNativeComponents(JSON.stringify(a)),isIosApp&&_utills.webToNativeIos.postMessage({action:"hideNativeComponents",components:b})}};exports.hideNativeComponents=hideNativeComponents;var showNativeComponents=function(a){if(isAndroidORIosApp){var b=(a||{}).components;isAndroidApp&&_utills.webToNative.checkPermission(JSON.stringify(a)),isIosApp&&_utills.webToNativeIos.postMessage({action:"showNativeComponents",components:b})}};exports.showNativeComponents=showNativeComponents;var registerNotification=function(a){if(isAndroidORIosApp){var b=(a||{}).callback;(0,_utills.registerCb)(function(a){var c=a.type;"registerNotification"===c&&b&&b(a)}),isAndroidApp&&_utills.webToNative.registerNotification(),isIosApp&&_utills.webToNativeIos.postMessage({action:"registerNotification"})}};exports.registerNotification=registerNotification;var _default={isAndroidApp:isAndroidApp,isIosApp:isIosApp,hideSplashScreen:hideSplashScreen,statusBar:statusBar,deviceInfo:deviceInfo,showInAppReview:showInAppReview,shareLink:shareLink,platform:_utills.platform,isNativeApp:_utills.isNativeApp,isDeviceGPSEnabled:isDeviceGPSEnabled,openUrlInBrowser:openUrlInBrowser,enablePullToRefresh:enablePullToRefresh,shareFile:shareFile,clearAppCache:clearAppCache,closeApp:closeApp,showDateTimePicker:showDateTimePicker,downloadBlobFile:downloadBlobFile,customFileDownload:customFileDownload,printFunction:printFunction,loadOfferCard:loadOfferCard,appFirstLoad:appFirstLoad,addToSiri:addToSiri,showPermission:showPermission,forceUpdateCookies:forceUpdateCookies,updateAppIcon:updateAppIcon,disableScreenshot:disableScreenshot,getSafeArea:getSafeArea,getAddOnStatus:getAddOnStatus,setOrientation:setOrientation,checkPermission:checkPermission,openAppSettingForPermission:openAppSettingForPermission,customBackHandling:customBackHandling,hideNativeComponents:hideNativeComponents,showNativeComponents:showNativeComponents,registerNotification:registerNotification};exports["default"]=_default;
|