webtonative 1.0.77 → 1.0.78-beta.2
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 +8 -0
- package/Notification/index.js +39 -1
- 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/OrufyConnect/index.d.ts +22 -0
- package/OrufyConnect/index.js +199 -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/RevenueCat/index.d.ts +7 -0
- package/RevenueCat/index.js +136 -0
- 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 +158 -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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type ICb = {
|
|
2
|
+
callback: (response: {
|
|
3
|
+
type: string;
|
|
4
|
+
} & Record<string, any>) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const onUnreadChatCountsChange: (options?: ICb) => void;
|
|
7
|
+
export declare const widgetLogin: (data?: Record<string, any>) => void;
|
|
8
|
+
export declare const setUserDetails: (data?: Record<string, any>) => void;
|
|
9
|
+
export declare const widgetLogout: () => void;
|
|
10
|
+
export declare const isInitializationDone: (options?: ICb) => void;
|
|
11
|
+
export declare const setAppId: (options: ICb & {
|
|
12
|
+
appId: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
export declare const setExternalUserid: (options: ICb & {
|
|
15
|
+
externalUserId: string;
|
|
16
|
+
}) => void;
|
|
17
|
+
export declare const isUserLoggedIn: (options: ICb) => void;
|
|
18
|
+
export declare const getUser: (options: ICb) => void;
|
|
19
|
+
export declare const setWidgetConfig: (options: Record<string, any>) => void;
|
|
20
|
+
export declare const getUnreadChatsCount: (options: ICb) => void;
|
|
21
|
+
export declare const sendChatMessage: (options: ICb) => void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendChatMessage = exports.getUnreadChatsCount = exports.setWidgetConfig = exports.getUser = exports.isUserLoggedIn = exports.setExternalUserid = exports.setAppId = exports.isInitializationDone = exports.widgetLogout = exports.setUserDetails = exports.widgetLogin = exports.onUnreadChatCountsChange = void 0;
|
|
4
|
+
var index_1 = require("../index");
|
|
5
|
+
var utills_1 = require("../utills");
|
|
6
|
+
var onUnreadChatCountsChange = function (options) {
|
|
7
|
+
var callback = (options || {}).callback;
|
|
8
|
+
(0, utills_1.registerCb)(function (response) {
|
|
9
|
+
var type = response.type;
|
|
10
|
+
if (type === "onUnreadChatCountsChange") {
|
|
11
|
+
callback && callback(response);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
if (index_1.isAndroidApp) {
|
|
15
|
+
utills_1.webToNative.onUnreadChatCountsChange();
|
|
16
|
+
}
|
|
17
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
18
|
+
utills_1.webToNativeIos.postMessage({
|
|
19
|
+
action: "onUnreadChatCountsChange",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.onUnreadChatCountsChange = onUnreadChatCountsChange;
|
|
24
|
+
var widgetLogin = function (data) {
|
|
25
|
+
if (index_1.isAndroidApp) {
|
|
26
|
+
utills_1.webToNative.widgetLogin(JSON.stringify(data));
|
|
27
|
+
}
|
|
28
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
29
|
+
utills_1.webToNativeIos.postMessage({
|
|
30
|
+
action: "widgetLogin",
|
|
31
|
+
data: data,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.widgetLogin = widgetLogin;
|
|
36
|
+
var setUserDetails = function (data) {
|
|
37
|
+
if (index_1.isAndroidApp) {
|
|
38
|
+
utills_1.webToNative.setUserDetails(JSON.stringify(data));
|
|
39
|
+
}
|
|
40
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
41
|
+
utills_1.webToNativeIos.postMessage({
|
|
42
|
+
action: "setUserDetails",
|
|
43
|
+
data: data,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.setUserDetails = setUserDetails;
|
|
48
|
+
var widgetLogout = function () {
|
|
49
|
+
if (index_1.isAndroidApp) {
|
|
50
|
+
utills_1.webToNative.widgetLogout();
|
|
51
|
+
}
|
|
52
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
53
|
+
utills_1.webToNativeIos.postMessage({
|
|
54
|
+
action: "widgetLogout",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.widgetLogout = widgetLogout;
|
|
59
|
+
var isInitializationDone = function (options) {
|
|
60
|
+
var callback = (options || {}).callback;
|
|
61
|
+
(0, utills_1.registerCb)(function (response) {
|
|
62
|
+
var type = response.type;
|
|
63
|
+
if (type === "isInitializationDone") {
|
|
64
|
+
callback && callback(response);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (index_1.isAndroidApp) {
|
|
68
|
+
utills_1.webToNative.isInitializationDone();
|
|
69
|
+
}
|
|
70
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
71
|
+
utills_1.webToNativeIos.postMessage({
|
|
72
|
+
action: "isInitializationDone",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.isInitializationDone = isInitializationDone;
|
|
77
|
+
var setAppId = function (options) {
|
|
78
|
+
var _a = options || {}, callback = _a.callback, appId = _a.appId;
|
|
79
|
+
(0, utills_1.registerCb)(function (response) {
|
|
80
|
+
var type = response.type;
|
|
81
|
+
if (type === "setAppId") {
|
|
82
|
+
callback && callback(response);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (index_1.isAndroidApp) {
|
|
86
|
+
utills_1.webToNative.setAppId(JSON.stringify(appId));
|
|
87
|
+
}
|
|
88
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
89
|
+
utills_1.webToNativeIos.postMessage({
|
|
90
|
+
action: "setAppId",
|
|
91
|
+
appId: appId,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.setAppId = setAppId;
|
|
96
|
+
var setExternalUserid = function (options) {
|
|
97
|
+
var _a = options || {}, callback = _a.callback, externalUserId = _a.externalUserId;
|
|
98
|
+
(0, utills_1.registerCb)(function (response) {
|
|
99
|
+
var type = response.type;
|
|
100
|
+
if (type === "setExternalUserid") {
|
|
101
|
+
callback && callback(response);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (index_1.isAndroidApp) {
|
|
105
|
+
utills_1.webToNative.setExternalUserid(JSON.stringify(externalUserId));
|
|
106
|
+
}
|
|
107
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
108
|
+
utills_1.webToNativeIos.postMessage({
|
|
109
|
+
action: "setExternalUserid",
|
|
110
|
+
externalUserId: externalUserId,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.setExternalUserid = setExternalUserid;
|
|
115
|
+
var isUserLoggedIn = function (options) {
|
|
116
|
+
var callback = (options || {}).callback;
|
|
117
|
+
(0, utills_1.registerCb)(function (response) {
|
|
118
|
+
var type = response.type;
|
|
119
|
+
if (type === "isUserLoggedIn") {
|
|
120
|
+
callback && callback(response);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
if (index_1.isAndroidApp) {
|
|
124
|
+
utills_1.webToNative.isUserLoggedIn();
|
|
125
|
+
}
|
|
126
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
127
|
+
utills_1.webToNativeIos.postMessage({
|
|
128
|
+
action: "isUserLoggedIn",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.isUserLoggedIn = isUserLoggedIn;
|
|
133
|
+
var getUser = function (options) {
|
|
134
|
+
var callback = (options || {}).callback;
|
|
135
|
+
(0, utills_1.registerCb)(function (response) {
|
|
136
|
+
var type = response.type;
|
|
137
|
+
if (type === "getUser") {
|
|
138
|
+
callback && callback(response);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (index_1.isAndroidApp) {
|
|
142
|
+
utills_1.webToNative.getUser();
|
|
143
|
+
}
|
|
144
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
145
|
+
utills_1.webToNativeIos.postMessage({
|
|
146
|
+
action: "getUser",
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
exports.getUser = getUser;
|
|
151
|
+
var setWidgetConfig = function (options) {
|
|
152
|
+
if (index_1.isAndroidApp) {
|
|
153
|
+
utills_1.webToNative.setWidgetConfig(JSON.stringify(options));
|
|
154
|
+
}
|
|
155
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
156
|
+
utills_1.webToNativeIos.postMessage({
|
|
157
|
+
action: "setWidgetConfig",
|
|
158
|
+
data: options,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
exports.setWidgetConfig = setWidgetConfig;
|
|
163
|
+
var getUnreadChatsCount = function (options) {
|
|
164
|
+
var callback = (options || {}).callback;
|
|
165
|
+
(0, utills_1.registerCb)(function (response) {
|
|
166
|
+
var type = response.type;
|
|
167
|
+
if (type === "getUnreadChatsCount") {
|
|
168
|
+
callback && callback(response);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
if (index_1.isAndroidApp) {
|
|
172
|
+
utills_1.webToNative.getUnreadChatsCount();
|
|
173
|
+
}
|
|
174
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
175
|
+
utills_1.webToNativeIos.postMessage({
|
|
176
|
+
action: "getUnreadChatsCount",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
exports.getUnreadChatsCount = getUnreadChatsCount;
|
|
181
|
+
var sendChatMessage = function (options) {
|
|
182
|
+
var callback = (options || {}).callback;
|
|
183
|
+
(0, utills_1.registerCb)(function (response) {
|
|
184
|
+
var type = response.type;
|
|
185
|
+
if (type === "sendChatMessage") {
|
|
186
|
+
callback && callback(response);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
if (index_1.isAndroidApp) {
|
|
190
|
+
utills_1.webToNative.sendChatMessage(JSON.stringify(options));
|
|
191
|
+
}
|
|
192
|
+
else if (index_1.isIosApp && utills_1.webToNativeIos) {
|
|
193
|
+
utills_1.webToNativeIos.postMessage({
|
|
194
|
+
action: "sendChatMessage",
|
|
195
|
+
data: options,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
exports.sendChatMessage = sendChatMessage;
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const configure: (options: any) => void;
|
|
2
|
+
export declare const isInitialized: (options: any) => void;
|
|
3
|
+
export declare const setUserId: (options: any) => void;
|
|
4
|
+
export declare const getCustomerInfo: (options: any) => void;
|
|
5
|
+
export declare const showPaywall: (options: any) => void;
|
|
6
|
+
export declare const makePurchase: (options: any) => void;
|
|
7
|
+
export declare const restorePurchase: (options: any) => void;
|