natively 2.22.0 → 2.24.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 +0 -1
- package/dist/classes/Natively.d.ts +2 -0
- package/dist/classes/Natively.js +8 -0
- package/dist/classes/NativelyAudioPlayer.d.ts +38 -0
- package/dist/classes/NativelyAudioPlayer.js +83 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inject.js +2 -0
- package/dist/types.d.ts +2 -0
- package/natively-frontend.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,8 @@ export declare class Natively {
|
|
|
32
32
|
analyticsTrackEvent(name: string, data?: Map<string, any>): void;
|
|
33
33
|
requestAppReview(): void;
|
|
34
34
|
getInsets(callback: Function): void;
|
|
35
|
+
getLocales(callback: Function): void;
|
|
36
|
+
setLocale(locale: string, callback?: Function): void;
|
|
35
37
|
setAppBackgroundColor(color: string): void;
|
|
36
38
|
setAppProgressColor(color: string): void;
|
|
37
39
|
setAppSwipeNavigation(toggle: boolean): void;
|
package/dist/classes/Natively.js
CHANGED
|
@@ -197,6 +197,14 @@ export class Natively {
|
|
|
197
197
|
getInsets(callback) {
|
|
198
198
|
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 36, callback, "get_insets");
|
|
199
199
|
}
|
|
200
|
+
getLocales(callback) {
|
|
201
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 40, callback, "get_locales");
|
|
202
|
+
}
|
|
203
|
+
setLocale(locale, callback) {
|
|
204
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 40, callback, "set_locale", {
|
|
205
|
+
locale
|
|
206
|
+
});
|
|
207
|
+
}
|
|
200
208
|
setAppBackgroundColor(color) {
|
|
201
209
|
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 1, undefined, "app_background", {
|
|
202
210
|
color
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type AudioMetadata = {
|
|
2
|
+
id?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
artist?: string;
|
|
5
|
+
album?: string;
|
|
6
|
+
genre?: string;
|
|
7
|
+
artwork?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
extras?: Record<string, any>;
|
|
10
|
+
};
|
|
11
|
+
type AudioPlayOptions = AudioMetadata & {
|
|
12
|
+
is_stream?: boolean;
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
autoplay?: boolean;
|
|
15
|
+
start_position?: number;
|
|
16
|
+
volume?: number;
|
|
17
|
+
speed?: number;
|
|
18
|
+
};
|
|
19
|
+
type AudioQueueAddOptions = AudioMetadata & {
|
|
20
|
+
play_now?: boolean;
|
|
21
|
+
is_stream?: boolean;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
export declare class NativelyAudioPlayer {
|
|
25
|
+
private readonly id;
|
|
26
|
+
private buildMetadata;
|
|
27
|
+
play(source: string, options?: AudioPlayOptions, play_callback?: Function): void;
|
|
28
|
+
pause(pause_callback?: Function): void;
|
|
29
|
+
stop(stop_callback?: Function): void;
|
|
30
|
+
seek(position: number, seek_callback?: Function): void;
|
|
31
|
+
queueAdd(source: string, options?: AudioQueueAddOptions, queue_add_callback?: Function): void;
|
|
32
|
+
queueGet(queue_get_callback?: Function): void;
|
|
33
|
+
queueRemove(index: number, queue_remove_callback?: Function): void;
|
|
34
|
+
setMetadata(metadata: AudioMetadata, set_metadata_callback?: Function): void;
|
|
35
|
+
setVolume(volume: number, set_volume_callback?: Function): void;
|
|
36
|
+
setSpeed(speed: number, set_speed_callback?: Function): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
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); }
|
|
6
|
+
import { generateID } from "../utils/generateID.js";
|
|
7
|
+
import globalContext from "../utils/globalThis.js";
|
|
8
|
+
export class NativelyAudioPlayer {
|
|
9
|
+
constructor() {
|
|
10
|
+
_defineProperty(this, "id", generateID());
|
|
11
|
+
}
|
|
12
|
+
buildMetadata(metadata) {
|
|
13
|
+
var params = {};
|
|
14
|
+
if (!metadata) {
|
|
15
|
+
return params;
|
|
16
|
+
}
|
|
17
|
+
if (metadata.id !== undefined) params.id = metadata.id;
|
|
18
|
+
if (metadata.title !== undefined) params.title = metadata.title;
|
|
19
|
+
if (metadata.artist !== undefined) params.artist = metadata.artist;
|
|
20
|
+
if (metadata.album !== undefined) params.album = metadata.album;
|
|
21
|
+
if (metadata.genre !== undefined) params.genre = metadata.genre;
|
|
22
|
+
if (metadata.artwork !== undefined) params.artwork = metadata.artwork;
|
|
23
|
+
if (metadata.duration != null) params.duration = metadata.duration;
|
|
24
|
+
if (metadata.extras !== undefined) params.extras = metadata.extras;
|
|
25
|
+
return params;
|
|
26
|
+
}
|
|
27
|
+
play(source, options, play_callback) {
|
|
28
|
+
var _options$is_stream, _options$autoplay;
|
|
29
|
+
var params = _objectSpread({
|
|
30
|
+
source,
|
|
31
|
+
is_stream: (_options$is_stream = options === null || options === void 0 ? void 0 : options.is_stream) !== null && _options$is_stream !== void 0 ? _options$is_stream : false,
|
|
32
|
+
autoplay: (_options$autoplay = options === null || options === void 0 ? void 0 : options.autoplay) !== null && _options$autoplay !== void 0 ? _options$autoplay : true
|
|
33
|
+
}, this.buildMetadata(options));
|
|
34
|
+
if ((options === null || options === void 0 ? void 0 : options.headers) !== undefined) params.headers = options.headers;
|
|
35
|
+
if ((options === null || options === void 0 ? void 0 : options.start_position) != null) params.start_position = options.start_position;
|
|
36
|
+
if ((options === null || options === void 0 ? void 0 : options.volume) != null) params.volume = options.volume;
|
|
37
|
+
if ((options === null || options === void 0 ? void 0 : options.speed) != null) params.speed = options.speed;
|
|
38
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, play_callback, "audio_play", params);
|
|
39
|
+
}
|
|
40
|
+
pause(pause_callback) {
|
|
41
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, pause_callback, "audio_pause", {});
|
|
42
|
+
}
|
|
43
|
+
stop(stop_callback) {
|
|
44
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, stop_callback, "audio_stop", {});
|
|
45
|
+
}
|
|
46
|
+
seek(position, seek_callback) {
|
|
47
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, seek_callback, "audio_seek", {
|
|
48
|
+
position
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
queueAdd(source, options, queue_add_callback) {
|
|
52
|
+
var _options$play_now, _options$is_stream2;
|
|
53
|
+
var params = _objectSpread({
|
|
54
|
+
source,
|
|
55
|
+
play_now: (_options$play_now = options === null || options === void 0 ? void 0 : options.play_now) !== null && _options$play_now !== void 0 ? _options$play_now : false,
|
|
56
|
+
is_stream: (_options$is_stream2 = options === null || options === void 0 ? void 0 : options.is_stream) !== null && _options$is_stream2 !== void 0 ? _options$is_stream2 : false
|
|
57
|
+
}, this.buildMetadata(options));
|
|
58
|
+
if ((options === null || options === void 0 ? void 0 : options.headers) !== undefined) params.headers = options.headers;
|
|
59
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, queue_add_callback, "audio_queue_add", params);
|
|
60
|
+
}
|
|
61
|
+
queueGet(queue_get_callback) {
|
|
62
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, queue_get_callback, "audio_queue_get", {});
|
|
63
|
+
}
|
|
64
|
+
queueRemove(index, queue_remove_callback) {
|
|
65
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, queue_remove_callback, "audio_queue_remove", {
|
|
66
|
+
index
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
setMetadata(metadata, set_metadata_callback) {
|
|
70
|
+
var params = this.buildMetadata(metadata);
|
|
71
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, set_metadata_callback, "audio_set_metadata", params);
|
|
72
|
+
}
|
|
73
|
+
setVolume(volume, set_volume_callback) {
|
|
74
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, set_volume_callback, "audio_set_volume", {
|
|
75
|
+
volume
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
setSpeed(speed, set_speed_callback) {
|
|
79
|
+
globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 39, set_speed_callback, "audio_set_speed", {
|
|
80
|
+
speed
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { NativelyPurchases } from "./classes/NativelyPurchases";
|
|
|
16
16
|
export { NativelyContacts } from "./classes/NativelyContacts";
|
|
17
17
|
export { NativelyMediaPicker } from "./classes/NativelyMediaPicker";
|
|
18
18
|
export { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder";
|
|
19
|
+
export { NativelyAudioPlayer } from "./classes/NativelyAudioPlayer";
|
|
19
20
|
export { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner";
|
|
20
21
|
export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
|
|
21
22
|
export { NativelyNFCService } from "./classes/NativelyNFCService";
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { NativelyPurchases } from "./classes/NativelyPurchases.js";
|
|
|
17
17
|
export { NativelyContacts } from "./classes/NativelyContacts.js";
|
|
18
18
|
export { NativelyMediaPicker } from "./classes/NativelyMediaPicker.js";
|
|
19
19
|
export { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder.js";
|
|
20
|
+
export { NativelyAudioPlayer } from "./classes/NativelyAudioPlayer.js";
|
|
20
21
|
export { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner.js";
|
|
21
22
|
export { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial.js";
|
|
22
23
|
export { NativelyNFCService } from "./classes/NativelyNFCService.js";
|
package/dist/inject.js
CHANGED
|
@@ -4,6 +4,7 @@ import { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner.js";
|
|
|
4
4
|
import { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial.js";
|
|
5
5
|
import { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService.js";
|
|
6
6
|
import { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder.js";
|
|
7
|
+
import { NativelyAudioPlayer } from "./classes/NativelyAudioPlayer.js";
|
|
7
8
|
import { NativelyBiometrics } from "./classes/NativelyBiometrics.js";
|
|
8
9
|
import { NativelyCamera } from "./classes/NativelyCamera.js";
|
|
9
10
|
import { NativelyClipboard } from "./classes/NativelyClipboard.js";
|
|
@@ -32,6 +33,7 @@ if (globalContext) {
|
|
|
32
33
|
globalContext.NativelyAdmobInterstitial = NativelyAdmobInterstitial;
|
|
33
34
|
globalContext.NativelyAppleSignInService = NativelyAppleSignInService;
|
|
34
35
|
globalContext.NativelyAudioRecorder = NativelyAudioRecorder;
|
|
36
|
+
globalContext.NativelyAudioPlayer = NativelyAudioPlayer;
|
|
35
37
|
globalContext.NativelyBiometrics = NativelyBiometrics;
|
|
36
38
|
globalContext.NativelyCamera = NativelyCamera;
|
|
37
39
|
globalContext.NativelyClipboard = NativelyClipboard;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { NativelyAdmobBanner } from "./classes/NativelyAdmobBanner";
|
|
|
3
3
|
import { NativelyAdmobInterstitial } from "./classes/NativelyAdmobInterstitial";
|
|
4
4
|
import { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService";
|
|
5
5
|
import { NativelyAudioRecorder } from "./classes/NativelyAudioRecorder";
|
|
6
|
+
import { NativelyAudioPlayer } from "./classes/NativelyAudioPlayer";
|
|
6
7
|
import { NativelyBiometrics } from "./classes/NativelyBiometrics";
|
|
7
8
|
import { NativelyCamera } from "./classes/NativelyCamera";
|
|
8
9
|
import { NativelyClipboard } from "./classes/NativelyClipboard";
|
|
@@ -28,6 +29,7 @@ interface NativelyProps {
|
|
|
28
29
|
NativelyAdmobInterstitial: NativelyAdmobInterstitial;
|
|
29
30
|
NativelyAppleSignInService: NativelyAppleSignInService;
|
|
30
31
|
NativelyAudioRecorder: NativelyAudioRecorder;
|
|
32
|
+
NativelyAudioPlayer: NativelyAudioPlayer;
|
|
31
33
|
NativelyBiometrics: NativelyBiometrics;
|
|
32
34
|
NativelyCamera: NativelyCamera;
|
|
33
35
|
NativelyClipboard: NativelyClipboard;
|
package/natively-frontend.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,i)=>{for(var l in i)e.o(i,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:i[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,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{Natively:()=>l,NativelyAdmobBanner:()=>N,NativelyAdmobInterstitial:()=>A,NativelyAppleSignInService:()=>a,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>I,NativelyCamera:()=>h,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>k,NativelyGeolocation:()=>d,NativelyHealth:()=>p,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>T,NativelyLocation:()=>g,NativelyMediaPicker:()=>f,NativelyMessage:()=>v,NativelyNFCService:()=>S,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>u,generateID:()=>n,useNatively:()=>D});const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null;class l{constructor(){var e,t,l,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.onNativeError=null,this.onTabChanged=null,this.isIOSApp=(null===(t=null===(e=null==i?void 0:i.navigator)||void 0===e?void 0:e.userAgent)||void 0===t?void 0:t.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(n=null===(l=null==i?void 0:i.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}setDebug(e){i&&(i.natively.isDebug=e)}notify(e,t){i&&(i.natively.injected=!0,e&&(i.natively.min_app_version=e),t&&(i.natively.app_version=t));const l=null==i?void 0:i.natively.observers;for((null==i?void 0:i.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==i?void 0:i.natively.injected)?e():((null==i?void 0:i.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==i||i.natively.observers.push(e))}trigger(e,t,l,n,a){const r=null==i?void 0:i.natively.isDebug;if(null==i?void 0:i.natively.injected)if(t>(null==i?void 0:i.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==i?void 0:i.natively.app_version}, feature version: ${t}`);else{if(l){let t;t=e?n+"_response_"+e:n+"_response",i&&(i[t]=function(n,a){null==i||i.$agent.response(),a.message&&r?alert(`[ERROR] Error message: ${a.message}`):(r&&console.log(`[DEBUG] Callback method: ${t}, 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==i||i.$agent.trigger(n,a)}else null==i||i.natively.addObserver((()=>{null==i||i.natively.trigger(e,t,l,n,a)}))}setTabChangedHandler(e){"function"==typeof e?this.onTabChanged=e:console.warn("[Natively] Tab changed handler must be a function")}removeTabChangedHandler(){this.onTabChanged=null}setErrorHandler(e){"function"==typeof e&&(this.onNativeError=e)}removeErrorHandler(){this.onNativeError=null}setErrorScreen(e){null==i||i.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}openLogger(){null==i||i.$agent.natively_logger()}openConsole(){null==i||i.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==i||i.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==i||i.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==i||i.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==i||i.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,t){null==i||i.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:t,text:e})}shareFile(e){null==i||i.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,t){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==t&&t?"external":"web"};null==i||i.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==i||i.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,t){null==i||i.natively.trigger(void 0,0,void 0,"show_toast",{text:t||"",type:e||"DEFAULT"})}showAppBanner(e,t,l){null==i||i.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:t||"",description:l||""})}analyticsTrackEvent(e,t){const l={name:e};t&&(l.data=t),null==i||i.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}requestAppReview(){null==i||i.natively.trigger(void 0,0,void 0,"request_review")}getInsets(e){null==i||i.natively.trigger(void 0,36,e,"get_insets")}setAppBackgroundColor(e){null==i||i.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==i||i.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==i||i.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==i||i.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==i||i.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==i||i.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==i||i.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==i||i.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==i||i.natively.trigger(void 0,0,void 0,"open_appsettings")}showTabBar(){null==i||i.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==i||i.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==i||i.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==i||i.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==i||i.natively.trigger(void 0,35,void 0,"reset_webview")}hapticPattern(e,t){null==i||i.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:t})}openPDF(e,t){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==i||i.natively.trigger(void 0,38,t,"open_pdf",l)}hapticImpact(e){null==i||i.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==i||i.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}sendPushNotification(e,t,i,l){return n=this,a=void 0,s=function*(){const n=i.filter((e=>e.length>0)),a=[...new Set(n)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":e,include_player_ids:a};t.template_id?r.template_id=t.template_id:(r.headings={en:t.title||"Empty Title"},r.contents={en:t.message||"Empty Message"},t.subtitle&&(r.subtitle={en:t.subtitle}),t.redirect_url&&(r.url=t.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,t){function i(e){try{o(s.next(e))}catch(e){t(e)}}function l(e){try{o(s.throw(e))}catch(e){t(e)}}function o(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,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==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=n()}copy(e){null==i||i.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==i||i.natively.trigger(this.id,11,e,"clipboard_paste")}}class s{constructor(){this.id=n()}browserInfo(){var e,t,l,n;return{isNativeApp:void 0!==(null==i?void 0:i.$agent),isIOSApp:(null===(t=null===(e=null==i?void 0:i.navigator)||void 0===e?void 0:e.userAgent)||void 0===t?void 0:t.includes("Natively/iOS"))||!1,isAndroidApp:(null===(n=null===(l=null==i?void 0:i.navigator)||void 0===l?void 0:l.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}}getAppInfo(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,19,e,"app_state"))}keyboard_visibility(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class o{constructor(){this.id=n()}getOneSignalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,t){null==i||i.natively.trigger(this.id,0,t,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==i||i.natively.trigger(this.id,0,e,"push_permission")}getExternalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,t){null==i||i.natively.trigger(this.id,0,t,"onesignal_setexternalid",e)}removeExternalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}}class d{constructor(){this.id=n()}getUserGeolocation(e,t){null==i||i.natively.trigger(this.id,0,t,"geolocation",{distance:e})}requestPermission(e){null==i||i.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==i||i.natively.trigger(this.id,0,e,"geo_permission")}}class g{constructor(){this.id=n()}current(e,t,l,n,a=!0){null==i||i.natively.trigger(this.id,12,n,"location_current",{minAccuracy:e,accuracyType:t,priority:l,fallbackToSettings:a})}permission(e){null==i||i.natively.trigger(this.id,6,e,"location_permission")}start(e,t,l,n,a,r=!0){null==i||i.natively.trigger(this.id,12,a,"location_start",{minAccuracy:t,accuracyType:l,priority:n,fallbackToSettings:r,interval:e})}stop(){null==i||i.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,t,l,n,a,r,s=!0){const o={identifier:null!=a?a:"empty",interval:null!=e?e:6e4,minAccuracy:null!=t?t:50,accuracyType:null!=l?l:"Best",priority:null!=n?n:"BALANCED",fallbackToSettings:s};null==i||i.natively.trigger(this.id,12,r,"location_start_bg",o)}statusBackground(e){null==i||i.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==i||i.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class v{constructor(){this.id=n()}sendSMS(e,t,l){const n={body:null!=e?e:"",recipient:null!=t?t:""};null==i||i.natively.trigger(this.id,0,l,"send_sms",n)}sendEmail(e,t,l,n){const a={subject:null!=e?e:"",body:null!=t?t:"",recipient:null!=l?l:""};null==i||i.natively.trigger(this.id,0,n,"send_email",a)}}class u{constructor(){this.id=n()}setStorageValue(e,t){null==i||i.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:t})}getStorageValue(e,t){null==i||i.natively.trigger(this.id,0,t,"get_storage_value",{key:e})}removeStorageValue(e){null==i||i.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==i||i.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(e){this.id=n(),this.allowPass=e}checkBiometricsSupport(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,t,l){null==i||i.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:t})}}class y{constructor(){this.id=n()}showDatePicker(e,t,l,n,a){const r={type:null!=l?l:"DATE",style:null!=n?n:"LIGHT",title:null!=e?e:"",description:null!=t?t:""};null==i||i.natively.trigger(this.id,0,a,"datepicker",r)}}class h{constructor(){this.id=n()}showCamera(e,t,l,n){const a={type:null!=e?e:"photo",quality:null!=t?t:"high",camera:null!=l?l:"BACK"};null==i||i.natively.trigger(this.id,2,n,"open_camera",a)}}class p{constructor(){this.id=n()}available(e){null==i||i.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,t,l){null==i||i.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:t})}permissionStatus(e,t){null==i||i.natively.trigger(this.id,10,t,"health_permission",{data_type:e})}getAllCharacteristics(e){null==i||i.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,t,l,n,a){const r={data_type:e,interval:t};l&&(r.start_date=l.getTime()),n&&(r.end_date=n.getTime()),null==i||i.natively.trigger(this.id,10,a,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,t,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),t&&(a.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,n,"health_get_daily_sleep_analysis",a)}getWorkouts(e,t,l,n){const a={limit:l||100};e&&(a.start_date=e.getTime()),t&&(a.end_date=t.getTime()),null==i||i.natively.trigger(this.id,21,n,"health_get_workouts",a)}getHealthConnectStatus(e){null==i||i.natively.trigger(this.id,40,e,"health_connect_status",{})}installHealthConnect(e){null==i||i.natively.trigger(this.id,40,e,"health_connect_install",{})}writeWorkout(e,t){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),null==i||i.natively.trigger(this.id,39,t,"health_write_workout",l)}writeNutrition(e,t){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),Array.isArray(null==e?void 0:e.items)&&(l.items=e.items.map((e=>{const t=Object.assign({},e);return(null==e?void 0:e.start_date)instanceof Date&&(t.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(t.end_date=e.end_date.getTime()),t}))),null==i||i.natively.trigger(this.id,39,t,"health_write_nutrition",l)}getActivitySummary(e,t,l){const n={};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,l,"health_get_activity_summary",n)}}class _{constructor(){this.id=n()}showScanner(e){null==i||i.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,t,l,n,a,r,s,o,d,g,v,u,c){const y={};o&&(y.source=o),a&&(y.menuColor=a),g&&(y.pageMode=g),null==e||isNaN(e)||(y.jpegQuality=e),n&&(y.highlightColor=n),t&&(y.foregroundColor=t),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),v&&(y.defaultFilter=v),u&&(y.availableFilters=u),d&&(y.ocrConfiguration={languages:[d]}),null==i||i.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class b{constructor(){this.id=n()}login(e,t,l){const n=null!=t?t:"";null==i||i.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:n})}logout(e){null==i||i.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==i||i.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==i||i.natively.trigger(this.id,10,e,"purchases_restore",{})}showPaywall(e,t,l){const n={offeringId:t,shouldShowCloseButton:e};null==i||i.natively.trigger(this.id,38,l,"purchases_show_paywall",n)}showPaywallIfNeeded(e,t,l,n){const a={offeringName:l,entitlementId:e,shouldShowCloseButton:t};null==i||i.natively.trigger(this.id,38,n,"purchases_show_paywall_if_needed",a)}purchasePackage(e,t,l,n){null==i||i.natively.trigger(this.id,3,t,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=n?n:null})}packagePrice(e,t){null==i||i.natively.trigger(this.id,8,t,"purchases_price",{packageId:e})}}class m{constructor(){this.id=n()}getAllContacts(e){null==i||i.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,t,l,n,a){const r={firstName:e,lastName:null!=t?t:"",email:null!=l?l:"",phone:null!=n?n:""};null==i||i.natively.trigger(this.id,3,a,"contacts_save",r)}}class f{constructor(){this.id=n()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=n()}showRecorder(e,t){const l={max_duration:null!=e?e:0};null==i||i.natively.trigger(this.id,13,t,"record_start",l)}}class N{constructor(e,t,l=!1,a,r=!1,s){var o,d,g,v,u,c;this.id=n();const y={};(null==i?void 0:i.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==i?void 0:i.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==i||i.natively.trigger(this.id,14,(e=>{null==t||t(e),l&&(null==i||i.natively.trigger(this.id,14,(e=>{null==a||a(e),r&&(null==i||i.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class A{constructor(e="ca-app-pub-3940256099942544/4411468910",t="ca-app-pub-3940256099942544/1033173712",l,a=!1,r){this.id=n(),(null==i?void 0:i.natively.isAndroidApp)?this.unitId=t:(null==i?void 0:i.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=a,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var t;const l={unitId:null!==(t=this.unitId)&&void 0!==t?t:"ca-app-pub-3940256099942544/4411468910"};null==i||i.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==i||i.natively.trigger(this.id,14,(t=>{e(t),"DID_DISMISS_AD"===t.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==i||i.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class S{constructor(e,t,i,l){this.id=n(),this.readAlertMessage=e,this.writeAlertMessage=t,this.readDetectedMessage=i,this.writeDetectedMessage=l}read(e){var t,l;const n={alertMessage:null!==(t=this.readAlertMessage)&&void 0!==t?t:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==i||i.natively.trigger(this.id,15,e,"nfc_read",n)}write(e,t,l,n){var a,r;const s={alertMessage:null!==(a=this.writeAlertMessage)&&void 0!==a?a:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=t?t:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==i||i.natively.trigger(this.id,15,n,"nfc_write",s)}available(e){null==i||i.natively.trigger(this.id,15,e,"nfc_available",{})}}class k{constructor(){this.id=n()}firebase_get_token(e){null==i||i.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==i||i.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==i||i.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==i||i.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,t){null==i||i.natively.trigger(this.id,31,t,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,t){null==i||i.natively.trigger(this.id,31,t,"firebase_unsubscribe_from_topic",{topic:e})}}class T{constructor(){this.id=n()}setProfile(e,t){null==i||i.natively.trigger(this.id,32,t,"klaviyo_set_profile",e)}getExternalId(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}registerToken(e,t){null==i||i.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:t})}pushPermission(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_push_register")}}class I{constructor(){this.id=n()}createCalendarEvent(e,t,l,n,a,r,s){const o={title:e,timezone:n,calendarId:a,description:r,endDate:null==t?void 0:t.toISOString(),startDate:l.toISOString()};null==i||i.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==i||i.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}const D=()=>null==i?void 0:i.natively;i&&(i.natively=new l,i.NativelyAdmobBanner=N,i.NativelyAdmobInterstitial=A,i.NativelyAppleSignInService=a,i.NativelyAudioRecorder=w,i.NativelyBiometrics=c,i.NativelyCamera=h,i.NativelyClipboard=r,i.NativelyContacts=m,i.NativelyDatePicker=y,i.NativelyGeolocation=d,i.NativelyHealth=p,i.NativelyInfo=s,i.NativelyLocation=g,i.NativelyMediaPicker=f,i.NativelyMessage=v,i.NativelyNFCService=S,i.NativelyNotifications=o,i.NativelyPurchases=b,i.NativelyScanner=_,i.NativelyStorage=u,i.NativelyCalendar=I,i.NativelyFirebaseNotifications=k,i.NativelyKlaviyoNotifications=T),null==i||i.natively.addObserver((()=>null==i?void 0:i.natively.trigger(void 0,0,(e=>{i&&(i.natively.min_app_version=e.minSDKVersion,i.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
|
|
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:()=>S,NativelyAppleSignInService:()=>n,NativelyAudioPlayer:()=>N,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>D,NativelyCamera:()=>h,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>T,NativelyGeolocation:()=>d,NativelyHealth:()=>p,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>I,NativelyLocation:()=>u,NativelyMediaPicker:()=>f,NativelyMessage:()=>g,NativelyNFCService:()=>k,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>_,NativelyStorage:()=>v,generateID:()=>a,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,a;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.onNativeError=null,this.onTabChanged=null,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===(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(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,a,n){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?a+"_response_"+e:a+"_response",t&&(t[i]=function(a,n){null==t||t.$agent.response(),n.message&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(a)}, respId: ${e}`),l(a))}),n?n.response_id=e:n={response_id:e}}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(e,i,l,a,n)}))}setTabChangedHandler(e){"function"==typeof e?this.onTabChanged=e:console.warn("[Natively] Tab changed handler must be a function")}removeTabChangedHandler(){this.onTabChanged=null}setErrorHandler(e){"function"==typeof e&&(this.onNativeError=e)}removeErrorHandler(){this.onNativeError=null}setErrorScreen(e){null==t||t.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}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||""})}analyticsTrackEvent(e,i){const l={name:e};i&&(l.data=i),null==t||t.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}getInsets(e){null==t||t.natively.trigger(void 0,36,e,"get_insets")}getLocales(e){null==t||t.natively.trigger(void 0,40,e,"get_locales")}setLocale(e,i){null==t||t.natively.trigger(void 0,40,i,"set_locale",{locale:e})}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")}showTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==t||t.natively.trigger(void 0,35,void 0,"reset_webview")}hapticPattern(e,i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:i})}openPDF(e,i){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==t||t.natively.trigger(void 0,38,i,"open_pdf",l)}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 a=this,n=void 0,s=function*(){const a=t.filter((e=>e.length>0)),n=[...new Set(a)],r={app_id:l?"be83022a-1d08-45d0-a07a-0c3655666e17":e,include_player_ids:n};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 a;i.done?e(i.value):(a=i.value,a instanceof r?a:new r((function(e){e(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(e){null==t||t.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=a()}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=a()}browserInfo(){var e,i,l,a;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===(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(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"))}keyboard_visibility(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class o{constructor(){this.id=a()}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")}getExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,i){null==t||t.natively.trigger(this.id,0,i,"onesignal_setexternalid",e)}removeExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}}class d{constructor(){this.id=a()}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 u{constructor(){this.id=a()}current(e,i,l,a,n=!0){null==t||t.natively.trigger(this.id,12,a,"location_current",{minAccuracy:e,accuracyType:i,priority:l,fallbackToSettings:n})}permission(e){null==t||t.natively.trigger(this.id,6,e,"location_permission")}start(e,i,l,a,n,r=!0){null==t||t.natively.trigger(this.id,12,n,"location_start",{minAccuracy:i,accuracyType:l,priority:a,fallbackToSettings:r,interval:e})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,i,l,a,n,r,s=!0){const o={identifier:null!=n?n:"empty",interval:null!=e?e:6e4,minAccuracy:null!=i?i:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"BALANCED",fallbackToSettings:s};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",o)}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 g{constructor(){this.id=a()}sendSMS(e,i,l){const a={body:null!=e?e:"",recipient:null!=i?i:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(e,i,l,a){const n={subject:null!=e?e:"",body:null!=i?i:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,a,"send_email",n)}}class v{constructor(){this.id=a()}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=a(),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=a()}showDatePicker(e,i,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=e?e:"",description:null!=i?i:""};null==t||t.natively.trigger(this.id,0,n,"datepicker",r)}}class h{constructor(){this.id=a()}showCamera(e,i,l,a){const n={type:null!=e?e:"photo",quality:null!=i?i:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,a,"open_camera",n)}}class p{constructor(){this.id=a()}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,a,n){const r={data_type:e,interval:i};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(e,i,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(e,i,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,21,a,"health_get_workouts",n)}getHealthConnectStatus(e){null==t||t.natively.trigger(this.id,40,e,"health_connect_status",{})}installHealthConnect(e){null==t||t.natively.trigger(this.id,40,e,"health_connect_install",{})}writeWorkout(e,i){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),null==t||t.natively.trigger(this.id,39,i,"health_write_workout",l)}writeNutrition(e,i){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),Array.isArray(null==e?void 0:e.items)&&(l.items=e.items.map((e=>{const i=Object.assign({},e);return(null==e?void 0:e.start_date)instanceof Date&&(i.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(i.end_date=e.end_date.getTime()),i}))),null==t||t.natively.trigger(this.id,39,i,"health_write_nutrition",l)}getActivitySummary(e,i,l){const a={};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class _{constructor(){this.id=a()}showScanner(e){null==t||t.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,i,l,a,n,r,s,o,d,u,g,v,c){const y={};o&&(y.source=o),n&&(y.menuColor=n),u&&(y.pageMode=u),null==e||isNaN(e)||(y.jpegQuality=e),a&&(y.highlightColor=a),i&&(y.foregroundColor=i),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),g&&(y.defaultFilter=g),v&&(y.availableFilters=v),d&&(y.ocrConfiguration={languages:[d]}),null==t||t.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class b{constructor(){this.id=a()}login(e,i,l){const a=null!=i?i:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:a})}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",{})}showPaywall(e,i,l){const a={offeringId:i,shouldShowCloseButton:e};null==t||t.natively.trigger(this.id,38,l,"purchases_show_paywall",a)}showPaywallIfNeeded(e,i,l,a){const n={offeringName:l,entitlementId:e,shouldShowCloseButton:i};null==t||t.natively.trigger(this.id,38,a,"purchases_show_paywall_if_needed",n)}purchasePackage(e,i,l,a){null==t||t.natively.trigger(this.id,3,i,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=a?a:null})}packagePrice(e,i){null==t||t.natively.trigger(this.id,8,i,"purchases_price",{packageId:e})}}class m{constructor(){this.id=a()}getAllContacts(e){null==t||t.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,i,l,a,n){const r={firstName:e,lastName:null!=i?i:"",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(e){null==t||t.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=a()}showRecorder(e,i){const l={max_duration:null!=e?e:0};null==t||t.natively.trigger(this.id,13,i,"record_start",l)}}class N{constructor(){this.id=a()}buildMetadata(e){const i={};return e?(void 0!==e.id&&(i.id=e.id),void 0!==e.title&&(i.title=e.title),void 0!==e.artist&&(i.artist=e.artist),void 0!==e.album&&(i.album=e.album),void 0!==e.genre&&(i.genre=e.genre),void 0!==e.artwork&&(i.artwork=e.artwork),null!=e.duration&&(i.duration=e.duration),void 0!==e.extras&&(i.extras=e.extras),i):i}play(e,i,l){var a,n;const r=Object.assign({source:e,is_stream:null!==(a=null==i?void 0:i.is_stream)&&void 0!==a&&a,autoplay:null===(n=null==i?void 0:i.autoplay)||void 0===n||n},this.buildMetadata(i));void 0!==(null==i?void 0:i.headers)&&(r.headers=i.headers),null!=(null==i?void 0:i.start_position)&&(r.start_position=i.start_position),null!=(null==i?void 0:i.volume)&&(r.volume=i.volume),null!=(null==i?void 0:i.speed)&&(r.speed=i.speed),null==t||t.natively.trigger(this.id,39,l,"audio_play",r)}pause(e){null==t||t.natively.trigger(this.id,39,e,"audio_pause",{})}stop(e){null==t||t.natively.trigger(this.id,39,e,"audio_stop",{})}seek(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_seek",{position:e})}queueAdd(e,i,l){var a,n;const r=Object.assign({source:e,play_now:null!==(a=null==i?void 0:i.play_now)&&void 0!==a&&a,is_stream:null!==(n=null==i?void 0:i.is_stream)&&void 0!==n&&n},this.buildMetadata(i));void 0!==(null==i?void 0:i.headers)&&(r.headers=i.headers),null==t||t.natively.trigger(this.id,39,l,"audio_queue_add",r)}queueGet(e){null==t||t.natively.trigger(this.id,39,e,"audio_queue_get",{})}queueRemove(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_queue_remove",{index:e})}setMetadata(e,i){const l=this.buildMetadata(e);null==t||t.natively.trigger(this.id,39,i,"audio_set_metadata",l)}setVolume(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_set_volume",{volume:e})}setSpeed(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_set_speed",{speed:e})}}class A{constructor(e,i,l=!1,n,r=!1,s){var o,d,u,g,v,c;this.id=a();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!==(u=e.position)&&void 0!==u?u:"BOTTOM",y.sizeType=null!==(g=e.sizeType)&&void 0!==g?g:"AUTO",y.width=null!==(v=e.custom_width)&&void 0!==v?v: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==n||n(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 S{constructor(e="ca-app-pub-3940256099942544/4411468910",i="ca-app-pub-3940256099942544/1033173712",l,n=!1,r){this.id=a(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=i:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=n,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 k{constructor(e,i,t,l){this.id=a(),this.readAlertMessage=e,this.writeAlertMessage=i,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(e){var i,l;const a={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",a)}write(e,i,l,a){var n,r;const s={alertMessage:null!==(n=this.writeAlertMessage)&&void 0!==n?n:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=i?i:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==t||t.natively.trigger(this.id,15,a,"nfc_write",s)}available(e){null==t||t.natively.trigger(this.id,15,e,"nfc_available",{})}}class T{constructor(){this.id=a()}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 I{constructor(){this.id=a()}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")}registerToken(e,i){null==t||t.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:i})}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")}}class D{constructor(){this.id=a()}createCalendarEvent(e,i,l,a,n,r,s){const o={title:e,timezone:a,calendarId:n,description:r,endDate:null==i?void 0:i.toISOString(),startDate:l.toISOString()};null==t||t.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==t||t.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}const P=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=A,t.NativelyAdmobInterstitial=S,t.NativelyAppleSignInService=n,t.NativelyAudioRecorder=w,t.NativelyAudioPlayer=N,t.NativelyBiometrics=c,t.NativelyCamera=h,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=p,t.NativelyInfo=s,t.NativelyLocation=u,t.NativelyMediaPicker=f,t.NativelyMessage=g,t.NativelyNFCService=k,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=_,t.NativelyStorage=v,t.NativelyCalendar=D,t.NativelyFirebaseNotifications=T,t.NativelyKlaviyoNotifications=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",{})))})();
|