natively 2.14.0 → 2.15.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.
Files changed (65) hide show
  1. package/README.md +63 -5
  2. package/dist/classes/Natively.d.ts +22 -0
  3. package/dist/classes/Natively.js +139 -0
  4. package/dist/classes/NativelyAdmobBanner.d.ts +16 -0
  5. package/dist/classes/NativelyAdmobBanner.js +53 -0
  6. package/dist/classes/NativelyAdmobInterstitial.d.ts +17 -0
  7. package/dist/classes/NativelyAdmobInterstitial.js +54 -0
  8. package/dist/classes/NativelyAppleSignInService.d.ts +4 -0
  9. package/dist/classes/NativelyAppleSignInService.js +13 -0
  10. package/dist/classes/NativelyAudioRecorder.d.ts +4 -0
  11. package/dist/classes/NativelyAudioRecorder.js +16 -0
  12. package/dist/classes/NativelyBiometrics.d.ts +11 -0
  13. package/dist/classes/NativelyBiometrics.js +40 -0
  14. package/dist/classes/NativelyCamera.d.ts +4 -0
  15. package/dist/classes/NativelyCamera.js +18 -0
  16. package/dist/classes/NativelyClipboard.d.ts +5 -0
  17. package/dist/classes/NativelyClipboard.js +18 -0
  18. package/dist/classes/NativelyContacts.d.ts +5 -0
  19. package/dist/classes/NativelyContacts.js +22 -0
  20. package/dist/classes/NativelyDatePicker.d.ts +4 -0
  21. package/dist/classes/NativelyDatePicker.js +19 -0
  22. package/dist/classes/NativelyFirebaseNotifications.d.ts +9 -0
  23. package/dist/classes/NativelyFirebaseNotifications.js +32 -0
  24. package/dist/classes/NativelyGeolocation.d.ts +6 -0
  25. package/dist/classes/NativelyGeolocation.js +23 -0
  26. package/dist/classes/NativelyHealth.d.ts +8 -0
  27. package/dist/classes/NativelyHealth.js +40 -0
  28. package/dist/classes/NativelyInfo.d.ts +11 -0
  29. package/dist/classes/NativelyInfo.js +33 -0
  30. package/dist/classes/NativelyLocation.d.ts +10 -0
  31. package/dist/classes/NativelyLocation.js +47 -0
  32. package/dist/classes/NativelyMediaPicker.d.ts +4 -0
  33. package/dist/classes/NativelyMediaPicker.js +13 -0
  34. package/dist/classes/NativelyMessage.d.ts +5 -0
  35. package/dist/classes/NativelyMessage.js +25 -0
  36. package/dist/classes/NativelyNFCService.d.ts +11 -0
  37. package/dist/classes/NativelyNFCService.js +39 -0
  38. package/dist/classes/NativelyNotifications.d.ts +6 -0
  39. package/dist/classes/NativelyNotifications.js +21 -0
  40. package/dist/classes/NativelyPurchases.d.ts +9 -0
  41. package/dist/classes/NativelyPurchases.js +36 -0
  42. package/dist/classes/NativelyScanner.d.ts +4 -0
  43. package/dist/classes/NativelyScanner.js +13 -0
  44. package/dist/classes/NativelyStorage.d.ts +7 -0
  45. package/dist/classes/NativelyStorage.js +29 -0
  46. package/dist/events.d.ts +1 -0
  47. package/dist/events.js +7 -0
  48. package/dist/hooks/useNatively.d.ts +2 -0
  49. package/dist/hooks/useNatively.js +2 -0
  50. package/dist/index.d.ts +27 -0
  51. package/dist/index.js +34 -0
  52. package/dist/inject.d.ts +1 -0
  53. package/dist/inject.js +50 -0
  54. package/dist/types.d.ts +54 -0
  55. package/dist/types.js +1 -0
  56. package/dist/utils/generateID.d.ts +1 -0
  57. package/dist/utils/generateID.js +1 -0
  58. package/dist/utils/globalThis.d.ts +2 -0
  59. package/dist/utils/globalThis.js +25 -0
  60. package/natively-frontend.min.js +1 -1
  61. package/package.json +36 -7
  62. package/.vscode/settings.json +0 -13
  63. package/natively-frontend.js +0 -977
  64. package/natively-frontend.min.mjs +0 -1
  65. package/natively-frontend.mjs +0 -979
@@ -0,0 +1,6 @@
1
+ export declare class NativelyGeolocation {
2
+ private readonly id;
3
+ getUserGeolocation(distance: number, geolocation_callback: Function): void;
4
+ requestPermission(geo_register_callback: Function): void;
5
+ getPermissionStatus(geo_permission_callback: Function): void;
6
+ }
@@ -0,0 +1,23 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+
7
+ // Legacy use Natively Location
8
+ export class NativelyGeolocation {
9
+ constructor() {
10
+ _defineProperty(this, "id", generateID());
11
+ }
12
+ getUserGeolocation(distance, geolocation_callback) {
13
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, geolocation_callback, "geolocation", {
14
+ distance
15
+ });
16
+ }
17
+ requestPermission(geo_register_callback) {
18
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, geo_register_callback, "geo_register");
19
+ }
20
+ getPermissionStatus(geo_permission_callback) {
21
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, geo_permission_callback, "geo_permission");
22
+ }
23
+ }
@@ -0,0 +1,8 @@
1
+ export declare class NativelyHealth {
2
+ private readonly id;
3
+ available(available_callback: Function): void;
4
+ requestAuthorization(write_data_types: string[], read_data_types: string[], request_callback: Function): void;
5
+ permissionStatus(data_type: string, callback: Function): void;
6
+ getAllCharacteristics(callback: Function): void;
7
+ getStatisticQuantity(data_type: string, interval: string, start_date?: Date, end_date?: Date, callback?: Function): void;
8
+ }
@@ -0,0 +1,40 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyHealth {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ available(available_callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, available_callback, "health_available", {});
12
+ }
13
+ requestAuthorization(write_data_types, read_data_types, request_callback) {
14
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, request_callback, "health_register", {
15
+ write_data_types,
16
+ read_data_types
17
+ });
18
+ }
19
+ permissionStatus(data_type, callback) {
20
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, callback, "health_permission", {
21
+ data_type
22
+ });
23
+ }
24
+ getAllCharacteristics(callback) {
25
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, callback, "health_get_all_characteristics", {});
26
+ }
27
+ getStatisticQuantity(data_type, interval, start_date, end_date, callback) {
28
+ var obj = {
29
+ data_type,
30
+ interval
31
+ };
32
+ if (start_date) {
33
+ obj.start_date = start_date.getTime();
34
+ }
35
+ if (end_date) {
36
+ obj.end_date = end_date.getTime();
37
+ }
38
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, callback, "health_get_statistic_quantity", obj);
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ export declare class NativelyInfo {
2
+ private readonly id;
3
+ browserInfo(): {
4
+ isNativeApp: boolean;
5
+ isIOSApp: boolean;
6
+ isAndroidApp: boolean;
7
+ };
8
+ getAppInfo(app_info_callback: Function): void;
9
+ connectivity(connectivity_callback: Function): void;
10
+ app_state(app_state_callback: Function): void;
11
+ }
@@ -0,0 +1,33 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyInfo {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ browserInfo() {
11
+ var _globalContext$naviga, _globalContext$naviga2;
12
+ var isNativeApp = typeof (globalContext === null || globalContext === void 0 ? void 0 : globalContext.$agent) !== "undefined";
13
+ var isIOSApp = (globalContext === null || globalContext === void 0 || (_globalContext$naviga = globalContext.navigator) === null || _globalContext$naviga === void 0 || (_globalContext$naviga = _globalContext$naviga.userAgent) === null || _globalContext$naviga === void 0 ? void 0 : _globalContext$naviga.includes("Natively/iOS")) || false;
14
+ var isAndroidApp = (globalContext === null || globalContext === void 0 || (_globalContext$naviga2 = globalContext.navigator) === null || _globalContext$naviga2 === void 0 || (_globalContext$naviga2 = _globalContext$naviga2.userAgent) === null || _globalContext$naviga2 === void 0 ? void 0 : _globalContext$naviga2.includes("Natively/Android")) || false;
15
+ return {
16
+ isNativeApp,
17
+ isIOSApp,
18
+ isAndroidApp
19
+ };
20
+ }
21
+ getAppInfo(app_info_callback) {
22
+ if (!(globalContext !== null && globalContext !== void 0 && globalContext.natively)) return;
23
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, app_info_callback, "app_info");
24
+ }
25
+ connectivity(connectivity_callback) {
26
+ if (!(globalContext !== null && globalContext !== void 0 && globalContext.natively)) return;
27
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, connectivity_callback, "connectivity");
28
+ }
29
+ app_state(app_state_callback) {
30
+ if (!(globalContext !== null && globalContext !== void 0 && globalContext.natively)) return;
31
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 19, app_state_callback, "app_state");
32
+ }
33
+ }
@@ -0,0 +1,10 @@
1
+ export declare class NativelyLocation {
2
+ private readonly id;
3
+ current(minAccuracyIOS: number, accuracyTypeIOS: string, priority_android: string, location_callback: Function): void;
4
+ permission(location_permission_callback: Function): void;
5
+ start(interval: number, minAccuracyIOS: number, accuracyTypeIOS: string, priority_android: string, location_callback: Function): void;
6
+ stop(): void;
7
+ startBackground(interval?: number, minAccuracyIOS?: number, accuracyTypeIOS?: string, priority_android?: string, responseIdentifier?: string, location_bg_callback?: Function): void;
8
+ statusBackground(location_bg_status_callback: Function): void;
9
+ stopBackground(location_bg_callback: Function): void;
10
+ }
@@ -0,0 +1,47 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyLocation {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ current(minAccuracyIOS, accuracyTypeIOS, priority_android, location_callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 12, location_callback, "location_current", {
12
+ minAccuracy: minAccuracyIOS,
13
+ accuracyType: accuracyTypeIOS,
14
+ priority: priority_android
15
+ });
16
+ }
17
+ permission(location_permission_callback) {
18
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 6, location_permission_callback, "location_permission");
19
+ }
20
+ start(interval, minAccuracyIOS, accuracyTypeIOS, priority_android, location_callback) {
21
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 12, location_callback, "location_start", {
22
+ minAccuracy: minAccuracyIOS,
23
+ accuracyType: accuracyTypeIOS,
24
+ priority: priority_android,
25
+ interval
26
+ });
27
+ }
28
+ stop() {
29
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, undefined, "location_stop", {});
30
+ }
31
+ startBackground(interval, minAccuracyIOS, accuracyTypeIOS, priority_android, responseIdentifier, location_bg_callback) {
32
+ var params = {
33
+ identifier: responseIdentifier !== null && responseIdentifier !== void 0 ? responseIdentifier : "empty",
34
+ interval: interval !== null && interval !== void 0 ? interval : 1000 * 60,
35
+ minAccuracy: minAccuracyIOS !== null && minAccuracyIOS !== void 0 ? minAccuracyIOS : 50,
36
+ accuracyType: accuracyTypeIOS !== null && accuracyTypeIOS !== void 0 ? accuracyTypeIOS : "Best",
37
+ priority: priority_android !== null && priority_android !== void 0 ? priority_android : "BALANCED"
38
+ };
39
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 12, location_bg_callback, "location_start_bg", params);
40
+ }
41
+ statusBackground(location_bg_status_callback) {
42
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 20, location_bg_status_callback, "location_status_bg", {});
43
+ }
44
+ stopBackground(location_bg_callback) {
45
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 4, location_bg_callback, "location_stop_bg", {});
46
+ }
47
+ }
@@ -0,0 +1,4 @@
1
+ export declare class NativelyMediaPicker {
2
+ private readonly id;
3
+ showMediaPicker(mediapicker_callback: Function): void;
4
+ }
@@ -0,0 +1,13 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyMediaPicker {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ showMediaPicker(mediapicker_callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 8, mediapicker_callback, "mediapicker", {});
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ export declare class NativelyMessage {
2
+ private readonly id;
3
+ sendSMS(body?: string, recipient?: string, send_sms_callback?: Function): void;
4
+ sendEmail(subject?: string, body?: string, recipient?: string, send_email_callback?: Function): void;
5
+ }
@@ -0,0 +1,25 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyMessage {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ sendSMS(body, recipient, send_sms_callback) {
11
+ var params = {
12
+ body: body !== null && body !== void 0 ? body : "",
13
+ recipient: recipient !== null && recipient !== void 0 ? recipient : ""
14
+ };
15
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, send_sms_callback, "send_sms", params);
16
+ }
17
+ sendEmail(subject, body, recipient, send_email_callback) {
18
+ var params = {
19
+ subject: subject !== null && subject !== void 0 ? subject : "",
20
+ body: body !== null && body !== void 0 ? body : "",
21
+ recipient: recipient !== null && recipient !== void 0 ? recipient : ""
22
+ };
23
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, send_email_callback, "send_email", params);
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ export declare class NativelyNFCService {
2
+ private readonly id;
3
+ private readAlertMessage;
4
+ private writeAlertMessage;
5
+ private readDetectedMessage;
6
+ private writeDetectedMessage;
7
+ constructor(readAlertMessage: string, writeAlertMessage: string, readDetectedMessage: string, writeDetectedMessage: string);
8
+ read(callback: Function): void;
9
+ write(recordId: string, recordData: string, callback: Function): void;
10
+ available(callback: Function): void;
11
+ }
@@ -0,0 +1,39 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyNFCService {
7
+ constructor(readAlertMessage, writeAlertMessage, readDetectedMessage, writeDetectedMessage) {
8
+ _defineProperty(this, "id", generateID());
9
+ _defineProperty(this, "readAlertMessage", void 0);
10
+ _defineProperty(this, "writeAlertMessage", void 0);
11
+ _defineProperty(this, "readDetectedMessage", void 0);
12
+ _defineProperty(this, "writeDetectedMessage", void 0);
13
+ this.readAlertMessage = readAlertMessage;
14
+ this.writeAlertMessage = writeAlertMessage;
15
+ this.readDetectedMessage = readDetectedMessage;
16
+ this.writeDetectedMessage = writeDetectedMessage;
17
+ }
18
+ read(callback) {
19
+ var _this$readAlertMessag, _this$readDetectedMes;
20
+ var params = {
21
+ alertMessage: (_this$readAlertMessag = this.readAlertMessage) !== null && _this$readAlertMessag !== void 0 ? _this$readAlertMessag : "please set readAlertMessage",
22
+ detectedMessage: (_this$readDetectedMes = this.readDetectedMessage) !== null && _this$readDetectedMes !== void 0 ? _this$readDetectedMes : "readDetectedMessage"
23
+ };
24
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 15, callback, "nfc_read", params);
25
+ }
26
+ write(recordId, recordData, callback) {
27
+ var _this$writeAlertMessa, _this$writeDetectedMe;
28
+ var params = {
29
+ alertMessage: (_this$writeAlertMessa = this.writeAlertMessage) !== null && _this$writeAlertMessa !== void 0 ? _this$writeAlertMessa : "please set writeAlertMessage",
30
+ detectedMessage: (_this$writeDetectedMe = this.writeDetectedMessage) !== null && _this$writeDetectedMe !== void 0 ? _this$writeDetectedMe : "please set writeDetectedMessage",
31
+ recordData: recordData !== null && recordData !== void 0 ? recordData : "please set recordData",
32
+ recordId: recordId !== null && recordId !== void 0 ? recordId : "please set recordId"
33
+ };
34
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 15, callback, "nfc_write", params);
35
+ }
36
+ available(callback) {
37
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 15, callback, "nfc_available", {});
38
+ }
39
+ }
@@ -0,0 +1,6 @@
1
+ export declare class NativelyNotifications {
2
+ private readonly id;
3
+ getOneSignalId(onesignal_playerid_callback: Function): void;
4
+ requestPermission(fallbackToSettings: boolean, push_register_callback: Function): void;
5
+ getPermissionStatus(push_permission_callback: Function): void;
6
+ }
@@ -0,0 +1,21 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyNotifications {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ getOneSignalId(onesignal_playerid_callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, onesignal_playerid_callback, "onesignal_playerid");
12
+ }
13
+ requestPermission(fallbackToSettings, push_register_callback) {
14
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, push_register_callback, "push_register", {
15
+ fallbackToSettings
16
+ });
17
+ }
18
+ getPermissionStatus(push_permission_callback) {
19
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, push_permission_callback, "push_permission");
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ export declare class NativelyPurchases {
2
+ private readonly id;
3
+ login(login: string, customerEmail?: string, login_callback?: Function): void;
4
+ logout(logout_callback: Function): void;
5
+ customerId(customer_id_callback: Function): void;
6
+ restore(restore_callback: Function): void;
7
+ purchasePackage(packageId: string, purchase_callback: Function): void;
8
+ packagePrice(packageId: string, purchase_callback: Function): void;
9
+ }
@@ -0,0 +1,36 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyPurchases {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ login(login, customerEmail, login_callback) {
11
+ var email = customerEmail !== null && customerEmail !== void 0 ? customerEmail : "";
12
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, login_callback, "purchases_login", {
13
+ login,
14
+ email
15
+ });
16
+ }
17
+ logout(logout_callback) {
18
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, logout_callback, "purchases_logout", {});
19
+ }
20
+ customerId(customer_id_callback) {
21
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, customer_id_callback, "purchases_customerid", {});
22
+ }
23
+ restore(restore_callback) {
24
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 10, restore_callback, "purchases_restore", {});
25
+ }
26
+ purchasePackage(packageId, purchase_callback) {
27
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, purchase_callback, "purchases_package", {
28
+ packageId
29
+ });
30
+ }
31
+ packagePrice(packageId, purchase_callback) {
32
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 8, purchase_callback, "purchases_price", {
33
+ packageId
34
+ });
35
+ }
36
+ }
@@ -0,0 +1,4 @@
1
+ export declare class NativelyScanner {
2
+ private readonly id;
3
+ showScanner(open_scanner_callback: Function): void;
4
+ }
@@ -0,0 +1,13 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyScanner {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ showScanner(open_scanner_callback) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 2, open_scanner_callback, "open_scanner", {});
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ export declare class NativelyStorage {
2
+ private readonly id;
3
+ setStorageValue(key: string, value: any): void;
4
+ getStorageValue(key: string, get_storage_value_callback: Function): void;
5
+ removeStorageValue(key: string): void;
6
+ resetStorage(): void;
7
+ }
@@ -0,0 +1,29 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { generateID } from "../utils/generateID";
5
+ import globalContext from "../utils/globalThis";
6
+ export class NativelyStorage {
7
+ constructor() {
8
+ _defineProperty(this, "id", generateID());
9
+ }
10
+ setStorageValue(key, value) {
11
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, undefined, "set_storage_value", {
12
+ key,
13
+ value
14
+ });
15
+ }
16
+ getStorageValue(key, get_storage_value_callback) {
17
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, get_storage_value_callback, "get_storage_value", {
18
+ key
19
+ });
20
+ }
21
+ removeStorageValue(key) {
22
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, undefined, "remove_storage_value", {
23
+ key
24
+ });
25
+ }
26
+ resetStorage() {
27
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, undefined, "reset_storage");
28
+ }
29
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/events.js ADDED
@@ -0,0 +1,7 @@
1
+ import globalContext from "./utils/globalThis";
2
+ globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.addObserver(() => globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.trigger(undefined, 0, resp => {
3
+ if (globalContext) {
4
+ globalContext.natively.min_app_version = resp.minSDKVersion;
5
+ globalContext.natively.app_version = resp.sdkVersion;
6
+ }
7
+ }, "app_info", {}));
@@ -0,0 +1,2 @@
1
+ import { Natively } from "../classes/Natively";
2
+ export declare const useNatively: () => Natively;
@@ -0,0 +1,2 @@
1
+ import globalContext from "../utils/globalThis";
2
+ export var useNatively = () => globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively;
@@ -0,0 +1,27 @@
1
+ export { Natively } from "./classes/Natively";
2
+ export { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService";
3
+ export { NativelyClipboard } from "./classes/NativelyClipboard";
4
+ export { NativelyInfo } from "./classes/NativelyInfo";
5
+ export { NativelyNotifications } from "./classes/NativelyNotifications";
6
+ export { NativelyGeolocation } from "./classes/NativelyGeolocation";
7
+ export { NativelyLocation } from "./classes/NativelyLocation";
8
+ export { NativelyMessage } from "./classes/NativelyMessage";
9
+ export { NativelyStorage } from "./classes/NativelyStorage";
10
+ export { NativelyBiometrics } from "./classes/NativelyBiometrics";
11
+ export { NativelyDatePicker } from "./classes/NativelyDatePicker";
12
+ export { NativelyCamera } from "./classes/NativelyCamera";
13
+ export { NativelyHealth } from "./classes/NativelyHealth";
14
+ export { NativelyScanner } from "./classes/NativelyScanner";
15
+ export { NativelyPurchases } from "./classes/NativelyPurchases";
16
+ export { NativelyContacts } from "./classes/NativelyContacts";
17
+ export { NativelyMediaPicker } from "./classes/NativelyMediaPicker";
18
+ export { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder";
19
+ export { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner";
20
+ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
21
+ export { NativelyNFCService } from "./classes/NativelyNFCService";
22
+ export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications';
23
+ export { useNatively } from './hooks/useNatively';
24
+ export { generateID } from "./utils/generateID";
25
+ import "./types";
26
+ import "./inject";
27
+ import "./events";
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ // Classes
2
+ export { Natively } from "./classes/Natively";
3
+ export { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService";
4
+ export { NativelyClipboard } from "./classes/NativelyClipboard";
5
+ export { NativelyInfo } from "./classes/NativelyInfo";
6
+ export { NativelyNotifications } from "./classes/NativelyNotifications";
7
+ export { NativelyGeolocation } from "./classes/NativelyGeolocation";
8
+ export { NativelyLocation } from "./classes/NativelyLocation";
9
+ export { NativelyMessage } from "./classes/NativelyMessage";
10
+ export { NativelyStorage } from "./classes/NativelyStorage";
11
+ export { NativelyBiometrics } from "./classes/NativelyBiometrics";
12
+ export { NativelyDatePicker } from "./classes/NativelyDatePicker";
13
+ export { NativelyCamera } from "./classes/NativelyCamera";
14
+ export { NativelyHealth } from "./classes/NativelyHealth";
15
+ export { NativelyScanner } from "./classes/NativelyScanner";
16
+ export { NativelyPurchases } from "./classes/NativelyPurchases";
17
+ export { NativelyContacts } from "./classes/NativelyContacts";
18
+ export { NativelyMediaPicker } from "./classes/NativelyMediaPicker";
19
+ export { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder";
20
+ export { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner";
21
+ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
22
+ export { NativelyNFCService } from "./classes/NativelyNFCService";
23
+ export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications';
24
+
25
+ // Hooks
26
+ export { useNatively } from './hooks/useNatively';
27
+
28
+ // Utils
29
+ export { generateID } from "./utils/generateID";
30
+
31
+ // Global stuff
32
+ import "./types";
33
+ import "./inject";
34
+ import "./events";
@@ -0,0 +1 @@
1
+ export {};
package/dist/inject.js ADDED
@@ -0,0 +1,50 @@
1
+ import globalContext from "./utils/globalThis";
2
+ import { Natively } from "./classes/Natively";
3
+ import { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner";
4
+ import { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
5
+ import { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService";
6
+ import { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder";
7
+ import { NativelyBiometrics } from "./classes/NativelyBiometrics";
8
+ import { NativelyCamera } from "./classes/NativelyCamera";
9
+ import { NativelyClipboard } from "./classes/NativelyClipboard";
10
+ import { NativelyContacts } from "./classes/NativelyContacts";
11
+ import { NativelyDatePicker } from "./classes/NativelyDatePicker";
12
+ import { NativelyGeolocation } from "./classes/NativelyGeolocation";
13
+ import { NativelyHealth } from "./classes/NativelyHealth";
14
+ import { NativelyInfo } from "./classes/NativelyInfo";
15
+ import { NativelyLocation } from "./classes/NativelyLocation";
16
+ import { NativelyMediaPicker } from "./classes/NativelyMediaPicker";
17
+ import { NativelyMessage } from "./classes/NativelyMessage";
18
+ import { NativelyNFCService } from "./classes/NativelyNFCService";
19
+ import { NativelyNotifications } from "./classes/NativelyNotifications";
20
+ import { NativelyPurchases } from "./classes/NativelyPurchases";
21
+ import { NativelyScanner } from "./classes/NativelyScanner";
22
+ import { NativelyStorage } from "./classes/NativelyStorage";
23
+ import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications";
24
+
25
+ // Assign natively to the global object
26
+ if (globalContext) {
27
+ globalContext.natively = new Natively();
28
+ // All other classes must be global to make a possibility to create any number of their instances
29
+ globalContext.NativelyAdmobBanner = NativelyAdmobBanner;
30
+ globalContext.NativelyAdmobInterstitial = NativelyAdmobInterstitial;
31
+ globalContext.NativelyAppleSignInService = NativelyAppleSignInService;
32
+ globalContext.NativelyAudioRecorder = NativelyAudioRecorder;
33
+ globalContext.NativelyBiometrics = NativelyBiometrics;
34
+ globalContext.NativelyCamera = NativelyCamera;
35
+ globalContext.NativelyClipboard = NativelyClipboard;
36
+ globalContext.NativelyContacts = NativelyContacts;
37
+ globalContext.NativelyDatePicker = NativelyDatePicker;
38
+ globalContext.NativelyGeolocation = NativelyGeolocation;
39
+ globalContext.NativelyHealth = NativelyHealth;
40
+ globalContext.NativelyInfo = NativelyInfo;
41
+ globalContext.NativelyLocation = NativelyLocation;
42
+ globalContext.NativelyMediaPicker = NativelyMediaPicker;
43
+ globalContext.NativelyMessage = NativelyMessage;
44
+ globalContext.NativelyNFCService = NativelyNFCService;
45
+ globalContext.NativelyNotifications = NativelyNotifications;
46
+ globalContext.NativelyPurchases = NativelyPurchases;
47
+ globalContext.NativelyScanner = NativelyScanner;
48
+ globalContext.NativelyStorage = NativelyStorage;
49
+ globalContext.NativelyFirebaseNotifications = NativelyFirebaseNotifications;
50
+ }