natively 2.13.3 → 2.15.0
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 +62 -4
- package/dist/classes/Natively.d.ts +22 -0
- package/dist/classes/Natively.js +139 -0
- package/dist/classes/NativelyAdmobBanner.d.ts +16 -0
- package/dist/classes/NativelyAdmobBanner.js +53 -0
- package/dist/classes/NativelyAdmobInterstitial.d.ts +17 -0
- package/dist/classes/NativelyAdmobInterstitial.js +54 -0
- package/dist/classes/NativelyAppleSignInService.d.ts +4 -0
- package/dist/classes/NativelyAppleSignInService.js +13 -0
- package/dist/classes/NativelyAudioRecorder.d.ts +4 -0
- package/dist/classes/NativelyAudioRecorder.js +16 -0
- package/dist/classes/NativelyBiometrics.d.ts +11 -0
- package/dist/classes/NativelyBiometrics.js +40 -0
- package/dist/classes/NativelyCamera.d.ts +4 -0
- package/dist/classes/NativelyCamera.js +18 -0
- package/dist/classes/NativelyClipboard.d.ts +5 -0
- package/dist/classes/NativelyClipboard.js +18 -0
- package/dist/classes/NativelyContacts.d.ts +5 -0
- package/dist/classes/NativelyContacts.js +22 -0
- package/dist/classes/NativelyDatePicker.d.ts +4 -0
- package/dist/classes/NativelyDatePicker.js +19 -0
- package/dist/classes/NativelyFirebaseNotifications.d.ts +9 -0
- package/dist/classes/NativelyFirebaseNotifications.js +32 -0
- package/dist/classes/NativelyGeolocation.d.ts +6 -0
- package/dist/classes/NativelyGeolocation.js +23 -0
- package/dist/classes/NativelyHealth.d.ts +8 -0
- package/dist/classes/NativelyHealth.js +40 -0
- package/dist/classes/NativelyInfo.d.ts +11 -0
- package/dist/classes/NativelyInfo.js +33 -0
- package/dist/classes/NativelyLocation.d.ts +10 -0
- package/dist/classes/NativelyLocation.js +47 -0
- package/dist/classes/NativelyMediaPicker.d.ts +4 -0
- package/dist/classes/NativelyMediaPicker.js +13 -0
- package/dist/classes/NativelyMessage.d.ts +5 -0
- package/dist/classes/NativelyMessage.js +25 -0
- package/dist/classes/NativelyNFCService.d.ts +11 -0
- package/dist/classes/NativelyNFCService.js +39 -0
- package/dist/classes/NativelyNotifications.d.ts +6 -0
- package/dist/classes/NativelyNotifications.js +21 -0
- package/dist/classes/NativelyPurchases.d.ts +9 -0
- package/dist/classes/NativelyPurchases.js +36 -0
- package/dist/classes/NativelyScanner.d.ts +4 -0
- package/dist/classes/NativelyScanner.js +13 -0
- package/dist/classes/NativelyStorage.d.ts +7 -0
- package/dist/classes/NativelyStorage.js +29 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.js +7 -0
- package/dist/hooks/useNatively.d.ts +2 -0
- package/dist/hooks/useNatively.js +2 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +34 -0
- package/dist/inject.d.ts +1 -0
- package/dist/inject.js +7 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.js +1 -0
- package/dist/utils/generateID.d.ts +1 -0
- package/dist/utils/generateID.js +1 -0
- package/dist/utils/globalThis.d.ts +2 -0
- package/dist/utils/globalThis.js +25 -0
- package/natively-frontend.min.js +1 -1
- package/package.json +36 -7
- package/.vscode/settings.json +0 -13
- package/natively-frontend.js +0 -938
- package/natively-frontend.min.mjs +0 -1
- package/natively-frontend.mjs +0 -940
package/README.md
CHANGED
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
### Installation
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Put the following code in your website header (between `<head></head>` tags):
|
|
6
6
|
|
|
7
|
+
```html
|
|
8
|
+
<head>
|
|
9
|
+
<script async onload="nativelyOnLoad()" src="https://cdn.jsdelivr.net/npm/natively@2.14.0/natively-frontend.min.js"></script>
|
|
10
|
+
<script>
|
|
11
|
+
function nativelyOnLoad() {
|
|
12
|
+
window.natively.setDebug(true); // To see errors
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
7
16
|
```
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
You can specify an SDK version by replacing version number 2.14.0. The latest version number can be found in this repo. Debug mode which enables native alerts with errors. It's can be very useful while you developing a website.
|
|
10
20
|
|
|
11
21
|
### Usage
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
14
25
|
// Elements (with callback from the App)
|
|
15
26
|
const notifications = new NativelyNotifications();
|
|
16
27
|
const playerId_callback = function(resp) {
|
|
@@ -23,5 +34,52 @@ notifications.getOneSignalId(playerId_callback);
|
|
|
23
34
|
window.natively.shareText("Hello world!");
|
|
24
35
|
```
|
|
25
36
|
|
|
37
|
+
🛠 React/NextJS (min version 2.15.0)
|
|
38
|
+
|
|
39
|
+
### Installation:
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
npm i natively@">=2.15.0"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Usage:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
'use client'; // <--- THIS IS IMPORTANT, Natively can't be used on server side
|
|
49
|
+
import { NativelyInfo, useNatively } from 'natively';
|
|
50
|
+
|
|
51
|
+
export default function Home() {
|
|
52
|
+
const natively = useNatively(); // <--- useNatively is just a wrapper on window.natively
|
|
53
|
+
const info = new NativelyInfo();
|
|
54
|
+
const browserInfo = info.browserInfo();
|
|
55
|
+
const openConsole = () => {
|
|
56
|
+
natively.openConsole();
|
|
57
|
+
};
|
|
58
|
+
console.log(browserInfo);
|
|
59
|
+
return (
|
|
60
|
+
<div>
|
|
61
|
+
Check the console for browser info. isNativeApp: {browserInfo.isNativeApp ? "true" : "false"}
|
|
62
|
+
<button onClick={openConsole}>Open Console</button>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Important for NextJS users make sure to add 'use client' to the component where you're using Natively SDK. "useNatively" is referring to "window.natively" everywhere in this documentation.
|
|
69
|
+
|
|
70
|
+
Example project: [https://github.com/romanfurman6/nextjs-boilerplate](https://github.com/romanfurman6/nextjs-boilerplate)
|
|
71
|
+
|
|
72
|
+
### Debugging (Inspect console inside of mobile app)
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
// Make sure you have JS SDK >=v2.7.2
|
|
76
|
+
window.natively.openConsole();
|
|
77
|
+
|
|
78
|
+
// NextJS/React
|
|
79
|
+
import { useNatively } from 'natively';
|
|
80
|
+
const natively = useNatively();
|
|
81
|
+
natively.openConsole();
|
|
82
|
+
```
|
|
83
|
+
|
|
26
84
|
More in [documentation](https://docs.buildnatively.com/guides/integration/how-to-get-started#javascript-sdk)
|
|
27
85
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class Natively {
|
|
2
|
+
isDebug: boolean;
|
|
3
|
+
min_app_version: number;
|
|
4
|
+
app_version: number;
|
|
5
|
+
injected: boolean;
|
|
6
|
+
observers: Function[];
|
|
7
|
+
isIOSApp: boolean;
|
|
8
|
+
isAndroidApp: boolean;
|
|
9
|
+
setDebug(isDebug: boolean): void;
|
|
10
|
+
notify(min?: number, current?: number): void;
|
|
11
|
+
addObserver(fn: Function): void;
|
|
12
|
+
trigger(respId: string | undefined, minVersion: number, callback: Function | undefined, method: string, body?: any): void;
|
|
13
|
+
openLogger(): void;
|
|
14
|
+
openConsole(): void;
|
|
15
|
+
closeApp(): void;
|
|
16
|
+
showProgress(toggle: boolean): void;
|
|
17
|
+
shareImage(image_url: string): void;
|
|
18
|
+
shareText(text: string): void;
|
|
19
|
+
shareTextAndImage(text: string, image_url: string): void;
|
|
20
|
+
shareFile(file_url: string): void;
|
|
21
|
+
openExternalURL(url?: string, external?: boolean): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
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 globalContext from "../utils/globalThis";
|
|
5
|
+
export class Natively {
|
|
6
|
+
constructor() {
|
|
7
|
+
var _globalContext$naviga, _globalContext$naviga2;
|
|
8
|
+
_defineProperty(this, "isDebug", false);
|
|
9
|
+
_defineProperty(this, "min_app_version", 0);
|
|
10
|
+
_defineProperty(this, "app_version", 0);
|
|
11
|
+
_defineProperty(this, "injected", false);
|
|
12
|
+
_defineProperty(this, "observers", []);
|
|
13
|
+
_defineProperty(this, "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
|
+
_defineProperty(this, "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
|
+
}
|
|
16
|
+
setDebug(isDebug) {
|
|
17
|
+
if (globalContext) {
|
|
18
|
+
globalContext.natively.isDebug = isDebug;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
notify(min, current) {
|
|
22
|
+
if (globalContext) {
|
|
23
|
+
globalContext.natively.injected = true;
|
|
24
|
+
if (min) {
|
|
25
|
+
globalContext.natively.min_app_version = min;
|
|
26
|
+
}
|
|
27
|
+
if (current) {
|
|
28
|
+
globalContext.natively.app_version = current;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var observers = globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.observers;
|
|
32
|
+
if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isDebug) {
|
|
33
|
+
console.log("[INFO] Notify observers: ", observers.length);
|
|
34
|
+
}
|
|
35
|
+
while (observers.length > 0) {
|
|
36
|
+
var observer = observers.shift();
|
|
37
|
+
observer === null || observer === void 0 || observer();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
addObserver(fn) {
|
|
41
|
+
if (globalContext !== null && globalContext !== void 0 && globalContext.natively.injected) {
|
|
42
|
+
fn();
|
|
43
|
+
} else {
|
|
44
|
+
if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isDebug) {
|
|
45
|
+
console.log("[DEBUG] addObserver: ".concat(fn));
|
|
46
|
+
}
|
|
47
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.observers.push(fn);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
trigger(respId, minVersion, callback, method, body) {
|
|
51
|
+
var isTestVersion = globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.isDebug;
|
|
52
|
+
if (!(globalContext !== null && globalContext !== void 0 && globalContext.natively.injected)) {
|
|
53
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.addObserver(() => {
|
|
54
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(respId, minVersion, callback, method, body);
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (minVersion > (globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.app_version)) {
|
|
59
|
+
if (isTestVersion) {
|
|
60
|
+
alert("[ERROR] Please rebuild the app to use this functionality. App Version: ".concat(globalContext === null || globalContext === void 0 ? void 0 : globalContext.natively.app_version, ", feature version: ").concat(minVersion));
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (callback) {
|
|
65
|
+
var fullMethodName;
|
|
66
|
+
if (respId) {
|
|
67
|
+
fullMethodName = method + "_response" + "_" + respId;
|
|
68
|
+
} else {
|
|
69
|
+
fullMethodName = method + "_response";
|
|
70
|
+
}
|
|
71
|
+
if (globalContext) {
|
|
72
|
+
globalContext[fullMethodName] = function (resp, err) {
|
|
73
|
+
globalContext === null || globalContext === void 0 || globalContext.$agent.response();
|
|
74
|
+
if (err.message && isTestVersion) {
|
|
75
|
+
alert("[ERROR] Error message: ".concat(err.message));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (isTestVersion) {
|
|
79
|
+
console.log("[DEBUG] Callback method: ".concat(fullMethodName, ", body: ").concat(JSON.stringify(resp), ", respId: ").concat(respId));
|
|
80
|
+
}
|
|
81
|
+
callback(resp);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (body) {
|
|
85
|
+
body.response_id = respId;
|
|
86
|
+
} else {
|
|
87
|
+
body = {
|
|
88
|
+
response_id: respId
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (isTestVersion) {
|
|
93
|
+
console.log("[DEBUG] Trigger method: ".concat(method, ", body: ").concat(JSON.stringify(body)));
|
|
94
|
+
}
|
|
95
|
+
globalContext === null || globalContext === void 0 || globalContext.$agent.trigger(method, body);
|
|
96
|
+
}
|
|
97
|
+
openLogger() {
|
|
98
|
+
globalContext === null || globalContext === void 0 || globalContext.$agent.natively_logger();
|
|
99
|
+
}
|
|
100
|
+
openConsole() {
|
|
101
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 22, undefined, "app_console");
|
|
102
|
+
}
|
|
103
|
+
closeApp() {
|
|
104
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 11, undefined, "app_close");
|
|
105
|
+
}
|
|
106
|
+
showProgress(toggle) {
|
|
107
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 11, undefined, "app_show_progress", {
|
|
108
|
+
toggle
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
shareImage(image_url) {
|
|
112
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, undefined, "share_image", {
|
|
113
|
+
url: image_url
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
shareText(text) {
|
|
117
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, undefined, "share_text", {
|
|
118
|
+
text
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
shareTextAndImage(text, image_url) {
|
|
122
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, undefined, "share_text_and_image", {
|
|
123
|
+
url: image_url,
|
|
124
|
+
text
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
shareFile(file_url) {
|
|
128
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 2, undefined, "share_file", {
|
|
129
|
+
url: file_url
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
openExternalURL(url, external) {
|
|
133
|
+
var params = {
|
|
134
|
+
url: typeof url === "undefined" ? "https://buildnatively.com" : url,
|
|
135
|
+
view: typeof external !== "undefined" && external ? "external" : "web"
|
|
136
|
+
};
|
|
137
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 18, undefined, "open_link", params);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class NativelyAdmobBanner {
|
|
2
|
+
private readonly id;
|
|
3
|
+
constructor(config: {
|
|
4
|
+
androidUnitId?: string;
|
|
5
|
+
iOSUnitId?: string;
|
|
6
|
+
position?: string;
|
|
7
|
+
sizeType?: string;
|
|
8
|
+
custom_width?: number;
|
|
9
|
+
custom_height?: number;
|
|
10
|
+
}, setup_callback?: Function, preload_ad?: boolean, preload_callback?: Function, show_ad?: boolean, show_callback?: Function);
|
|
11
|
+
loadAd(callback?: Function): void;
|
|
12
|
+
showBanner(callback?: Function): void;
|
|
13
|
+
hideBanner(callback?: Function): void;
|
|
14
|
+
bannerIsReady(callback: Function): void;
|
|
15
|
+
bannerIsVisible(callback: Function): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 NativelyAdmobBanner {
|
|
7
|
+
constructor(config, setup_callback) {
|
|
8
|
+
var _config$position, _config$sizeType, _config$custom_width, _config$custom_height;
|
|
9
|
+
var preload_ad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
10
|
+
var preload_callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
11
|
+
var show_ad = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
12
|
+
var show_callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
13
|
+
_defineProperty(this, "id", generateID());
|
|
14
|
+
var params = {};
|
|
15
|
+
if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isAndroidApp) {
|
|
16
|
+
var _config$androidUnitId;
|
|
17
|
+
params.unitId = (_config$androidUnitId = config.androidUnitId) !== null && _config$androidUnitId !== void 0 ? _config$androidUnitId : "ca-app-pub-3940256099942544/6300978111";
|
|
18
|
+
} else if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isIOSApp) {
|
|
19
|
+
var _config$iOSUnitId;
|
|
20
|
+
params.unitId = (_config$iOSUnitId = config.iOSUnitId) !== null && _config$iOSUnitId !== void 0 ? _config$iOSUnitId : "ca-app-pub-3940256099942544/2934735716";
|
|
21
|
+
}
|
|
22
|
+
params.position = (_config$position = config.position) !== null && _config$position !== void 0 ? _config$position : "BOTTOM";
|
|
23
|
+
params.sizeType = (_config$sizeType = config.sizeType) !== null && _config$sizeType !== void 0 ? _config$sizeType : "AUTO";
|
|
24
|
+
params.width = (_config$custom_width = config.custom_width) !== null && _config$custom_width !== void 0 ? _config$custom_width : 320;
|
|
25
|
+
params.height = (_config$custom_height = config.custom_height) !== null && _config$custom_height !== void 0 ? _config$custom_height : 50;
|
|
26
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, resp => {
|
|
27
|
+
setup_callback === null || setup_callback === void 0 || setup_callback(resp);
|
|
28
|
+
if (preload_ad) {
|
|
29
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, resp => {
|
|
30
|
+
preload_callback === null || preload_callback === void 0 || preload_callback(resp);
|
|
31
|
+
if (show_ad) {
|
|
32
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, show_callback, "bannerad_show", {});
|
|
33
|
+
}
|
|
34
|
+
}, "bannerad_load", {});
|
|
35
|
+
}
|
|
36
|
+
}, "bannerad_setup", params);
|
|
37
|
+
}
|
|
38
|
+
loadAd(callback) {
|
|
39
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "bannerad_load", {});
|
|
40
|
+
}
|
|
41
|
+
showBanner(callback) {
|
|
42
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "bannerad_show", {});
|
|
43
|
+
}
|
|
44
|
+
hideBanner(callback) {
|
|
45
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "bannerad_hide", {});
|
|
46
|
+
}
|
|
47
|
+
bannerIsReady(callback) {
|
|
48
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "bannerad_ready", {});
|
|
49
|
+
}
|
|
50
|
+
bannerIsVisible(callback) {
|
|
51
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "bannerad_visible", {});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description \>=2.9.0
|
|
3
|
+
*
|
|
4
|
+
* Can be only one instance of NativelyAdmobInterstitial per page.
|
|
5
|
+
*
|
|
6
|
+
* Make sure to use this and not reload page a lot.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NativelyAdmobInterstitial {
|
|
9
|
+
private readonly id;
|
|
10
|
+
private auto_ad_reload;
|
|
11
|
+
private auto_ad_reload_callback;
|
|
12
|
+
private unitId;
|
|
13
|
+
constructor(iOSUnitId?: string, androidUnitId?: string, setup_callback?: Function, auto_ad_reload?: boolean, auto_ad_reload_callback?: Function);
|
|
14
|
+
loadAd(callback?: Function): void;
|
|
15
|
+
showInterstitialAd(callback: Function): void;
|
|
16
|
+
interstitialIsReady(callback: Function): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* @description \>=2.9.0
|
|
9
|
+
*
|
|
10
|
+
* Can be only one instance of NativelyAdmobInterstitial per page.
|
|
11
|
+
*
|
|
12
|
+
* Make sure to use this and not reload page a lot.
|
|
13
|
+
*/
|
|
14
|
+
export class NativelyAdmobInterstitial {
|
|
15
|
+
constructor() {
|
|
16
|
+
var iOSUnitId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "ca-app-pub-3940256099942544/4411468910";
|
|
17
|
+
var androidUnitId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "ca-app-pub-3940256099942544/1033173712";
|
|
18
|
+
var setup_callback = arguments.length > 2 ? arguments[2] : undefined;
|
|
19
|
+
var auto_ad_reload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
20
|
+
var auto_ad_reload_callback = arguments.length > 4 ? arguments[4] : undefined;
|
|
21
|
+
_defineProperty(this, "id", generateID());
|
|
22
|
+
_defineProperty(this, "auto_ad_reload", void 0);
|
|
23
|
+
_defineProperty(this, "auto_ad_reload_callback", void 0);
|
|
24
|
+
_defineProperty(this, "unitId", void 0);
|
|
25
|
+
if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isAndroidApp) {
|
|
26
|
+
this.unitId = androidUnitId;
|
|
27
|
+
} else if (globalContext !== null && globalContext !== void 0 && globalContext.natively.isIOSApp) {
|
|
28
|
+
this.unitId = iOSUnitId;
|
|
29
|
+
}
|
|
30
|
+
this.auto_ad_reload = auto_ad_reload;
|
|
31
|
+
this.auto_ad_reload_callback = auto_ad_reload_callback;
|
|
32
|
+
this.loadAd(setup_callback);
|
|
33
|
+
}
|
|
34
|
+
loadAd(callback) {
|
|
35
|
+
var _this$unitId;
|
|
36
|
+
var params = {
|
|
37
|
+
unitId: (_this$unitId = this.unitId) !== null && _this$unitId !== void 0 ? _this$unitId : "ca-app-pub-3940256099942544/4411468910"
|
|
38
|
+
};
|
|
39
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "interstitialad_setup", params);
|
|
40
|
+
}
|
|
41
|
+
showInterstitialAd(callback) {
|
|
42
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, resp => {
|
|
43
|
+
callback(resp);
|
|
44
|
+
if (resp.event === "DID_DISMISS_AD" && this.auto_ad_reload) {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this.loadAd(this.auto_ad_reload_callback);
|
|
47
|
+
}, 500);
|
|
48
|
+
}
|
|
49
|
+
}, "interstitialad_show", {});
|
|
50
|
+
}
|
|
51
|
+
interstitialIsReady(callback) {
|
|
52
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 14, callback, "interstitialad_ready", {});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -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 NativelyAppleSignInService {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
signin(callback) {
|
|
11
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 16, callback, "apple_signin", {});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -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";
|
|
5
|
+
import globalContext from "../utils/globalThis";
|
|
6
|
+
export class NativelyAudioRecorder {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
showRecorder(max_duration, record_callback) {
|
|
11
|
+
var params = {
|
|
12
|
+
max_duration: max_duration !== null && max_duration !== void 0 ? max_duration : 0
|
|
13
|
+
};
|
|
14
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 13, record_callback, "record_start", params);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class NativelyBiometrics {
|
|
2
|
+
private readonly id;
|
|
3
|
+
private readonly allowPass;
|
|
4
|
+
constructor(allowPass: boolean);
|
|
5
|
+
checkBiometricsSupport(biometrics_support_callback: Function): void;
|
|
6
|
+
checkCredentials(biometrics_has_credentials_callback: Function): void;
|
|
7
|
+
verifyUserIdentify(biometrics_verify_callback: Function): void;
|
|
8
|
+
getUserCredentials(biometrics_auth_callback: Function): void;
|
|
9
|
+
removeUserCredentials(biometrics_remove_credentials_callback: Function): void;
|
|
10
|
+
saveUserCredentials(login: string, password: string, biometrics_auth_callback: Function): void;
|
|
11
|
+
}
|
|
@@ -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 NativelyBiometrics {
|
|
7
|
+
constructor(allowPass) {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
_defineProperty(this, "allowPass", void 0);
|
|
10
|
+
this.allowPass = allowPass;
|
|
11
|
+
}
|
|
12
|
+
checkBiometricsSupport(biometrics_support_callback) {
|
|
13
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_support_callback, "biometrics_support", {
|
|
14
|
+
allowPass: this.allowPass
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
checkCredentials(biometrics_has_credentials_callback) {
|
|
18
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_has_credentials_callback, "biometrics_has_credentials");
|
|
19
|
+
}
|
|
20
|
+
verifyUserIdentify(biometrics_verify_callback) {
|
|
21
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_verify_callback, "biometrics_verify", {
|
|
22
|
+
allowPass: this.allowPass
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
getUserCredentials(biometrics_auth_callback) {
|
|
26
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_auth_callback, "biometrics_auth", {
|
|
27
|
+
allowPass: this.allowPass
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
removeUserCredentials(biometrics_remove_credentials_callback) {
|
|
31
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_remove_credentials_callback, "biometrics_remove_credentials");
|
|
32
|
+
}
|
|
33
|
+
saveUserCredentials(login, password, biometrics_auth_callback) {
|
|
34
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, biometrics_auth_callback, "biometrics_auth", {
|
|
35
|
+
allowPass: this.allowPass,
|
|
36
|
+
login,
|
|
37
|
+
password
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 NativelyCamera {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
showCamera(type, quality, camera, open_camera_callback) {
|
|
11
|
+
var params = {
|
|
12
|
+
type: type !== null && type !== void 0 ? type : "photo",
|
|
13
|
+
quality: quality !== null && quality !== void 0 ? quality : "high",
|
|
14
|
+
camera: camera !== null && camera !== void 0 ? camera : "BACK"
|
|
15
|
+
};
|
|
16
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 2, open_camera_callback, "open_camera", params);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 NativelyClipboard {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
copy(text) {
|
|
11
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 11, undefined, "clipboard_copy", {
|
|
12
|
+
text
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
paste(paste_callback) {
|
|
16
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 11, paste_callback, "clipboard_paste");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 NativelyContacts {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
getAllContacts(contacts_all_callback) {
|
|
11
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, contacts_all_callback, "contacts_all", {});
|
|
12
|
+
}
|
|
13
|
+
createContact(firstName, lastName, email, phone, contacts_save_callback) {
|
|
14
|
+
var params = {
|
|
15
|
+
firstName,
|
|
16
|
+
lastName: lastName !== null && lastName !== void 0 ? lastName : "",
|
|
17
|
+
email: email !== null && email !== void 0 ? email : "",
|
|
18
|
+
phone: phone !== null && phone !== void 0 ? phone : ""
|
|
19
|
+
};
|
|
20
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 3, contacts_save_callback, "contacts_save", params);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 NativelyDatePicker {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
showDatePicker(title, description, type, style, datepicker_callback) {
|
|
11
|
+
var params = {
|
|
12
|
+
type: type !== null && type !== void 0 ? type : "DATE",
|
|
13
|
+
style: style !== null && style !== void 0 ? style : "LIGHT",
|
|
14
|
+
title: title !== null && title !== void 0 ? title : "",
|
|
15
|
+
description: description !== null && description !== void 0 ? description : ""
|
|
16
|
+
};
|
|
17
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, datepicker_callback, "datepicker", params);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class NativelyFirebaseNotifications {
|
|
2
|
+
private readonly id;
|
|
3
|
+
firebase_get_token(token_callback: Function): void;
|
|
4
|
+
firebase_get_apns_token(apns_token_callback: Function): void;
|
|
5
|
+
firebase_request_permission(permission_callback: Function): void;
|
|
6
|
+
firebase_has_permission(permission_status_callback: Function): void;
|
|
7
|
+
firebase_subscribe_to_topic(topic: string, subscribe_callback: Function): void;
|
|
8
|
+
firebase_unsubscribe_from_topic(topic: string, unsubscribe_callback: Function): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 NativelyFirebaseNotifications {
|
|
7
|
+
constructor() {
|
|
8
|
+
_defineProperty(this, "id", generateID());
|
|
9
|
+
}
|
|
10
|
+
firebase_get_token(token_callback) {
|
|
11
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, token_callback, "firebase_get_token");
|
|
12
|
+
}
|
|
13
|
+
firebase_get_apns_token(apns_token_callback) {
|
|
14
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, apns_token_callback, "firebase_get_apns_token");
|
|
15
|
+
}
|
|
16
|
+
firebase_request_permission(permission_callback) {
|
|
17
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, permission_callback, "firebase_request_permission");
|
|
18
|
+
}
|
|
19
|
+
firebase_has_permission(permission_status_callback) {
|
|
20
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, permission_status_callback, "firebase_has_permission");
|
|
21
|
+
}
|
|
22
|
+
firebase_subscribe_to_topic(topic, subscribe_callback) {
|
|
23
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, subscribe_callback, "firebase_subscribe_to_topic", {
|
|
24
|
+
topic
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
firebase_unsubscribe_from_topic(topic, unsubscribe_callback) {
|
|
28
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 31, unsubscribe_callback, "firebase_unsubscribe_from_topic", {
|
|
29
|
+
topic
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|