webtonative 1.0.76 → 1.0.78-beta.1

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.
Files changed (142) hide show
  1. package/ATTConsent/index.d.ts +16 -0
  2. package/ATTConsent/index.js +53 -1
  3. package/ATTConsent/types.d.ts +14 -0
  4. package/ATTConsent/types.js +2 -0
  5. package/AdMob/index.d.ts +30 -0
  6. package/AdMob/index.js +101 -1
  7. package/AdMob/types.d.ts +24 -0
  8. package/AdMob/types.js +3 -0
  9. package/AppReview/index.d.ts +6 -0
  10. package/AppReview/index.js +21 -1
  11. package/AppReview/types.d.ts +7 -0
  12. package/AppReview/types.js +3 -0
  13. package/AppsFlyer/index.d.ts +14 -0
  14. package/AppsFlyer/index.js +42 -4
  15. package/AppsFlyer/types.d.ts +9 -0
  16. package/AppsFlyer/types.js +2 -0
  17. package/BackgroundLocation/index.d.ts +11 -0
  18. package/BackgroundLocation/index.js +64 -4
  19. package/BackgroundLocation/types.d.ts +31 -0
  20. package/BackgroundLocation/types.js +2 -0
  21. package/Beacon/index.d.ts +6 -0
  22. package/Beacon/index.js +29 -1
  23. package/Beacon/types.d.ts +18 -0
  24. package/Beacon/types.js +2 -0
  25. package/Biometric/index.d.ts +26 -0
  26. package/Biometric/index.js +124 -1
  27. package/Biometric/types.d.ts +23 -0
  28. package/Biometric/types.js +2 -0
  29. package/Bluetooth/index.d.ts +16 -0
  30. package/Bluetooth/index.js +66 -1
  31. package/Bluetooth/types.d.ts +33 -0
  32. package/Bluetooth/types.js +2 -0
  33. package/BottomNavigation/index.d.ts +10 -0
  34. package/BottomNavigation/index.js +40 -4
  35. package/BottomNavigation/types.d.ts +8 -0
  36. package/BottomNavigation/types.js +2 -0
  37. package/Clipboard/index.d.ts +11 -0
  38. package/Clipboard/index.js +44 -4
  39. package/Clipboard/types.d.ts +19 -0
  40. package/Clipboard/types.js +3 -0
  41. package/Facebook/events.d.ts +12 -0
  42. package/Facebook/events.js +43 -4
  43. package/Facebook/index.d.ts +2 -0
  44. package/Facebook/index.js +28 -1
  45. package/Facebook/types.d.ts +21 -0
  46. package/Facebook/types.js +2 -0
  47. package/Firebase/Analytics/index.d.ts +31 -0
  48. package/Firebase/Analytics/index.js +109 -4
  49. package/Firebase/Messaging/index.d.ts +16 -0
  50. package/Firebase/Messaging/index.js +63 -4
  51. package/Firebase/index.d.ts +3 -0
  52. package/Firebase/index.js +30 -1
  53. package/Firebase/types.d.ts +57 -0
  54. package/Firebase/types.js +3 -0
  55. package/FirebaseAnalytics/index.d.ts +2 -0
  56. package/FirebaseAnalytics/index.js +28 -1
  57. package/Haptics/index.d.ts +6 -0
  58. package/Haptics/index.js +20 -1
  59. package/Haptics/types.d.ts +7 -0
  60. package/Haptics/types.js +2 -0
  61. package/InAppPurchase/index.d.ts +22 -0
  62. package/InAppPurchase/index.js +80 -1
  63. package/InAppPurchase/types.d.ts +33 -0
  64. package/InAppPurchase/types.js +2 -0
  65. package/InAppUpdate/index.d.ts +11 -0
  66. package/InAppUpdate/index.js +38 -1
  67. package/InAppUpdate/types.d.ts +14 -0
  68. package/InAppUpdate/types.js +2 -0
  69. package/MediaPlayer/index.d.ts +16 -0
  70. package/MediaPlayer/index.js +55 -7
  71. package/MediaPlayer/types.d.ts +13 -0
  72. package/MediaPlayer/types.js +2 -0
  73. package/NativeContacts/index.d.ts +11 -0
  74. package/NativeContacts/index.js +50 -6
  75. package/NativeContacts/types.d.ts +13 -0
  76. package/NativeContacts/types.js +2 -0
  77. package/NativeDatastore/index.d.ts +7 -0
  78. package/NativeDatastore/index.js +134 -1
  79. package/NativeDatastore/type.d.ts +23 -0
  80. package/NativeDatastore/type.js +2 -0
  81. package/Notification/index.d.ts +8 -0
  82. package/Notification/index.js +39 -5
  83. package/Notification/types.d.ts +13 -0
  84. package/Notification/types.js +2 -0
  85. package/OneSignal/index.d.ts +17 -0
  86. package/OneSignal/index.js +264 -1
  87. package/OneSignal/types.d.ts +40 -0
  88. package/OneSignal/types.js +3 -0
  89. package/Printing/index.d.ts +6 -0
  90. package/Printing/index.js +19 -1
  91. package/Printing/types.d.ts +8 -0
  92. package/Printing/types.js +2 -0
  93. package/README.md +31 -2
  94. package/RevenueCat/index.d.ts +7 -0
  95. package/RevenueCat/index.js +136 -0
  96. package/Screen/index.d.ts +8 -0
  97. package/Screen/index.js +34 -4
  98. package/Screen/types.d.ts +5 -0
  99. package/Screen/types.js +3 -0
  100. package/Siri/index.d.ts +6 -0
  101. package/Siri/index.js +25 -1
  102. package/Siri/types.d.ts +13 -0
  103. package/Siri/types.js +2 -0
  104. package/SocialLogin/apple/index.d.ts +11 -0
  105. package/SocialLogin/apple/index.js +31 -0
  106. package/SocialLogin/facebook/index.d.ts +21 -0
  107. package/SocialLogin/facebook/index.js +60 -0
  108. package/SocialLogin/google/index.d.ts +21 -0
  109. package/SocialLogin/google/index.js +60 -0
  110. package/SocialLogin/index.d.ts +16 -0
  111. package/SocialLogin/index.js +22 -1
  112. package/SocialLogin/types.d.ts +38 -0
  113. package/SocialLogin/types.js +2 -0
  114. package/Stripe/index.d.ts +2 -0
  115. package/Stripe/index.js +48 -1
  116. package/Stripe/types.d.ts +31 -0
  117. package/Stripe/types.js +2 -0
  118. package/VoiceSearch/index.d.ts +12 -0
  119. package/VoiceSearch/index.js +33 -1
  120. package/VoiceSearch/types.d.ts +9 -0
  121. package/VoiceSearch/types.js +2 -0
  122. package/barcode/barcode-scan.d.ts +15 -0
  123. package/barcode/barcode-scan.js +39 -1
  124. package/barcode/barcode-types.d.ts +17 -0
  125. package/barcode/barcode-types.js +2 -0
  126. package/barcode/formats.d.ts +17 -0
  127. package/barcode/formats.js +22 -1
  128. package/barcode/index.d.ts +4 -0
  129. package/barcode/index.js +12 -1
  130. package/barcode/types.d.ts +16 -0
  131. package/barcode/types.js +21 -1
  132. package/index.d.ts +155 -0
  133. package/index.js +540 -2
  134. package/package.json +154 -3
  135. package/types/index.d.ts +49 -0
  136. package/types/index.js +3 -0
  137. package/utills.d.ts +11 -0
  138. package/utills.js +110 -1
  139. package/webtonative.min.js +1 -1
  140. package/SocialLogin/apple.js +0 -1
  141. package/SocialLogin/facebook.js +0 -9
  142. package/SocialLogin/google.js +0 -9
@@ -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;
@@ -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 Google login
7
+ * @param options - Options for Google login
8
+ * @example wtn.socialLogin.google.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 === "googleLoginToken") {
20
+ callback_1 && callback_1(response);
21
+ }
22
+ });
23
+ utills_1.platform === "ANDROID_APP" && utills_1.webToNative.signInWithGoogle();
24
+ if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
25
+ utills_1.webToNativeIos.postMessage({
26
+ action: "googleSignIn",
27
+ scope: scope,
28
+ });
29
+ }
30
+ }
31
+ };
32
+ exports.login = login;
33
+ /**
34
+ * This function handles native Google logout
35
+ * @param options - Options for Google logout
36
+ * @example wtn.socialLogin.google.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 === "googleLogOut") {
48
+ callback_2 && callback_2(response);
49
+ }
50
+ });
51
+ utills_1.platform === "ANDROID_APP" && utills_1.webToNative.signOutWithGoogle();
52
+ if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
53
+ utills_1.webToNativeIos.postMessage({
54
+ action: "googleSignOut",
55
+ scope: scope,
56
+ });
57
+ }
58
+ }
59
+ };
60
+ exports.logout = logout;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Social login module for Facebook, Google, and Apple authentication
3
+ */
4
+ export declare const socialLogin: {
5
+ facebook: {
6
+ login: (options: import("./types").SocialLoginOptions) => void;
7
+ logout: (options: import("./types").SocialLoginOptions) => void;
8
+ };
9
+ google: {
10
+ login: (options: import("./types").SocialLoginOptions) => void;
11
+ logout: (options: import("./types").SocialLoginOptions) => void;
12
+ };
13
+ apple: {
14
+ login: (options: import("./types").SocialLoginOptions) => void;
15
+ };
16
+ };
@@ -1 +1,22 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.socialLogin=void 0;var _facebook=require("./facebook"),_apple=require("./apple"),_google=require("./google"),socialLogin={facebook:{login:_facebook.login,logout:_facebook.logout},google:{login:_google.login,logout:_google.logout},apple:{login:_apple.login}};exports.socialLogin=socialLogin;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.socialLogin = void 0;
4
+ var facebook_1 = require("./facebook");
5
+ var apple_1 = require("./apple");
6
+ var google_1 = require("./google");
7
+ /**
8
+ * Social login module for Facebook, Google, and Apple authentication
9
+ */
10
+ exports.socialLogin = {
11
+ facebook: {
12
+ login: facebook_1.login,
13
+ logout: facebook_1.logout,
14
+ },
15
+ google: {
16
+ login: google_1.login,
17
+ logout: google_1.logout,
18
+ },
19
+ apple: {
20
+ login: apple_1.login,
21
+ },
22
+ };
@@ -0,0 +1,38 @@
1
+ export interface SocialLoginResponse {
2
+ type: string;
3
+ [key: string]: any;
4
+ }
5
+ export interface SocialLoginCallback {
6
+ (response: SocialLoginResponse): void;
7
+ }
8
+ export interface SocialLoginOptions {
9
+ callback?: SocialLoginCallback;
10
+ scope?: string;
11
+ }
12
+ export interface FacebookLoginResponse extends SocialLoginResponse {
13
+ type: 'fbLoginToken';
14
+ }
15
+ export interface FacebookLogoutResponse extends SocialLoginResponse {
16
+ type: 'fbLogOut';
17
+ }
18
+ export interface FacebookIosMessage {
19
+ action: 'fbSignIn' | 'fbSignOut';
20
+ scope?: string;
21
+ }
22
+ export interface GoogleLoginResponse extends SocialLoginResponse {
23
+ type: 'googleLoginToken';
24
+ }
25
+ export interface GoogleLogoutResponse extends SocialLoginResponse {
26
+ type: 'googleLogOut';
27
+ }
28
+ export interface GoogleIosMessage {
29
+ action: 'googleSignIn' | 'googleSignOut';
30
+ scope?: string;
31
+ }
32
+ export interface AppleLoginResponse extends SocialLoginResponse {
33
+ type: 'appleLoginToken';
34
+ }
35
+ export interface AppleIosMessage {
36
+ action: 'appleSignIn';
37
+ scope?: string;
38
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { StripeOptions } from "./types";
2
+ export declare const makeTapToPay: (options: StripeOptions) => void;
package/Stripe/index.js CHANGED
@@ -1 +1,48 @@
1
- "use strict";var _utills=require("../utills");Object.defineProperty(exports,"__esModule",{value:!0}),exports.makeTapToPay=void 0;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var makeTapToPay=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.callback,c=a.apiUrl,d=void 0===c?null:c,e=a.amount,f=a.currency,g=a.isSimulated,h=a.captureMethod,i=void 0===h?"automatic":h,j=a.connectionToken,k=a.stripeLocationId,l=a.clientSecret,m=void 0===l?null:l;(0,_utills.registerCb)(function(a){var c=a.type;"makeTapToPayStripePayment"===c&&b&&b(a)});var n={secretToken:j,amount:e,currency:f,isSimulated:void 0!==g&&g,captureMethod:i,locationId:k};d&&(n.apiUrl=d),m&&(n.client_secret=m),"ANDROID_APP"===_utills.platform&&_utills.webToNative.makeTapToPayStripePayment(JSON.stringify(n)),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage(_objectSpread({action:"makeTapToPayStripePayment"},n))}};exports.makeTapToPay=makeTapToPay;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.makeTapToPay = void 0;
15
+ var utills_1 = require("../utills");
16
+ var makeTapToPay = function (options) {
17
+ if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
18
+ var callback_1 = options.callback, _a = options.apiUrl, apiUrl = _a === void 0 ? null : _a, amount = options.amount, currency = options.currency, _b = options.isSimulated, isSimulated = _b === void 0 ? false : _b, _c = options.captureMethod, captureMethod = _c === void 0 ? "automatic" : _c, connectionToken = options.connectionToken, stripeLocationId = options.stripeLocationId, _d = options.clientSecret, clientSecret = _d === void 0 ? null : _d;
19
+ (0, utills_1.registerCb)(function (response) {
20
+ var type = response.type;
21
+ if (type === "makeTapToPayStripePayment") {
22
+ callback_1 && callback_1(response);
23
+ }
24
+ });
25
+ var paymentData = {
26
+ secretToken: connectionToken,
27
+ amount: amount,
28
+ currency: currency,
29
+ isSimulated: isSimulated,
30
+ captureMethod: captureMethod,
31
+ locationId: stripeLocationId
32
+ };
33
+ if (apiUrl) {
34
+ paymentData.apiUrl = apiUrl;
35
+ }
36
+ if (clientSecret) {
37
+ paymentData.client_secret = clientSecret;
38
+ }
39
+ if (utills_1.platform === "ANDROID_APP") {
40
+ utills_1.webToNative.makeTapToPayStripePayment(JSON.stringify(paymentData));
41
+ }
42
+ if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
43
+ var iosMessage = __assign({ "action": "makeTapToPayStripePayment" }, paymentData);
44
+ utills_1.webToNativeIos.postMessage(iosMessage);
45
+ }
46
+ }
47
+ };
48
+ exports.makeTapToPay = makeTapToPay;
@@ -0,0 +1,31 @@
1
+ import { BaseCallback, BaseResponse } from "../types";
2
+ export interface StripeResponse extends BaseResponse {
3
+ type: "makeTapToPayStripePayment";
4
+ }
5
+ export interface StripeCallback extends BaseCallback {
6
+ (response: StripeResponse): void;
7
+ }
8
+ export interface StripePaymentData {
9
+ secretToken: string;
10
+ amount: number;
11
+ currency: string;
12
+ isSimulated: boolean;
13
+ captureMethod: string;
14
+ locationId: string;
15
+ apiUrl?: string;
16
+ client_secret?: string;
17
+ }
18
+ export interface StripeOptions {
19
+ callback?: StripeCallback;
20
+ apiUrl?: string;
21
+ amount: number;
22
+ currency: string;
23
+ isSimulated?: boolean;
24
+ captureMethod?: string;
25
+ connectionToken: string;
26
+ stripeLocationId: string;
27
+ clientSecret?: string;
28
+ }
29
+ export interface StripeIosMessage extends StripePaymentData {
30
+ action: string;
31
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { VoiceSearchOptions } from "./types";
2
+ /**
3
+ * This function opens native voice search
4
+ * @param options Configuration options for voice search
5
+ * @example wtn.openVoiceSearch({
6
+ * onVoiceSearch:(value)=>{
7
+ * console.log(value);
8
+ * }
9
+ * });
10
+ */
11
+ declare const openVoiceSearch: (options?: VoiceSearchOptions) => any;
12
+ export default openVoiceSearch;
@@ -1 +1,33 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _utills=require("../utills"),_this=void 0,voiceSearchCb=null,_default=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.onVoiceSearch;return(0,_utills.registerCb)(function(a){var b=a.type,c=a.results;"VOICE_SEARCH_RESULT"===b&&(voiceSearchCb&&voiceSearchCb(c),voiceSearchCb=null)}),_utills.isNativeApp&&_utills.webToNative.openVoiceSearch(),"function"==typeof b&&(voiceSearchCb=b),_this};exports["default"]=_default;
1
+ "use strict";
2
+ var _this = this;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var utills_1 = require("../utills");
5
+ var voiceSearchCb = null;
6
+ /**
7
+ * This function opens native voice search
8
+ * @param options Configuration options for voice search
9
+ * @example wtn.openVoiceSearch({
10
+ * onVoiceSearch:(value)=>{
11
+ * console.log(value);
12
+ * }
13
+ * });
14
+ */
15
+ var openVoiceSearch = function (options) {
16
+ if (options === void 0) { options = {}; }
17
+ var onVoiceSearch = options.onVoiceSearch;
18
+ (0, utills_1.registerCb)(function (response) {
19
+ var _a = response, type = _a.type, results = _a.results;
20
+ if (type === "VOICE_SEARCH_RESULT") {
21
+ voiceSearchCb && voiceSearchCb(results);
22
+ voiceSearchCb = null;
23
+ }
24
+ });
25
+ if (utills_1.isNativeApp) {
26
+ utills_1.webToNative.openVoiceSearch();
27
+ }
28
+ if (typeof onVoiceSearch === "function") {
29
+ voiceSearchCb = onVoiceSearch;
30
+ }
31
+ return _this;
32
+ };
33
+ exports.default = openVoiceSearch;
@@ -0,0 +1,9 @@
1
+ import { BaseResponse } from "../types";
2
+ export interface VoiceSearchResponse extends BaseResponse {
3
+ type: "VOICE_SEARCH_RESULT";
4
+ results: string;
5
+ }
6
+ export type VoiceSearchCallback = (results: string) => void;
7
+ export interface VoiceSearchOptions {
8
+ onVoiceSearch?: VoiceSearchCallback;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ interface BarcodeScanOptions {
2
+ onBarcodeSearch?: (value: string) => void;
3
+ format?: number;
4
+ }
5
+ /**
6
+ * This function opens native barcode scanner from Android/Ios app.
7
+ * @param {object} options
8
+ * @example wtn.onScanner({
9
+ * onBarcodeSearch:(value)=>{
10
+ * console.log(value);
11
+ * }
12
+ * });
13
+ */
14
+ declare const BarcodeScan: (options: BarcodeScanOptions) => void;
15
+ export default BarcodeScan;
@@ -1 +1,39 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _utills=require("../utills"),_formats=_interopRequireDefault(require("./formats"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var successCb=null,_default=function(a){if(["ANDROID_APP","IOS_APP"].includes(_utills.platform)){var b=a.onBarcodeSearch,c=a.format;(0,_utills.registerCb)(function(a){var c=a.type,d=a.value;"BARCODE_SCAN"===c&&b&&b(d)}),"ANDROID_APP"===_utills.platform&&_utills.webToNative.startScanner(JSON.stringify({formats:c?[c]:[]})),"IOS_APP"===_utills.platform&&_utills.webToNativeIos.postMessage({action:"barcodeScan",barcodeFormat:c?c+"":_formats["default"].ALL_FORMATS+""})}};exports["default"]=_default;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var utills_1 = require("../utills");
7
+ var formats_1 = __importDefault(require("./formats"));
8
+ /**
9
+ * This function opens native barcode scanner from Android/Ios app.
10
+ * @param {object} options
11
+ * @example wtn.onScanner({
12
+ * onBarcodeSearch:(value)=>{
13
+ * console.log(value);
14
+ * }
15
+ * });
16
+ */
17
+ var BarcodeScan = function (options) {
18
+ if (["ANDROID_APP", "IOS_APP"].includes(utills_1.platform)) {
19
+ var onBarcodeSearch_1 = options.onBarcodeSearch, format = options.format;
20
+ (0, utills_1.registerCb)(function (response) {
21
+ var type = response.type, value = response.value;
22
+ if (type === "BARCODE_SCAN") {
23
+ onBarcodeSearch_1 && onBarcodeSearch_1(value);
24
+ }
25
+ });
26
+ if (utills_1.platform === "ANDROID_APP" && utills_1.webToNative.startScanner) {
27
+ utills_1.webToNative.startScanner(JSON.stringify({
28
+ formats: format ? [format] : [],
29
+ }));
30
+ }
31
+ if (utills_1.platform === "IOS_APP" && utills_1.webToNativeIos) {
32
+ utills_1.webToNativeIos.postMessage({
33
+ action: "barcodeScan",
34
+ barcodeFormat: format ? String(format) : String(formats_1.default.ALL_FORMATS),
35
+ });
36
+ }
37
+ }
38
+ };
39
+ exports.default = BarcodeScan;
@@ -0,0 +1,17 @@
1
+ import { BaseResponse } from "../types";
2
+ export interface BarcodeScanResponse extends BaseResponse {
3
+ type: "BARCODE_SCAN";
4
+ value: string;
5
+ }
6
+ export type BarcodeScanCallback = (value: string) => void;
7
+ export interface BarcodeScanOptions {
8
+ onBarcodeSearch?: BarcodeScanCallback;
9
+ format?: number;
10
+ }
11
+ export interface BarcodeScanAndroidParams {
12
+ formats: number[];
13
+ }
14
+ export interface BarcodeScanIosMessage {
15
+ action: string;
16
+ barcodeFormat: string;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ export declare enum BarcodeFormat {
2
+ ALL_FORMATS = 0,
3
+ CODE_128 = 1,
4
+ CODE_39 = 2,
5
+ CODE_93 = 4,
6
+ CODABAR = 8,
7
+ DATA_MATRIX = 16,
8
+ EAN_13 = 32,
9
+ EAN_8 = 64,
10
+ ITF = 128,
11
+ QR_CODE = 256,
12
+ UPC_A = 512,
13
+ UPC_E = 1024,
14
+ PDF417 = 2048,
15
+ AZTEC = 4096
16
+ }
17
+ export default BarcodeFormat;
@@ -1 +1,22 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _default={UNKNOWN:-1,ALL_FORMATS:0,CODE_128:1,CODE_39:2,CODE_93:4,CODABAR:8,DATA_MATRIX:16,EAN_13:32,EAN_8:64,ITF:128,QR_CODE:256,UPC_A:512,UPC_E:1024,PDF417:2048,AZTEC:4096};exports["default"]=_default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BarcodeFormat = void 0;
4
+ // Barcode formats
5
+ var BarcodeFormat;
6
+ (function (BarcodeFormat) {
7
+ BarcodeFormat[BarcodeFormat["ALL_FORMATS"] = 0] = "ALL_FORMATS";
8
+ BarcodeFormat[BarcodeFormat["CODE_128"] = 1] = "CODE_128";
9
+ BarcodeFormat[BarcodeFormat["CODE_39"] = 2] = "CODE_39";
10
+ BarcodeFormat[BarcodeFormat["CODE_93"] = 4] = "CODE_93";
11
+ BarcodeFormat[BarcodeFormat["CODABAR"] = 8] = "CODABAR";
12
+ BarcodeFormat[BarcodeFormat["DATA_MATRIX"] = 16] = "DATA_MATRIX";
13
+ BarcodeFormat[BarcodeFormat["EAN_13"] = 32] = "EAN_13";
14
+ BarcodeFormat[BarcodeFormat["EAN_8"] = 64] = "EAN_8";
15
+ BarcodeFormat[BarcodeFormat["ITF"] = 128] = "ITF";
16
+ BarcodeFormat[BarcodeFormat["QR_CODE"] = 256] = "QR_CODE";
17
+ BarcodeFormat[BarcodeFormat["UPC_A"] = 512] = "UPC_A";
18
+ BarcodeFormat[BarcodeFormat["UPC_E"] = 1024] = "UPC_E";
19
+ BarcodeFormat[BarcodeFormat["PDF417"] = 2048] = "PDF417";
20
+ BarcodeFormat[BarcodeFormat["AZTEC"] = 4096] = "AZTEC";
21
+ })(BarcodeFormat = exports.BarcodeFormat || (exports.BarcodeFormat = {}));
22
+ exports.default = BarcodeFormat;
@@ -0,0 +1,4 @@
1
+ import Format from "./formats";
2
+ import Types from "./types";
3
+ import BarcodeScan from "./barcode-scan";
4
+ export { Format, Types, BarcodeScan };
package/barcode/index.js CHANGED
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BarcodeScan",{enumerable:!0,get:function get(){return _barcodeScan["default"]}}),Object.defineProperty(exports,"Format",{enumerable:!0,get:function get(){return _formats["default"]}}),Object.defineProperty(exports,"Types",{enumerable:!0,get:function get(){return _types["default"]}});var _formats=_interopRequireDefault(require("./formats")),_types=_interopRequireDefault(require("./types")),_barcodeScan=_interopRequireDefault(require("./barcode-scan"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BarcodeScan = exports.Types = exports.Format = void 0;
7
+ var formats_1 = __importDefault(require("./formats"));
8
+ exports.Format = formats_1.default;
9
+ var types_1 = __importDefault(require("./types"));
10
+ exports.Types = types_1.default;
11
+ var barcode_scan_1 = __importDefault(require("./barcode-scan"));
12
+ exports.BarcodeScan = barcode_scan_1.default;
@@ -0,0 +1,16 @@
1
+ export declare enum BarcodeType {
2
+ QR_CODE = "QR_CODE",
3
+ DATA_MATRIX = "DATA_MATRIX",
4
+ UPC_E = "UPC_E",
5
+ UPC_A = "UPC_A",
6
+ EAN_8 = "EAN_8",
7
+ EAN_13 = "EAN_13",
8
+ CODE_128 = "CODE_128",
9
+ CODE_39 = "CODE_39",
10
+ CODE_93 = "CODE_93",
11
+ CODABAR = "CODABAR",
12
+ ITF = "ITF",
13
+ AZTEC = "AZTEC",
14
+ PDF_417 = "PDF_417"
15
+ }
16
+ export default BarcodeType;
package/barcode/types.js CHANGED
@@ -1 +1,21 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _default={UNKNOWN:0,CONTACT_INFO:1,EMAIL:2,ISBN:3,PHONE:4,PRODUCT:5,SMS:6,TEXT:7,URL:8,WIFI:9,GEO:10,CALENDAR_EVENT:11,DRIVER_LICENSE:12};exports["default"]=_default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BarcodeType = void 0;
4
+ // Barcode types
5
+ var BarcodeType;
6
+ (function (BarcodeType) {
7
+ BarcodeType["QR_CODE"] = "QR_CODE";
8
+ BarcodeType["DATA_MATRIX"] = "DATA_MATRIX";
9
+ BarcodeType["UPC_E"] = "UPC_E";
10
+ BarcodeType["UPC_A"] = "UPC_A";
11
+ BarcodeType["EAN_8"] = "EAN_8";
12
+ BarcodeType["EAN_13"] = "EAN_13";
13
+ BarcodeType["CODE_128"] = "CODE_128";
14
+ BarcodeType["CODE_39"] = "CODE_39";
15
+ BarcodeType["CODE_93"] = "CODE_93";
16
+ BarcodeType["CODABAR"] = "CODABAR";
17
+ BarcodeType["ITF"] = "ITF";
18
+ BarcodeType["AZTEC"] = "AZTEC";
19
+ BarcodeType["PDF_417"] = "PDF_417";
20
+ })(BarcodeType = exports.BarcodeType || (exports.BarcodeType = {}));
21
+ exports.default = BarcodeType;