natively 2.15.7 → 2.15.9
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/README.md +9 -0
- package/dist/classes/NativelyTabBar.d.ts +5 -0
- package/dist/classes/NativelyTabBar.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inject.js +4 -0
- package/dist/private/NativelyBluetoothPrinter.d.ts +96 -0
- package/dist/private/NativelyBluetoothPrinter.js +134 -0
- package/dist/types.d.ts +2 -0
- package/natively-frontend.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -81,5 +81,14 @@ const natively = useNatively();
|
|
|
81
81
|
natively.openConsole();
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### Release new version (for developers)
|
|
85
|
+
0. login to npm registry
|
|
86
|
+
1. npm run build
|
|
87
|
+
2. git commit...
|
|
88
|
+
3. npm version patch/minor/major
|
|
89
|
+
4. npm publish
|
|
90
|
+
5. git push...
|
|
91
|
+
6. Create a new release in GitHub
|
|
92
|
+
|
|
84
93
|
More in [documentation](https://docs.buildnatively.com/guides/integration/how-to-get-started#javascript-sdk)
|
|
85
94
|
|
|
@@ -0,0 +1,16 @@
|
|
|
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.js";
|
|
5
|
+
import globalContext from "../utils/globalThis.js";
|
|
6
|
+
export class NativelyTabBar {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
showTabBar() {
|
|
11
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 33, "show_tab_bar");
|
|
12
|
+
}
|
|
13
|
+
hideTabBar() {
|
|
14
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 33, "hide_tab_bar");
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
|
|
|
21
21
|
export { NativelyNFCService } from "./classes/NativelyNFCService";
|
|
22
22
|
export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications';
|
|
23
23
|
export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications';
|
|
24
|
+
export { NativelyTabBar } from './classes/NativelyTabBar';
|
|
24
25
|
export { useNatively } from './hooks/useNatively';
|
|
25
26
|
export { generateID } from "./utils/generateID";
|
|
26
27
|
import "./types";
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial.j
|
|
|
22
22
|
export { NativelyNFCService } from "./classes/NativelyNFCService.js";
|
|
23
23
|
export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications.js';
|
|
24
24
|
export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
|
|
25
|
+
export { NativelyTabBar } from './classes/NativelyTabBar.js';
|
|
25
26
|
|
|
26
27
|
// Hooks
|
|
27
28
|
export { useNatively } from './hooks/useNatively.js';
|
package/dist/inject.js
CHANGED
|
@@ -21,6 +21,8 @@ import { NativelyPurchases } from "./classes/NativelyPurchases.js";
|
|
|
21
21
|
import { NativelyScanner } from "./classes/NativelyScanner.js";
|
|
22
22
|
import { NativelyStorage } from "./classes/NativelyStorage.js";
|
|
23
23
|
import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications.js";
|
|
24
|
+
import { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
|
|
25
|
+
import { NativelyTabBar } from './classes/NativelyTabBar.js';
|
|
24
26
|
|
|
25
27
|
// Assign natively to the global object
|
|
26
28
|
if (globalContext) {
|
|
@@ -47,4 +49,6 @@ if (globalContext) {
|
|
|
47
49
|
globalContext.NativelyScanner = NativelyScanner;
|
|
48
50
|
globalContext.NativelyStorage = NativelyStorage;
|
|
49
51
|
globalContext.NativelyFirebaseNotifications = NativelyFirebaseNotifications;
|
|
52
|
+
globalContext.NativelyKlaviyoNotifications = NativelyKlaviyoNotifications;
|
|
53
|
+
globalContext.NativelyTabBar = NativelyTabBar;
|
|
50
54
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativelyBluetoothPrinter class provides methods for Bluetooth device management and printing operations.
|
|
3
|
+
* This class handles device discovery, connection management, service discovery, and data printing.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
*
|
|
7
|
+
* const printer = new NativelyBluetoothPrinter();
|
|
8
|
+
*
|
|
9
|
+
* // 1. Discover devices
|
|
10
|
+
* printer.discoverDevices((response) => {
|
|
11
|
+
* if (response.devices) {
|
|
12
|
+
* // Handle list of devices
|
|
13
|
+
* }
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // 2. Connect to a device
|
|
17
|
+
* printer.connectDevice("00:11:22:33:AA:BB", (response) => {
|
|
18
|
+
* if (response.status === "SUCCESS") {
|
|
19
|
+
* // Connected successfully
|
|
20
|
+
* }
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // 3. Discover services (optional for bonded printers)
|
|
24
|
+
* printer.discoverService((response) => {
|
|
25
|
+
* if (response.status === "SUCCESS") {
|
|
26
|
+
* // Handle services and characteristics
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // 4. Print data
|
|
31
|
+
* printer.printData("27,112,0,25,250", "18f0", "2af1", 2, (response) => {
|
|
32
|
+
* if (response.status === "SUCCESS") {
|
|
33
|
+
* // Printing successful
|
|
34
|
+
* }
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare class NativelyBluetoothPrinter {
|
|
39
|
+
private readonly id;
|
|
40
|
+
/**
|
|
41
|
+
* Discovers available Bluetooth devices.
|
|
42
|
+
* @param callback Function to handle the response containing list of devices
|
|
43
|
+
* @callback {Object} response
|
|
44
|
+
* @callback {Array<{name: string, id: string}>} [response.devices] - List of discovered devices
|
|
45
|
+
* @callback {string} [response.status] - Status of the operation if failed
|
|
46
|
+
* @callback {string} [response.message] - Error message if failed
|
|
47
|
+
*/
|
|
48
|
+
discoverDevices(callback: Function): void;
|
|
49
|
+
/**
|
|
50
|
+
* Connects to a specified Bluetooth device.
|
|
51
|
+
* @param deviceId The unique identifier of the device to connect
|
|
52
|
+
* @param callback Function to handle the connection response
|
|
53
|
+
* @callback {Object} response
|
|
54
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
55
|
+
* @callback {string} [response.message] - Error message if failed
|
|
56
|
+
*/
|
|
57
|
+
connectDevice(deviceId: string, callback: Function): void;
|
|
58
|
+
/**
|
|
59
|
+
* Disconnects from the currently connected Bluetooth device.
|
|
60
|
+
* @param callback Function to handle the disconnection response
|
|
61
|
+
* @callback {Object} response
|
|
62
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
63
|
+
* @callback {string} [response.message] - Error message if failed
|
|
64
|
+
*/
|
|
65
|
+
disconnectDevice(callback: Function): void;
|
|
66
|
+
/**
|
|
67
|
+
* Discovers available services and characteristics on the connected device.
|
|
68
|
+
* @param callback Function to handle the service discovery response
|
|
69
|
+
* @callback {Object} response
|
|
70
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
71
|
+
* @callback {Array<{service_id: string, characteristics: string[]}>} [response.services] - List of services and characteristics
|
|
72
|
+
* @callback {string} [response.message] - Additional information or error message
|
|
73
|
+
*/
|
|
74
|
+
discoverService(callback: Function): void;
|
|
75
|
+
/**
|
|
76
|
+
* Sends data to the connected printer.
|
|
77
|
+
* @param payload Comma-separated byte values to print
|
|
78
|
+
* @param serviceId UUID of the service to use (default: '18f0')
|
|
79
|
+
* @param characteristicId UUID of the characteristic to use (default: '2af1')
|
|
80
|
+
* @param linesToAppend Number of new lines to append after printing (default: 0)
|
|
81
|
+
* @param callback Function to handle the printing response
|
|
82
|
+
* @callback {Object} response
|
|
83
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
84
|
+
* @callback {string} [response.message] - Error message if failed
|
|
85
|
+
*/
|
|
86
|
+
printData(payload: string, serviceId: string | undefined, characteristicId: string | undefined, linesToAppend: number | undefined, callback: Function): void;
|
|
87
|
+
/**
|
|
88
|
+
* Checks if a specific device is currently connected.
|
|
89
|
+
* @param deviceId The unique identifier of the device to check
|
|
90
|
+
* @param callback Function to handle the connection status response
|
|
91
|
+
* @callback {Object} response
|
|
92
|
+
* @callback {boolean} response.is_connected - Whether the device is connected
|
|
93
|
+
* @callback {string} [response.message] - Additional information if another device is connected
|
|
94
|
+
*/
|
|
95
|
+
isDeviceConnected(deviceId: string, callback: Function): void;
|
|
96
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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.js";
|
|
5
|
+
import globalContext from "../utils/globalThis.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* NativelyBluetoothPrinter class provides methods for Bluetooth device management and printing operations.
|
|
9
|
+
* This class handles device discovery, connection management, service discovery, and data printing.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* const printer = new NativelyBluetoothPrinter();
|
|
14
|
+
*
|
|
15
|
+
* // 1. Discover devices
|
|
16
|
+
* printer.discoverDevices((response) => {
|
|
17
|
+
* if (response.devices) {
|
|
18
|
+
* // Handle list of devices
|
|
19
|
+
* }
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // 2. Connect to a device
|
|
23
|
+
* printer.connectDevice("00:11:22:33:AA:BB", (response) => {
|
|
24
|
+
* if (response.status === "SUCCESS") {
|
|
25
|
+
* // Connected successfully
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // 3. Discover services (optional for bonded printers)
|
|
30
|
+
* printer.discoverService((response) => {
|
|
31
|
+
* if (response.status === "SUCCESS") {
|
|
32
|
+
* // Handle services and characteristics
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // 4. Print data
|
|
37
|
+
* printer.printData("27,112,0,25,250", "18f0", "2af1", 2, (response) => {
|
|
38
|
+
* if (response.status === "SUCCESS") {
|
|
39
|
+
* // Printing successful
|
|
40
|
+
* }
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
export class NativelyBluetoothPrinter {
|
|
45
|
+
constructor() {
|
|
46
|
+
_defineProperty(this, "id", generateID());
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Discovers available Bluetooth devices.
|
|
50
|
+
* @param callback Function to handle the response containing list of devices
|
|
51
|
+
* @callback {Object} response
|
|
52
|
+
* @callback {Array<{name: string, id: string}>} [response.devices] - List of discovered devices
|
|
53
|
+
* @callback {string} [response.status] - Status of the operation if failed
|
|
54
|
+
* @callback {string} [response.message] - Error message if failed
|
|
55
|
+
*/
|
|
56
|
+
discoverDevices(callback) {
|
|
57
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "discover_devices");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Connects to a specified Bluetooth device.
|
|
62
|
+
* @param deviceId The unique identifier of the device to connect
|
|
63
|
+
* @param callback Function to handle the connection response
|
|
64
|
+
* @callback {Object} response
|
|
65
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
66
|
+
* @callback {string} [response.message] - Error message if failed
|
|
67
|
+
*/
|
|
68
|
+
connectDevice(deviceId, callback) {
|
|
69
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "connect_device", {
|
|
70
|
+
device_id: deviceId
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Disconnects from the currently connected Bluetooth device.
|
|
76
|
+
* @param callback Function to handle the disconnection response
|
|
77
|
+
* @callback {Object} response
|
|
78
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
79
|
+
* @callback {string} [response.message] - Error message if failed
|
|
80
|
+
*/
|
|
81
|
+
disconnectDevice(callback) {
|
|
82
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "disconnect_device");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Discovers available services and characteristics on the connected device.
|
|
87
|
+
* @param callback Function to handle the service discovery response
|
|
88
|
+
* @callback {Object} response
|
|
89
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
90
|
+
* @callback {Array<{service_id: string, characteristics: string[]}>} [response.services] - List of services and characteristics
|
|
91
|
+
* @callback {string} [response.message] - Additional information or error message
|
|
92
|
+
*/
|
|
93
|
+
discoverService(callback) {
|
|
94
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "discover_service");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Sends data to the connected printer.
|
|
99
|
+
* @param payload Comma-separated byte values to print
|
|
100
|
+
* @param serviceId UUID of the service to use (default: '18f0')
|
|
101
|
+
* @param characteristicId UUID of the characteristic to use (default: '2af1')
|
|
102
|
+
* @param linesToAppend Number of new lines to append after printing (default: 0)
|
|
103
|
+
* @param callback Function to handle the printing response
|
|
104
|
+
* @callback {Object} response
|
|
105
|
+
* @callback {string} response.status - "SUCCESS" or "FAILED"
|
|
106
|
+
* @callback {string} [response.message] - Error message if failed
|
|
107
|
+
*/
|
|
108
|
+
printData(payload) {
|
|
109
|
+
var serviceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '18f0';
|
|
110
|
+
var characteristicId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '2af1';
|
|
111
|
+
var linesToAppend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
112
|
+
var callback = arguments.length > 4 ? arguments[4] : undefined;
|
|
113
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "print_data", {
|
|
114
|
+
payload,
|
|
115
|
+
service_id: serviceId,
|
|
116
|
+
characteristic_id: characteristicId,
|
|
117
|
+
lines_to_append: linesToAppend
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Checks if a specific device is currently connected.
|
|
123
|
+
* @param deviceId The unique identifier of the device to check
|
|
124
|
+
* @param callback Function to handle the connection status response
|
|
125
|
+
* @callback {Object} response
|
|
126
|
+
* @callback {boolean} response.is_connected - Whether the device is connected
|
|
127
|
+
* @callback {string} [response.message] - Additional information if another device is connected
|
|
128
|
+
*/
|
|
129
|
+
isDeviceConnected(deviceId, callback) {
|
|
130
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "is_device_connected", {
|
|
131
|
+
device_id: deviceId
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { NativelyScanner } from "./classes/NativelyScanner";
|
|
|
21
21
|
import { NativelyStorage } from "./classes/NativelyStorage";
|
|
22
22
|
import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications";
|
|
23
23
|
import { NativelyKlaviyoNotifications } from "./classes/NativelyKlaviyoNotifications";
|
|
24
|
+
import { NativelyTabBar } from "./classes/NativelyTabBar";
|
|
24
25
|
interface NativelyProps {
|
|
25
26
|
natively: Natively;
|
|
26
27
|
NativelyAdmobBanner: NativelyAdmobBanner;
|
|
@@ -45,6 +46,7 @@ interface NativelyProps {
|
|
|
45
46
|
NativelyStorage: NativelyStorage;
|
|
46
47
|
NativelyFirebaseNotifications: NativelyFirebaseNotifications;
|
|
47
48
|
NativelyKlaviyoNotifications: NativelyKlaviyoNotifications;
|
|
49
|
+
NativelyTabBar: NativelyTabBar;
|
|
48
50
|
$agent: never;
|
|
49
51
|
}
|
|
50
52
|
declare global {
|
package/natively-frontend.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(i,t)=>{for(var l in t)e.o(t,l)&&!e.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:t[l]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};e.r(i),e.d(i,{Natively:()=>l,NativelyAdmobBanner:()=>A,NativelyAdmobInterstitial:()=>w,NativelyAppleSignInService:()=>a,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>c,NativelyCamera:()=>p,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>k,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>S,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,generateID:()=>n,useNatively:()=>P});const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null;class l{constructor(){var e,i,l,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.isIOSApp=(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}setDebug(e){t&&(t.natively.isDebug=e)}notify(e,i){t&&(t.natively.injected=!0,e&&(t.natively.min_app_version=e),i&&(t.natively.app_version=i));const l=null==t?void 0:t.natively.observers;for((null==t?void 0:t.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==t?void 0:t.natively.injected)?e():((null==t?void 0:t.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==t||t.natively.observers.push(e))}trigger(e,i,l,n,a){const r=null==t?void 0:t.natively.isDebug;if(null==t?void 0:t.natively.injected)if(i>(null==t?void 0:t.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==t?void 0:t.natively.app_version}, feature version: ${i}`);else{if(l){let i;i=e?n+"_response_"+e:n+"_response",t&&(t[i]=function(n,a){null==t||t.$agent.response(),a.message&&r?alert(`[ERROR] Error message: ${a.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(n)}, respId: ${e}`),l(n))}),a?a.response_id=e:a={response_id:e}}r&&console.log(`[DEBUG] Trigger method: ${n}, body: ${JSON.stringify(a)}`),null==t||t.$agent.trigger(n,a)}else null==t||t.natively.addObserver((()=>{null==t||t.natively.trigger(e,i,l,n,a)}))}openLogger(){null==t||t.$agent.natively_logger()}openConsole(){null==t||t.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==t||t.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==t||t.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==t||t.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==t||t.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,i){null==t||t.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:i,text:e})}shareFile(e){null==t||t.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,i){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==i&&i?"external":"web"};null==t||t.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==t||t.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,i){null==t||t.natively.trigger(void 0,0,void 0,"show_toast",{text:i||"",type:e||"DEFAULT"})}showAppBanner(e,i,l){null==t||t.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:i||"",description:l||""})}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}setAppBackgroundColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==t||t.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==t||t.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==t||t.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==t||t.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==t||t.natively.trigger(void 0,0,void 0,"open_appsettings")}hapticPattern(e,i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:i})}hapticImpact(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}sendPushNotification(e,i,t,l){return n=this,a=void 0,s=function*(){const n=t.filter((e=>e.length>0)),a=[...new Set(n)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":e,include_player_ids:a};i.template_id?r.template_id=i.template_id:(r.headings={en:i.title||"Empty Title"},r.contents={en:i.message||"Empty Message"},i.subtitle&&(r.subtitle={en:i.subtitle}),i.redirect_url&&(r.url=i.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(r)};return yield fetch("https://onesignal.com/api/v1/notifications",s)},new((r=void 0)||(r=Promise))((function(e,i){function t(e){try{o(s.next(e))}catch(e){i(e)}}function l(e){try{o(s.throw(e))}catch(e){i(e)}}function o(i){var n;i.done?e(i.value):(n=i.value,n instanceof r?n:new r((function(e){e(n)}))).then(t,l)}o((s=s.apply(n,a||[])).next())}));var n,a,r,s}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class a{constructor(){this.id=n()}signin(e){null==t||t.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=n()}copy(e){null==t||t.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==t||t.natively.trigger(this.id,11,e,"clipboard_paste")}}class s{constructor(){this.id=n()}browserInfo(){var e,i,l,n;return{isNativeApp:void 0!==(null==t?void 0:t.$agent),isIOSApp:(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,isAndroidApp:(null===(n=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}}getAppInfo(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,19,e,"app_state"))}}class o{constructor(){this.id=n()}getOneSignalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,i){null==t||t.natively.trigger(this.id,0,i,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"push_permission")}}class d{constructor(){this.id=n()}getUserGeolocation(e,i){null==t||t.natively.trigger(this.id,0,i,"geolocation",{distance:e})}requestPermission(e){null==t||t.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"geo_permission")}}class g{constructor(){this.id=n()}current(e,i,l,n){null==t||t.natively.trigger(this.id,12,n,"location_current",{minAccuracy:e,accuracyType:i,priority:l})}permission(e){null==t||t.natively.trigger(this.id,6,e,"location_permission")}start(e,i,l,n,a){null==t||t.natively.trigger(this.id,12,a,"location_start",{minAccuracy:i,accuracyType:l,priority:n,interval:e})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,i,l,n,a,r){const s={identifier:null!=a?a:"empty",interval:null!=e?e:6e4,minAccuracy:null!=i?i:50,accuracyType:null!=l?l:"Best",priority:null!=n?n:"BALANCED"};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",s)}statusBackground(e){null==t||t.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==t||t.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class v{constructor(){this.id=n()}sendSMS(e,i,l){const n={body:null!=e?e:"",recipient:null!=i?i:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",n)}sendEmail(e,i,l,n){const a={subject:null!=e?e:"",body:null!=i?i:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,n,"send_email",a)}}class u{constructor(){this.id=n()}setStorageValue(e,i){null==t||t.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:i})}getStorageValue(e,i){null==t||t.natively.trigger(this.id,0,i,"get_storage_value",{key:e})}removeStorageValue(e){null==t||t.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==t||t.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(e){this.id=n(),this.allowPass=e}checkBiometricsSupport(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,i,l){null==t||t.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:i})}}class y{constructor(){this.id=n()}showDatePicker(e,i,l,n,a){const r={type:null!=l?l:"DATE",style:null!=n?n:"LIGHT",title:null!=e?e:"",description:null!=i?i:""};null==t||t.natively.trigger(this.id,0,a,"datepicker",r)}}class p{constructor(){this.id=n()}showCamera(e,i,l,n){const a={type:null!=e?e:"photo",quality:null!=i?i:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,n,"open_camera",a)}}class h{constructor(){this.id=n()}available(e){null==t||t.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,i,l){null==t||t.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:i})}permissionStatus(e,i){null==t||t.natively.trigger(this.id,10,i,"health_permission",{data_type:e})}getAllCharacteristics(e){null==t||t.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,i,l,n,a){const r={data_type:e,interval:i};l&&(r.start_date=l.getTime()),n&&(r.end_date=n.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,n,"health_get_daily_sleep_analysis",a)}getWorkouts(e,i,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,21,n,"health_get_workouts",a)}getActivitySummary(e,i,l){const n={};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",n)}}class _{constructor(){this.id=n()}showScanner(e){null==t||t.natively.trigger(this.id,2,e,"open_scanner",{})}}class b{constructor(){this.id=n()}login(e,i,l){const n=null!=i?i:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:n})}logout(e){null==t||t.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==t||t.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==t||t.natively.trigger(this.id,10,e,"purchases_restore",{})}purchasePackage(e,i,l){null==t||t.natively.trigger(this.id,3,i,"purchases_package",{packageId:e,oldProductId:null!=l?l:null})}packagePrice(e,i){null==t||t.natively.trigger(this.id,8,i,"purchases_price",{packageId:e})}}class m{constructor(){this.id=n()}getAllContacts(e){null==t||t.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,i,l,n,a){const r={firstName:e,lastName:null!=i?i:"",email:null!=l?l:"",phone:null!=n?n:""};null==t||t.natively.trigger(this.id,3,a,"contacts_save",r)}}class f{constructor(){this.id=n()}showMediaPicker(e){null==t||t.natively.trigger(this.id,8,e,"mediapicker",{})}}class N{constructor(){this.id=n()}showRecorder(e,i){const l={max_duration:null!=e?e:0};null==t||t.natively.trigger(this.id,13,i,"record_start",l)}}class A{constructor(e,i,l=!1,a,r=!1,s){var o,d,g,v,u,c;this.id=n();const y={};(null==t?void 0:t.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==t?void 0:t.natively.isIOSApp)&&(y.unitId=null!==(d=e.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(g=e.position)&&void 0!==g?g:"BOTTOM",y.sizeType=null!==(v=e.sizeType)&&void 0!==v?v:"AUTO",y.width=null!==(u=e.custom_width)&&void 0!==u?u:320,y.height=null!==(c=e.custom_height)&&void 0!==c?c:50,null==t||t.natively.trigger(this.id,14,(e=>{null==i||i(e),l&&(null==t||t.natively.trigger(this.id,14,(e=>{null==a||a(e),r&&(null==t||t.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class w{constructor(e="ca-app-pub-3940256099942544/4411468910",i="ca-app-pub-3940256099942544/1033173712",l,a=!1,r){this.id=n(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=i:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=a,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var i;const l={unitId:null!==(i=this.unitId)&&void 0!==i?i:"ca-app-pub-3940256099942544/4411468910"};null==t||t.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==t||t.natively.trigger(this.id,14,(i=>{e(i),"DID_DISMISS_AD"===i.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==t||t.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class S{constructor(e,i,t,l){this.id=n(),this.readAlertMessage=e,this.writeAlertMessage=i,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(e){var i,l;const n={alertMessage:null!==(i=this.readAlertMessage)&&void 0!==i?i:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==t||t.natively.trigger(this.id,15,e,"nfc_read",n)}write(e,i,l){var n,a;const r={alertMessage:null!==(n=this.writeAlertMessage)&&void 0!==n?n:"please set writeAlertMessage",detectedMessage:null!==(a=this.writeDetectedMessage)&&void 0!==a?a:"please set writeDetectedMessage",recordData:null!=i?i:"please set recordData",recordId:null!=e?e:"please set recordId"};null==t||t.natively.trigger(this.id,15,l,"nfc_write",r)}available(e){null==t||t.natively.trigger(this.id,15,e,"nfc_available",{})}}class I{constructor(){this.id=n()}firebase_get_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_unsubscribe_from_topic",{topic:e})}}class k{constructor(){this.id=n()}setProfile(e,i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_set_profile",e)}getExternalId(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}pushPermission(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_register")}}const P=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=A,t.NativelyAdmobInterstitial=w,t.NativelyAppleSignInService=a,t.NativelyAudioRecorder=N,t.NativelyBiometrics=c,t.NativelyCamera=p,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=h,t.NativelyInfo=s,t.NativelyLocation=g,t.NativelyMediaPicker=f,t.NativelyMessage=v,t.NativelyNFCService=S,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=_,t.NativelyStorage=u,t.NativelyFirebaseNotifications=I),null==t||t.natively.addObserver((()=>null==t?void 0:t.natively.trigger(void 0,0,(e=>{t&&(t.natively.min_app_version=e.minSDKVersion,t.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
|
|
1
|
+
(()=>{"use strict";var i={d:(e,t)=>{for(var l in t)i.o(t,l)&&!i.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})}};i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(i){if("object"==typeof window)return window}}(),i.o=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),i.r=i=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var e={};i.r(e),i.d(e,{Natively:()=>l,NativelyAdmobBanner:()=>A,NativelyAdmobInterstitial:()=>w,NativelyAppleSignInService:()=>n,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>c,NativelyCamera:()=>p,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>k,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>S,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,NativelyTabBar:()=>P,generateID:()=>a,useNatively:()=>T});const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i.g?i.g:null;class l{constructor(){var i,e,l,a;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.isIOSApp=(null===(e=null===(i=null==t?void 0:t.navigator)||void 0===i?void 0:i.userAgent)||void 0===e?void 0:e.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(a=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.includes("Natively/Android"))||!1}setDebug(i){t&&(t.natively.isDebug=i)}notify(i,e){t&&(t.natively.injected=!0,i&&(t.natively.min_app_version=i),e&&(t.natively.app_version=e));const l=null==t?void 0:t.natively.observers;for((null==t?void 0:t.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const i=l.shift();null==i||i()}}addObserver(i){(null==t?void 0:t.natively.injected)?i():((null==t?void 0:t.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${i}`),null==t||t.natively.observers.push(i))}trigger(i,e,l,a,n){const r=null==t?void 0:t.natively.isDebug;if(null==t?void 0:t.natively.injected)if(e>(null==t?void 0:t.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==t?void 0:t.natively.app_version}, feature version: ${e}`);else{if(l){let e;e=i?a+"_response_"+i:a+"_response",t&&(t[e]=function(a,n){null==t||t.$agent.response(),n.message&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${e}, body: ${JSON.stringify(a)}, respId: ${i}`),l(a))}),n?n.response_id=i:n={response_id:i}}r&&console.log(`[DEBUG] Trigger method: ${a}, body: ${JSON.stringify(n)}`),null==t||t.$agent.trigger(a,n)}else null==t||t.natively.addObserver((()=>{null==t||t.natively.trigger(i,e,l,a,n)}))}openLogger(){null==t||t.$agent.natively_logger()}openConsole(){null==t||t.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==t||t.natively.trigger(void 0,11,void 0,"app_close")}showProgress(i){null==t||t.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:i})}shareImage(i){null==t||t.natively.trigger(void 0,0,void 0,"share_image",{url:i})}shareText(i){null==t||t.natively.trigger(void 0,0,void 0,"share_text",{text:i})}shareTextAndImage(i,e){null==t||t.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:e,text:i})}shareFile(i){null==t||t.natively.trigger(void 0,2,void 0,"share_file",{url:i})}openExternalURL(i,e){const l={url:void 0===i?"https://buildnatively.com":i,view:void 0!==e&&e?"external":"web"};null==t||t.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(i){null==t||t.natively.trigger(void 0,22,void 0,"open_app",{url:i})}showAppToast(i,e){null==t||t.natively.trigger(void 0,0,void 0,"show_toast",{text:e||"",type:i||"DEFAULT"})}showAppBanner(i,e,l){null==t||t.natively.trigger(void 0,0,void 0,"show_banner",{type:i||"INFO",title:e||"",description:l||""})}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}setAppBackgroundColor(i){null==t||t.natively.trigger(void 0,1,void 0,"app_background",{color:i})}setAppProgressColor(i){null==t||t.natively.trigger(void 0,1,void 0,"app_progress",{color:i})}setAppSwipeNavigation(i){null==t||t.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:i})}setAppPullToRefresh(i){null==t||t.natively.trigger(void 0,1,void 0,"app_pull",{toggle:i})}setAppOrientation(i){null==t||t.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:i})}setAppStatusBarStyle(i){null==t||t.natively.trigger(void 0,22,void 0,"status_bar_style",{style:i})}hideLoadingScreen(){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(i){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:i||!1})}openAppSettings(){null==t||t.natively.trigger(void 0,0,void 0,"open_appsettings")}hapticPattern(i,e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:i,delay:e})}hapticImpact(i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_impact",{type:i})}hapticNotification(i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_notification",{type:i})}sendPushNotification(i,e,t,l){return a=this,n=void 0,s=function*(){const a=t.filter((i=>i.length>0)),n=[...new Set(a)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":i,include_player_ids:n};e.template_id?r.template_id=e.template_id:(r.headings={en:e.title||"Empty Title"},r.contents={en:e.message||"Empty Message"},e.subtitle&&(r.subtitle={en:e.subtitle}),e.redirect_url&&(r.url=e.redirect_url));const s={method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify(r)};return yield fetch("https://onesignal.com/api/v1/notifications",s)},new((r=void 0)||(r=Promise))((function(i,e){function t(i){try{o(s.next(i))}catch(i){e(i)}}function l(i){try{o(s.throw(i))}catch(i){e(i)}}function o(e){var a;e.done?i(e.value):(a=e.value,a instanceof r?a:new r((function(i){i(a)}))).then(t,l)}o((s=s.apply(a,n||[])).next())}));var a,n,r,s}}const a=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class n{constructor(){this.id=a()}signin(i){null==t||t.natively.trigger(this.id,16,i,"apple_signin",{})}}class r{constructor(){this.id=a()}copy(i){null==t||t.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:i})}paste(i){null==t||t.natively.trigger(this.id,11,i,"clipboard_paste")}}class s{constructor(){this.id=a()}browserInfo(){var i,e,l,a;return{isNativeApp:void 0!==(null==t?void 0:t.$agent),isIOSApp:(null===(e=null===(i=null==t?void 0:t.navigator)||void 0===i?void 0:i.userAgent)||void 0===e?void 0:e.includes("Natively/iOS"))||!1,isAndroidApp:(null===(a=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.includes("Natively/Android"))||!1}}getAppInfo(i){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(this.id,0,i,"app_info"))}connectivity(i){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,0,i,"connectivity"))}app_state(i){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,19,i,"app_state"))}}class o{constructor(){this.id=a()}getOneSignalId(i){null==t||t.natively.trigger(this.id,0,i,"onesignal_playerid")}requestPermission(i,e){null==t||t.natively.trigger(this.id,0,e,"push_register",{fallbackToSettings:i})}getPermissionStatus(i){null==t||t.natively.trigger(this.id,0,i,"push_permission")}}class d{constructor(){this.id=a()}getUserGeolocation(i,e){null==t||t.natively.trigger(this.id,0,e,"geolocation",{distance:i})}requestPermission(i){null==t||t.natively.trigger(this.id,0,i,"geo_register")}getPermissionStatus(i){null==t||t.natively.trigger(this.id,0,i,"geo_permission")}}class g{constructor(){this.id=a()}current(i,e,l,a){null==t||t.natively.trigger(this.id,12,a,"location_current",{minAccuracy:i,accuracyType:e,priority:l})}permission(i){null==t||t.natively.trigger(this.id,6,i,"location_permission")}start(i,e,l,a,n){null==t||t.natively.trigger(this.id,12,n,"location_start",{minAccuracy:e,accuracyType:l,priority:a,interval:i})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(i,e,l,a,n,r){const s={identifier:null!=n?n:"empty",interval:null!=i?i:6e4,minAccuracy:null!=e?e:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"BALANCED"};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",s)}statusBackground(i){null==t||t.natively.trigger(this.id,20,i,"location_status_bg",{})}stopBackground(i){null==t||t.natively.trigger(this.id,4,i,"location_stop_bg",{})}}class v{constructor(){this.id=a()}sendSMS(i,e,l){const a={body:null!=i?i:"",recipient:null!=e?e:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(i,e,l,a){const n={subject:null!=i?i:"",body:null!=e?e:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,a,"send_email",n)}}class u{constructor(){this.id=a()}setStorageValue(i,e){null==t||t.natively.trigger(this.id,0,void 0,"set_storage_value",{key:i,value:e})}getStorageValue(i,e){null==t||t.natively.trigger(this.id,0,e,"get_storage_value",{key:i})}removeStorageValue(i){null==t||t.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:i})}resetStorage(){null==t||t.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(i){this.id=a(),this.allowPass=i}checkBiometricsSupport(i){null==t||t.natively.trigger(this.id,0,i,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(i){null==t||t.natively.trigger(this.id,0,i,"biometrics_has_credentials")}verifyUserIdentify(i){null==t||t.natively.trigger(this.id,0,i,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(i){null==t||t.natively.trigger(this.id,0,i,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(i){null==t||t.natively.trigger(this.id,0,i,"biometrics_remove_credentials")}saveUserCredentials(i,e,l){null==t||t.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:i,password:e})}}class y{constructor(){this.id=a()}showDatePicker(i,e,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=i?i:"",description:null!=e?e:""};null==t||t.natively.trigger(this.id,0,n,"datepicker",r)}}class p{constructor(){this.id=a()}showCamera(i,e,l,a){const n={type:null!=i?i:"photo",quality:null!=e?e:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,a,"open_camera",n)}}class h{constructor(){this.id=a()}available(i){null==t||t.natively.trigger(this.id,10,i,"health_available",{})}requestAuthorization(i,e,l){null==t||t.natively.trigger(this.id,10,l,"health_register",{write_data_types:i,read_data_types:e})}permissionStatus(i,e){null==t||t.natively.trigger(this.id,10,e,"health_permission",{data_type:i})}getAllCharacteristics(i){null==t||t.natively.trigger(this.id,10,i,"health_get_all_characteristics",{})}getStatisticQuantity(i,e,l,a,n){const r={data_type:i,interval:e};l&&(r.start_date=l.getTime()),a&&(r.end_date=a.getTime()),null==t||t.natively.trigger(this.id,10,n,"health_get_statistic_quantity",r)}getDailySleepAnalysis(i,e,l,a){const n={limit:l||100};i&&(n.start_date=i.getTime()),e&&(n.end_date=e.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(i,e,l,a){const n={limit:l||100};i&&(n.start_date=i.getTime()),e&&(n.end_date=e.getTime()),null==t||t.natively.trigger(this.id,21,a,"health_get_workouts",n)}getActivitySummary(i,e,l){const a={};i&&(a.start_date=i.getTime()),e&&(a.end_date=e.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class _{constructor(){this.id=a()}showScanner(i){null==t||t.natively.trigger(this.id,2,i,"open_scanner",{})}}class b{constructor(){this.id=a()}login(i,e,l){const a=null!=e?e:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:i,email:a})}logout(i){null==t||t.natively.trigger(this.id,3,i,"purchases_logout",{})}customerId(i){null==t||t.natively.trigger(this.id,3,i,"purchases_customerid",{})}restore(i){null==t||t.natively.trigger(this.id,10,i,"purchases_restore",{})}purchasePackage(i,e,l){null==t||t.natively.trigger(this.id,3,e,"purchases_package",{packageId:i,oldProductId:null!=l?l:null})}packagePrice(i,e){null==t||t.natively.trigger(this.id,8,e,"purchases_price",{packageId:i})}}class m{constructor(){this.id=a()}getAllContacts(i){null==t||t.natively.trigger(this.id,3,i,"contacts_all",{})}createContact(i,e,l,a,n){const r={firstName:i,lastName:null!=e?e:"",email:null!=l?l:"",phone:null!=a?a:""};null==t||t.natively.trigger(this.id,3,n,"contacts_save",r)}}class f{constructor(){this.id=a()}showMediaPicker(i){null==t||t.natively.trigger(this.id,8,i,"mediapicker",{})}}class N{constructor(){this.id=a()}showRecorder(i,e){const l={max_duration:null!=i?i:0};null==t||t.natively.trigger(this.id,13,e,"record_start",l)}}class A{constructor(i,e,l=!1,n,r=!1,s){var o,d,g,v,u,c;this.id=a();const y={};(null==t?void 0:t.natively.isAndroidApp)?y.unitId=null!==(o=i.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==t?void 0:t.natively.isIOSApp)&&(y.unitId=null!==(d=i.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(g=i.position)&&void 0!==g?g:"BOTTOM",y.sizeType=null!==(v=i.sizeType)&&void 0!==v?v:"AUTO",y.width=null!==(u=i.custom_width)&&void 0!==u?u:320,y.height=null!==(c=i.custom_height)&&void 0!==c?c:50,null==t||t.natively.trigger(this.id,14,(i=>{null==e||e(i),l&&(null==t||t.natively.trigger(this.id,14,(i=>{null==n||n(i),r&&(null==t||t.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(i){null==t||t.natively.trigger(this.id,14,i,"bannerad_load",{})}showBanner(i){null==t||t.natively.trigger(this.id,14,i,"bannerad_show",{})}hideBanner(i){null==t||t.natively.trigger(this.id,14,i,"bannerad_hide",{})}bannerIsReady(i){null==t||t.natively.trigger(this.id,14,i,"bannerad_ready",{})}bannerIsVisible(i){null==t||t.natively.trigger(this.id,14,i,"bannerad_visible",{})}}class w{constructor(i="ca-app-pub-3940256099942544/4411468910",e="ca-app-pub-3940256099942544/1033173712",l,n=!1,r){this.id=a(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=e:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=i),this.auto_ad_reload=n,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(i){var e;const l={unitId:null!==(e=this.unitId)&&void 0!==e?e:"ca-app-pub-3940256099942544/4411468910"};null==t||t.natively.trigger(this.id,14,i,"interstitialad_setup",l)}showInterstitialAd(i){null==t||t.natively.trigger(this.id,14,(e=>{i(e),"DID_DISMISS_AD"===e.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(i){null==t||t.natively.trigger(this.id,14,i,"interstitialad_ready",{})}}class S{constructor(i,e,t,l){this.id=a(),this.readAlertMessage=i,this.writeAlertMessage=e,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(i){var e,l;const a={alertMessage:null!==(e=this.readAlertMessage)&&void 0!==e?e:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==t||t.natively.trigger(this.id,15,i,"nfc_read",a)}write(i,e,l){var a,n;const r={alertMessage:null!==(a=this.writeAlertMessage)&&void 0!==a?a:"please set writeAlertMessage",detectedMessage:null!==(n=this.writeDetectedMessage)&&void 0!==n?n:"please set writeDetectedMessage",recordData:null!=e?e:"please set recordData",recordId:null!=i?i:"please set recordId"};null==t||t.natively.trigger(this.id,15,l,"nfc_write",r)}available(i){null==t||t.natively.trigger(this.id,15,i,"nfc_available",{})}}class I{constructor(){this.id=a()}firebase_get_token(i){null==t||t.natively.trigger(this.id,31,i,"firebase_get_token")}firebase_get_apns_token(i){null==t||t.natively.trigger(this.id,31,i,"firebase_get_apns_token")}firebase_request_permission(i){null==t||t.natively.trigger(this.id,31,i,"firebase_request_permission")}firebase_has_permission(i){null==t||t.natively.trigger(this.id,31,i,"firebase_has_permission")}firebase_subscribe_to_topic(i,e){null==t||t.natively.trigger(this.id,31,e,"firebase_subscribe_to_topic",{topic:i})}firebase_unsubscribe_from_topic(i,e){null==t||t.natively.trigger(this.id,31,e,"firebase_unsubscribe_from_topic",{topic:i})}}class k{constructor(){this.id=a()}setProfile(i,e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_set_profile",i)}getExternalId(i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_external_id")}resetProfile(i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_reset_profile")}pushPermission(i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_push_permission")}pushRegister(i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_push_register")}}class P{constructor(){this.id=a()}showTabBar(){null==t||t.natively.trigger(this.id,33,"show_tab_bar")}hideTabBar(){null==t||t.natively.trigger(this.id,33,"hide_tab_bar")}}const T=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=A,t.NativelyAdmobInterstitial=w,t.NativelyAppleSignInService=n,t.NativelyAudioRecorder=N,t.NativelyBiometrics=c,t.NativelyCamera=p,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=h,t.NativelyInfo=s,t.NativelyLocation=g,t.NativelyMediaPicker=f,t.NativelyMessage=v,t.NativelyNFCService=S,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=_,t.NativelyStorage=u,t.NativelyFirebaseNotifications=I,t.NativelyKlaviyoNotifications=k,t.NativelyTabBar=P),null==t||t.natively.addObserver((()=>null==t?void 0:t.natively.trigger(void 0,0,(i=>{t&&(t.natively.min_app_version=i.minSDKVersion,t.natively.app_version=i.sdkVersion)}),"app_info",{})))})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natively",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.9",
|
|
4
4
|
"description": "Natively SDK for building native-like web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"ts-loader": "^9.5.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.6.3",
|
|
51
|
-
"webpack": "^5.
|
|
51
|
+
"webpack": "^5.97.1",
|
|
52
52
|
"webpack-cli": "^5.1.4"
|
|
53
53
|
}
|
|
54
54
|
}
|