webtonative 1.0.76 → 1.0.78
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.d.ts +16 -0
- package/ATTConsent/index.js +53 -1
- package/ATTConsent/types.d.ts +14 -0
- package/ATTConsent/types.js +2 -0
- package/AdMob/index.d.ts +30 -0
- package/AdMob/index.js +101 -1
- package/AdMob/types.d.ts +24 -0
- package/AdMob/types.js +3 -0
- package/AppReview/index.d.ts +6 -0
- package/AppReview/index.js +21 -1
- package/AppReview/types.d.ts +7 -0
- package/AppReview/types.js +3 -0
- package/AppsFlyer/index.d.ts +14 -0
- package/AppsFlyer/index.js +42 -4
- package/AppsFlyer/types.d.ts +9 -0
- package/AppsFlyer/types.js +2 -0
- package/BackgroundLocation/index.d.ts +11 -0
- package/BackgroundLocation/index.js +64 -4
- package/BackgroundLocation/types.d.ts +31 -0
- package/BackgroundLocation/types.js +2 -0
- package/Beacon/index.d.ts +6 -0
- package/Beacon/index.js +29 -1
- package/Beacon/types.d.ts +18 -0
- package/Beacon/types.js +2 -0
- package/Biometric/index.d.ts +26 -0
- package/Biometric/index.js +124 -1
- package/Biometric/types.d.ts +23 -0
- package/Biometric/types.js +2 -0
- package/Bluetooth/index.d.ts +16 -0
- package/Bluetooth/index.js +66 -1
- package/Bluetooth/types.d.ts +33 -0
- package/Bluetooth/types.js +2 -0
- package/BottomNavigation/index.d.ts +10 -0
- package/BottomNavigation/index.js +40 -4
- package/BottomNavigation/types.d.ts +8 -0
- package/BottomNavigation/types.js +2 -0
- package/Clipboard/index.d.ts +11 -0
- package/Clipboard/index.js +44 -4
- package/Clipboard/types.d.ts +19 -0
- package/Clipboard/types.js +3 -0
- package/Facebook/events.d.ts +12 -0
- package/Facebook/events.js +43 -4
- package/Facebook/index.d.ts +2 -0
- package/Facebook/index.js +28 -1
- package/Facebook/types.d.ts +21 -0
- package/Facebook/types.js +2 -0
- package/Firebase/Analytics/index.d.ts +31 -0
- package/Firebase/Analytics/index.js +109 -4
- package/Firebase/Messaging/index.d.ts +16 -0
- package/Firebase/Messaging/index.js +63 -4
- package/Firebase/index.d.ts +3 -0
- package/Firebase/index.js +30 -1
- package/Firebase/types.d.ts +57 -0
- package/Firebase/types.js +3 -0
- package/FirebaseAnalytics/index.d.ts +2 -0
- package/FirebaseAnalytics/index.js +28 -1
- package/Haptics/index.d.ts +6 -0
- package/Haptics/index.js +20 -1
- package/Haptics/types.d.ts +7 -0
- package/Haptics/types.js +2 -0
- package/InAppPurchase/index.d.ts +22 -0
- package/InAppPurchase/index.js +80 -1
- package/InAppPurchase/types.d.ts +33 -0
- package/InAppPurchase/types.js +2 -0
- package/InAppUpdate/index.d.ts +11 -0
- package/InAppUpdate/index.js +38 -1
- package/InAppUpdate/types.d.ts +14 -0
- package/InAppUpdate/types.js +2 -0
- package/MediaPlayer/index.d.ts +16 -0
- package/MediaPlayer/index.js +55 -7
- package/MediaPlayer/types.d.ts +13 -0
- package/MediaPlayer/types.js +2 -0
- package/NativeContacts/index.d.ts +11 -0
- package/NativeContacts/index.js +50 -6
- package/NativeContacts/types.d.ts +13 -0
- package/NativeContacts/types.js +2 -0
- package/NativeDatastore/index.d.ts +7 -0
- package/NativeDatastore/index.js +134 -1
- package/NativeDatastore/type.d.ts +23 -0
- package/NativeDatastore/type.js +2 -0
- package/Notification/index.d.ts +10 -0
- package/Notification/index.js +41 -5
- package/Notification/types.d.ts +13 -0
- package/Notification/types.js +2 -0
- package/OneSignal/index.d.ts +17 -0
- package/OneSignal/index.js +264 -1
- package/OneSignal/types.d.ts +40 -0
- package/OneSignal/types.js +3 -0
- package/Printing/index.d.ts +6 -0
- package/Printing/index.js +19 -1
- package/Printing/types.d.ts +8 -0
- package/Printing/types.js +2 -0
- package/README.md +31 -2
- package/Screen/index.d.ts +8 -0
- package/Screen/index.js +34 -4
- package/Screen/types.d.ts +5 -0
- package/Screen/types.js +3 -0
- package/Siri/index.d.ts +6 -0
- package/Siri/index.js +25 -1
- package/Siri/types.d.ts +13 -0
- package/Siri/types.js +2 -0
- package/SocialLogin/apple/index.d.ts +11 -0
- package/SocialLogin/apple/index.js +31 -0
- package/SocialLogin/facebook/index.d.ts +21 -0
- package/SocialLogin/facebook/index.js +60 -0
- package/SocialLogin/google/index.d.ts +21 -0
- package/SocialLogin/google/index.js +60 -0
- package/SocialLogin/index.d.ts +16 -0
- package/SocialLogin/index.js +22 -1
- package/SocialLogin/types.d.ts +38 -0
- package/SocialLogin/types.js +2 -0
- package/Stripe/index.d.ts +2 -0
- package/Stripe/index.js +48 -1
- package/Stripe/types.d.ts +31 -0
- package/Stripe/types.js +2 -0
- package/VoiceSearch/index.d.ts +12 -0
- package/VoiceSearch/index.js +33 -1
- package/VoiceSearch/types.d.ts +9 -0
- package/VoiceSearch/types.js +2 -0
- package/barcode/barcode-scan.d.ts +15 -0
- package/barcode/barcode-scan.js +39 -1
- package/barcode/barcode-types.d.ts +17 -0
- package/barcode/barcode-types.js +2 -0
- package/barcode/formats.d.ts +17 -0
- package/barcode/formats.js +22 -1
- package/barcode/index.d.ts +4 -0
- package/barcode/index.js +12 -1
- package/barcode/types.d.ts +16 -0
- package/barcode/types.js +21 -1
- package/index.d.ts +155 -0
- package/index.js +540 -2
- package/package.json +150 -3
- package/types/index.d.ts +49 -0
- package/types/index.js +3 -0
- package/utills.d.ts +11 -0
- package/utills.js +110 -1
- package/webtonative.min.js +1 -1
- package/SocialLogin/apple.js +0 -1
- package/SocialLogin/facebook.js +0 -9
- package/SocialLogin/google.js +0 -9
package/OneSignal/index.js
CHANGED
|
@@ -1 +1,264 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optOutUser = exports.optInUser = exports.logoutSMSNumber = exports.logoutEmail = exports.setSMSNumber = exports.setEmail = exports.getTriggers = exports.getTriggerValue = exports.removeTriggers = exports.removeTrigger = exports.addTriggers = exports.addTrigger = exports.setTags = exports.removeExternalUserId = exports.setExternalUserId = exports.getPlayerId = void 0;
|
|
4
|
+
var utills_1 = require("../utills");
|
|
5
|
+
var getPlayerId = function () {
|
|
6
|
+
return new Promise(function (resolve, reject) {
|
|
7
|
+
(0, utills_1.registerCb)(function (results) {
|
|
8
|
+
if (results.isSuccess) {
|
|
9
|
+
resolve(results.playerId);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
reject(results);
|
|
13
|
+
}
|
|
14
|
+
}, {
|
|
15
|
+
key: "getPlayerId",
|
|
16
|
+
});
|
|
17
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
18
|
+
utills_1.webToNative.getOneSignalId();
|
|
19
|
+
}
|
|
20
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
21
|
+
utills_1.webToNativeIos.postMessage({
|
|
22
|
+
action: "getPlayerId",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
reject("This function will work in Native App Powered By WebToNative");
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.getPlayerId = getPlayerId;
|
|
31
|
+
var setExternalUserId = function (userId) {
|
|
32
|
+
if (userId) {
|
|
33
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
34
|
+
return utills_1.isNativeApp && utills_1.webToNative.setExternalUserId(userId);
|
|
35
|
+
}
|
|
36
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
37
|
+
utills_1.webToNativeIos.postMessage({
|
|
38
|
+
action: "setExternalUserId",
|
|
39
|
+
userId: userId,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw "userId is required";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.setExternalUserId = setExternalUserId;
|
|
48
|
+
var removeExternalUserId = function () {
|
|
49
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
50
|
+
return utills_1.isNativeApp && utills_1.webToNative.removeExternalUserId();
|
|
51
|
+
}
|
|
52
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
53
|
+
utills_1.webToNativeIos.postMessage({
|
|
54
|
+
action: "removeExternalUserId",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.removeExternalUserId = removeExternalUserId;
|
|
59
|
+
var setTags = function (_a) {
|
|
60
|
+
var tags = _a.tags;
|
|
61
|
+
if (tags) {
|
|
62
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
63
|
+
return utills_1.isNativeApp && utills_1.webToNative.setUserTags(JSON.stringify(tags));
|
|
64
|
+
}
|
|
65
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
66
|
+
utills_1.webToNativeIos.postMessage({
|
|
67
|
+
action: "setUserTags",
|
|
68
|
+
tags: tags,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.setTags = setTags;
|
|
74
|
+
var addTrigger = function (options) {
|
|
75
|
+
if (options === void 0) { options = {}; }
|
|
76
|
+
var key = options.key, value = options.value;
|
|
77
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
78
|
+
utills_1.webToNative.addTrigger(JSON.stringify({
|
|
79
|
+
key: key,
|
|
80
|
+
value: value,
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
84
|
+
utills_1.webToNativeIos.postMessage({
|
|
85
|
+
action: "addTrigger",
|
|
86
|
+
key: key,
|
|
87
|
+
value: value,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
exports.addTrigger = addTrigger;
|
|
92
|
+
var addTriggers = function (options) {
|
|
93
|
+
if (options === void 0) { options = {}; }
|
|
94
|
+
var triggers = options.triggers;
|
|
95
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
96
|
+
utills_1.webToNative.addTriggers(JSON.stringify({
|
|
97
|
+
triggers: triggers,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
101
|
+
utills_1.webToNativeIos.postMessage({
|
|
102
|
+
action: "addTriggers",
|
|
103
|
+
triggers: triggers,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
exports.addTriggers = addTriggers;
|
|
108
|
+
var removeTrigger = function (options) {
|
|
109
|
+
if (options === void 0) { options = {}; }
|
|
110
|
+
var key = options.key;
|
|
111
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
112
|
+
utills_1.webToNative.removeTriggerForKey(key);
|
|
113
|
+
}
|
|
114
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
115
|
+
utills_1.webToNativeIos.postMessage({
|
|
116
|
+
action: "removeTrigger",
|
|
117
|
+
key: key,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.removeTrigger = removeTrigger;
|
|
122
|
+
var removeTriggers = function (options) {
|
|
123
|
+
if (options === void 0) { options = {}; }
|
|
124
|
+
var keys = options.keys;
|
|
125
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
126
|
+
utills_1.webToNative.removeTriggersForKeys(JSON.stringify({ keys: keys }));
|
|
127
|
+
}
|
|
128
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
129
|
+
utills_1.webToNativeIos.postMessage({
|
|
130
|
+
action: "removeTriggers",
|
|
131
|
+
keys: keys,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.removeTriggers = removeTriggers;
|
|
136
|
+
var getTriggerValue = function (options) {
|
|
137
|
+
if (options === void 0) { options = {}; }
|
|
138
|
+
var key = options.key, callback = options.callback;
|
|
139
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
140
|
+
(0, utills_1.registerCb)(function (response) {
|
|
141
|
+
var type = response.type;
|
|
142
|
+
if (type === "getTriggerValue") {
|
|
143
|
+
callback && callback(response);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
147
|
+
utills_1.webToNative.getTriggerValueForKey(key);
|
|
148
|
+
}
|
|
149
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
150
|
+
utills_1.webToNativeIos.postMessage({
|
|
151
|
+
action: "getTriggerValue",
|
|
152
|
+
key: key,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
exports.getTriggerValue = getTriggerValue;
|
|
158
|
+
var getTriggers = function (options) {
|
|
159
|
+
if (options === void 0) { options = {}; }
|
|
160
|
+
var callback = options.callback;
|
|
161
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
162
|
+
(0, utills_1.registerCb)(function (response) {
|
|
163
|
+
var type = response.type;
|
|
164
|
+
if (type === "getTriggers") {
|
|
165
|
+
callback && callback(response);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
169
|
+
utills_1.webToNative.getTriggers();
|
|
170
|
+
}
|
|
171
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
172
|
+
utills_1.webToNativeIos.postMessage({
|
|
173
|
+
action: "getTriggers",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
exports.getTriggers = getTriggers;
|
|
179
|
+
var setEmail = function (options) {
|
|
180
|
+
if (options === void 0) { options = {}; }
|
|
181
|
+
var emailId = options.emailId;
|
|
182
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
183
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
184
|
+
utills_1.webToNative.setEmail(emailId);
|
|
185
|
+
}
|
|
186
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
187
|
+
utills_1.webToNativeIos.postMessage({
|
|
188
|
+
action: "setEmail",
|
|
189
|
+
emailId: emailId,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
exports.setEmail = setEmail;
|
|
195
|
+
var setSMSNumber = function (options) {
|
|
196
|
+
if (options === void 0) { options = {}; }
|
|
197
|
+
var smsNumber = options.smsNumber;
|
|
198
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
199
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
200
|
+
utills_1.webToNative.setSMSNumber(smsNumber);
|
|
201
|
+
}
|
|
202
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
203
|
+
utills_1.webToNativeIos.postMessage({
|
|
204
|
+
action: "setSMSNumber",
|
|
205
|
+
smsNumber: smsNumber,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
exports.setSMSNumber = setSMSNumber;
|
|
211
|
+
var logoutEmail = function (options) {
|
|
212
|
+
if (options === void 0) { options = {}; }
|
|
213
|
+
var emailId = options.emailId;
|
|
214
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
215
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
216
|
+
utills_1.webToNative.logoutEmail(emailId);
|
|
217
|
+
}
|
|
218
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
219
|
+
utills_1.webToNativeIos.postMessage({
|
|
220
|
+
action: "logoutEmail",
|
|
221
|
+
emailId: emailId,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
exports.logoutEmail = logoutEmail;
|
|
227
|
+
var logoutSMSNumber = function (options) {
|
|
228
|
+
if (options === void 0) { options = {}; }
|
|
229
|
+
var smsNumber = options.smsNumber;
|
|
230
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
231
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
232
|
+
utills_1.webToNative.logoutSMSNumber(smsNumber);
|
|
233
|
+
}
|
|
234
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
235
|
+
utills_1.webToNativeIos.postMessage({
|
|
236
|
+
action: "logoutSMSNumber",
|
|
237
|
+
smsNumber: smsNumber,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
exports.logoutSMSNumber = logoutSMSNumber;
|
|
243
|
+
var optInUser = function () {
|
|
244
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
245
|
+
utills_1.webToNative.optInOneSignalPermissionDialog();
|
|
246
|
+
}
|
|
247
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
248
|
+
utills_1.webToNativeIos.postMessage({
|
|
249
|
+
action: "optInOneSignalPermissionDialog",
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
exports.optInUser = optInUser;
|
|
254
|
+
var optOutUser = function () {
|
|
255
|
+
if (utills_1.platform === "ANDROID_APP") {
|
|
256
|
+
utills_1.webToNative.optOutOneSignalPermissionDialog();
|
|
257
|
+
}
|
|
258
|
+
else if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
259
|
+
utills_1.webToNativeIos.postMessage({
|
|
260
|
+
action: "optOutOneSignalPermissionDialog",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
exports.optOutUser = optOutUser;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface PlayerIdResponse {
|
|
2
|
+
isSuccess: boolean;
|
|
3
|
+
playerId?: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export interface TriggerResponse {
|
|
7
|
+
type: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export interface TriggerCallback {
|
|
11
|
+
(response: TriggerResponse): void;
|
|
12
|
+
}
|
|
13
|
+
export interface TriggerOptions {
|
|
14
|
+
key?: string;
|
|
15
|
+
value?: any;
|
|
16
|
+
keys?: string[];
|
|
17
|
+
triggers?: Record<string, any>;
|
|
18
|
+
callback?: TriggerCallback;
|
|
19
|
+
}
|
|
20
|
+
export interface TagsOptions {
|
|
21
|
+
tags: Record<string, any>;
|
|
22
|
+
}
|
|
23
|
+
export interface EmailOptions {
|
|
24
|
+
emailId?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SMSOptions {
|
|
27
|
+
smsNumber?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface OneSignalIosMessage {
|
|
30
|
+
action: string;
|
|
31
|
+
userId?: string;
|
|
32
|
+
key?: string;
|
|
33
|
+
value?: any;
|
|
34
|
+
keys?: string[];
|
|
35
|
+
triggers?: Record<string, any>;
|
|
36
|
+
tags?: Record<string, any>;
|
|
37
|
+
emailId?: string;
|
|
38
|
+
smsNumber?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
package/Printing/index.js
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setPrintSize = void 0;
|
|
4
|
+
var utills_1 = require("../utills");
|
|
5
|
+
/**
|
|
6
|
+
* Sets the print size for Android printing
|
|
7
|
+
* @param options - Options for setting print size
|
|
8
|
+
*/
|
|
9
|
+
var setPrintSize = function (options) {
|
|
10
|
+
if (["ANDROID_APP"].includes(utills_1.platform)) {
|
|
11
|
+
var _a = options.printSize, printSize = _a === void 0 ? "ISO_A4" : _a, _b = options.label, label = _b === void 0 ? "" : _b;
|
|
12
|
+
utills_1.platform === "ANDROID_APP" &&
|
|
13
|
+
utills_1.webToNative.setPrintSize(JSON.stringify({
|
|
14
|
+
printSize: printSize,
|
|
15
|
+
label: label
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.setPrintSize = setPrintSize;
|
package/README.md
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
# WebToNative SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Repository for WebToNative TypeScript/JavaScript SDK. Build your Android/iOS app from https://webtonative.com
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install webtonative
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## TypeScript Support
|
|
12
|
+
|
|
13
|
+
This package includes TypeScript type definitions. You can use it in your TypeScript projects with full type checking and autocompletion support.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import webtonative from 'webtonative';
|
|
17
|
+
|
|
18
|
+
// Initialize the SDK
|
|
19
|
+
const wtn = webtonative();
|
|
20
|
+
|
|
21
|
+
// Use with TypeScript type checking
|
|
22
|
+
wtn.statusBar({ color: '#FFFFFF', style: 'dark' });
|
|
23
|
+
|
|
24
|
+
// Access device information with typed response
|
|
25
|
+
wtn.deviceInfo().then(info => {
|
|
26
|
+
console.log(info);
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
For complete documentation, visit:
|
|
4
33
|
https://docs.webtonative.com
|
package/Screen/index.js
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keepScreenNormal = exports.keepScreenOn = void 0;
|
|
4
|
+
var utills_1 = require("../utills");
|
|
5
|
+
/**
|
|
6
|
+
* Keeps the screen on (prevents screen from turning off)
|
|
7
|
+
*/
|
|
8
|
+
var keepScreenOn = function () {
|
|
9
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
10
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
11
|
+
utills_1.webToNativeIos.postMessage({
|
|
12
|
+
action: "keepScreenOn",
|
|
13
|
+
flag: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
utills_1.platform === "ANDROID_APP" && utills_1.webToNative.keepScreenOn();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.keepScreenOn = keepScreenOn;
|
|
20
|
+
/**
|
|
21
|
+
* Returns screen to normal behavior (allows screen to turn off)
|
|
22
|
+
*/
|
|
23
|
+
var keepScreenNormal = function () {
|
|
24
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
25
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
26
|
+
utills_1.webToNativeIos.postMessage({
|
|
27
|
+
action: "keepScreenOn",
|
|
28
|
+
flag: false,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
utills_1.platform === "ANDROID_APP" && utills_1.webToNative.keepScreenNormal();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.keepScreenNormal = keepScreenNormal;
|
package/Screen/types.js
ADDED
package/Siri/index.d.ts
ADDED
package/Siri/index.js
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addToSiri = void 0;
|
|
4
|
+
var utills_1 = require("../utills");
|
|
5
|
+
/**
|
|
6
|
+
* Adds an action to Siri (iOS only)
|
|
7
|
+
* @param options - Options for adding to Siri
|
|
8
|
+
*/
|
|
9
|
+
var addToSiri = function (options) {
|
|
10
|
+
if (options === void 0) { options = {}; }
|
|
11
|
+
var actionUrl = options.actionUrl, suggestedPhrase = options.suggestedPhrase, title = options.title;
|
|
12
|
+
if (["IOS_APP"].includes(utills_1.platform)) {
|
|
13
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
14
|
+
utills_1.webToNativeIos.postMessage({
|
|
15
|
+
"action": "addToSiri",
|
|
16
|
+
"data": {
|
|
17
|
+
actionUrl: actionUrl,
|
|
18
|
+
suggestedPhrase: suggestedPhrase,
|
|
19
|
+
title: title
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.addToSiri = addToSiri;
|
package/Siri/types.d.ts
ADDED
package/Siri/types.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SocialLoginOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* This function handles native Apple login
|
|
4
|
+
* @param options - Options for Apple login
|
|
5
|
+
* @example wtn.socialLogin.apple.login({
|
|
6
|
+
* callback:(data)=>{
|
|
7
|
+
* console.log(data);
|
|
8
|
+
* }
|
|
9
|
+
* });
|
|
10
|
+
*/
|
|
11
|
+
export declare const login: (options: SocialLoginOptions) => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.login = void 0;
|
|
4
|
+
var utills_1 = require("../../utills");
|
|
5
|
+
/**
|
|
6
|
+
* This function handles native Apple login
|
|
7
|
+
* @param options - Options for Apple login
|
|
8
|
+
* @example wtn.socialLogin.apple.login({
|
|
9
|
+
* callback:(data)=>{
|
|
10
|
+
* console.log(data);
|
|
11
|
+
* }
|
|
12
|
+
* });
|
|
13
|
+
*/
|
|
14
|
+
var login = function (options) {
|
|
15
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
16
|
+
var callback_1 = options.callback, scope = options.scope;
|
|
17
|
+
(0, utills_1.registerCb)(function (response) {
|
|
18
|
+
var type = response.type;
|
|
19
|
+
if (type === "appleLoginToken") {
|
|
20
|
+
callback_1 && callback_1(response);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
24
|
+
utills_1.webToNativeIos.postMessage({
|
|
25
|
+
action: "appleSignIn",
|
|
26
|
+
scope: scope,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.login = login;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SocialLoginOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* This function handles native facebook login
|
|
4
|
+
* @param options - Options for Facebook login
|
|
5
|
+
* @example wtn.socialLogin.facebook.login({
|
|
6
|
+
* callback:(data)=>{
|
|
7
|
+
* console.log(data);
|
|
8
|
+
* }
|
|
9
|
+
* });
|
|
10
|
+
*/
|
|
11
|
+
export declare const login: (options: SocialLoginOptions) => void;
|
|
12
|
+
/**
|
|
13
|
+
* This function handles native facebook logout
|
|
14
|
+
* @param options - Options for Facebook logout
|
|
15
|
+
* @example wtn.socialLogin.facebook.logout({
|
|
16
|
+
* callback:(data)=>{
|
|
17
|
+
* console.log(data);
|
|
18
|
+
* }
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
export declare const logout: (options: SocialLoginOptions) => void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logout = exports.login = void 0;
|
|
4
|
+
var utills_1 = require("../../utills");
|
|
5
|
+
/**
|
|
6
|
+
* This function handles native facebook login
|
|
7
|
+
* @param options - Options for Facebook login
|
|
8
|
+
* @example wtn.socialLogin.facebook.login({
|
|
9
|
+
* callback:(data)=>{
|
|
10
|
+
* console.log(data);
|
|
11
|
+
* }
|
|
12
|
+
* });
|
|
13
|
+
*/
|
|
14
|
+
var login = function (options) {
|
|
15
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
16
|
+
var callback_1 = options.callback, scope = options.scope;
|
|
17
|
+
(0, utills_1.registerCb)(function (response) {
|
|
18
|
+
var type = response.type;
|
|
19
|
+
if (type === "fbLoginToken") {
|
|
20
|
+
callback_1 && callback_1(response);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
utills_1.platform === "ANDROID_APP" && utills_1.webToNative.loginWithFacebook();
|
|
24
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
25
|
+
utills_1.webToNativeIos.postMessage({
|
|
26
|
+
action: "fbSignIn",
|
|
27
|
+
scope: scope,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.login = login;
|
|
33
|
+
/**
|
|
34
|
+
* This function handles native facebook logout
|
|
35
|
+
* @param options - Options for Facebook logout
|
|
36
|
+
* @example wtn.socialLogin.facebook.logout({
|
|
37
|
+
* callback:(data)=>{
|
|
38
|
+
* console.log(data);
|
|
39
|
+
* }
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
var logout = function (options) {
|
|
43
|
+
if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
|
|
44
|
+
var callback_2 = options.callback, scope = options.scope;
|
|
45
|
+
(0, utills_1.registerCb)(function (response) {
|
|
46
|
+
var type = response.type;
|
|
47
|
+
if (type === "fbLogOut") {
|
|
48
|
+
callback_2 && callback_2(response);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
utills_1.platform === "ANDROID_APP" && utills_1.webToNative.logoutWithFacebook();
|
|
52
|
+
if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
|
|
53
|
+
utills_1.webToNativeIos.postMessage({
|
|
54
|
+
action: "fbSignOut",
|
|
55
|
+
scope: scope,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.logout = logout;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SocialLoginOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* This function handles native Google login
|
|
4
|
+
* @param options - Options for Google login
|
|
5
|
+
* @example wtn.socialLogin.google.login({
|
|
6
|
+
* callback:(data)=>{
|
|
7
|
+
* console.log(data);
|
|
8
|
+
* }
|
|
9
|
+
* });
|
|
10
|
+
*/
|
|
11
|
+
export declare const login: (options: SocialLoginOptions) => void;
|
|
12
|
+
/**
|
|
13
|
+
* This function handles native Google logout
|
|
14
|
+
* @param options - Options for Google logout
|
|
15
|
+
* @example wtn.socialLogin.google.logout({
|
|
16
|
+
* callback:(data)=>{
|
|
17
|
+
* console.log(data);
|
|
18
|
+
* }
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
export declare const logout: (options: SocialLoginOptions) => void;
|